From 9519b653a8cef055366b0903fdd371c8f86d1206 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 19 Sep 2017 10:42:07 +0500 Subject: Implement per device Notifications --- swagger.json | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 97 insertions(+), 13 deletions(-) (limited to 'swagger.json') diff --git a/swagger.json b/swagger.json index 762ef3525..5f9abb9b8 100644 --- a/swagger.json +++ b/swagger.json @@ -627,19 +627,25 @@ } } }, - "/users/notifications": { + "/notifications": { "get": { - "summary": "Fetch a list of Notification types", - "description": "Without params, it returns a list of the user's enabled Notifications", + "summary": "Fetch a list of Notifications", + "description": "Without params, it returns a list of Notifications the user has access to", "parameters": [ { - "name": "all", - "in": "query", - "description": "To fetch a list of all available Notifications", - "type": "boolean" + "$ref": "#/parameters/all" }, { "$ref": "#/parameters/userId" + }, + { + "$ref": "#/parameters/deviceId" + }, + { + "$ref": "#/parameters/groupId" + }, + { + "$ref": "#/parameters/refresh" } ], "responses": { @@ -655,16 +661,32 @@ } }, "post": { - "summary": "Set or unset a Notification", + "summary": "Create a Notification", "parameters": [ { - "name": "body", - "in": "body", - "required": true, + "$ref": "#/parameters/Notification" + } + ], + "responses": { + "200": { + "description": "OK", "schema": { "$ref": "#/definitions/Notification" } } + } + } + }, + "/notifications/{id}": { + "put": { + "summary": "Update a Notification", + "parameters": [ + { + "$ref": "#/parameters/entityId" + }, + { + "$ref": "#/parameters/Notification" + } ], "responses": { "200": { @@ -674,6 +696,50 @@ } } } + }, + "delete": { + "summary": "Delete a Notification", + "parameters": [ + { + "$ref": "#/parameters/entityId" + } + ], + "responses": { + "204": { + "description": "No Content" + } + } + } + }, + "/notifications/types": { + "get": { + "summary": "Fetch a list of available Notification types", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/NotificationType" + } + } + } + } + } + }, + "/notifications/test": { + "post": { + "summary": "Send test notification to current user via Email and SMS", + "parameters": [], + "responses": { + "204": { + "description": "Successful sending" + }, + "400": { + "description": "Could happen if sending has failed" + } + } } }, "/commandtypes": { @@ -1604,8 +1670,8 @@ "type": { "type": "string" }, - "userId": { - "type": "integer" + "always": { + "type": "boolean" }, "web": { "type": "boolean" @@ -1613,9 +1679,19 @@ "mail": { "type": "boolean" }, + "sms": { + "type": "boolean" + }, "attributes": {} } }, + "NotificationType": { + "properties": { + "type": { + "type": "string" + } + } + }, "Event": { "properties": { "id": { @@ -1966,6 +2042,14 @@ "$ref": "#/definitions/Command" } }, + "Notification": { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Notification" + } + }, "deviceIdArray": { "name": "deviceId", "in": "query", -- cgit v1.2.3