Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

'Set a reminder' API support #1207

Merged
merged 1 commit into from
Apr 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backend/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ func patchUserNotifySettings(w http.ResponseWriter, r *http.Request) {
if v, ok := body["notify"].(bool); ok {
data.Enabled = v
}
if v, ok := body["iostart"].(bool); ok {
data.IOStart = v
}
if sub, ok := body["subscriber"].(string); ok {
url, ok := body["endpoint"].(string)
if !ok || url == "" {
Expand Down
2 changes: 2 additions & 0 deletions backend/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ func TestStoreUserPushConfig(t *testing.T) {
"notify": true,
"subscriber": "sub-id",
"endpoint": "https://test",
"iostart": true,
"ioext": {
"name": "Amsterdam",
"lat": 52.37607,
Expand All @@ -712,6 +713,7 @@ func TestStoreUserPushConfig(t *testing.T) {
Enabled: true,
Subscribers: []string{"sub-id"},
Endpoints: []string{"https://test"},
IOStart: true,
Ext: ioExtPush{
Enabled: true,
Name: "Amsterdam",
Expand Down
1 change: 1 addition & 0 deletions backend/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type userPush struct {
userID string

Enabled bool `json:"notify" datastore:"on"`
IOStart bool `json:"iostart" datastore:"io"`
Subscribers []string `json:"subscribers,omitempty" datastore:"subs,noindex"`
Endpoints []string `json:"-" datastore:"urls,noindex"`

Expand Down
8 changes: 8 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Current notification state. Response body sample:
{
"notify": true,
"subscribers": ["123456789", "987654321"],
"iostart": true,
"ioext": {
"name": "Amsterdam",
"lat": 52.37607,
Expand All @@ -131,13 +132,20 @@ Current notification state. Response body sample:

* Toggle global notification state on/off: `notify`.
* Add to the subscriber IDs list of a user: `subscriber` and `endpoint`.
* Receive a notification about the start of I/O: `iostart`.
* Subscribe/unsubscribe from "I/O Extended events near me": `ioext`.

The start of I/O reminder is 1 day before the date.
Session reminders are 10 min before the start time.
Notifications about I/O Extended and any changes to the bookmarked sessions,
including added videos, are sent immediately.

```json
{
"notify": true,
"subscriber": "subscriber ID",
"endpoint": "https://push/notifications/endpoint",
"iostart": true,
"ioext": {
"name": "Amsterdam",
"lat": 52.37607,
Expand Down