Commit b3e64ca9 by Galves, Miguel

Added new push optional parameters and the possibility to send a json payload…

Added new push optional parameters and the possibility to send a json payload instead of a simple string message
parent e7602e16
......@@ -24,14 +24,23 @@ class Push(ParseResource):
ENDPOINT_ROOT = '/'.join([API_ROOT, 'push'])
@classmethod
def send(cls, message, channels=None, **kw):
alert_message = {'alert': message}
def send(cls, message, channels=None, type=None, push_time=None, expiration_interval=None, **kw):
if type(message) == dict:
data = message
else:
data = {'alert': message}
targets = {}
if push_time:
targets["push_time"] = push_time
if expiration_interval:
targets["expiration_interval"] = expiration_interval
if type:
targets["type"] = type
if channels:
targets['channels'] = channels
if kw:
targets['where'] = kw
return cls.POST('', data=alert_message, **targets)
return cls.POST('', data=data, **targets)
Installation.Query = QueryManager(Installation)
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