files.com 1.0.297 → 1.0.298
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.
|
1
|
+
1.0.298
|
@@ -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`.
|
@@ -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
@@ -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
|