files.com 1.0.296 → 1.0.298
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/Automation.md +8 -8
- package/docs/models/EmailIncomingMessage.md +44 -0
- package/lib/models/Automation.js +4 -4
- package/lib/models/EmailIncomingMessage.js +123 -0
- package/package.json +1 -1
- package/src/models/Automation.js +4 -4
- package/src/models/EmailIncomingMessage.js +73 -0
package/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.298
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"automation": "create_folder",
|
|
9
9
|
"deleted": true,
|
|
10
10
|
"disabled": true,
|
|
11
|
-
"trigger": "
|
|
11
|
+
"trigger": "daily",
|
|
12
12
|
"interval": "week",
|
|
13
13
|
"last_modified_at": "2000-01-01T01:00:00Z",
|
|
14
14
|
"name": "example",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
* `automation` (string): Automation type
|
|
50
50
|
* `deleted` (boolean): Indicates if the automation has been deleted.
|
|
51
51
|
* `disabled` (boolean): If true, this automation will not run.
|
|
52
|
-
* `trigger` (string): How this automation is triggered to run.
|
|
52
|
+
* `trigger` (string): How this automation is triggered to run.
|
|
53
53
|
* `interval` (string): If trigger is `daily`, this specifies how often to run this automation. One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
|
|
54
54
|
* `last_modified_at` (date-time): Time when automation was last modified. Does not change for name or description updates.
|
|
55
55
|
* `name` (string): Name for this automation.
|
|
56
56
|
* `schedule` (object): If trigger is `custom_schedule`, Custom schedule description for when the automation should be run.
|
|
57
57
|
* `source` (string): Source Path
|
|
58
|
-
* `destinations` (array): Destination
|
|
58
|
+
* `destinations` (array): Destination Paths
|
|
59
59
|
* `destination_replace_from` (string): If set, this string in the destination path will be replaced with the value in `destination_replace_to`.
|
|
60
60
|
* `destination_replace_to` (string): If set, this string will replace the value `destination_replace_from` in the destination filename. You can use special patterns here.
|
|
61
61
|
* `description` (string): Description for the this Automation.
|
|
@@ -126,7 +126,7 @@ await Automation.create({
|
|
|
126
126
|
'description': "example",
|
|
127
127
|
'disabled': true,
|
|
128
128
|
'name': "example",
|
|
129
|
-
'trigger': "
|
|
129
|
+
'trigger': "daily",
|
|
130
130
|
'trigger_actions': ["create"],
|
|
131
131
|
'value': {"limit":"1"},
|
|
132
132
|
'recurring_day': 25,
|
|
@@ -151,7 +151,7 @@ await Automation.create({
|
|
|
151
151
|
* `description` (string): Description for the this Automation.
|
|
152
152
|
* `disabled` (boolean): If true, this automation will not run.
|
|
153
153
|
* `name` (string): Name for this automation.
|
|
154
|
-
* `trigger` (string): How this automation is triggered to run.
|
|
154
|
+
* `trigger` (string): How this automation is triggered to run.
|
|
155
155
|
* `trigger_actions` (array(string)): If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
|
156
156
|
* `value` (object): A Hash of attributes specific to the automation type.
|
|
157
157
|
* `recurring_day` (int64): If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
|
|
@@ -193,7 +193,7 @@ await automation.update({
|
|
|
193
193
|
'description': "example",
|
|
194
194
|
'disabled': true,
|
|
195
195
|
'name': "example",
|
|
196
|
-
'trigger': "
|
|
196
|
+
'trigger': "daily",
|
|
197
197
|
'trigger_actions': ["create"],
|
|
198
198
|
'value': {"limit":"1"},
|
|
199
199
|
'recurring_day': 25,
|
|
@@ -218,7 +218,7 @@ await automation.update({
|
|
|
218
218
|
* `description` (string): Description for the this Automation.
|
|
219
219
|
* `disabled` (boolean): If true, this automation will not run.
|
|
220
220
|
* `name` (string): Name for this automation.
|
|
221
|
-
* `trigger` (string): How this automation is triggered to run.
|
|
221
|
+
* `trigger` (string): How this automation is triggered to run.
|
|
222
222
|
* `trigger_actions` (array(string)): If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
|
223
223
|
* `value` (object): A Hash of attributes specific to the automation type.
|
|
224
224
|
* `recurring_day` (int64): If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
|
|
@@ -232,7 +232,7 @@ await automation.update({
|
|
|
232
232
|
"automation": "create_folder",
|
|
233
233
|
"deleted": true,
|
|
234
234
|
"disabled": true,
|
|
235
|
-
"trigger": "
|
|
235
|
+
"trigger": "daily",
|
|
236
236
|
"interval": "week",
|
|
237
237
|
"last_modified_at": "2000-01-01T01:00:00Z",
|
|
238
238
|
"name": "example",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# EmailIncomingMessage
|
|
2
|
+
|
|
3
|
+
## Example EmailIncomingMessage Object
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
{
|
|
7
|
+
"id": 1,
|
|
8
|
+
"inbox_id": 1,
|
|
9
|
+
"sender": "example",
|
|
10
|
+
"status": "success",
|
|
11
|
+
"message": "example",
|
|
12
|
+
"created_at": "2000-01-01T01:00:00Z"
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* `id` (int64): Id of the Email Incoming Message
|
|
17
|
+
* `inbox_id` (int64): Id of the Inbox associated with this message
|
|
18
|
+
* `sender` (string): Sender of the email
|
|
19
|
+
* `status` (string): Status of the message
|
|
20
|
+
* `message` (string): Message describing the failure
|
|
21
|
+
* `created_at` (date-time): Message creation date/time
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## List Email Incoming Messages
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
await EmailIncomingMessage.list({
|
|
29
|
+
'per_page': 1,
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Parameters
|
|
35
|
+
|
|
36
|
+
* `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.
|
|
37
|
+
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
38
|
+
* `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[created_at]=desc`). Valid fields are `created_at`, `sender`, `status` or `inbox_id`.
|
|
39
|
+
* `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`, `inbox_id`, `sender` or `status`. Valid field combinations are `[ sender, created_at ]`, `[ status, created_at ]`, `[ inbox_id, created_at ]`, `[ inbox_id, status, created_at ]` or `[ inbox_id, status, sender, created_at ]`.
|
|
40
|
+
* `filter_gt` (object): If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`.
|
|
41
|
+
* `filter_gteq` (object): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`.
|
|
42
|
+
* `filter_prefix` (object): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `sender`.
|
|
43
|
+
* `filter_lt` (object): If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
|
|
44
|
+
* `filter_lteq` (object): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
|
package/lib/models/Automation.js
CHANGED
|
@@ -59,7 +59,7 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
|
59
59
|
(0, _defineProperty2.default)(this, "setDisabled", function (value) {
|
|
60
60
|
_this.attributes.disabled = value;
|
|
61
61
|
});
|
|
62
|
-
// string # How this automation is triggered to run.
|
|
62
|
+
// string # How this automation is triggered to run.
|
|
63
63
|
(0, _defineProperty2.default)(this, "getTrigger", function () {
|
|
64
64
|
return _this.attributes.trigger;
|
|
65
65
|
});
|
|
@@ -101,7 +101,7 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
|
101
101
|
(0, _defineProperty2.default)(this, "setSource", function (value) {
|
|
102
102
|
_this.attributes.source = value;
|
|
103
103
|
});
|
|
104
|
-
// array # Destination
|
|
104
|
+
// array # Destination Paths
|
|
105
105
|
(0, _defineProperty2.default)(this, "getDestinations", function () {
|
|
106
106
|
return _this.attributes.destinations;
|
|
107
107
|
});
|
|
@@ -267,7 +267,7 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
|
267
267
|
// description - string - Description for the this Automation.
|
|
268
268
|
// disabled - boolean - If true, this automation will not run.
|
|
269
269
|
// name - string - Name for this automation.
|
|
270
|
-
// trigger - string - How this automation is triggered to run.
|
|
270
|
+
// trigger - string - How this automation is triggered to run.
|
|
271
271
|
// trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
|
272
272
|
// value - object - A Hash of attributes specific to the automation type.
|
|
273
273
|
// recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
|
|
@@ -616,7 +616,7 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
|
616
616
|
// description - string - Description for the this Automation.
|
|
617
617
|
// disabled - boolean - If true, this automation will not run.
|
|
618
618
|
// name - string - Name for this automation.
|
|
619
|
-
// trigger - string - How this automation is triggered to run.
|
|
619
|
+
// trigger - string - How this automation is triggered to run.
|
|
620
620
|
// trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
|
621
621
|
// value - object - A Hash of attributes specific to the automation type.
|
|
622
622
|
// recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
|
|
@@ -0,0 +1,123 @@
|
|
|
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 _Logger = _interopRequireDefault(require("../Logger"));
|
|
16
|
+
var _utils = require("../utils");
|
|
17
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
/**
|
|
22
|
+
* Class EmailIncomingMessage
|
|
23
|
+
*/
|
|
24
|
+
var EmailIncomingMessage = /*#__PURE__*/(0, _createClass2.default)(function EmailIncomingMessage() {
|
|
25
|
+
var _this = this;
|
|
26
|
+
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
27
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
28
|
+
(0, _classCallCheck2.default)(this, EmailIncomingMessage);
|
|
29
|
+
(0, _defineProperty2.default)(this, "attributes", {});
|
|
30
|
+
(0, _defineProperty2.default)(this, "options", {});
|
|
31
|
+
(0, _defineProperty2.default)(this, "isLoaded", function () {
|
|
32
|
+
return !!_this.attributes.id;
|
|
33
|
+
});
|
|
34
|
+
// int64 # Id of the Email Incoming Message
|
|
35
|
+
(0, _defineProperty2.default)(this, "getId", function () {
|
|
36
|
+
return _this.attributes.id;
|
|
37
|
+
});
|
|
38
|
+
// int64 # Id of the Inbox associated with this message
|
|
39
|
+
(0, _defineProperty2.default)(this, "getInboxId", function () {
|
|
40
|
+
return _this.attributes.inbox_id;
|
|
41
|
+
});
|
|
42
|
+
// string # Sender of the email
|
|
43
|
+
(0, _defineProperty2.default)(this, "getSender", function () {
|
|
44
|
+
return _this.attributes.sender;
|
|
45
|
+
});
|
|
46
|
+
// string # Status of the message
|
|
47
|
+
(0, _defineProperty2.default)(this, "getStatus", function () {
|
|
48
|
+
return _this.attributes.status;
|
|
49
|
+
});
|
|
50
|
+
// string # Message describing the failure
|
|
51
|
+
(0, _defineProperty2.default)(this, "getMessage", function () {
|
|
52
|
+
return _this.attributes.message;
|
|
53
|
+
});
|
|
54
|
+
// date-time # Message creation date/time
|
|
55
|
+
(0, _defineProperty2.default)(this, "getCreatedAt", function () {
|
|
56
|
+
return _this.attributes.created_at;
|
|
57
|
+
});
|
|
58
|
+
Object.entries(attributes).forEach(function (_ref) {
|
|
59
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
60
|
+
key = _ref2[0],
|
|
61
|
+
value = _ref2[1];
|
|
62
|
+
var normalizedKey = key.replace('?', '');
|
|
63
|
+
_this.attributes[normalizedKey] = value;
|
|
64
|
+
Object.defineProperty(_this, normalizedKey, {
|
|
65
|
+
value: value,
|
|
66
|
+
writable: false
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
this.options = _objectSpread({}, options);
|
|
70
|
+
});
|
|
71
|
+
// Parameters:
|
|
72
|
+
// 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.
|
|
73
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
74
|
+
// sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[created_at]=desc`). Valid fields are `created_at`, `sender`, `status` or `inbox_id`.
|
|
75
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`, `inbox_id`, `sender` or `status`. Valid field combinations are `[ sender, created_at ]`, `[ status, created_at ]`, `[ inbox_id, created_at ]`, `[ inbox_id, status, created_at ]` or `[ inbox_id, status, sender, created_at ]`.
|
|
76
|
+
// filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`.
|
|
77
|
+
// filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`.
|
|
78
|
+
// filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `sender`.
|
|
79
|
+
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
|
|
80
|
+
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
|
|
81
|
+
(0, _defineProperty2.default)(EmailIncomingMessage, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
82
|
+
var _response$data;
|
|
83
|
+
var params,
|
|
84
|
+
options,
|
|
85
|
+
response,
|
|
86
|
+
_args = arguments;
|
|
87
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
88
|
+
while (1) switch (_context.prev = _context.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
91
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
92
|
+
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
|
93
|
+
_context.next = 4;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
|
|
97
|
+
case 4:
|
|
98
|
+
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
|
99
|
+
_context.next = 6;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
|
|
103
|
+
case 6:
|
|
104
|
+
_context.next = 8;
|
|
105
|
+
return _Api.default.sendRequest("/email_incoming_messages", 'GET', params, options);
|
|
106
|
+
case 8:
|
|
107
|
+
response = _context.sent;
|
|
108
|
+
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) {
|
|
109
|
+
return new EmailIncomingMessage(obj, options);
|
|
110
|
+
})) || []);
|
|
111
|
+
case 10:
|
|
112
|
+
case "end":
|
|
113
|
+
return _context.stop();
|
|
114
|
+
}
|
|
115
|
+
}, _callee);
|
|
116
|
+
})));
|
|
117
|
+
(0, _defineProperty2.default)(EmailIncomingMessage, "all", function () {
|
|
118
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
119
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
120
|
+
return EmailIncomingMessage.list(params, options);
|
|
121
|
+
});
|
|
122
|
+
var _default = EmailIncomingMessage;
|
|
123
|
+
exports.default = _default;
|
package/package.json
CHANGED
package/src/models/Automation.js
CHANGED
|
@@ -51,7 +51,7 @@ class Automation {
|
|
|
51
51
|
this.attributes.disabled = value
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// string # How this automation is triggered to run.
|
|
54
|
+
// string # How this automation is triggered to run.
|
|
55
55
|
getTrigger = () => this.attributes.trigger
|
|
56
56
|
|
|
57
57
|
setTrigger = value => {
|
|
@@ -93,7 +93,7 @@ class Automation {
|
|
|
93
93
|
this.attributes.source = value
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// array # Destination
|
|
96
|
+
// array # Destination Paths
|
|
97
97
|
getDestinations = () => this.attributes.destinations
|
|
98
98
|
|
|
99
99
|
setDestinations = value => {
|
|
@@ -235,7 +235,7 @@ class Automation {
|
|
|
235
235
|
// description - string - Description for the this Automation.
|
|
236
236
|
// disabled - boolean - If true, this automation will not run.
|
|
237
237
|
// name - string - Name for this automation.
|
|
238
|
-
// trigger - string - How this automation is triggered to run.
|
|
238
|
+
// trigger - string - How this automation is triggered to run.
|
|
239
239
|
// trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
|
240
240
|
// value - object - A Hash of attributes specific to the automation type.
|
|
241
241
|
// recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
|
|
@@ -422,7 +422,7 @@ class Automation {
|
|
|
422
422
|
// description - string - Description for the this Automation.
|
|
423
423
|
// disabled - boolean - If true, this automation will not run.
|
|
424
424
|
// name - string - Name for this automation.
|
|
425
|
-
// trigger - string - How this automation is triggered to run.
|
|
425
|
+
// trigger - string - How this automation is triggered to run.
|
|
426
426
|
// trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
|
427
427
|
// value - object - A Hash of attributes specific to the automation type.
|
|
428
428
|
// recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import Api from '../Api'
|
|
2
|
+
import * as errors from '../Errors'
|
|
3
|
+
import Logger from '../Logger'
|
|
4
|
+
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Class EmailIncomingMessage
|
|
8
|
+
*/
|
|
9
|
+
class EmailIncomingMessage {
|
|
10
|
+
attributes = {}
|
|
11
|
+
options = {}
|
|
12
|
+
|
|
13
|
+
constructor(attributes = {}, options = {}) {
|
|
14
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
15
|
+
const normalizedKey = key.replace('?', '')
|
|
16
|
+
|
|
17
|
+
this.attributes[normalizedKey] = value
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(this, normalizedKey, { value, writable: false })
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
this.options = { ...options }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
isLoaded = () => !!this.attributes.id
|
|
26
|
+
// int64 # Id of the Email Incoming Message
|
|
27
|
+
getId = () => this.attributes.id
|
|
28
|
+
|
|
29
|
+
// int64 # Id of the Inbox associated with this message
|
|
30
|
+
getInboxId = () => this.attributes.inbox_id
|
|
31
|
+
|
|
32
|
+
// string # Sender of the email
|
|
33
|
+
getSender = () => this.attributes.sender
|
|
34
|
+
|
|
35
|
+
// string # Status of the message
|
|
36
|
+
getStatus = () => this.attributes.status
|
|
37
|
+
|
|
38
|
+
// string # Message describing the failure
|
|
39
|
+
getMessage = () => this.attributes.message
|
|
40
|
+
|
|
41
|
+
// date-time # Message creation date/time
|
|
42
|
+
getCreatedAt = () => this.attributes.created_at
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// Parameters:
|
|
46
|
+
// 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.
|
|
47
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
48
|
+
// sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[created_at]=desc`). Valid fields are `created_at`, `sender`, `status` or `inbox_id`.
|
|
49
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`, `inbox_id`, `sender` or `status`. Valid field combinations are `[ sender, created_at ]`, `[ status, created_at ]`, `[ inbox_id, created_at ]`, `[ inbox_id, status, created_at ]` or `[ inbox_id, status, sender, created_at ]`.
|
|
50
|
+
// filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`.
|
|
51
|
+
// filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`.
|
|
52
|
+
// filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `sender`.
|
|
53
|
+
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
|
|
54
|
+
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
|
|
55
|
+
static list = async (params = {}, options = {}) => {
|
|
56
|
+
if (params['cursor'] && !isString(params['cursor'])) {
|
|
57
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (params['per_page'] && !isInt(params['per_page'])) {
|
|
61
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const response = await Api.sendRequest(`/email_incoming_messages`, 'GET', params, options)
|
|
65
|
+
|
|
66
|
+
return response?.data?.map(obj => new EmailIncomingMessage(obj, options)) || []
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static all = (params = {}, options = {}) =>
|
|
70
|
+
EmailIncomingMessage.list(params, options)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default EmailIncomingMessage
|