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.

325 lines
7.6 KiB
YAML

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