Compare commits

..

No commits in common. "c2b6ad0693d81b18a051feddfd9d0e48ec614b68" and "5a60d8f3db7c3bed18dbbf1dbc67540985e44dfd" have entirely different histories.

View File

@ -1,9 +1,7 @@
openapi: 3.0.0 openapi: 3.0.0
info: info:
title: ClydeAPI title: ClydeAPI
description: description: Clyde's api
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 version: 0.0.1
servers: servers:
@ -13,128 +11,32 @@ servers:
paths: paths:
/ping: /ping:
get: get:
summary: Check the API status summary: Test if the api is up.
responses: responses:
default: default:
description: pong description: Standard response to ping
content: content:
text/plain: text/plain:
schema: schema:
type: string type: string
example: pong 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: /user:
get: put:
summary: get informations about yourself summary: create a new user
tags: tags:
- General - users
- Users
security: security:
- bearer: [] - bearer: []
responses: responses:
'200': '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 description: User created
'401': '401':
$ref: '#/components/responses/UnauthorizedError' $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}: /user/{mat}:
parameters:
- name: mat
in: path
description: Matricule of the user (unique id)
required: true
schema:
type: integer
get: get:
summary: Get user's informations summary: get user's info
tags: tags:
- General - users
- Admin
responses: responses:
'200': '200':
description: User found description: User found
@ -142,228 +44,48 @@ paths:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/User" $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: parameters:
- name: id - name: mat
in: path in: path
description: Matricule of the user (unique id)
required: true required: true
schema: schema:
type: integer 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}: /cursus/{id}:
get: get:
summary: See Cursus's informations summary: Voir les informations sur un Cursus
tags: tags:
- General - Courses
- cursus
responses: responses:
'200': '200':
description: OK description: Cursus found
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Cursus' $ref: '#/components/schemas/Cursus'
parameters: /courses/{id}:
- name: id get:
in: path summary: Voir les informations sur un cours*
required: true tags:
schema: - Courses
type: integer responses:
put:
summary: Créer un nouveau cours
tags:
- Courses
security:
- bearer: []
responses:
delete: delete:
summary: Delete cursus summary: Suprimer un cours
tags: tags:
- General - Courses
- cursus
security: security:
- bearer: [] - bearer: []
responses: 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'
components: components:
@ -375,82 +97,54 @@ components:
User: User:
type: object type: object
properties: properties:
regNo: RegNo:
type: integer type: integer
photo: Photo:
type: object type: object
lastName: LastName:
type: string type: string
firstName: FirstName:
type: string type: string
email: Email:
type: string type: string
address: Address:
$ref: "#/components/schemas/Address" $ref: "#/components/schemas/Address"
birthDate: BirthDate:
type: string type: string
description: Follow the iso 8601 ("YYYY-MM-DD") description: Follow the iso 8601 ("YYYY-MM-DD")
StaffMember:
type: boolean
example: example:
{ {
"regNo": 42, "RegNo": 42,
"lastName": "Doe" , "LastName": "Doe" ,
"firstName": "John", "FirstName": "John",
"email": "John.Doe@example.com", "Email": "John.Doe@example.com",
"address": { "Address": {
"address": "Rue de Tournais 42", "Address": "Rue de Tounais 42",
"country": "BE"}, "Country": "BE"},
"birthDate": "1941-02-22", "BirthDate": "1941-02-22",
"staffMember": true, "StaffMember": true
} }
Address: Address:
type: object type: object
properties: properties:
address: Address:
type: string type: string
country: Country:
type: string type: string
description: Follow the ISO-3166-1 alpha-2 standard. description: Follow the ISO-3166-1 alpha-2 standard.
example: example:
{ {
"address": "Rue de Tournais 42", "Address": "Rue de Tounais 42",
"country": "BE" "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: Cursus:
type: object type: object
properties: properties:
id: Id:
type: integer type: integer
name: Courses:
type: string
courses:
type: array type: array
items: items:
type: string type: string
@ -461,4 +155,4 @@ components:
} }
responses: responses:
UnauthorizedError: UnauthorizedError:
description: Unauthorized access or missing bearer description: Access token is missing or invalid