Clyde/Documents/proto/general/openapi.yaml
2023-12-11 11:11:09 +01:00

938 lines
23 KiB
YAML

openapi: 3.0.0
info:
title: ClydeAPI
description:
This is the Clyde's api documentation. <br/>
Each endpoints are organised by endpoints **AND** by extensions making it easier to navigate.
version: 0.0.1
servers:
- url: https://clyde.herisson.ovh/api
description: default api point for clyde's service
paths:
/ping:
get:
summary: Check the API status
responses:
default:
description: pong
content:
text/plain:
schema:
type: string
example: pong
/users:
get:
summary: list all users
tags:
- General
- SI
security:
- bearer: []
parameters:
- in: query
name: type
required: false
schema:
type: string
enum: [teacher, student, secretary]
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/User"
'401':
$ref: '#/components/responses/UnauthorizedError'
/user:
get:
summary: get informations about yourself
tags:
- General
- Users
security:
- bearer: []
responses:
'200':
description: Ok
content:
application/json:
schema:
$ref: "#/components/schemas/User"
'401':
$ref: '#/components/responses/UnauthorizedError'
post:
summary: Create user
tags:
- General
- Users
requestBody:
required: 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 Tournais 42",
"Country": "BE"},
"BirthDate": "1941-02-22",
}
responses:
'201':
description: User created
'401':
$ref: '#/components/responses/UnauthorizedError'
patch:
summary: Change informations about yourself
tags:
- General
- Users
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/User'
responses:
'201':
description: Successfully changed.
'401':
$ref: '#/components/responses/UnauthorizedError'
/user/{mat}:
parameters:
- name: mat
in: path
description: Matricule of the user (unique id)
required: true
schema:
type: integer
get:
summary: Get user's informations
tags:
- General
- Admin
responses:
'200':
description: User found
content:
application/json:
schema:
$ref: "#/components/schemas/User"
patch:
summary: Alter user's informations
tags:
- General
- Admin
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/User'
responses:
'201':
description: Successfully changed
'401':
$ref: '#/components/responses/UnauthorizedError'
/course:
post:
summary: Create new course
tags:
- General
- Courses
- Secretariat
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
courses:
type: array
items:
type: string
responses:
'201':
description: course created
'401':
$ref: '#/components/responses/UnauthorizedError'
/courses/{id}:
get:
summary: see courses informations
tags:
- General
- Courses
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Course'
parameters:
- name: id
in: path
required: true
schema:
type: integer
delete:
summary: delete a course
tags:
- General
- Courses
- Secretariat
security:
- bearer: []
responses:
'201':
description: Success
'401':
$ref: '#/components/responses/UnauthorizedError'
patch:
summary: Change course options
tags:
- General
- Secretariat
- Courses
security:
- bearer: []
requestBody:
required: 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": [ ]
}
responses:
'201':
description: Course modified
'401':
$ref: '#/components/responses/UnauthorizedError'
/cursus:
post:
summary: Create a cursus
tags:
- General
- cursus
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
courses:
type: array
items:
type: integer
description: id of courses
example:
{
"name": "Bac1",
[]
}
responses:
'201':
description: Cursus created
'401':
$ref: '#/components/responses/UnauthorizedError'
/cursus/{id}:
get:
summary: See Cursus's informations
tags:
- General
- cursus
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Cursus'
parameters:
- name: id
in: path
required: true
schema:
type: integer
delete:
summary: Delete cursus
tags:
- General
- cursus
security:
- bearer: []
responses:
'201':
description: Success
'401':
$ref: '#/components/responses/UnauthorizedError'
patch:
summary: Modify cursus
tags:
- General
- cursus
security:
- bearer: []
requestBody:
required: 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": [ ]
}
responses:
'201':
description: Cursus modified
'401':
$ref: '#/components/responses/UnauthorizedError'
/RegRequests:
get :
summary : Get an array of every register requests
tags :
- RegisterRequests
responses :
'200':
description : OK
content :
application/json :
schema :
type : array
items :
$ref : '#/components/schemas/RegRequests'
/RegRequest/{id}:
get :
summary : Get all the data composing a register request
tags :
- RegisterRequests
responses :
'200':
description : OK
content :
application/json :
schema :
type : object
properties:
$ref : '#/components/schemas/RegRequest'
parameters:
- name: id
in: path
description: id of a regRequest
required: true
schema:
type: integer
patch:
summary: Change the state of a register request
tags:
- RegisterRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
State:
type: string
responses:
'201':
description: State modified
'401':
$ref: '#/components/responses/UnauthorizedError'
/RegRequest:
post :
summary: Add a new register request
tags :
- RegisterRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/RegRequest'
responses:
'201':
description: New student created
'401':
$ref: '#/components/responses/UnauthorizedError'
/ReRegRequest:
get :
summary : Get an array of every reregister requests
tags :
- ReregisterRequests
responses :
'200':
description : OK
content :
application/json :
schema :
type : array
items :
$ref : '#/components/schemas/ReRegRequest'
post :
summary: Add a new ReRegister request
tags :
- ReregisterRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/ReRegRequest'
responses:
'201':
description: New ReRegister request created
'401':
$ref: '#/components/responses/UnauthorizedError'
/ReRegRequest/{id}:
parameters:
- name: id
in: path
description: id of a reregistrationrequest
required: true
schema:
type: integer
get:
summary : get the data of a single reregistration request
tags :
- ReregisterRequests
responses :
'200':
description : OK
content :
application/json :
schema :
$ref : '#/components/schemas/ReRegRequest'
patch:
summary: Change the state of a reregister request
tags:
- ReregisterRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
State:
type: string
responses:
'201':
description: State modified
'401':
$ref: '#/components/responses/UnauthorizedError'
/SSRequest:
get :
summary : Get an array of every scholarship requests
tags :
- ScholarshipRequests
responses :
'200':
description : OK
content :
application/json :
schema :
type : array
items :
$ref : '#/components/schemas/SSRequest'
post :
summary: Add a new scholarship request
tags :
- ScholarshipRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/SSRequest'
responses:
'201':
description: New scholarship request created
'401':
$ref: '#/components/responses/UnauthorizedError'
/SSRequest/{id}:
parameters:
- name: id
in: path
description: id of a scholarshiprequest
required: true
schema:
type: integer
get:
summary : get the data of a single scholarship request
tags :
- ScholarshipRequests
responses :
'200':
description : OK
content :
application/json :
schema :
$ref : '#/components/schemas/SSRequest'
patch:
summary: Change the state of a scholarship request
tags:
- ScholarshipRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
State:
type: string
responses:
'201':
description: State modified
'401':
$ref: '#/components/responses/UnauthorizedError'
/UnRegRequest:
get :
summary : Get an array of every unregister requests
tags :
- UnregisterRequests
responses :
'200':
description : OK
content :
application/json :
schema :
type : array
items :
$ref : '#/components/schemas/UnRegRequest'
post :
summary: Add a new unregister request
tags :
- UnregisterRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/UnRegRequest'
responses:
'201':
description: New unregister request created
'401':
$ref: '#/components/responses/UnauthorizedError'
/UnRegRequest{id}:
parameters:
- name: id
in: path
description: id of a unregistrationrequest
required: true
schema:
type: integer
get:
summary : get the data of a single unregistration request
tags :
- UnregisterRequests
responses :
'200':
description : OK
content :
application/json :
schema :
$ref : '#/components/schemas/UnRegRequest'
patch:
summary: Change the state of a unregister request
tags:
- UnregisterRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
State:
type: string
responses:
'201':
description: State modified
'401':
$ref: '#/components/responses/UnauthorizedError'
/ExempRequest:
get :
summary : Get an array of every exemptions requests
tags :
- ExemptionRequests
responses :
'200':
description : OK
content :
application/json :
schema :
type : array
items :
$ref : '#/components/schemas/ExempRequest'
post :
summary: Add a new exemption request
tags :
- ExemptionRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/ExempRequest'
responses:
'201':
description: New exemption request created
'401':
$ref: '#/components/responses/UnauthorizedError'
/ExempRequest/{id}:
parameters:
- name: id
in: path
description: id of a exemption request
required: true
schema:
type: integer
get:
summary : get the data of a single exemption request
tags :
- ExemptionRequests
responses :
'200':
description : OK
content :
application/json :
schema :
$ref : '#/components/schemas/ExempRequest'
patch:
summary: Change the state of a exemption request
tags:
- ExemptionRequests
security:
- bearer: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
State:
type: string
responses:
'201':
description: State modified
'401':
$ref: '#/components/responses/UnauthorizedError'
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")
example:
{
"regNo": 42,
"lastName": "Doe" ,
"firstName": "John",
"email": "John.Doe@example.com",
"address": {
"address": "Rue de Tournais 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 Tournais 42",
"country": "BE"
}
Course:
type: object
properties:
id:
type: integer
name:
type: string
credits:
type: integer
faculty:
type: string
teachers:
type: integer
description: user's id
assistants:
type: array
items:
type: integer
description: user's id
example:
{
"id": 42,
"name": "Math pour l'info",
"credits": 11,
"faculty": "science",
"Teacher": 42,
"Assistants": [ ]
}
Cursus:
type: object
properties:
id:
type: integer
name:
type: string
courses:
type: array
items:
type: string
example:
{
"id": 42,
"courses": ['Math', 'Info']
}
RegRequest:
type : object
properties:
id:
type : integer
Name :
type: string
Firstname :
type : string
Address :
$ref: "#/components/schemas/Address"
Email:
type : string
BirthDate:
type : string
description: Follow the iso 8601 ("YYYY-MM-DD")
Cursus:
type : integer
description : ID of a specific cursus
Photo:
type : string
description: Path of the picture that the user uploaded
IdentityCard:
type : string
description: Path of the picture of the user's identity card
Degree:
type : string
description: Path of the pdf containing the user's degree
Certificate:
type : string
description: Path of the pdf containing the user's admission certificate (optionnal)
ForeignerCertificate:
type : string
description: Path of the pdf containing the user's foreigner certificate (optionnal)
State:
type : string
RegRequests:
type : object
properties:
id :
type : integer
Firstname :
type : string
Name :
type : string
Date :
type : string
description : Follow the iso 8601 ("YYYY-MM-DD")
State :
type : string
ReRegRequest:
type : object
properties :
id :
type : integer
RegNo :
type : integer
NewCursusid :
type : integer
State :
type : string
SSRequest:
type : object
properties :
id :
type : integer
RegNo :
type : integer
Amount :
type : integer
Document :
type : string
description : justification document for a scholarship
UnRegRequest :
type : object
properties :
id :
type : integer
RegNo :
type : integer
State :
type : string
ExempRequest :
type : object
properties :
id:
type : integer
RegNo :
type : integer
Courseid :
type : integer
State :
type : string
responses:
UnauthorizedError:
description: Unauthorized access or missing bearer