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): ...@@ -24,14 +24,23 @@ class Push(ParseResource):
ENDPOINT_ROOT = '/'.join([API_ROOT, 'push']) ENDPOINT_ROOT = '/'.join([API_ROOT, 'push'])
@classmethod @classmethod
def send(cls, message, channels=None, **kw): def send(cls, message, channels=None, type=None, push_time=None, expiration_interval=None, **kw):
alert_message = {'alert': message} if type(message) == dict:
data = message
else:
data = {'alert': message}
targets = {} targets = {}
if push_time:
targets["push_time"] = push_time
if expiration_interval:
targets["expiration_interval"] = expiration_interval
if type:
targets["type"] = type
if channels: if channels:
targets['channels'] = channels targets['channels'] = channels
if kw: if kw:
targets['where'] = kw targets['where'] = kw
return cls.POST('', data=alert_message, **targets) return cls.POST('', data=data, **targets)
Installation.Query = QueryManager(Installation) 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