{ "consumes": [ "application/json" ], "produces": [ "application/json" ], "schemes": [ "https" ], "swagger": "2.0", "info": { "title": "JNX Robot Control Manager API Documentation.", "version": "1.0.0" }, "host": "jannex", "basePath": "/v1", "paths": { "/api/v1/robots": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "robots" ], "summary": "Get all robots", "operationId": "getRobots", "parameters": [ { "description": "Page number", "name": "page", "in": "query" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/RobotsResponse" } } } } }, "/api/v1/urobots": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "robots" ], "summary": "Get all unauthorized robots", "operationId": "getUnauthorizedRobots", "parameters": [ { "description": "Page number", "name": "page", "in": "query" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/UnauthorizedRobotsResponse" } } } } }, "/control/1": { "post": { "description": "This is used to control Rex.\n", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "control" ], "summary": "Control Rex.", "operationId": "controlRex", "parameters": [ { "description": "Control Rex body.", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ControlBody" } } ], "responses": { "200": { "description": "Control Rex" }, "400": { "description": "Invalid request body" }, "422": { "description": "Robot not found" } } } }, "/control/1/finish": { "post": { "description": "This is used to finish control Rex.\n", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "control" ], "summary": "Finish control Rex.", "operationId": "finishControlRex", "responses": { "200": { "description": "Finish control Rex" }, "400": { "description": "Invalid robot name" }, "422": { "description": "Robot not found" } } } }, "/permitjoin/{enabled}": { "post": { "description": "This is used to enable or disable permit join.\n", "tags": [ "permitjoin" ], "summary": "Set permit join.", "operationId": "setPermitJoin", "parameters": [ { "description": "Enable or disable permit join. 0 = disable, 1 = enable.", "name": "enabled", "in": "path", "required": true, "schema": { "type": "integer", "enum": [ 0, 1 ] } } ], "responses": { "200": { "description": "Permit join set" }, "400": { "description": "Invalid request body" } } } }, "/robot": { "post": { "description": "This is the first request from the robot. It will be used to identify the robot.\n", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "robot" ], "summary": "First request from robot.", "operationId": "robotFirstRequest", "parameters": [ { "description": "First request body.", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/FirstRequestBody" } } ], "responses": { "200": { "description": "Robot identified", "schema": { "$ref": "#/definitions/StatusResponse" } }, "400": { "description": "Invalid request body" }, "403": { "description": "Permit join is enabled" } } } }, "/robot/authorize/{robotId}": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "robot" ], "summary": "Authorize robot.", "operationId": "robotAuthorize", "parameters": [ { "description": "Robot id.", "name": "robotId", "in": "params", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Robot authorized" }, "400": { "description": "Invalid robot id" }, "422": { "description": "Robot not found" } } } }, "/robot/deny/{robotId}": { "delete": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "robot" ], "summary": "Deny unauthorized robot.", "operationId": "robotDenyUnauthorizedRobot", "parameters": [ { "description": "Robot id.", "name": "robotId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Robot denied" }, "400": { "description": "Invalid robot id" } } } }, "/robot/{robotId}": { "delete": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "robot" ], "summary": "Delete robot.", "operationId": "robotDelete", "parameters": [ { "description": "Robot id.", "name": "robotId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Robot deleted" }, "400": { "description": "Invalid robot id" } } } } }, "definitions": { "ControlBody": { "type": "object", "properties": { "JobId": { "type": "string" }, "JobName": { "type": "string" }, "RobotName": { "type": "string" }, "Task": { "$ref": "#/definitions/ControlTask" } }, "x-go-package": "jannex/robot-control-manager/modules/structs" }, "ControlTask": { "type": "object", "properties": { "ConnectedModule": { "type": "integer", "format": "int64" }, "X": { "type": "integer", "format": "int64" }, "Y": { "type": "integer", "format": "int64" }, "Z": { "type": "integer", "format": "int64" } }, "x-go-package": "jannex/robot-control-manager/modules/structs" }, "FirstRequestBody": { "type": "object", "properties": { "FirmwareVersion": { "description": "used firmware version of the robot", "type": "string" }, "Id": { "description": "robot id", "type": "string" }, "Type": { "description": "robot type", "type": "integer", "format": "uint8" } }, "x-go-package": "jannex/robot-control-manager/modules/structs" }, "Mutex": { "description": "A Mutex must not be copied after first use.\n\nIn the terminology of the Go memory model,\nthe n'th call to Unlock “synchronizes before” the m'th call to Lock\nfor any n \u003c m.\nA successful call to TryLock is equivalent to a call to Lock.\nA failed call to TryLock does not establish any “synchronizes before”\nrelation at all.", "type": "object", "title": "A Mutex is a mutual exclusion lock.\nThe zero value for a Mutex is an unlocked mutex.", "x-go-package": "sync" }, "Robot": { "type": "object", "properties": { "Address": { "type": "string" }, "ConnectedAt": { "type": "string", "format": "date-time" }, "CreatedAt": { "type": "string", "format": "date-time" }, "CurrentJobId": { "type": "string" }, "CurrentJobName": { "type": "string" }, "Id": { "type": "string" }, "JobMutex": { "$ref": "#/definitions/Mutex" }, "JobsWaitingCount": { "type": "integer", "format": "int64" }, "JobsWaitingNameList": { "type": "array", "items": { "type": "string" } }, "LastTaskAt": { "type": "string", "format": "date-time" }, "Name": { "type": "string" }, "PingRetries": { "type": "integer", "format": "uint8" }, "Status": { "type": "integer", "format": "uint8" }, "Type": { "type": "integer", "format": "uint8" } }, "x-go-package": "jannex/robot-control-manager/modules/structs" }, "RobotsResponse": { "type": "object", "properties": { "Robots": { "type": "array", "items": { "$ref": "#/definitions/Robot" } }, "TotalPages": { "type": "integer", "format": "int64" } }, "x-go-package": "jannex/robot-control-manager/modules/structs" }, "StatusResponse": { "type": "object", "properties": { "Status": { "type": "string" } }, "x-go-package": "jannex/robot-control-manager/modules/structs" }, "UnauthorizedRobot": { "type": "object", "properties": { "Address": { "type": "string" }, "ConnectedAt": { "type": "string", "format": "date-time" }, "CreatedAt": { "type": "string", "format": "date-time" }, "Id": { "type": "string" }, "Type": { "type": "integer", "format": "uint8" } }, "x-go-package": "jannex/robot-control-manager/modules/structs" }, "UnauthorizedRobotsResponse": { "type": "object", "properties": { "TotalPages": { "type": "integer", "format": "int64" }, "UnauthorizedRobots": { "type": "array", "items": { "$ref": "#/definitions/UnauthorizedRobot" } } }, "x-go-package": "jannex/robot-control-manager/modules/structs" } } }