From c721d6ccdd37bd6833887c40a8d9aa857b0fc6b6 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 13 Sep 2017 16:17:56 +0500 Subject: Update swagger documentation to recent changes --- swagger.json | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 138 insertions(+), 15 deletions(-) diff --git a/swagger.json b/swagger.json index eba9e0910..762ef3525 100644 --- a/swagger.json +++ b/swagger.json @@ -22,8 +22,116 @@ ], "paths": { "/commands": { + "get": { + "summary": "Fetch a list of Saved Commands", + "description": "Without params, it returns a list of Drivers the user has access to", + "parameters": [ + { + "$ref": "#/parameters/all" + }, + { + "$ref": "#/parameters/userId" + }, + { + "$ref": "#/parameters/deviceId" + }, + { + "$ref": "#/parameters/groupId" + }, + { + "$ref": "#/parameters/refresh" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Command" + } + } + } + } + }, + "post": { + "summary": "Create a Saved Command", + "parameters": [ + { + "$ref": "#/parameters/Command" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Command" + } + } + } + } + }, + "/commands/{id}": { + "put": { + "summary": "Update a Saved Command", + "parameters": [ + { + "$ref": "#/parameters/entityId" + }, + { + "$ref": "#/parameters/Command" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Command" + } + } + } + }, + "delete": { + "summary": "Delete a Saved Command", + "parameters": [ + { + "$ref": "#/parameters/entityId" + } + ], + "responses": { + "204": { + "description": "No Content" + } + } + } + }, + "/commands/send": { + "get": { + "summary": "Fetch a list of Saved Commands supported by Device at the moment", + "description": "Return a list of saved commands linked to Device and its groups, filtered by current Device state and protocol support", + "parameters": [ + { + "$ref": "#/parameters/deviceId" + }, + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Command" + } + } + }, + "400": { + "description": "Could happen when the user doesn't have permission for the device" + } + } + }, "post": { "summary": "Dispatch commands to device", + "description": "Dispatch a new command or Saved Command if _body.id_ set", "parameters": [ { "name": "body", @@ -570,13 +678,17 @@ }, "/commandtypes": { "get": { - "summary": "Fetch a list of available Commands for the Device", + "summary": "Fetch a list of available Commands for the Device or all possible Commands if Device ommited", "parameters": [ { "name": "deviceId", "in": "query", - "required": true, "type": "integer" + }, + { + "name": "textChannel", + "in": "query", + "type": "boolean" } ], "responses": { @@ -590,7 +702,7 @@ } }, "400": { - "description": "Could happen when trying to fetch from an offline device or the user does not have permission" + "description": "Could happen when trying to fetch from a device the user does not have permission" } } } @@ -1249,12 +1361,6 @@ "map": { "type": "string" }, - "distanceUnit": { - "type": "string" - }, - "speedUnit": { - "type": "string" - }, "latitude": { "type": "number" }, @@ -1290,6 +1396,9 @@ "deviceReadonly": { "type": "boolean" }, + "limitCommands": { + "type": "boolean" + }, "token": { "type": "string" }, @@ -1307,6 +1416,12 @@ "readonly": { "type": "boolean" }, + "deviceReadonly": { + "type": "boolean" + }, + "limitCommands": { + "type": "boolean" + }, "map": { "type": "string" }, @@ -1316,12 +1431,6 @@ "mapUrl": { "type": "string" }, - "distanceUnit": { - "type": "string" - }, - "speedUnit": { - "type": "string" - }, "latitude": { "type": "number" }, @@ -1348,9 +1457,15 @@ }, "Command": { "properties": { + "id": { + "type": "integer" + }, "deviceId": { "type": "integer" }, + "description": { + "type": "string" + }, "type": { "type": "string" }, @@ -1843,6 +1958,14 @@ "$ref": "#/definitions/Driver" } }, + "Command": { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Command" + } + }, "deviceIdArray": { "name": "deviceId", "in": "query", -- cgit v1.2.3