159 lines
3.3 KiB
YAML
159 lines
3.3 KiB
YAML
openapi: 3.0.0
|
|
info:
|
|
title: ClydeAPI
|
|
description: Clyde's api
|
|
version: 0.0.1
|
|
|
|
servers:
|
|
- url: https://clyde.herisson.ovh/api
|
|
description: default api point for clyde's service
|
|
|
|
paths:
|
|
/ping:
|
|
get:
|
|
summary: Test if the api is up.
|
|
responses:
|
|
default:
|
|
description: Standard response to ping
|
|
content:
|
|
text/plain:
|
|
schema:
|
|
type: string
|
|
example: pong
|
|
/user:
|
|
put:
|
|
summary: create a new user
|
|
tags:
|
|
- users
|
|
security:
|
|
- bearer: []
|
|
responses:
|
|
'200':
|
|
description: User created
|
|
'401':
|
|
$ref: '#/components/responses/UnauthorizedError'
|
|
/user/{mat}:
|
|
get:
|
|
summary: get user's info
|
|
tags:
|
|
- users
|
|
responses:
|
|
'200':
|
|
description: User found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/User"
|
|
parameters:
|
|
- name: mat
|
|
in: path
|
|
description: Matricule of the user (unique id)
|
|
required: true
|
|
schema:
|
|
type: integer
|
|
|
|
/cursus/{id}:
|
|
get:
|
|
summary: Voir les informations sur un Cursus
|
|
tags:
|
|
- Courses
|
|
responses:
|
|
'200':
|
|
description: Cursus found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/Cursus'
|
|
/courses/{id}:
|
|
get:
|
|
summary: Voir les informations sur un cours*
|
|
tags:
|
|
- Courses
|
|
responses:
|
|
|
|
put:
|
|
summary: Créer un nouveau cours
|
|
tags:
|
|
- Courses
|
|
security:
|
|
- bearer: []
|
|
responses:
|
|
|
|
delete:
|
|
summary: Suprimer un cours
|
|
tags:
|
|
- Courses
|
|
security:
|
|
- bearer: []
|
|
responses:
|
|
|
|
|
|
components:
|
|
securitySchemes:
|
|
bearer:
|
|
type: http
|
|
scheme: bearer
|
|
schemas:
|
|
User:
|
|
type: object
|
|
properties:
|
|
RegNo:
|
|
type: integer
|
|
Photo:
|
|
type: object
|
|
LastName:
|
|
type: string
|
|
FirstName:
|
|
type: string
|
|
Email:
|
|
type: string
|
|
Address:
|
|
$ref: "#/components/schemas/Address"
|
|
BirthDate:
|
|
type: string
|
|
description: Follow the iso 8601 ("YYYY-MM-DD")
|
|
StaffMember:
|
|
type: boolean
|
|
example:
|
|
{
|
|
"RegNo": 42,
|
|
"LastName": "Doe" ,
|
|
"FirstName": "John",
|
|
"Email": "John.Doe@example.com",
|
|
"Address": {
|
|
"Address": "Rue de Tounais 42",
|
|
"Country": "BE"},
|
|
"BirthDate": "1941-02-22",
|
|
"StaffMember": true
|
|
}
|
|
Address:
|
|
type: object
|
|
properties:
|
|
Address:
|
|
type: string
|
|
Country:
|
|
type: string
|
|
description: Follow the ISO-3166-1 alpha-2 standard.
|
|
example:
|
|
{
|
|
"Address": "Rue de Tounais 42",
|
|
"Country": "BE"
|
|
}
|
|
Cursus:
|
|
type: object
|
|
properties:
|
|
Id:
|
|
type: integer
|
|
Courses:
|
|
type: array
|
|
items:
|
|
type: string
|
|
example:
|
|
{
|
|
"id": 42,
|
|
"courses": ['Math', 'Info']
|
|
}
|
|
responses:
|
|
UnauthorizedError:
|
|
description: Access token is missing or invalid
|