Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
onesignal-node
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Schedules
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Cedar Studios
onesignal-node
Commits
eabedd78
Commit
eabedd78
authored
Jul 29, 2018
by
zeynel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate unused methods
parent
93f5fdbd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
24 deletions
+17
-24
notification.js
lib/notification.js
+17
-24
No files found.
lib/notification.js
View file @
eabedd78
...
@@ -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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment