VILLASweb-backend-go/doc/api/api.yaml
2019-04-15 13:35:56 +02:00

445 lines
10 KiB
YAML

openapi: 3.0.1
info:
title: VILLASweb API
description: API for VILLASweb. Documentation in progress... please be patient
version: 1.0.0
servers:
- url: http://111.222.333.444:5555/api/v1
tags:
- name: simulations
description: Manage Simulations
- name: counts
description: Get counters for database elements
- name: files
description: Manage Files
paths:
/simulations:
get:
tags:
- simulations
summary: Get all available simulations
description: Return a JSON representation of all simulations
operationId: getSimulations
responses:
400:
description: Unable to receive simulations
content: {}
post:
tags:
- simulations
summary: Add a new simulation to the database
operationId: addSimulation
requestBody:
description: "Simulation object to add to DB"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Simulation'
responses:
400:
description: Unable to find user or unable to create simulation
content: {}
500:
description: Unable to save user
content: {}
/simulations/{SimulationID}:
put:
tags:
- simulations
summary: Update properties of simulation with ID SimulationID
operationId: updateSimulationProperties
parameters:
- in: path
name: SimulationID
description: ID of a simulation
required: true
schema:
type: integer
requestBody:
description: "Simulation object with new properties"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Simulation'
responses:
500:
description: Unable to find user or unable to save user or
content: {}
400:
description: PUT Simulation Unknown for ID or unable to save simulation
content: {}
get:
tags:
- simulations
summary: Get properties of simulation with ID SimulationID
operationId: getSimulationProperties
parameters:
- in: path
name: SimulationID
description: ID of a simulation
required: true
schema:
type: integer
responses:
200:
description: TODO RESPONSES!
content: {}
delete:
tags:
- simulations
summary: Delete simulation with ID SimulationID
operationId: deleteSimulationProperties
parameters:
- in: path
name: SimulationID
description: ID of a simulation
required: true
schema:
type: integer
responses:
200:
description: TODO RESPONSES!
content: {}
/counts:
get:
tags:
- counts
summary: Get counters for all elements in the database
operationId: getCounts
responses:
200:
description: Counts successful (TODO CHECK IF CODE CORRECT!)
content:
application/json:
schema:
type: object
properties:
simulations:
type: integer
description: number of simulations
users:
type: integer
description: number of users
simulators:
type: integer
description: number of simulators
projects:
type: integer
description: number of projects
visualizations:
type: integer
description: number of visualizations
/files:
get:
tags:
- files
summary: Get files of user
operationId: getFilesOfUser
responses:
200:
description: Files obtained successfully (TODO CHECK CODE!)
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/File'
500:
description: Could not retrieve user's files
content: {}
/files/{FileID}:
get:
tags:
- files
summary: Get properties of file with ID FileID
operationId: getFileProperties
parameters:
- in: path
name: FileID
description: ID of a file
required: true
schema:
type: integer
responses:
200:
description: TODO RESPONSES!
content: {}
400:
description: GET Unknown file for ID
content: {}
delete:
tags:
- files
summary: Delete file with ID FileID
operationId: deleteFileProperties
parameters:
- in: path
name: FileID
description: ID of a file
required: true
schema:
type: integer
responses:
200:
description: TODO RESPONSES!
content: {}
400:
description: DELETE unknown file for id
content: {}
500:
description: Unable to remove file
content: {}
components:
schemas:
Project:
required:
- Name
- SimulationID
- UserID
type: object
properties:
Name:
type: string
UserID:
type: integer
User:
$ref: '#/components/schemas/User'
SimulationID:
type: integer
Simulation:
$ref: '#/components/schemas/Simulation'
Visualizations:
type: array
items:
$ref: '#/components/schemas/Visualization'
Visualization:
required:
- Name
- Grid
- ProjectID
- UserID
type: object
properties:
Name:
type: string
Grid:
type: integer
UserID:
type: integer
User:
$ref: '#/components/schemas/User'
ProjectID:
type: integer
Project:
$ref: '#/components/schemas/Project'
Widgets:
type: array
items:
$ref: '#/components/schemas/Widget'
User:
required:
- Username
- Password
- Role
- Mail
type: object
properties:
Username:
type: string
Password:
type: string
Role:
type: string
Mail:
type: string
Projects:
type: array
items:
$ref: '#/components/schemas/Project'
Simulations:
type: array
items:
$ref: '#/components/schemas/Simulation'
Files:
type: array
items:
$ref: '#/components/schemas/File'
Simulation:
required:
- Name
- UserID
type: object
properties:
Name:
type: string
Running:
type: boolean
Models:
type: array
items:
$ref: '#/components/schemas/SimulationModel'
Projects:
type: array
items:
$ref: '#/components/schemas/Project'
UserID:
type: integer
User:
$ref: '#/components/schemas/User'
StartParameters:
type: object
properties: {}
File:
required:
- Name
- Path
- Type
- Size
- Date
- UserID
type: object
properties:
Name:
type: string
Path:
type: string
Type:
type: string
Size:
type: integer
ImageHeight:
type: integer
ImageWidth:
type: integer
UserID:
type: integer
User:
$ref: '#/components/schemas/User'
Date:
type: string
Simulator:
required:
- UUID
- Host
- ModelType
type: object
properties:
UUID:
type: string
Host:
type: string
ModelType:
type: string
UpTime:
type: integer
State:
type: string
StateUpdateAt:
type: string
Properties:
type: object
properties: {}
RawProperties:
type: object
properties: {}
SimulationModel:
required:
- Name
- OutputLength
- InputLength
- BelongsToSimulationID
- BelongsToSimulatorID
type: object
properties:
Name:
type: string
OutputLength:
type: integer
InputLength:
type: integer
BelongsToSimulationID:
type: integer
BelongsToSimulation:
$ref: '#/components/schemas/Simulation'
BelongsToSimulatorID:
type: integer
BelongsToSimulator:
$ref: '#/components/schemas/Simulator'
StartParameters:
type: object
properties: {}
OutputMapping:
type: array
items:
$ref: '#/components/schemas/Signal'
InputMapping:
type: array
items:
$ref: '#/components/schemas/Signal'
Signal:
required:
- Name
- Unit
- SimulationModelID
type: object
properties:
Name:
type: string
Unit:
type: string
SimulationModelID:
type: integer
Widget:
required:
- Name
- Type
- Width
- Height
- MinWidth
- MinHeight
- X
- Y
- Z
- IsLocked
- VisualizationID
type: object
properties:
Name:
type: string
Type:
type: string
Width:
type: integer
Height:
type: integer
MinWidth:
type: integer
MinHeight:
type: integer
X:
type: integer
Y:
type: integer
Z:
type: integer
IsLocked:
type: boolean
VisualizationID:
type: integer
CustomProperties:
type: object
properties: {}