567 lines
15 KiB
YAML
567 lines
15 KiB
YAML
info:
|
|
title: Gamification Swagger - OpenAPI 3.0
|
|
description: NextGen Cities Institute Gamification API
|
|
termsOfService: http://swagger.io/terms/
|
|
contact:
|
|
email: peteryefi@gmail.com
|
|
version: 1.4
|
|
externalDocs:
|
|
description: Find out more about Swagger
|
|
url: http://swagger.io
|
|
paths:
|
|
/v1.4/city:
|
|
post:
|
|
tags:
|
|
- city
|
|
summary: Create a city
|
|
operationId: createCity
|
|
description: Create a new city with a file upoload
|
|
parameters:
|
|
- in: header
|
|
name: appId
|
|
schema:
|
|
type: string
|
|
required: true
|
|
description: the Id of the application access this API
|
|
requestBody:
|
|
content:
|
|
multipart/form-data:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
city_file:
|
|
type: string
|
|
format: binary
|
|
required: true
|
|
responses:
|
|
'201':
|
|
description: City created successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/City'
|
|
'200':
|
|
description: City not created
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'400':
|
|
description: Bad Request
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'404':
|
|
description: City not found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'403':
|
|
description: Forbidden
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'401':
|
|
description: Unauthorized
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'500':
|
|
description: Internal server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
security:
|
|
- BearerAuth: []
|
|
/v1.4/heat-pump/{city_id}:
|
|
post:
|
|
tags:
|
|
- heatpump
|
|
summary: Create a heat pump simulation
|
|
operationId: createHeatpump
|
|
description: heatpump simulation with existing catalog data
|
|
parameters:
|
|
- in: header
|
|
name: appId
|
|
schema:
|
|
type: string
|
|
required: true
|
|
description: the Id of the application access this API
|
|
- in: path
|
|
name: city_id
|
|
schema:
|
|
type: integer
|
|
required: true
|
|
description: Numeric ID of the city to get
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
$ref: '#/components/schemas/HeatPump'
|
|
required: true
|
|
responses:
|
|
'201':
|
|
description: Heatpump simulation created successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/HeatPumpRes'
|
|
'400':
|
|
description: Bad Request
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'404':
|
|
description: Not found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'403':
|
|
description: Forbidden
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'401':
|
|
description: Unauthorized
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'500':
|
|
description: Internal server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
security:
|
|
- BearerAuth: [ ]
|
|
/v1.4/city/{city_id}:
|
|
get:
|
|
tags:
|
|
- city
|
|
summary: Get a city
|
|
operationId: getCity
|
|
description: Retrieve a city with a given city ID
|
|
parameters:
|
|
- in: header
|
|
name: appId
|
|
schema:
|
|
type: string
|
|
required: true
|
|
description: the ID of the application access this API
|
|
- in: path
|
|
name: city_id
|
|
schema:
|
|
type: integer
|
|
required: true
|
|
description: Numeric ID of the city to get
|
|
responses:
|
|
'200':
|
|
description: City created successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/City'
|
|
'400':
|
|
description: Bad Request
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'404':
|
|
description: City not found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'403':
|
|
description: Forbidden
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'401':
|
|
description: Unauthorized
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'500':
|
|
description: Internal server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
security:
|
|
- BearerAuth: [ ]
|
|
/v1.4/user:
|
|
post:
|
|
tags:
|
|
- user
|
|
summary: Create user
|
|
description: This can only be done by the logged in admin.
|
|
operationId: createUser
|
|
parameters:
|
|
- in: header
|
|
name: appId
|
|
schema:
|
|
type: string
|
|
required: true
|
|
description: the Id of the application access this API
|
|
requestBody:
|
|
description: Created user object
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
application/xml:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
responses:
|
|
'201':
|
|
description: User created successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
'400':
|
|
description: Bad Request
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'403':
|
|
description: Forbidden
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'401':
|
|
description: Unauthorized
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'500':
|
|
description: Internal server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
security:
|
|
- BearerAuth: [ ]
|
|
put:
|
|
tags:
|
|
- user
|
|
summary: Update user
|
|
description: This can only be done by the logged in admin.
|
|
operationId: updateUser
|
|
requestBody:
|
|
description: Update user object
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
application/xml:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
responses:
|
|
'201':
|
|
description: User updated successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
'400':
|
|
description: Bad Request
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'403':
|
|
description: Forbidden
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'401':
|
|
description: Unauthorized
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
'500':
|
|
description: Internal server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
security:
|
|
- BearerAuth: [ ]
|
|
/v1.4/user/login:
|
|
post:
|
|
tags:
|
|
- user
|
|
summary: Logs user into the system
|
|
description: ''
|
|
operationId: loginUser
|
|
parameters:
|
|
- in: header
|
|
name: appId
|
|
schema:
|
|
type: string
|
|
required: true
|
|
description: the Id of the application access this API
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/Login'
|
|
required: true
|
|
responses:
|
|
'200':
|
|
description: Login successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/LoginRes'
|
|
'400':
|
|
description: Invalid username/password supplied
|
|
'500':
|
|
description: Internal server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ApiResponse'
|
|
components:
|
|
schemas:
|
|
City:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: integer
|
|
format: int64
|
|
example: 10
|
|
name:
|
|
type: string
|
|
example: Montreal
|
|
srs_name:
|
|
type: string
|
|
example: EPSG:26918
|
|
country:
|
|
type: string
|
|
example: ca
|
|
lon:
|
|
type: float
|
|
example: 0.38292983
|
|
lat:
|
|
type: float
|
|
example: 0.92898883
|
|
time_zone:
|
|
type: string
|
|
example: utc
|
|
city_version:
|
|
type: integer
|
|
format: int64
|
|
example: 1
|
|
lower_corner:
|
|
type: array
|
|
items:
|
|
type: float
|
|
example: [610610.7547462888,5035770.347264212,566.5784301757819]
|
|
upper_corner:
|
|
type: array
|
|
items:
|
|
type: float
|
|
example: [610610.7547462888,5035770.347264212,566.5784301757819]
|
|
user:
|
|
type: object
|
|
$ref: '#/components/schemas/User'
|
|
created:
|
|
type: string
|
|
example: 2023-01-15 18:40:54.64877
|
|
updated:
|
|
type: string
|
|
example: 2023-01-15 18:40:54.64877
|
|
HeatPump:
|
|
type: object
|
|
properties:
|
|
StartYear:
|
|
type: integer
|
|
format: int64
|
|
example: 10
|
|
EndYear:
|
|
type: integer
|
|
format: int64
|
|
example: 10
|
|
MaximumHPEnergyInput:
|
|
type: float
|
|
example: 9.8382
|
|
HoursOfStorageAtMaxDemand:
|
|
type: integer
|
|
format: int64
|
|
example: 9
|
|
BuildingSuppTemp:
|
|
type: integer
|
|
format: int64
|
|
example: 40
|
|
TemperatureDifference:
|
|
type: float
|
|
example: 9.8382
|
|
FuelLHV:
|
|
type: float
|
|
example: 9.8382
|
|
FuelPrice:
|
|
type: float
|
|
example: 9.8382
|
|
FuelEF:
|
|
type: integer
|
|
format: int64
|
|
example: 40
|
|
FuelDensity:
|
|
type: float
|
|
example: 9.8382
|
|
HPSupTemp:
|
|
type: float
|
|
example: 9.8382
|
|
HeatPumpType:
|
|
type: string
|
|
example: Water to Water HP
|
|
enum:
|
|
- Water to Water HP
|
|
- Air Source HP
|
|
HeatPumpModel:
|
|
type: string
|
|
example: Water to Water HP
|
|
enum:
|
|
- ClimateMaster 156 kW
|
|
- ClimateMaster 256 kW
|
|
- ClimateMaster 335 kW
|
|
- 012
|
|
- 015
|
|
- 018
|
|
- 023
|
|
- 030
|
|
- 033
|
|
- 037
|
|
- 044
|
|
- 047
|
|
- 057
|
|
- 070
|
|
- 087
|
|
- 097
|
|
- 102
|
|
- 120
|
|
- 130
|
|
- 140
|
|
SimType:
|
|
type: int
|
|
example: 1
|
|
format: int64
|
|
EnergyDemand:
|
|
type: array
|
|
items:
|
|
type: float
|
|
example: [ 610.610, 754.746, 288.338 ]
|
|
User:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: integer
|
|
format: int64
|
|
example: 10
|
|
name:
|
|
type: string
|
|
example: Peter Yefi
|
|
email:
|
|
type: string
|
|
example: peteryefi@gmail.com
|
|
password:
|
|
type: string
|
|
example: 'Hub@183838'
|
|
role:
|
|
type: string
|
|
enum:
|
|
- Admin
|
|
- Hub_Reader
|
|
HeatPumpRes:
|
|
type: object
|
|
properties:
|
|
hourly_electricity_demand:
|
|
type: array
|
|
items:
|
|
type: object
|
|
daily_electricity_demand:
|
|
type: array
|
|
items:
|
|
type: object
|
|
monthly_electricity_demand:
|
|
type: array
|
|
items:
|
|
type: object
|
|
daily_fossil_consumption:
|
|
type: array
|
|
items:
|
|
type: object
|
|
monthly_fossil_consumption:
|
|
type: array
|
|
items:
|
|
type: object
|
|
Login:
|
|
type: object
|
|
properties:
|
|
email:
|
|
type: string
|
|
example: peteryefi@gmail.com
|
|
password:
|
|
type: string
|
|
example: 'Hub@183838'
|
|
LoginRes:
|
|
type: object
|
|
properties:
|
|
token:
|
|
type: string
|
|
example: eylskdkdjfkdj67uhbnmkhbn908uyhndh
|
|
user:
|
|
type: object
|
|
$ref: '#/components/schemas/User'
|
|
ApiResponse:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
format: int32
|
|
message:
|
|
type: string
|
|
requestBodies:
|
|
User:
|
|
description: Pet object that needs to be added to the store
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
application/xml:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
CityArray:
|
|
description: List of city object
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/City'
|
|
securitySchemes:
|
|
BearerAuth:
|
|
type: http
|
|
scheme: bearer
|
|
bearerFormat: JWT |