files.com 1.0.183 → 1.0.184
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/lib/models/Notification.js +39 -17
- package/package.json +1 -1
- package/src/models/Notification.js +16 -0
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.184
|
@@ -89,6 +89,12 @@ var Notification = /*#__PURE__*/(0, _createClass2.default)(function Notification
|
|
89
89
|
(0, _defineProperty2.default)(this, "setSendInterval", function (value) {
|
90
90
|
_this.attributes.send_interval = value;
|
91
91
|
});
|
92
|
+
(0, _defineProperty2.default)(this, "getMessage", function () {
|
93
|
+
return _this.attributes.message;
|
94
|
+
});
|
95
|
+
(0, _defineProperty2.default)(this, "setMessage", function (value) {
|
96
|
+
_this.attributes.message = value;
|
97
|
+
});
|
92
98
|
(0, _defineProperty2.default)(this, "getUnsubscribed", function () {
|
93
99
|
return _this.attributes.unsubscribed;
|
94
100
|
});
|
@@ -163,32 +169,40 @@ var Notification = /*#__PURE__*/(0, _createClass2.default)(function Notification
|
|
163
169
|
throw new Error("Bad parameter: send_interval must be of type String, received ".concat((0, _utils.getType)(send_interval)));
|
164
170
|
|
165
171
|
case 10:
|
172
|
+
if (!(params['message'] && !(0, _utils.isString)(params['message']))) {
|
173
|
+
_context.next = 12;
|
174
|
+
break;
|
175
|
+
}
|
176
|
+
|
177
|
+
throw new Error("Bad parameter: message must be of type String, received ".concat((0, _utils.getType)(message)));
|
178
|
+
|
179
|
+
case 12:
|
166
180
|
if (params['id']) {
|
167
|
-
_context.next =
|
181
|
+
_context.next = 18;
|
168
182
|
break;
|
169
183
|
}
|
170
184
|
|
171
185
|
if (!_this.attributes.id) {
|
172
|
-
_context.next =
|
186
|
+
_context.next = 17;
|
173
187
|
break;
|
174
188
|
}
|
175
189
|
|
176
190
|
params['id'] = _this.id;
|
177
|
-
_context.next =
|
191
|
+
_context.next = 18;
|
178
192
|
break;
|
179
193
|
|
180
|
-
case
|
194
|
+
case 17:
|
181
195
|
throw new Error('Parameter missing: id');
|
182
196
|
|
183
|
-
case
|
184
|
-
_context.next =
|
197
|
+
case 18:
|
198
|
+
_context.next = 20;
|
185
199
|
return _Api.default.sendRequest("/notifications/".concat(params['id']), 'PATCH', params, _this.options);
|
186
200
|
|
187
|
-
case
|
201
|
+
case 20:
|
188
202
|
response = _context.sent;
|
189
203
|
return _context.abrupt("return", new Notification(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
190
204
|
|
191
|
-
case
|
205
|
+
case 22:
|
192
206
|
case "end":
|
193
207
|
return _context.stop();
|
194
208
|
}
|
@@ -456,38 +470,46 @@ var Notification = /*#__PURE__*/(0, _createClass2.default)(function Notification
|
|
456
470
|
throw new Error("Bad parameter: send_interval must be of type String, received ".concat((0, _utils.getType)(send_interval)));
|
457
471
|
|
458
472
|
case 6:
|
459
|
-
if (!(params['
|
473
|
+
if (!(params['message'] && !(0, _utils.isString)(params['message']))) {
|
460
474
|
_context5.next = 8;
|
461
475
|
break;
|
462
476
|
}
|
463
477
|
|
464
|
-
throw new Error("Bad parameter:
|
478
|
+
throw new Error("Bad parameter: message must be of type String, received ".concat((0, _utils.getType)(message)));
|
465
479
|
|
466
480
|
case 8:
|
467
|
-
if (!(params['
|
481
|
+
if (!(params['group_id'] && !(0, _utils.isInt)(params['group_id']))) {
|
468
482
|
_context5.next = 10;
|
469
483
|
break;
|
470
484
|
}
|
471
485
|
|
472
|
-
throw new Error("Bad parameter:
|
486
|
+
throw new Error("Bad parameter: group_id must be of type Int, received ".concat((0, _utils.getType)(group_id)));
|
473
487
|
|
474
488
|
case 10:
|
475
|
-
if (!(params['
|
489
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
476
490
|
_context5.next = 12;
|
477
491
|
break;
|
478
492
|
}
|
479
493
|
|
480
|
-
throw new Error("Bad parameter:
|
494
|
+
throw new Error("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
|
481
495
|
|
482
496
|
case 12:
|
483
|
-
|
484
|
-
|
497
|
+
if (!(params['username'] && !(0, _utils.isString)(params['username']))) {
|
498
|
+
_context5.next = 14;
|
499
|
+
break;
|
500
|
+
}
|
501
|
+
|
502
|
+
throw new Error("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(username)));
|
485
503
|
|
486
504
|
case 14:
|
505
|
+
_context5.next = 16;
|
506
|
+
return _Api.default.sendRequest("/notifications", 'POST', params, options);
|
507
|
+
|
508
|
+
case 16:
|
487
509
|
response = _context5.sent;
|
488
510
|
return _context5.abrupt("return", new Notification(response === null || response === void 0 ? void 0 : response.data, options));
|
489
511
|
|
490
|
-
case
|
512
|
+
case 18:
|
491
513
|
case "end":
|
492
514
|
return _context5.stop();
|
493
515
|
}
|
package/package.json
CHANGED
@@ -78,6 +78,13 @@ class Notification {
|
|
78
78
|
this.attributes.send_interval = value
|
79
79
|
}
|
80
80
|
|
81
|
+
// string # Custom message to include in notification emails.
|
82
|
+
getMessage = () => this.attributes.message
|
83
|
+
|
84
|
+
setMessage = value => {
|
85
|
+
this.attributes.message = value
|
86
|
+
}
|
87
|
+
|
81
88
|
// boolean # Is the user unsubscribed from this notification?
|
82
89
|
getUnsubscribed = () => this.attributes.unsubscribed
|
83
90
|
|
@@ -119,6 +126,7 @@ class Notification {
|
|
119
126
|
// notify_user_actions - boolean - If `true` actions initiated by the user will still result in a notification
|
120
127
|
// recursive - boolean - If `true`, enable notifications for each subfolder in this path
|
121
128
|
// send_interval - string - The time interval that notifications are aggregated by. Can be `five_minutes`, `fifteen_minutes`, `hourly`, or `daily`.
|
129
|
+
// message - string - Custom message to include in notification emails.
|
122
130
|
update = async (params = {}) => {
|
123
131
|
if (!this.attributes.id) {
|
124
132
|
throw new Error('Current object has no id')
|
@@ -135,6 +143,9 @@ class Notification {
|
|
135
143
|
if (params['send_interval'] && !isString(params['send_interval'])) {
|
136
144
|
throw new Error(`Bad parameter: send_interval must be of type String, received ${getType(send_interval)}`)
|
137
145
|
}
|
146
|
+
if (params['message'] && !isString(params['message'])) {
|
147
|
+
throw new Error(`Bad parameter: message must be of type String, received ${getType(message)}`)
|
148
|
+
}
|
138
149
|
|
139
150
|
if (!params['id']) {
|
140
151
|
if (this.attributes.id) {
|
@@ -263,6 +274,7 @@ class Notification {
|
|
263
274
|
// notify_user_actions - boolean - If `true` actions initiated by the user will still result in a notification
|
264
275
|
// recursive - boolean - If `true`, enable notifications for each subfolder in this path
|
265
276
|
// send_interval - string - The time interval that notifications are aggregated by. Can be `five_minutes`, `fifteen_minutes`, `hourly`, or `daily`.
|
277
|
+
// message - string - Custom message to include in notification emails.
|
266
278
|
// group_id - int64 - The ID of the group to notify. Provide `user_id`, `username` or `group_id`.
|
267
279
|
// path - string - Path
|
268
280
|
// username - string - The username of the user to notify. Provide `user_id`, `username` or `group_id`.
|
@@ -275,6 +287,10 @@ class Notification {
|
|
275
287
|
throw new Error(`Bad parameter: send_interval must be of type String, received ${getType(send_interval)}`)
|
276
288
|
}
|
277
289
|
|
290
|
+
if (params['message'] && !isString(params['message'])) {
|
291
|
+
throw new Error(`Bad parameter: message must be of type String, received ${getType(message)}`)
|
292
|
+
}
|
293
|
+
|
278
294
|
if (params['group_id'] && !isInt(params['group_id'])) {
|
279
295
|
throw new Error(`Bad parameter: group_id must be of type Int, received ${getType(group_id)}`)
|
280
296
|
}
|