1
0
forked from PGL/Clyde
Clyde/Documents/proto/general/openapi.yaml

453 lines
11 KiB
YAML
Raw Normal View History

2023-12-04 19:58:00 +01:00
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:
2023-12-07 23:27:23 +01:00
summary: Vérifie l'état de l'api.
2023-12-04 19:58:00 +01:00
responses:
default:
2023-12-07 23:27:23 +01:00
description: Retourne pong
2023-12-04 19:58:00 +01:00
content:
text/plain:
schema:
type: string
example: pong
2023-12-05 20:47:12 +01:00
/users:
get:
2023-12-07 23:27:23 +01:00
summary: Liste les utilisateurs
2023-12-05 20:47:12 +01:00
tags:
- SI
2023-12-04 19:58:00 +01:00
security:
- bearer: []
2023-12-07 23:27:23 +01:00
parameters:
- in: query
name: type
required: false
schema:
type: string
enum: [teacher, student, secretary]
2023-12-05 20:47:12 +01:00
responses:
2023-12-07 23:27:23 +01:00
'200':
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/User"
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-05 20:47:12 +01:00
2023-12-07 23:27:23 +01:00
/user:
get:
summary: Récupére ses informations
tags:
- Users
responses:
'200':
description: Ok
content:
application/json:
schema:
$ref: "#/components/schemas/User"
2023-12-05 20:47:12 +01:00
post:
summary: Créer un utilisateur
tags:
2023-12-07 23:27:23 +01:00
- Users
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
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")
example:
{
"LastName": "Doe" ,
"FirstName": "John",
"Email": "John.Doe@example.com",
"Address": {
"Address": "Rue de Tounais 42",
"Country": "BE"},
"BirthDate": "1941-02-22",
}
2023-12-04 19:58:00 +01:00
responses:
2023-12-07 23:27:23 +01:00
'201':
2023-12-04 19:58:00 +01:00
description: User created
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-05 20:47:12 +01:00
patch:
summary: modifier ses informations
tags:
2023-12-07 23:27:23 +01:00
- Users
2023-12-05 20:47:12 +01:00
security:
- bearer: []
2023-12-07 23:27:23 +01:00
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/User'
2023-12-05 20:47:12 +01:00
responses:
2023-12-07 23:27:23 +01:00
'201':
description: Informations modifiées
2023-12-05 20:47:12 +01:00
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-04 19:58:00 +01:00
/user/{mat}:
get:
2023-12-07 23:27:23 +01:00
summary: Récupérer les informations d'un utilisateur
2023-12-04 19:58:00 +01:00
tags:
2023-12-05 20:47:12 +01:00
- Admin
2023-12-04 19:58:00 +01:00
responses:
'200':
2023-12-07 23:27:23 +01:00
description: Utilisateur trouvé
2023-12-04 19:58:00 +01:00
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
2023-12-05 20:47:12 +01:00
patch:
summary: modifier les informations d'un utilisateur
tags:
- Admin
security:
- bearer: []
2023-12-07 23:27:23 +01:00
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/User'
2023-12-05 20:47:12 +01:00
responses:
2023-12-07 23:27:23 +01:00
'201':
description: Informations modifiées
2023-12-05 20:47:12 +01:00
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-04 19:58:00 +01:00
2023-12-07 23:27:23 +01:00
/course:
post:
summary: Créer un nouveau cours
2023-12-05 20:47:12 +01:00
tags:
2023-12-07 23:27:23 +01:00
- Courses
- Secretariat
security:
2023-12-05 20:47:12 +01:00
- bearer: []
2023-12-07 23:27:23 +01:00
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
courses:
type: array
items:
type: string
2023-12-05 20:47:12 +01:00
responses:
2023-12-07 23:27:23 +01:00
'201':
description: Nouveau cours crée
2023-12-05 20:47:12 +01:00
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-04 19:58:00 +01:00
/courses/{id}:
get:
2023-12-07 23:27:23 +01:00
summary: Voir les informations sur un cours
2023-12-04 19:58:00 +01:00
tags:
- Courses
responses:
2023-12-07 23:27:23 +01:00
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Course'
2023-12-05 20:47:12 +01:00
parameters:
- name: id
in: path
required: true
schema:
type: integer
delete:
summary: Suprimer un cours
tags:
- Courses
2023-12-07 23:27:23 +01:00
- Secretariat
2023-12-05 20:47:12 +01:00
security:
- bearer: []
responses:
2023-12-07 23:27:23 +01:00
'201':
description: Success
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-05 20:47:12 +01:00
patch:
summary: Changer les options du cours
2023-12-04 19:58:00 +01:00
tags:
2023-12-07 23:27:23 +01:00
- Secretariat
2023-12-04 19:58:00 +01:00
- Courses
2023-12-05 20:47:12 +01:00
security:
- bearer: []
2023-12-07 23:27:23 +01:00
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
credits:
type: integer
faculty:
type: string
teachers:
type: object
$ref: '#/components/schemas/User'
assistants:
type: array
items:
$ref: '#/components/schemas/User'
example:
{
"name": "Math pour l'info",
"credits": 11,
"faculty": "science",
"Teacher": ,
"Assistants": [ ]
}
2023-12-05 20:47:12 +01:00
responses:
2023-12-07 23:27:23 +01:00
'201':
description: Cours modifié
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-05 20:47:12 +01:00
/cursus:
post:
2023-12-07 23:27:23 +01:00
summary: Créer un nouveau cursus
2023-12-05 20:47:12 +01:00
tags:
- cursus
2023-12-04 19:58:00 +01:00
security:
- bearer: []
2023-12-07 23:27:23 +01:00
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
credits:
type: integer
faculty:
type: string
teachers:
type: object
$ref: '#/components/schemas/User'
assistants:
type: array
items:
$ref: '#/components/schemas/User'
example:
{
"name": "Math pour l'info",
"credits": 11,
"faculty": "science",
"Teacher": ,
"Assistants": [ ]
}
2023-12-04 19:58:00 +01:00
responses:
2023-12-07 23:27:23 +01:00
'201':
description: Nouveau cursus crée
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-05 20:47:12 +01:00
/cursus/{id}:
get:
summary: Voir les informations sur un cursus
tags:
- cursus
responses:
2023-12-07 23:27:23 +01:00
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Cursus'
2023-12-05 20:47:12 +01:00
parameters:
- name: id
in: path
required: true
schema:
type: integer
2023-12-04 19:58:00 +01:00
delete:
2023-12-05 20:47:12 +01:00
summary: Suprimer un cursus
tags:
- cursus
security:
- bearer: []
responses:
2023-12-07 23:27:23 +01:00
'201':
description: Success
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-05 20:47:12 +01:00
patch:
summary: Changer les options du cursus
tags:
- cursus
security:
- bearer: []
2023-12-07 23:27:23 +01:00
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
credits:
type: integer
faculty:
type: string
teachers:
type: object
$ref: '#/components/schemas/User'
assistants:
type: array
items:
$ref: '#/components/schemas/User'
example:
{
"name": "Math pour l'info",
"credits": 11,
"faculty": "science",
"Teacher": ,
"Assistants": [ ]
}
2023-12-05 20:47:12 +01:00
responses:
2023-12-07 23:27:23 +01:00
'201':
description: Cours modifié
'401':
$ref: '#/components/responses/UnauthorizedError'
2023-12-05 20:47:12 +01:00
2023-12-04 19:58:00 +01:00
components:
securitySchemes:
bearer:
type: http
scheme: bearer
schemas:
User:
type: object
properties:
2023-12-07 23:27:23 +01:00
regNo:
2023-12-04 19:58:00 +01:00
type: integer
2023-12-07 23:27:23 +01:00
photo:
2023-12-04 19:58:00 +01:00
type: object
2023-12-07 23:27:23 +01:00
lastName:
2023-12-04 19:58:00 +01:00
type: string
2023-12-07 23:27:23 +01:00
firstName:
2023-12-04 19:58:00 +01:00
type: string
2023-12-07 23:27:23 +01:00
email:
2023-12-04 19:58:00 +01:00
type: string
2023-12-07 23:27:23 +01:00
address:
2023-12-04 19:58:00 +01:00
$ref: "#/components/schemas/Address"
2023-12-07 23:27:23 +01:00
birthDate:
2023-12-04 19:58:00 +01:00
type: string
description: Follow the iso 8601 ("YYYY-MM-DD")
example:
{
2023-12-07 23:27:23 +01:00
"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,
2023-12-04 19:58:00 +01:00
}
Address:
type: object
properties:
2023-12-07 23:27:23 +01:00
address:
2023-12-04 19:58:00 +01:00
type: string
2023-12-07 23:27:23 +01:00
country:
2023-12-04 19:58:00 +01:00
type: string
description: Follow the ISO-3166-1 alpha-2 standard.
example:
{
2023-12-07 23:27:23 +01:00
"address": "Rue de Tounais 42",
"country": "BE"
}
Course:
type: object
properties:
id:
type: integer
name:
type: string
credits:
type: integer
faculty:
type: string
teachers:
type: object
$ref: '#/components/schemas/User'
assistants:
type: array
items:
$ref: '#/components/schemas/User'
example:
{
"id": 42,
"name": "Math pour l'info",
"credits": 11,
"faculty": "science",
"Teacher": ,
"Assistants": [ ]
2023-12-04 19:58:00 +01:00
}
Cursus:
type: object
properties:
2023-12-07 23:27:23 +01:00
id:
2023-12-04 19:58:00 +01:00
type: integer
2023-12-07 23:27:23 +01:00
name:
type: string
courses:
2023-12-04 19:58:00 +01:00
type: array
items:
type: string
example:
{
"id": 42,
"courses": ['Math', 'Info']
}
responses:
UnauthorizedError:
2023-12-07 23:27:23 +01:00
description: Permission non accordée