files.com 1.2.48 → 1.2.50

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 CHANGED
@@ -1 +1 @@
1
- 1.2.48
1
+ 1.2.50
@@ -0,0 +1,58 @@
1
+ # BundleAction
2
+
3
+ ## Example BundleAction Object
4
+
5
+ ```
6
+ {
7
+ "action": "create",
8
+ "bundle_registration": {
9
+ "code": "abc123",
10
+ "name": "account",
11
+ "company": "Action Verb",
12
+ "email": "john.doe@files.com",
13
+ "ip": "10.1.1.1",
14
+ "inbox_code": "abc123",
15
+ "clickwrap_body": "example",
16
+ "form_field_set_id": 1,
17
+ "form_field_data": {
18
+ "key": "example value"
19
+ },
20
+ "bundle_code": "example",
21
+ "bundle_id": 1,
22
+ "bundle_recipient_id": 1,
23
+ "created_at": "2000-01-01T01:00:00Z"
24
+ },
25
+ "when": "2000-01-01T01:00:00Z",
26
+ "destination": "/to_path",
27
+ "path": "",
28
+ "source": "/from_path"
29
+ }
30
+ ```
31
+
32
+ * `action` (string): Type of action
33
+ * `bundle_registration` (BundleRegistration): Object that contains bundle registration information
34
+ * `when` (date-time): Action occurrence date/time
35
+ * `destination` (string): The destination path for this bundle action, if applicable
36
+ * `path` (string): Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
37
+ * `source` (string): The source path for this bundle action, if applicable
38
+
39
+ ---
40
+
41
+ ## List Bundle Actions
42
+
43
+ ```
44
+ await BundleAction.list({
45
+ 'per_page': 1,
46
+ 'bundle_id': 1,
47
+ 'bundle_registration_id': 1,
48
+ })
49
+ ```
50
+
51
+
52
+ ### Parameters
53
+
54
+ * `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.
55
+ * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
56
+ * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[bundle_registration_id]=desc`). Valid fields are `bundle_registration_id` and `created_at`.
57
+ * `bundle_id` (int64): Bundle ID
58
+ * `bundle_registration_id` (int64): BundleRegistration ID
@@ -13,6 +13,7 @@
13
13
  "error_message": "example",
14
14
  "user_agent": "example",
15
15
  "response_code": 1,
16
+ "success": true,
16
17
  "duration_ms": 1
17
18
  }
18
19
  ```
@@ -26,6 +27,7 @@
26
27
  * `error_message` (string): Error message, if applicable
27
28
  * `user_agent` (string): User-Agent
28
29
  * `response_code` (int64): HTTP Response Code
30
+ * `success` (boolean): `false` if HTTP Response Code is 4xx or 5xx
29
31
  * `duration_ms` (int64): Duration (in milliseconds)
30
32
 
31
33
  ---
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.48';
14
+ var version = '1.2.50';
15
15
  var userAgent = "Files.com JavaScript SDK v".concat(version);
16
16
  var logLevel = _Logger.LogLevel.INFO;
17
17
  var debugRequest = false;
@@ -0,0 +1,135 @@
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 _BundleAction;
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 BundleAction
25
+ */
26
+ var BundleAction = /*#__PURE__*/(0, _createClass2.default)(function BundleAction() {
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, BundleAction);
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
+ // string # Type of action
37
+ (0, _defineProperty2.default)(this, "getAction", function () {
38
+ return _this.attributes.action;
39
+ });
40
+ // BundleRegistration # Object that contains bundle registration information
41
+ (0, _defineProperty2.default)(this, "getBundleRegistration", function () {
42
+ return _this.attributes.bundle_registration;
43
+ });
44
+ // date-time # Action occurrence date/time
45
+ (0, _defineProperty2.default)(this, "getWhen", function () {
46
+ return _this.attributes.when;
47
+ });
48
+ // string # The destination path for this bundle action, if applicable
49
+ (0, _defineProperty2.default)(this, "getDestination", function () {
50
+ return _this.attributes.destination;
51
+ });
52
+ // string # 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
+ // string # The source path for this bundle action, if applicable
57
+ (0, _defineProperty2.default)(this, "getSource", function () {
58
+ return _this.attributes.source;
59
+ });
60
+ Object.entries(attributes).forEach(function (_ref) {
61
+ var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
62
+ key = _ref2[0],
63
+ value = _ref2[1];
64
+ var normalizedKey = key.replace('?', '');
65
+ _this.attributes[normalizedKey] = value;
66
+ Object.defineProperty(_this, normalizedKey, {
67
+ value: value,
68
+ writable: false
69
+ });
70
+ });
71
+ this.options = _objectSpread({}, options);
72
+ });
73
+ _BundleAction = BundleAction;
74
+ // Parameters:
75
+ // 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.
76
+ // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
77
+ // sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[bundle_registration_id]=desc`). Valid fields are `bundle_registration_id` and `created_at`.
78
+ // bundle_id - int64 - Bundle ID
79
+ // bundle_registration_id - int64 - BundleRegistration ID
80
+ (0, _defineProperty2.default)(BundleAction, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
81
+ var _response$data;
82
+ var params,
83
+ options,
84
+ response,
85
+ _args = arguments;
86
+ return _regenerator.default.wrap(function _callee$(_context) {
87
+ while (1) switch (_context.prev = _context.next) {
88
+ case 0:
89
+ params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
90
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
91
+ if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
92
+ _context.next = 4;
93
+ break;
94
+ }
95
+ throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
96
+ case 4:
97
+ if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
98
+ _context.next = 6;
99
+ break;
100
+ }
101
+ throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
102
+ case 6:
103
+ if (!(params.bundle_id && !(0, _utils.isInt)(params.bundle_id))) {
104
+ _context.next = 8;
105
+ break;
106
+ }
107
+ throw new errors.InvalidParameterError("Bad parameter: bundle_id must be of type Int, received ".concat((0, _utils.getType)(params.bundle_id)));
108
+ case 8:
109
+ if (!(params.bundle_registration_id && !(0, _utils.isInt)(params.bundle_registration_id))) {
110
+ _context.next = 10;
111
+ break;
112
+ }
113
+ throw new errors.InvalidParameterError("Bad parameter: bundle_registration_id must be of type Int, received ".concat((0, _utils.getType)(params.bundle_registration_id)));
114
+ case 10:
115
+ _context.next = 12;
116
+ return _Api.default.sendRequest('/bundle_actions', 'GET', params, options);
117
+ case 12:
118
+ response = _context.sent;
119
+ 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) {
120
+ return new _BundleAction(obj, options);
121
+ })) || []);
122
+ case 14:
123
+ case "end":
124
+ return _context.stop();
125
+ }
126
+ }, _callee);
127
+ })));
128
+ (0, _defineProperty2.default)(BundleAction, "all", function () {
129
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
130
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
131
+ return _BundleAction.list(params, options);
132
+ });
133
+ var _default = exports.default = BundleAction;
134
+ module.exports = BundleAction;
135
+ module.exports.default = BundleAction;
@@ -69,6 +69,10 @@ var ExavaultApiRequestLog = /*#__PURE__*/(0, _createClass2.default)(function Exa
69
69
  (0, _defineProperty2.default)(this, "getResponseCode", function () {
70
70
  return _this.attributes.response_code;
71
71
  });
72
+ // boolean # `false` if HTTP Response Code is 4xx or 5xx
73
+ (0, _defineProperty2.default)(this, "getSuccess", function () {
74
+ return _this.attributes.success;
75
+ });
72
76
  // int64 # Duration (in milliseconds)
73
77
  (0, _defineProperty2.default)(this, "getDurationMs", function () {
74
78
  return _this.attributes.duration_ms;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.2.48",
3
+ "version": "1.2.50",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Files.js CHANGED
@@ -5,7 +5,7 @@ const endpointPrefix = '/api/rest/v1'
5
5
  let apiKey
6
6
  let baseUrl = 'https://app.files.com'
7
7
  let sessionId = null
8
- const version = '1.2.48'
8
+ const version = '1.2.50'
9
9
  let userAgent = `Files.com JavaScript SDK v${version}`
10
10
 
11
11
  let logLevel = LogLevel.INFO
@@ -0,0 +1,84 @@
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 BundleAction
11
+ */
12
+ class BundleAction {
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
+ // string # Type of action
32
+ getAction = () => this.attributes.action
33
+
34
+ // BundleRegistration # Object that contains bundle registration information
35
+ getBundleRegistration = () => this.attributes.bundle_registration
36
+
37
+ // date-time # Action occurrence date/time
38
+ getWhen = () => this.attributes.when
39
+
40
+ // string # The destination path for this bundle action, if applicable
41
+ getDestination = () => this.attributes.destination
42
+
43
+ // string # 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
+ // string # The source path for this bundle action, if applicable
47
+ getSource = () => this.attributes.source
48
+
49
+ // Parameters:
50
+ // 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.
51
+ // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
52
+ // sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[bundle_registration_id]=desc`). Valid fields are `bundle_registration_id` and `created_at`.
53
+ // bundle_id - int64 - Bundle ID
54
+ // bundle_registration_id - int64 - BundleRegistration ID
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
+ if (params.bundle_id && !isInt(params.bundle_id)) {
65
+ throw new errors.InvalidParameterError(`Bad parameter: bundle_id must be of type Int, received ${getType(params.bundle_id)}`)
66
+ }
67
+
68
+ if (params.bundle_registration_id && !isInt(params.bundle_registration_id)) {
69
+ throw new errors.InvalidParameterError(`Bad parameter: bundle_registration_id must be of type Int, received ${getType(params.bundle_registration_id)}`)
70
+ }
71
+
72
+ const response = await Api.sendRequest('/bundle_actions', 'GET', params, options)
73
+
74
+ return response?.data?.map(obj => new BundleAction(obj, options)) || []
75
+ }
76
+
77
+ static all = (params = {}, options = {}) =>
78
+ BundleAction.list(params, options)
79
+ }
80
+
81
+ export default BundleAction
82
+
83
+ module.exports = BundleAction
84
+ module.exports.default = BundleAction
@@ -55,6 +55,9 @@ class ExavaultApiRequestLog {
55
55
  // int64 # HTTP Response Code
56
56
  getResponseCode = () => this.attributes.response_code
57
57
 
58
+ // boolean # `false` if HTTP Response Code is 4xx or 5xx
59
+ getSuccess = () => this.attributes.success
60
+
58
61
  // int64 # Duration (in milliseconds)
59
62
  getDurationMs = () => this.attributes.duration_ms
60
63