Commit eabedd78 authored by zeynel's avatar zeynel

Deprecate unused methods

parent 93f5fdbd
...@@ -10,22 +10,7 @@ var Notification = function (initialBody) { ...@@ -10,22 +10,7 @@ var Notification = function (initialBody) {
throw 'Body must be a JSON object'; throw 'Body must be a JSON object';
} }
this.postBody = {}; this.postBody = JSON.parse(JSON.stringify(initialBody));
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'
}; };
/** /**
...@@ -33,11 +18,9 @@ var Notification = function (initialBody) { ...@@ -33,11 +18,9 @@ var Notification = function (initialBody) {
* @param name { String } * @param name { String }
* @param value * @param value
*/ */
// TODO Deprecate
Notification.prototype.setParameter = function (name, value) { Notification.prototype.setParameter = function (name, value) {
// TODO Deprecate console.warn("[onesignal-node] setParameter function will be removed in next release, please check documentation.");
if (name && name[0] === '!') {
name = name.substring(1);
}
this.postBody[name] = value; this.postBody[name] = value;
}; };
...@@ -45,7 +28,9 @@ Notification.prototype.setParameter = function (name, value) { ...@@ -45,7 +28,9 @@ Notification.prototype.setParameter = function (name, value) {
* *
* @param contents * @param contents
*/ */
// TODO Deprecate
Notification.prototype.setContent = function (contents) { Notification.prototype.setContent = function (contents) {
console.warn("[onesignal-node] setContent function will be removed in next release, please check documentation.");
this.postBody.contents = contents; this.postBody.contents = contents;
}; };
...@@ -53,32 +38,40 @@ Notification.prototype.setContent = function (contents) { ...@@ -53,32 +38,40 @@ Notification.prototype.setContent = function (contents) {
* *
* @param included_segments The segment names you want to target * @param included_segments The segment names you want to target
*/ */
// TODO Deprecate
Notification.prototype.setIncludedSegments = function (included_segments) { 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 * @param excluded_segments Segment that will be excluded when sending
*/ */
// TODO Deprecate
Notification.prototype.setExcludedSegments = function (excluded_segments) { 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 * @param filters
*/ */
// TODO Deprecate
Notification.prototype.setFilters = function (filters) { 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 * @param include_player_ids Specific players to send your notification to
*/ */
// TODO Deprecate
Notification.prototype.setTargetDevices = function (include_player_ids) { 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; 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