Commit eabedd78 authored by zeynel's avatar zeynel

Deprecate unused methods

parent 93f5fdbd
......@@ -10,22 +10,7 @@ var Notification = function (initialBody) {
throw 'Body must be a JSON object';
}
this.postBody = {};
if ('contents' in initialBody) {
this.postBody.contents = initialBody.contents;
return;
}
if ('content_available' in initialBody) {
this.postBody.content_available = initialBody.content_available;
return;
}
if ('template_id' in initialBody) {
this.postBody.template_id = initialBody.template_id;
return;
}
throw 'Body must include one of the following fields: contents, content_available, template_id'
this.postBody = JSON.parse(JSON.stringify(initialBody));
};
/**
......@@ -33,11 +18,9 @@ var Notification = function (initialBody) {
* @param name { String }
* @param value
*/
// TODO Deprecate
Notification.prototype.setParameter = function (name, value) {
// TODO Deprecate
if (name && name[0] === '!') {
name = name.substring(1);
}
console.warn("[onesignal-node] setParameter function will be removed in next release, please check documentation.");
this.postBody[name] = value;
};
......@@ -45,7 +28,9 @@ Notification.prototype.setParameter = function (name, value) {
*
* @param contents
*/
// TODO Deprecate
Notification.prototype.setContent = function (contents) {
console.warn("[onesignal-node] setContent function will be removed in next release, please check documentation.");
this.postBody.contents = contents;
};
......@@ -53,32 +38,40 @@ Notification.prototype.setContent = function (contents) {
*
* @param included_segments The segment names you want to target
*/
// TODO Deprecate
Notification.prototype.setIncludedSegments = function (included_segments) {
this.postBody.included_segments = included_segments;
console.warn("[onesignal-node] setIncludedSegments function will be removed in next release, please check documentation.");
this.postBody.included_segments = included_segments;
};
/**
*
* @param excluded_segments Segment that will be excluded when sending
*/
// TODO Deprecate
Notification.prototype.setExcludedSegments = function (excluded_segments) {
this.postBody.excluded_segments = excluded_segments;
console.warn("[onesignal-node] setExcludedSegments function will be removed in next release, please check documentation.");
this.postBody.excluded_segments = excluded_segments;
};
/**
*
* @param filters
*/
// TODO Deprecate
Notification.prototype.setFilters = function (filters) {
this.postBody.filters = filters;
console.warn("[onesignal-node] setFilters function will be removed in next release, please check documentation.");
this.postBody.filters = filters;
};
/**
*
* @param include_player_ids Specific players to send your notification to
*/
// TODO Deprecate
Notification.prototype.setTargetDevices = function (include_player_ids) {
this.postBody.include_player_ids = include_player_ids;
console.warn("[onesignal-node] setTargetDevices function will be removed in next release, please check documentation.");
this.postBody.include_player_ids = include_player_ids;
};
module.exports = Notification;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment