Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ParsePy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ParsePy
Commits
24237b46
Commit
24237b46
authored
Jan 30, 2015
by
David Robinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #86 from LetsOrder/master
Added Installation channel subscription modification
parents
4db8a436
4a6bb305
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
parse_rest/installation.py
+29
-0
No files found.
parse_rest/installation.py
View file @
24237b46
...
...
@@ -19,6 +19,35 @@ from parse_rest.query import QueryManager
class
Installation
(
ParseResource
):
ENDPOINT_ROOT
=
'/'
.
join
([
API_ROOT
,
'installations'
])
@classmethod
def
_get_installation_url
(
cls
,
installation_id
):
"""
Get the URL for RESTful operations on this particular installation
"""
return
'/'
.
join
([
cls
.
ENDPOINT_ROOT
,
installation_id
])
@classmethod
def
update_channels
(
cls
,
installation_id
,
channels_to_add
=
set
(),
channels_to_remove
=
set
(),
**
kw
):
"""
Allow an application to manually subscribe or unsubscribe an
installation to a certain push channel in a unified operation.
this is based on:
https://www.parse.com/docs/rest#installations-updating
installation_id: the installation id you'd like to add a channel to
channels_to_add: the name of the channel you'd like to subscribe the user to
channels_to_remove: the name of the channel you'd like to unsubscribe the user from
"""
installation_url
=
cls
.
_get_installation_url
(
installation_id
)
current_config
=
cls
.
GET
(
installation_url
)
new_channels
=
list
(
set
(
current_config
[
'channels'
])
.
union
(
channels_to_add
)
.
difference
(
channels_to_remove
))
cls
.
PUT
(
installation_url
,
channels
=
new_channels
)
class
Push
(
ParseResource
):
ENDPOINT_ROOT
=
'/'
.
join
([
API_ROOT
,
'push'
])
...
...
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