idea-toolbox
Version:
IDEA's utility functions
30 lines (29 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PushNotificationsDevice = void 0;
const resource_model_1 = require("./resource.model");
const pushNotificationsPlatforms_enum_1 = require("./pushNotificationsPlatforms.enum");
/**
* Devices for push notifications.
*/
class PushNotificationsDevice extends resource_model_1.Resource {
load(x) {
super.load(x);
this.token = this.clean(x.token, String);
this.platform = this.clean(x.platform, String);
this.endpoint = this.clean(x.endpoint, String);
}
validate(complete) {
const e = super.validate();
if (this.iE(this.token))
e.push('token');
if (!(this.platform in pushNotificationsPlatforms_enum_1.PushNotificationsPlatforms))
e.push('platform');
if (complete) {
if (this.iE(this.endpoint))
e.push('endpoint');
}
return e;
}
}
exports.PushNotificationsDevice = PushNotificationsDevice;