You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

498 lines
16 KiB
JSON

{
"swagger": "2.0",
"info": {
"contact": {}
},
"basePath": "/api/v1",
"paths": {
"/humidity/add_humidity": {
"post": {
"description": "Add a humidity",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Humidity"
],
"summary": "Add a humidity",
"parameters": [
{
"description": "The humidity to create",
"name": "humidity",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.AddHumidity"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/models.Humidity"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/humidity/humidities": {
"get": {
"description": "Lists all the humidities in DTM for every room",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Humidity"
],
"summary": "Get all humidities in DTM",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Humidity"
}
}
}
}
}
},
"/rooms/add_room": {
"post": {
"description": "Create a room",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Rooms"
],
"summary": "Create a room",
"parameters": [
{
"description": "The room to create",
"name": "room",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.AddRoom"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/models.AddRoom"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/rooms/delete_room/{room_id}": {
"delete": {
"description": "Delete a room",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Rooms"
],
"summary": "Delete a room",
"parameters": [
{
"type": "string",
"description": "The ID of the room to be deleted",
"name": "room_id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/rooms/delete_room_by_name/{name}": {
"delete": {
"description": "Delete a room using it name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Rooms"
],
"summary": "Delete a room using its name",
"parameters": [
{
"type": "string",
"description": "The name of the room to be deleted",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/rooms/get_room_by_name/{name}": {
"get": {
"description": "Get a room by its name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Rooms"
],
"summary": "Get a room by its name",
"parameters": [
{
"type": "string",
"description": "The room to get based on its name",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Room"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/rooms/get_room_id_by_name/{name}": {
"get": {
"description": "Get the ID for a room based on its name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Rooms"
],
"summary": "Get the ID for a room based on its name",
"parameters": [
{
"type": "string",
"description": "The name of the room to get the ID for",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "integer"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/rooms/rooms": {
"get": {
"description": "Lists all the rooms added to DTM",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Rooms"
],
"summary": "Get all the rooms added to DTM",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Room"
}
}
}
}
}
},
"/temperatures/add_temperature": {
"post": {
"description": "Add a temperature",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Temperatures"
],
"summary": "Add a temperature",
"parameters": [
{
"description": "The temperature to create",
"name": "temperature",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.AddTemperature"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/models.AddTemperature"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/models.Error"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/models.Error"
}
}
}
}
},
"/temperatures/temperatures": {
"get": {
"description": "Lists all the temperatures in DTM for every room",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Temperatures"
],
"summary": "Get all temperatures in DTM",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Temperature"
}
}
}
}
}
}
},
"definitions": {
"models.AddHumidity": {
"type": "object",
"properties": {
"humidity": {
"type": "number"
},
"room_name": {
"type": "string"
}
}
},
"models.AddRoom": {
"type": "object",
"properties": {
"Name": {
"type": "string"
}
}
},
"models.AddTemperature": {
"type": "object",
"properties": {
"room_name": {
"type": "string"
},
"temperature": {
"type": "number"
}
}
},
"models.Error": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"models.Humidity": {
"type": "object",
"properties": {
"humidity": {
"type": "number"
},
"room_id": {
"type": "integer"
},
"time": {
"type": "string"
}
}
},
"models.Room": {
"type": "object",
"properties": {
"humidity": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Humidity"
}
},
"name": {
"type": "string"
},
"temperature": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Temperature"
}
}
}
},
"models.Temperature": {
"type": "object",
"properties": {
"room_id": {
"type": "integer"
},
"temperature": {
"type": "number"
},
"time": {
"type": "string"
}
}
}
}
}