files.com 1.0.231 → 1.0.232
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.232
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# BundleNotification
|
2
|
+
|
3
|
+
## Example BundleNotification Object
|
4
|
+
|
5
|
+
```
|
6
|
+
{
|
7
|
+
"bundle_id": 1,
|
8
|
+
"id": 1,
|
9
|
+
"notify_on_registration": true,
|
10
|
+
"user_id": 1
|
11
|
+
}
|
12
|
+
```
|
13
|
+
|
14
|
+
* `bundle_id` (int64): Bundle ID to notify on
|
15
|
+
* `id` (int64): Bundle Notification ID
|
16
|
+
* `notify_on_registration` (boolean): Triggers bundle notification when a registration action occurs for it.
|
17
|
+
* `user_id` (int64): The id of the user to notify.
|
18
|
+
|
19
|
+
---
|
20
|
+
|
21
|
+
## List Bundle Notifications
|
22
|
+
|
23
|
+
```
|
24
|
+
await BundleNotification.list({
|
25
|
+
'user_id': 1,
|
26
|
+
'per_page': 1,
|
27
|
+
'bundle_id': 1,
|
28
|
+
})
|
29
|
+
```
|
30
|
+
|
31
|
+
|
32
|
+
### Parameters
|
33
|
+
|
34
|
+
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
35
|
+
* `cursor` (string): Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
36
|
+
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
37
|
+
* `bundle_id` (int64): Bundle ID to notify on
|
38
|
+
|
39
|
+
---
|
40
|
+
|
41
|
+
## Show Bundle Notification
|
42
|
+
|
43
|
+
```
|
44
|
+
await BundleNotification.find(id)
|
45
|
+
```
|
46
|
+
|
47
|
+
|
48
|
+
### Parameters
|
49
|
+
|
50
|
+
* `id` (int64): Required - Bundle Notification ID.
|
51
|
+
|
52
|
+
---
|
53
|
+
|
54
|
+
## Create Bundle Notification
|
55
|
+
|
56
|
+
```
|
57
|
+
await BundleNotification.create({
|
58
|
+
'user_id': 1,
|
59
|
+
'notify_on_registration': true,
|
60
|
+
'bundle_id': 1,
|
61
|
+
})
|
62
|
+
```
|
63
|
+
|
64
|
+
|
65
|
+
### Parameters
|
66
|
+
|
67
|
+
* `user_id` (int64): Required - The id of the user to notify.
|
68
|
+
* `notify_on_registration` (boolean): Triggers bundle notification when a registration action occurs for it.
|
69
|
+
* `bundle_id` (int64): Required - Bundle ID to notify on
|
70
|
+
|
71
|
+
---
|
72
|
+
|
73
|
+
## Delete Bundle Notification
|
74
|
+
|
75
|
+
```
|
76
|
+
const [bundle_notification] = await BundleNotification.list()
|
77
|
+
|
78
|
+
await bundle_notification.delete()
|
79
|
+
```
|
80
|
+
|
81
|
+
### Parameters
|
82
|
+
|
83
|
+
* `id` (int64): Required - Bundle Notification ID.
|
84
|
+
|
@@ -0,0 +1,293 @@
|
|
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 _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 BundleNotification
|
23
|
+
*/
|
24
|
+
var BundleNotification = /*#__PURE__*/(0, _createClass2.default)(function BundleNotification() {
|
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, BundleNotification);
|
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
|
+
(0, _defineProperty2.default)(this, "getBundleId", function () {
|
35
|
+
return _this.attributes.bundle_id;
|
36
|
+
});
|
37
|
+
(0, _defineProperty2.default)(this, "setBundleId", function (value) {
|
38
|
+
_this.attributes.bundle_id = value;
|
39
|
+
});
|
40
|
+
(0, _defineProperty2.default)(this, "getId", function () {
|
41
|
+
return _this.attributes.id;
|
42
|
+
});
|
43
|
+
(0, _defineProperty2.default)(this, "setId", function (value) {
|
44
|
+
_this.attributes.id = value;
|
45
|
+
});
|
46
|
+
(0, _defineProperty2.default)(this, "getNotifyOnRegistration", function () {
|
47
|
+
return _this.attributes.notify_on_registration;
|
48
|
+
});
|
49
|
+
(0, _defineProperty2.default)(this, "setNotifyOnRegistration", function (value) {
|
50
|
+
_this.attributes.notify_on_registration = value;
|
51
|
+
});
|
52
|
+
(0, _defineProperty2.default)(this, "getUserId", function () {
|
53
|
+
return _this.attributes.user_id;
|
54
|
+
});
|
55
|
+
(0, _defineProperty2.default)(this, "setUserId", function (value) {
|
56
|
+
_this.attributes.user_id = value;
|
57
|
+
});
|
58
|
+
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
59
|
+
var params,
|
60
|
+
response,
|
61
|
+
_args = arguments;
|
62
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
63
|
+
while (1) {
|
64
|
+
switch (_context.prev = _context.next) {
|
65
|
+
case 0:
|
66
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
67
|
+
if (_this.attributes.id) {
|
68
|
+
_context.next = 3;
|
69
|
+
break;
|
70
|
+
}
|
71
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
72
|
+
case 3:
|
73
|
+
if ((0, _utils.isObject)(params)) {
|
74
|
+
_context.next = 5;
|
75
|
+
break;
|
76
|
+
}
|
77
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
78
|
+
case 5:
|
79
|
+
params.id = _this.attributes.id;
|
80
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
81
|
+
_context.next = 8;
|
82
|
+
break;
|
83
|
+
}
|
84
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
85
|
+
case 8:
|
86
|
+
if (params['id']) {
|
87
|
+
_context.next = 14;
|
88
|
+
break;
|
89
|
+
}
|
90
|
+
if (!_this.attributes.id) {
|
91
|
+
_context.next = 13;
|
92
|
+
break;
|
93
|
+
}
|
94
|
+
params['id'] = _this.id;
|
95
|
+
_context.next = 14;
|
96
|
+
break;
|
97
|
+
case 13:
|
98
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
99
|
+
case 14:
|
100
|
+
_context.next = 16;
|
101
|
+
return _Api.default.sendRequest("/bundle_notifications/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
|
102
|
+
case 16:
|
103
|
+
response = _context.sent;
|
104
|
+
return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
105
|
+
case 18:
|
106
|
+
case "end":
|
107
|
+
return _context.stop();
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}, _callee);
|
111
|
+
})));
|
112
|
+
(0, _defineProperty2.default)(this, "destroy", function () {
|
113
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
114
|
+
return _this.delete(params);
|
115
|
+
});
|
116
|
+
(0, _defineProperty2.default)(this, "save", function () {
|
117
|
+
if (_this.attributes['id']) {
|
118
|
+
throw new errors.NotImplementedError('The BundleNotification object doesn\'t support updates.');
|
119
|
+
} else {
|
120
|
+
var newObject = BundleNotification.create(_this.attributes, _this.options);
|
121
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
122
|
+
return true;
|
123
|
+
}
|
124
|
+
});
|
125
|
+
Object.entries(attributes).forEach(function (_ref2) {
|
126
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
127
|
+
key = _ref3[0],
|
128
|
+
value = _ref3[1];
|
129
|
+
var normalizedKey = key.replace('?', '');
|
130
|
+
_this.attributes[normalizedKey] = value;
|
131
|
+
Object.defineProperty(_this, normalizedKey, {
|
132
|
+
value: value,
|
133
|
+
writable: false
|
134
|
+
});
|
135
|
+
});
|
136
|
+
this.options = _objectSpread({}, options);
|
137
|
+
});
|
138
|
+
(0, _defineProperty2.default)(BundleNotification, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
139
|
+
var _response$data;
|
140
|
+
var params,
|
141
|
+
options,
|
142
|
+
response,
|
143
|
+
_args2 = arguments;
|
144
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
145
|
+
while (1) {
|
146
|
+
switch (_context2.prev = _context2.next) {
|
147
|
+
case 0:
|
148
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
149
|
+
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
150
|
+
if (!(params['user_id'] && !(0, _utils.isInt)(params['user_id']))) {
|
151
|
+
_context2.next = 4;
|
152
|
+
break;
|
153
|
+
}
|
154
|
+
throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params['user_id'])));
|
155
|
+
case 4:
|
156
|
+
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
157
|
+
_context2.next = 6;
|
158
|
+
break;
|
159
|
+
}
|
160
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
|
161
|
+
case 6:
|
162
|
+
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
163
|
+
_context2.next = 8;
|
164
|
+
break;
|
165
|
+
}
|
166
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
|
167
|
+
case 8:
|
168
|
+
if (!(params['bundle_id'] && !(0, _utils.isInt)(params['bundle_id']))) {
|
169
|
+
_context2.next = 10;
|
170
|
+
break;
|
171
|
+
}
|
172
|
+
throw new errors.InvalidParameterError("Bad parameter: bundle_id must be of type Int, received ".concat((0, _utils.getType)(params['bundle_id'])));
|
173
|
+
case 10:
|
174
|
+
_context2.next = 12;
|
175
|
+
return _Api.default.sendRequest("/bundle_notifications", 'GET', params, options);
|
176
|
+
case 12:
|
177
|
+
response = _context2.sent;
|
178
|
+
return _context2.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
179
|
+
return new BundleNotification(obj, options);
|
180
|
+
})) || []);
|
181
|
+
case 14:
|
182
|
+
case "end":
|
183
|
+
return _context2.stop();
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}, _callee2);
|
187
|
+
})));
|
188
|
+
(0, _defineProperty2.default)(BundleNotification, "all", function () {
|
189
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
190
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
191
|
+
return BundleNotification.list(params, options);
|
192
|
+
});
|
193
|
+
(0, _defineProperty2.default)(BundleNotification, "find", /*#__PURE__*/function () {
|
194
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(id) {
|
195
|
+
var params,
|
196
|
+
options,
|
197
|
+
response,
|
198
|
+
_args3 = arguments;
|
199
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
200
|
+
while (1) {
|
201
|
+
switch (_context3.prev = _context3.next) {
|
202
|
+
case 0:
|
203
|
+
params = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
204
|
+
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
|
205
|
+
if ((0, _utils.isObject)(params)) {
|
206
|
+
_context3.next = 4;
|
207
|
+
break;
|
208
|
+
}
|
209
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
210
|
+
case 4:
|
211
|
+
params['id'] = id;
|
212
|
+
if (params['id']) {
|
213
|
+
_context3.next = 7;
|
214
|
+
break;
|
215
|
+
}
|
216
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
217
|
+
case 7:
|
218
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
219
|
+
_context3.next = 9;
|
220
|
+
break;
|
221
|
+
}
|
222
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params['id'])));
|
223
|
+
case 9:
|
224
|
+
_context3.next = 11;
|
225
|
+
return _Api.default.sendRequest("/bundle_notifications/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
|
226
|
+
case 11:
|
227
|
+
response = _context3.sent;
|
228
|
+
return _context3.abrupt("return", new BundleNotification(response === null || response === void 0 ? void 0 : response.data, options));
|
229
|
+
case 13:
|
230
|
+
case "end":
|
231
|
+
return _context3.stop();
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}, _callee3);
|
235
|
+
}));
|
236
|
+
return function (_x) {
|
237
|
+
return _ref5.apply(this, arguments);
|
238
|
+
};
|
239
|
+
}());
|
240
|
+
(0, _defineProperty2.default)(BundleNotification, "get", function (id) {
|
241
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
242
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
243
|
+
return BundleNotification.find(id, params, options);
|
244
|
+
});
|
245
|
+
(0, _defineProperty2.default)(BundleNotification, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
246
|
+
var params,
|
247
|
+
options,
|
248
|
+
response,
|
249
|
+
_args4 = arguments;
|
250
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
251
|
+
while (1) {
|
252
|
+
switch (_context4.prev = _context4.next) {
|
253
|
+
case 0:
|
254
|
+
params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
255
|
+
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
256
|
+
if (params['user_id']) {
|
257
|
+
_context4.next = 4;
|
258
|
+
break;
|
259
|
+
}
|
260
|
+
throw new errors.MissingParameterError('Parameter missing: user_id');
|
261
|
+
case 4:
|
262
|
+
if (params['bundle_id']) {
|
263
|
+
_context4.next = 6;
|
264
|
+
break;
|
265
|
+
}
|
266
|
+
throw new errors.MissingParameterError('Parameter missing: bundle_id');
|
267
|
+
case 6:
|
268
|
+
if (!(params['user_id'] && !(0, _utils.isInt)(params['user_id']))) {
|
269
|
+
_context4.next = 8;
|
270
|
+
break;
|
271
|
+
}
|
272
|
+
throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params['user_id'])));
|
273
|
+
case 8:
|
274
|
+
if (!(params['bundle_id'] && !(0, _utils.isInt)(params['bundle_id']))) {
|
275
|
+
_context4.next = 10;
|
276
|
+
break;
|
277
|
+
}
|
278
|
+
throw new errors.InvalidParameterError("Bad parameter: bundle_id must be of type Int, received ".concat((0, _utils.getType)(params['bundle_id'])));
|
279
|
+
case 10:
|
280
|
+
_context4.next = 12;
|
281
|
+
return _Api.default.sendRequest("/bundle_notifications", 'POST', params, options);
|
282
|
+
case 12:
|
283
|
+
response = _context4.sent;
|
284
|
+
return _context4.abrupt("return", new BundleNotification(response === null || response === void 0 ? void 0 : response.data, options));
|
285
|
+
case 14:
|
286
|
+
case "end":
|
287
|
+
return _context4.stop();
|
288
|
+
}
|
289
|
+
}
|
290
|
+
}, _callee4);
|
291
|
+
})));
|
292
|
+
var _default = BundleNotification;
|
293
|
+
exports.default = _default;
|
package/package.json
CHANGED
@@ -0,0 +1,177 @@
|
|
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 BundleNotification
|
8
|
+
*/
|
9
|
+
class BundleNotification {
|
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 # Bundle ID to notify on
|
27
|
+
getBundleId = () => this.attributes.bundle_id
|
28
|
+
|
29
|
+
setBundleId = value => {
|
30
|
+
this.attributes.bundle_id = value
|
31
|
+
}
|
32
|
+
|
33
|
+
// int64 # Bundle Notification ID
|
34
|
+
getId = () => this.attributes.id
|
35
|
+
|
36
|
+
setId = value => {
|
37
|
+
this.attributes.id = value
|
38
|
+
}
|
39
|
+
|
40
|
+
// boolean # Triggers bundle notification when a registration action occurs for it.
|
41
|
+
getNotifyOnRegistration = () => this.attributes.notify_on_registration
|
42
|
+
|
43
|
+
setNotifyOnRegistration = value => {
|
44
|
+
this.attributes.notify_on_registration = value
|
45
|
+
}
|
46
|
+
|
47
|
+
// int64 # The id of the user to notify.
|
48
|
+
getUserId = () => this.attributes.user_id
|
49
|
+
|
50
|
+
setUserId = value => {
|
51
|
+
this.attributes.user_id = value
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
delete = async (params = {}) => {
|
56
|
+
if (!this.attributes.id) {
|
57
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
58
|
+
}
|
59
|
+
|
60
|
+
if (!isObject(params)) {
|
61
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
62
|
+
}
|
63
|
+
|
64
|
+
params.id = this.attributes.id
|
65
|
+
if (params['id'] && !isInt(params['id'])) {
|
66
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
67
|
+
}
|
68
|
+
|
69
|
+
if (!params['id']) {
|
70
|
+
if (this.attributes.id) {
|
71
|
+
params['id'] = this.id
|
72
|
+
} else {
|
73
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
const response = await Api.sendRequest(`/bundle_notifications/${encodeURIComponent(params['id'])}`, 'DELETE', params, this.options)
|
78
|
+
|
79
|
+
return response?.data
|
80
|
+
}
|
81
|
+
|
82
|
+
destroy = (params = {}) =>
|
83
|
+
this.delete(params)
|
84
|
+
|
85
|
+
save = () => {
|
86
|
+
if (this.attributes['id']) {
|
87
|
+
throw new errors.NotImplementedError('The BundleNotification object doesn\'t support updates.')
|
88
|
+
} else {
|
89
|
+
const newObject = BundleNotification.create(this.attributes, this.options)
|
90
|
+
this.attributes = { ...newObject.attributes }
|
91
|
+
return true
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
// Parameters:
|
96
|
+
// user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
97
|
+
// cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
98
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
99
|
+
// bundle_id - int64 - Bundle ID to notify on
|
100
|
+
static list = async (params = {}, options = {}) => {
|
101
|
+
if (params['user_id'] && !isInt(params['user_id'])) {
|
102
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params['user_id'])}`)
|
103
|
+
}
|
104
|
+
|
105
|
+
if (params['cursor'] && !isString(params['cursor'])) {
|
106
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
|
107
|
+
}
|
108
|
+
|
109
|
+
if (params['per_page'] && !isInt(params['per_page'])) {
|
110
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
|
111
|
+
}
|
112
|
+
|
113
|
+
if (params['bundle_id'] && !isInt(params['bundle_id'])) {
|
114
|
+
throw new errors.InvalidParameterError(`Bad parameter: bundle_id must be of type Int, received ${getType(params['bundle_id'])}`)
|
115
|
+
}
|
116
|
+
|
117
|
+
const response = await Api.sendRequest(`/bundle_notifications`, 'GET', params, options)
|
118
|
+
|
119
|
+
return response?.data?.map(obj => new BundleNotification(obj, options)) || []
|
120
|
+
}
|
121
|
+
|
122
|
+
static all = (params = {}, options = {}) =>
|
123
|
+
BundleNotification.list(params, options)
|
124
|
+
|
125
|
+
// Parameters:
|
126
|
+
// id (required) - int64 - Bundle Notification ID.
|
127
|
+
static find = async (id, params = {}, options = {}) => {
|
128
|
+
if (!isObject(params)) {
|
129
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
130
|
+
}
|
131
|
+
|
132
|
+
params['id'] = id
|
133
|
+
|
134
|
+
if (!params['id']) {
|
135
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
136
|
+
}
|
137
|
+
|
138
|
+
if (params['id'] && !isInt(params['id'])) {
|
139
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
140
|
+
}
|
141
|
+
|
142
|
+
const response = await Api.sendRequest(`/bundle_notifications/${encodeURIComponent(params['id'])}`, 'GET', params, options)
|
143
|
+
|
144
|
+
return new BundleNotification(response?.data, options)
|
145
|
+
}
|
146
|
+
|
147
|
+
static get = (id, params = {}, options = {}) =>
|
148
|
+
BundleNotification.find(id, params, options)
|
149
|
+
|
150
|
+
// Parameters:
|
151
|
+
// user_id (required) - int64 - The id of the user to notify.
|
152
|
+
// notify_on_registration - boolean - Triggers bundle notification when a registration action occurs for it.
|
153
|
+
// bundle_id (required) - int64 - Bundle ID to notify on
|
154
|
+
static create = async (params = {}, options = {}) => {
|
155
|
+
if (!params['user_id']) {
|
156
|
+
throw new errors.MissingParameterError('Parameter missing: user_id')
|
157
|
+
}
|
158
|
+
|
159
|
+
if (!params['bundle_id']) {
|
160
|
+
throw new errors.MissingParameterError('Parameter missing: bundle_id')
|
161
|
+
}
|
162
|
+
|
163
|
+
if (params['user_id'] && !isInt(params['user_id'])) {
|
164
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params['user_id'])}`)
|
165
|
+
}
|
166
|
+
|
167
|
+
if (params['bundle_id'] && !isInt(params['bundle_id'])) {
|
168
|
+
throw new errors.InvalidParameterError(`Bad parameter: bundle_id must be of type Int, received ${getType(params['bundle_id'])}`)
|
169
|
+
}
|
170
|
+
|
171
|
+
const response = await Api.sendRequest(`/bundle_notifications`, 'POST', params, options)
|
172
|
+
|
173
|
+
return new BundleNotification(response?.data, options)
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
export default BundleNotification
|