files.com 1.2.229 → 1.2.231
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 +1 -1
- package/docs/models/As2IncomingMessage.md +0 -2
- package/docs/models/As2OutgoingMessage.md +0 -2
- package/docs/models/Restore.md +74 -0
- package/lib/Files.js +1 -1
- package/lib/models/As2IncomingMessage.js +0 -4
- package/lib/models/As2OutgoingMessage.js +0 -4
- package/lib/models/Restore.js +261 -0
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/As2IncomingMessage.js +0 -3
- package/src/models/As2OutgoingMessage.js +0 -3
- package/src/models/Restore.js +186 -0
package/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.231
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"http_headers": {
|
|
13
13
|
"key": "example value"
|
|
14
14
|
},
|
|
15
|
-
"activity_log": "example",
|
|
16
15
|
"processing_result": "example",
|
|
17
16
|
"processing_result_description": "example",
|
|
18
17
|
"mic": "example",
|
|
@@ -52,7 +51,6 @@
|
|
|
52
51
|
* `uuid` (string): UUID assigned to this message.
|
|
53
52
|
* `content_type` (string): Content Type header of the incoming message.
|
|
54
53
|
* `http_headers` (object): HTTP Headers sent with this message.
|
|
55
|
-
* `activity_log` (string): JSON Structure of the activity log.
|
|
56
54
|
* `processing_result` (string): Result of processing.
|
|
57
55
|
* `processing_result_description` (string): Result of processing description.
|
|
58
56
|
* `mic` (string): AS2 Message Integrity Check
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"http_headers": {
|
|
12
12
|
"key": "example value"
|
|
13
13
|
},
|
|
14
|
-
"activity_log": "example",
|
|
15
14
|
"processing_result": "example",
|
|
16
15
|
"processing_result_description": "example",
|
|
17
16
|
"mic": "example",
|
|
@@ -47,7 +46,6 @@
|
|
|
47
46
|
* `as2_station_id` (int64): Id of the AS2 Station associated with this message.
|
|
48
47
|
* `uuid` (string): UUID assigned to this message.
|
|
49
48
|
* `http_headers` (object): HTTP Headers sent with this message.
|
|
50
|
-
* `activity_log` (string): JSON Structure of the activity log.
|
|
51
49
|
* `processing_result` (string): Result of processing.
|
|
52
50
|
* `processing_result_description` (string): Result of processing description.
|
|
53
51
|
* `mic` (string): AS2 Message Integrity Check SHA1
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Restore
|
|
2
|
+
|
|
3
|
+
## Example Restore Object
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
{
|
|
7
|
+
"earliest_date": "2000-01-01T01:00:00Z",
|
|
8
|
+
"id": 1,
|
|
9
|
+
"dirs_restored": 1,
|
|
10
|
+
"dirs_errored": 1,
|
|
11
|
+
"dirs_total": 1,
|
|
12
|
+
"files_restored": 1,
|
|
13
|
+
"files_errored": 1,
|
|
14
|
+
"files_total": 1,
|
|
15
|
+
"prefix": "foo/bar/baz.txt",
|
|
16
|
+
"restore_in_place": true,
|
|
17
|
+
"restore_deleted_permissions": true,
|
|
18
|
+
"status": "pending",
|
|
19
|
+
"update_timestamps": true,
|
|
20
|
+
"error_messages": [
|
|
21
|
+
"example"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
* `earliest_date` (date-time): Restore all files deleted after this date/time. Don't set this earlier than you need. Can not be greater than 365
|
|
27
|
+
* `id` (int64): Restore Record ID.
|
|
28
|
+
* `dirs_restored` (int64): Number of directories that were successfully restored.
|
|
29
|
+
* `dirs_errored` (int64): Number of directories that were not able to be restored.
|
|
30
|
+
* `dirs_total` (int64): Total number of directories processed.
|
|
31
|
+
* `files_restored` (int64): Number of files successfully restored.
|
|
32
|
+
* `files_errored` (int64): Number of files that were not able to be restored.
|
|
33
|
+
* `files_total` (int64): Total number of files processed.
|
|
34
|
+
* `prefix` (string): Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash.
|
|
35
|
+
* `restore_in_place` (boolean): If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
|
|
36
|
+
* `restore_deleted_permissions` (boolean): If true, we will also restore any Permissions that match the same path prefix from the same dates.
|
|
37
|
+
* `status` (string): Status of the restoration process.
|
|
38
|
+
* `update_timestamps` (boolean): If trie, we will update the last modified timestamp of restored files to today's date. If false, we might trigger File Expiration to delete the file again.
|
|
39
|
+
* `error_messages` (array(string)): Error messages received while restoring files and/or directories. Only present if there were errors.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## List Restores
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
await Restore.list
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Parameters
|
|
51
|
+
|
|
52
|
+
* `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.
|
|
53
|
+
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Create Restore
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
await Restore.create({
|
|
61
|
+
'earliest_date': "2000-01-01T01:00:00Z",
|
|
62
|
+
'restore_deleted_permissions': true,
|
|
63
|
+
'restore_in_place': true,
|
|
64
|
+
'prefix': "foo/bar/baz.txt",
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Parameters
|
|
70
|
+
|
|
71
|
+
* `earliest_date` (string): Required - Restore all files deleted after this date/time. Don't set this earlier than you need. Can not be greater than 365
|
|
72
|
+
* `restore_deleted_permissions` (boolean): If true, we will also restore any Permissions that match the same path prefix from the same dates.
|
|
73
|
+
* `restore_in_place` (boolean): If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
|
|
74
|
+
* `prefix` (string): Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash.
|
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.231';
|
|
15
15
|
var userAgent = "Files.com JavaScript SDK v".concat(version);
|
|
16
16
|
var logLevel = _Logger.LogLevel.INFO;
|
|
17
17
|
var debugRequest = false;
|
|
@@ -57,10 +57,6 @@ var As2IncomingMessage = /*#__PURE__*/(0, _createClass2.default)(function As2Inc
|
|
|
57
57
|
(0, _defineProperty2.default)(this, "getHttpHeaders", function () {
|
|
58
58
|
return _this.attributes.http_headers;
|
|
59
59
|
});
|
|
60
|
-
// string # JSON Structure of the activity log.
|
|
61
|
-
(0, _defineProperty2.default)(this, "getActivityLog", function () {
|
|
62
|
-
return _this.attributes.activity_log;
|
|
63
|
-
});
|
|
64
60
|
// string # Result of processing.
|
|
65
61
|
(0, _defineProperty2.default)(this, "getProcessingResult", function () {
|
|
66
62
|
return _this.attributes.processing_result;
|
|
@@ -53,10 +53,6 @@ var As2OutgoingMessage = /*#__PURE__*/(0, _createClass2.default)(function As2Out
|
|
|
53
53
|
(0, _defineProperty2.default)(this, "getHttpHeaders", function () {
|
|
54
54
|
return _this.attributes.http_headers;
|
|
55
55
|
});
|
|
56
|
-
// string # JSON Structure of the activity log.
|
|
57
|
-
(0, _defineProperty2.default)(this, "getActivityLog", function () {
|
|
58
|
-
return _this.attributes.activity_log;
|
|
59
|
-
});
|
|
60
56
|
// string # Result of processing.
|
|
61
57
|
(0, _defineProperty2.default)(this, "getProcessingResult", function () {
|
|
62
58
|
return _this.attributes.processing_result;
|
|
@@ -0,0 +1,261 @@
|
|
|
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
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 _Restore;
|
|
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 Restore
|
|
25
|
+
*/
|
|
26
|
+
var Restore = /*#__PURE__*/(0, _createClass2.default)(function Restore() {
|
|
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, Restore);
|
|
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 # Restore all files deleted after this date/time. Don't set this earlier than you need. Can not be greater than 365
|
|
37
|
+
(0, _defineProperty2.default)(this, "getEarliestDate", function () {
|
|
38
|
+
return _this.attributes.earliest_date;
|
|
39
|
+
});
|
|
40
|
+
(0, _defineProperty2.default)(this, "setEarliestDate", function (value) {
|
|
41
|
+
_this.attributes.earliest_date = value;
|
|
42
|
+
});
|
|
43
|
+
// int64 # Restore Record ID.
|
|
44
|
+
(0, _defineProperty2.default)(this, "getId", function () {
|
|
45
|
+
return _this.attributes.id;
|
|
46
|
+
});
|
|
47
|
+
(0, _defineProperty2.default)(this, "setId", function (value) {
|
|
48
|
+
_this.attributes.id = value;
|
|
49
|
+
});
|
|
50
|
+
// int64 # Number of directories that were successfully restored.
|
|
51
|
+
(0, _defineProperty2.default)(this, "getDirsRestored", function () {
|
|
52
|
+
return _this.attributes.dirs_restored;
|
|
53
|
+
});
|
|
54
|
+
(0, _defineProperty2.default)(this, "setDirsRestored", function (value) {
|
|
55
|
+
_this.attributes.dirs_restored = value;
|
|
56
|
+
});
|
|
57
|
+
// int64 # Number of directories that were not able to be restored.
|
|
58
|
+
(0, _defineProperty2.default)(this, "getDirsErrored", function () {
|
|
59
|
+
return _this.attributes.dirs_errored;
|
|
60
|
+
});
|
|
61
|
+
(0, _defineProperty2.default)(this, "setDirsErrored", function (value) {
|
|
62
|
+
_this.attributes.dirs_errored = value;
|
|
63
|
+
});
|
|
64
|
+
// int64 # Total number of directories processed.
|
|
65
|
+
(0, _defineProperty2.default)(this, "getDirsTotal", function () {
|
|
66
|
+
return _this.attributes.dirs_total;
|
|
67
|
+
});
|
|
68
|
+
(0, _defineProperty2.default)(this, "setDirsTotal", function (value) {
|
|
69
|
+
_this.attributes.dirs_total = value;
|
|
70
|
+
});
|
|
71
|
+
// int64 # Number of files successfully restored.
|
|
72
|
+
(0, _defineProperty2.default)(this, "getFilesRestored", function () {
|
|
73
|
+
return _this.attributes.files_restored;
|
|
74
|
+
});
|
|
75
|
+
(0, _defineProperty2.default)(this, "setFilesRestored", function (value) {
|
|
76
|
+
_this.attributes.files_restored = value;
|
|
77
|
+
});
|
|
78
|
+
// int64 # Number of files that were not able to be restored.
|
|
79
|
+
(0, _defineProperty2.default)(this, "getFilesErrored", function () {
|
|
80
|
+
return _this.attributes.files_errored;
|
|
81
|
+
});
|
|
82
|
+
(0, _defineProperty2.default)(this, "setFilesErrored", function (value) {
|
|
83
|
+
_this.attributes.files_errored = value;
|
|
84
|
+
});
|
|
85
|
+
// int64 # Total number of files processed.
|
|
86
|
+
(0, _defineProperty2.default)(this, "getFilesTotal", function () {
|
|
87
|
+
return _this.attributes.files_total;
|
|
88
|
+
});
|
|
89
|
+
(0, _defineProperty2.default)(this, "setFilesTotal", function (value) {
|
|
90
|
+
_this.attributes.files_total = value;
|
|
91
|
+
});
|
|
92
|
+
// string # Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash.
|
|
93
|
+
(0, _defineProperty2.default)(this, "getPrefix", function () {
|
|
94
|
+
return _this.attributes.prefix;
|
|
95
|
+
});
|
|
96
|
+
(0, _defineProperty2.default)(this, "setPrefix", function (value) {
|
|
97
|
+
_this.attributes.prefix = value;
|
|
98
|
+
});
|
|
99
|
+
// boolean # If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
|
|
100
|
+
(0, _defineProperty2.default)(this, "getRestoreInPlace", function () {
|
|
101
|
+
return _this.attributes.restore_in_place;
|
|
102
|
+
});
|
|
103
|
+
(0, _defineProperty2.default)(this, "setRestoreInPlace", function (value) {
|
|
104
|
+
_this.attributes.restore_in_place = value;
|
|
105
|
+
});
|
|
106
|
+
// boolean # If true, we will also restore any Permissions that match the same path prefix from the same dates.
|
|
107
|
+
(0, _defineProperty2.default)(this, "getRestoreDeletedPermissions", function () {
|
|
108
|
+
return _this.attributes.restore_deleted_permissions;
|
|
109
|
+
});
|
|
110
|
+
(0, _defineProperty2.default)(this, "setRestoreDeletedPermissions", function (value) {
|
|
111
|
+
_this.attributes.restore_deleted_permissions = value;
|
|
112
|
+
});
|
|
113
|
+
// string # Status of the restoration process.
|
|
114
|
+
(0, _defineProperty2.default)(this, "getStatus", function () {
|
|
115
|
+
return _this.attributes.status;
|
|
116
|
+
});
|
|
117
|
+
(0, _defineProperty2.default)(this, "setStatus", function (value) {
|
|
118
|
+
_this.attributes.status = value;
|
|
119
|
+
});
|
|
120
|
+
// boolean # If trie, we will update the last modified timestamp of restored files to today's date. If false, we might trigger File Expiration to delete the file again.
|
|
121
|
+
(0, _defineProperty2.default)(this, "getUpdateTimestamps", function () {
|
|
122
|
+
return _this.attributes.update_timestamps;
|
|
123
|
+
});
|
|
124
|
+
(0, _defineProperty2.default)(this, "setUpdateTimestamps", function (value) {
|
|
125
|
+
_this.attributes.update_timestamps = value;
|
|
126
|
+
});
|
|
127
|
+
// array(string) # Error messages received while restoring files and/or directories. Only present if there were errors.
|
|
128
|
+
(0, _defineProperty2.default)(this, "getErrorMessages", function () {
|
|
129
|
+
return _this.attributes.error_messages;
|
|
130
|
+
});
|
|
131
|
+
(0, _defineProperty2.default)(this, "setErrorMessages", function (value) {
|
|
132
|
+
_this.attributes.error_messages = value;
|
|
133
|
+
});
|
|
134
|
+
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
135
|
+
var newObject;
|
|
136
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
137
|
+
while (1) switch (_context.prev = _context.next) {
|
|
138
|
+
case 0:
|
|
139
|
+
if (!_this.attributes.id) {
|
|
140
|
+
_context.next = 4;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
throw new errors.NotImplementedError('The Restore object doesn\'t support updates.');
|
|
144
|
+
case 4:
|
|
145
|
+
_context.next = 6;
|
|
146
|
+
return Restore.create(_this.attributes, _this.options);
|
|
147
|
+
case 6:
|
|
148
|
+
newObject = _context.sent;
|
|
149
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
|
150
|
+
return _context.abrupt("return", true);
|
|
151
|
+
case 9:
|
|
152
|
+
case "end":
|
|
153
|
+
return _context.stop();
|
|
154
|
+
}
|
|
155
|
+
}, _callee);
|
|
156
|
+
})));
|
|
157
|
+
Object.entries(attributes).forEach(function (_ref2) {
|
|
158
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
159
|
+
key = _ref3[0],
|
|
160
|
+
value = _ref3[1];
|
|
161
|
+
var normalizedKey = key.replace('?', '');
|
|
162
|
+
_this.attributes[normalizedKey] = value;
|
|
163
|
+
Object.defineProperty(_this, normalizedKey, {
|
|
164
|
+
value: value,
|
|
165
|
+
writable: false
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
this.options = _objectSpread({}, options);
|
|
169
|
+
});
|
|
170
|
+
_Restore = Restore;
|
|
171
|
+
// Parameters:
|
|
172
|
+
// 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.
|
|
173
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
174
|
+
(0, _defineProperty2.default)(Restore, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
175
|
+
var _response$data;
|
|
176
|
+
var params,
|
|
177
|
+
options,
|
|
178
|
+
response,
|
|
179
|
+
_args2 = arguments;
|
|
180
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
181
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
182
|
+
case 0:
|
|
183
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
184
|
+
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
185
|
+
if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
|
|
186
|
+
_context2.next = 4;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
|
|
190
|
+
case 4:
|
|
191
|
+
if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
|
|
192
|
+
_context2.next = 6;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
|
|
196
|
+
case 6:
|
|
197
|
+
_context2.next = 8;
|
|
198
|
+
return _Api.default.sendRequest('/restores', 'GET', params, options);
|
|
199
|
+
case 8:
|
|
200
|
+
response = _context2.sent;
|
|
201
|
+
return _context2.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
|
202
|
+
return new _Restore(obj, options);
|
|
203
|
+
})) || []);
|
|
204
|
+
case 10:
|
|
205
|
+
case "end":
|
|
206
|
+
return _context2.stop();
|
|
207
|
+
}
|
|
208
|
+
}, _callee2);
|
|
209
|
+
})));
|
|
210
|
+
(0, _defineProperty2.default)(Restore, "all", function () {
|
|
211
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
212
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
213
|
+
return _Restore.list(params, options);
|
|
214
|
+
});
|
|
215
|
+
// Parameters:
|
|
216
|
+
// earliest_date (required) - string - Restore all files deleted after this date/time. Don't set this earlier than you need. Can not be greater than 365
|
|
217
|
+
// restore_deleted_permissions - boolean - If true, we will also restore any Permissions that match the same path prefix from the same dates.
|
|
218
|
+
// restore_in_place - boolean - If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
|
|
219
|
+
// prefix - string - Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash.
|
|
220
|
+
(0, _defineProperty2.default)(Restore, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
221
|
+
var params,
|
|
222
|
+
options,
|
|
223
|
+
response,
|
|
224
|
+
_args3 = arguments;
|
|
225
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
226
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
227
|
+
case 0:
|
|
228
|
+
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
229
|
+
options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
230
|
+
if (params.earliest_date) {
|
|
231
|
+
_context3.next = 4;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
throw new errors.MissingParameterError('Parameter missing: earliest_date');
|
|
235
|
+
case 4:
|
|
236
|
+
if (!(params.earliest_date && !(0, _utils.isString)(params.earliest_date))) {
|
|
237
|
+
_context3.next = 6;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
throw new errors.InvalidParameterError("Bad parameter: earliest_date must be of type String, received ".concat((0, _utils.getType)(params.earliest_date)));
|
|
241
|
+
case 6:
|
|
242
|
+
if (!(params.prefix && !(0, _utils.isString)(params.prefix))) {
|
|
243
|
+
_context3.next = 8;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
throw new errors.InvalidParameterError("Bad parameter: prefix must be of type String, received ".concat((0, _utils.getType)(params.prefix)));
|
|
247
|
+
case 8:
|
|
248
|
+
_context3.next = 10;
|
|
249
|
+
return _Api.default.sendRequest('/restores', 'POST', params, options);
|
|
250
|
+
case 10:
|
|
251
|
+
response = _context3.sent;
|
|
252
|
+
return _context3.abrupt("return", new _Restore(response === null || response === void 0 ? void 0 : response.data, options));
|
|
253
|
+
case 12:
|
|
254
|
+
case "end":
|
|
255
|
+
return _context3.stop();
|
|
256
|
+
}
|
|
257
|
+
}, _callee3);
|
|
258
|
+
})));
|
|
259
|
+
var _default = exports.default = Restore;
|
|
260
|
+
module.exports = Restore;
|
|
261
|
+
module.exports.default = Restore;
|
package/package.json
CHANGED
package/src/Files.js
CHANGED
|
@@ -46,9 +46,6 @@ class As2IncomingMessage {
|
|
|
46
46
|
// object # HTTP Headers sent with this message.
|
|
47
47
|
getHttpHeaders = () => this.attributes.http_headers
|
|
48
48
|
|
|
49
|
-
// string # JSON Structure of the activity log.
|
|
50
|
-
getActivityLog = () => this.attributes.activity_log
|
|
51
|
-
|
|
52
49
|
// string # Result of processing.
|
|
53
50
|
getProcessingResult = () => this.attributes.processing_result
|
|
54
51
|
|
|
@@ -43,9 +43,6 @@ class As2OutgoingMessage {
|
|
|
43
43
|
// object # HTTP Headers sent with this message.
|
|
44
44
|
getHttpHeaders = () => this.attributes.http_headers
|
|
45
45
|
|
|
46
|
-
// string # JSON Structure of the activity log.
|
|
47
|
-
getActivityLog = () => this.attributes.activity_log
|
|
48
|
-
|
|
49
46
|
// string # Result of processing.
|
|
50
47
|
getProcessingResult = () => this.attributes.processing_result
|
|
51
48
|
|
|
@@ -0,0 +1,186 @@
|
|
|
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 Restore
|
|
11
|
+
*/
|
|
12
|
+
class Restore {
|
|
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 # Restore all files deleted after this date/time. Don't set this earlier than you need. Can not be greater than 365
|
|
32
|
+
getEarliestDate = () => this.attributes.earliest_date
|
|
33
|
+
|
|
34
|
+
setEarliestDate = value => {
|
|
35
|
+
this.attributes.earliest_date = value
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// int64 # Restore Record ID.
|
|
39
|
+
getId = () => this.attributes.id
|
|
40
|
+
|
|
41
|
+
setId = value => {
|
|
42
|
+
this.attributes.id = value
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// int64 # Number of directories that were successfully restored.
|
|
46
|
+
getDirsRestored = () => this.attributes.dirs_restored
|
|
47
|
+
|
|
48
|
+
setDirsRestored = value => {
|
|
49
|
+
this.attributes.dirs_restored = value
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// int64 # Number of directories that were not able to be restored.
|
|
53
|
+
getDirsErrored = () => this.attributes.dirs_errored
|
|
54
|
+
|
|
55
|
+
setDirsErrored = value => {
|
|
56
|
+
this.attributes.dirs_errored = value
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// int64 # Total number of directories processed.
|
|
60
|
+
getDirsTotal = () => this.attributes.dirs_total
|
|
61
|
+
|
|
62
|
+
setDirsTotal = value => {
|
|
63
|
+
this.attributes.dirs_total = value
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// int64 # Number of files successfully restored.
|
|
67
|
+
getFilesRestored = () => this.attributes.files_restored
|
|
68
|
+
|
|
69
|
+
setFilesRestored = value => {
|
|
70
|
+
this.attributes.files_restored = value
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// int64 # Number of files that were not able to be restored.
|
|
74
|
+
getFilesErrored = () => this.attributes.files_errored
|
|
75
|
+
|
|
76
|
+
setFilesErrored = value => {
|
|
77
|
+
this.attributes.files_errored = value
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// int64 # Total number of files processed.
|
|
81
|
+
getFilesTotal = () => this.attributes.files_total
|
|
82
|
+
|
|
83
|
+
setFilesTotal = value => {
|
|
84
|
+
this.attributes.files_total = value
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// string # Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash.
|
|
88
|
+
getPrefix = () => this.attributes.prefix
|
|
89
|
+
|
|
90
|
+
setPrefix = value => {
|
|
91
|
+
this.attributes.prefix = value
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// boolean # If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
|
|
95
|
+
getRestoreInPlace = () => this.attributes.restore_in_place
|
|
96
|
+
|
|
97
|
+
setRestoreInPlace = value => {
|
|
98
|
+
this.attributes.restore_in_place = value
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// boolean # If true, we will also restore any Permissions that match the same path prefix from the same dates.
|
|
102
|
+
getRestoreDeletedPermissions = () => this.attributes.restore_deleted_permissions
|
|
103
|
+
|
|
104
|
+
setRestoreDeletedPermissions = value => {
|
|
105
|
+
this.attributes.restore_deleted_permissions = value
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// string # Status of the restoration process.
|
|
109
|
+
getStatus = () => this.attributes.status
|
|
110
|
+
|
|
111
|
+
setStatus = value => {
|
|
112
|
+
this.attributes.status = value
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// boolean # If trie, we will update the last modified timestamp of restored files to today's date. If false, we might trigger File Expiration to delete the file again.
|
|
116
|
+
getUpdateTimestamps = () => this.attributes.update_timestamps
|
|
117
|
+
|
|
118
|
+
setUpdateTimestamps = value => {
|
|
119
|
+
this.attributes.update_timestamps = value
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// array(string) # Error messages received while restoring files and/or directories. Only present if there were errors.
|
|
123
|
+
getErrorMessages = () => this.attributes.error_messages
|
|
124
|
+
|
|
125
|
+
setErrorMessages = value => {
|
|
126
|
+
this.attributes.error_messages = value
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
save = async () => {
|
|
130
|
+
if (this.attributes.id) {
|
|
131
|
+
throw new errors.NotImplementedError('The Restore object doesn\'t support updates.')
|
|
132
|
+
} else {
|
|
133
|
+
const newObject = await Restore.create(this.attributes, this.options)
|
|
134
|
+
this.attributes = { ...newObject.attributes }
|
|
135
|
+
return true
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Parameters:
|
|
140
|
+
// 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.
|
|
141
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
142
|
+
static list = async (params = {}, options = {}) => {
|
|
143
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
144
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
148
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const response = await Api.sendRequest('/restores', 'GET', params, options)
|
|
152
|
+
|
|
153
|
+
return response?.data?.map(obj => new Restore(obj, options)) || []
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static all = (params = {}, options = {}) =>
|
|
157
|
+
Restore.list(params, options)
|
|
158
|
+
|
|
159
|
+
// Parameters:
|
|
160
|
+
// earliest_date (required) - string - Restore all files deleted after this date/time. Don't set this earlier than you need. Can not be greater than 365
|
|
161
|
+
// restore_deleted_permissions - boolean - If true, we will also restore any Permissions that match the same path prefix from the same dates.
|
|
162
|
+
// restore_in_place - boolean - If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
|
|
163
|
+
// prefix - string - Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash.
|
|
164
|
+
static create = async (params = {}, options = {}) => {
|
|
165
|
+
if (!params.earliest_date) {
|
|
166
|
+
throw new errors.MissingParameterError('Parameter missing: earliest_date')
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (params.earliest_date && !isString(params.earliest_date)) {
|
|
170
|
+
throw new errors.InvalidParameterError(`Bad parameter: earliest_date must be of type String, received ${getType(params.earliest_date)}`)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (params.prefix && !isString(params.prefix)) {
|
|
174
|
+
throw new errors.InvalidParameterError(`Bad parameter: prefix must be of type String, received ${getType(params.prefix)}`)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const response = await Api.sendRequest('/restores', 'POST', params, options)
|
|
178
|
+
|
|
179
|
+
return new Restore(response?.data, options)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export default Restore
|
|
184
|
+
|
|
185
|
+
module.exports = Restore
|
|
186
|
+
module.exports.default = Restore
|