1
0
forked from PGL/Clyde

First api

This commit is contained in:
Debucquoy Anthony 2023-12-15 14:32:37 +01:00 committed by Debucquoy Anthony
parent abef330bd7
commit 6f5f89d954

View File

@ -18,6 +18,10 @@ tags:
description: Scientifics articles extension's endpoints
- name: Ext (Schedule)
description: Schedule extension's endpoints
- name: Ext (Student Registration)
description: Student Registration's endpoints
- name: Ext (Messaging)
description: Messaging extension's endpoints
paths:
/ping:
@ -31,6 +35,610 @@ paths:
schema:
type: string
example: pong
# Messaging
/forum:
get:
summary: get list of available forum
security:
- bearer: []
tags:
- Ext (Messaging)
- Forum
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
type: object
required:
- id
- name
- owner
properties:
id:
type: integer
name:
type: string
owner:
type: integer
description: user id of the teacher
'401':
$ref: '#/components/responses/UnauthorizedError'
post:
summary: Create a new forum
security:
- bearer: []
tags:
- Ext (Messaging)
- Forum
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
courseId:
type: integer
responses:
'201':
description: User created
'401':
$ref: '#/components/responses/UnauthorizedError'
/forum/{forumId}:
parameters:
- name: forumId
in: path
description: Id of the forum
required: true
schema:
type: integer
get:
summary: get informations about a forum
tags:
- Ext (Messaging)
- Forum
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
type: object
required:
- id
- name
- owner
properties:
id:
type: integer
name:
type: string
owner:
type: integer
description: user id of the teacher
topics:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
autor:
type: integer
description: user Id
registered:
description: List of registered user only if have the authorisation to view
type: array
items:
type: integer
description: userId
'401':
$ref: '#/components/responses/UnauthorizedError'
delete:
summary: remove the forum
security:
- bearer: []
tags:
- Ext (Messaging)
- Forum
responses:
'201':
description: Forum deleted
'401':
$ref: '#/components/responses/UnauthorizedError'
/forum/{forumId}/topic:
parameters:
- name: forumId
in: path
description: Id of the forum
required: true
schema:
type: integer
get:
summary: list topics of a forum
tags:
- Ext (Messaging)
- Forum
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
type: object
required:
- id
- name
- author
properties:
id:
type: integer
name:
type: string
author:
type: integer
description: user id of the author
'401':
$ref: '#/components/responses/UnauthorizedError'
post:
summary: create a new topic in the forum
tags:
- Ext (Messaging)
- Forum
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
subject:
type: string
content:
type: integer
responses:
'201':
description: post created
'401':
$ref: '#/components/responses/UnauthorizedError'
/forum/{forumId}/topic/{topicId}:
parameters:
- name: forumId
in: path
description: Id of the forum
required: true
schema:
type: integer
- name: topicId
in: path
description: Id of the topic
required: true
schema:
type: integer
get:
summary: get info about a topic
tags:
- Ext (Messaging)
- Forum
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
required:
- id
- name
- author
- locked
properties:
id:
type: integer
name:
type: string
author:
type: integer
description: user id of the author
locked:
type: boolean
description: define if the topic is locked to new responses or not
'401':
$ref: '#/components/responses/UnauthorizedError'
delete:
summary: delete a topic
security:
- bearer: []
tags:
- Ext (Messaging)
- Forum
responses:
'201':
description: Topic deleted
'401':
$ref: '#/components/responses/UnauthorizedError'
/forum/{forumId}/topic/{topicId}/response:
parameters:
- name: forumId
in: path
description: Id of the forum
required: true
schema:
type: integer
- name: topicId
in: path
description: Id of the topic
required: true
schema:
type: integer
get:
summary: list responses of a topic
tags:
- Ext (Messaging)
- Forum
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
author:
type: integer
description: user id of the author
content:
type: string
'401':
$ref: '#/components/responses/UnauthorizedError'
post:
summary: create a new response
tags:
- Ext (Messaging)
- Forum
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
content:
type: integer
responses:
'201':
description: Message posted
'401':
$ref: '#/components/responses/UnauthorizedError'
/forum/{forumId}/topic/{topicId}/response/{responseId}:
parameters:
- name: forumId
in: path
description: Id of the forum
required: true
schema:
type: integer
- name: topicId
in: path
description: Id of the topic
required: true
schema:
type: integer
- name: responseId
in: path
description: Id of the response
required: true
schema:
type: integer
get:
summary: get info on a response
tags:
- Ext (Messaging)
- Forum
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
required:
- id
- author
- content
properties:
id:
type: integer
author:
type: string
content:
type: integer
'401':
$ref: '#/components/responses/UnauthorizedError'
delete:
summary: delete a response
tags:
- Ext (Messaging)
- Forum
responses:
'201':
description: Message deleted
'401':
$ref: '#/components/responses/UnauthorizedError'
/discussion:
get:
summary: get list of available discussions
tags:
- Ext (Messaging)
- discussion
responses:
'201':
description: OK
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
users:
type: array
items:
type: integer
'401':
$ref: '#/components/responses/UnauthorizedError'
post:
summary: create a new discussion
tags:
- Ext (Messaging)
- discussion
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
users:
type: array
descrition: id of users
items:
type: integer
responses:
'201':
description: Discussion created
'401':
$ref: '#/components/responses/UnauthorizedError'
/discussion/{id}:
parameters:
- name: id
in: path
description: Id of the discussion
required: true
schema:
type: integer
get:
summary: get info on a discussion
tags:
- Ext (Messaging)
- discussion
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
required:
- id
- name
- users
properties:
id:
type: integer
name:
type: string
users:
type: integer
description: user ids of participants
'401':
$ref: '#/components/responses/UnauthorizedError'
/discussion/{id}/msg:
parameters:
- name: id
in: path
description: Id of the discussion
required: true
schema:
type: integer
get:
summary: list messages in a discussion
tags:
- Ext (Messaging)
- discussion
responses:
'200':
description: Ok
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
datetime:
type: integer
author:
type: integer
content:
type: string
'401':
$ref: '#/components/responses/UnauthorizedError'
post:
summary: post a new message in a discussion
tags:
- Ext (Messaging)
- discussion
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: string
description: message content
responses:
'201':
description: Message sent
'401':
$ref: '#/components/responses/UnauthorizedError'
/appointment:
get:
summary: list appointments
tags:
- Ext (Messaging)
- appointment
parameters:
- name: type
in: query
required: false
schema:
type: string
enum: [open, closed]
responses:
'200':
description: Ok
content:
test/calendar:
description: file containing the appointments
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
teacher:
type: integer
student:
type: integer
date:
type: integer
status:
type: string
'401':
$ref: '#/components/responses/UnauthorizedError'
post:
summary: create a new appointment
tags:
- Ext (Messaging)
- appointment
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
content:
type: integer
datetime:
type: integer
to:
type: integer
description: user id of the person to request to
responses:
'201':
description: Appointment created
'401':
$ref: '#/components/responses/UnauthorizedError'
/appointment/{id}:
parameters:
- name: id
in: path
description: Id of the appointment
required: true
schema:
type: integer
get:
summary: get info on an appointment
tags:
- Ext (Messaging)
- appointment
responses:
'200':
description: Ok
content:
test/calendar:
description: file containing the appointment
application/json:
schema:
type: object
properties:
id:
type: integer
teacher:
type: integer
student:
type: integer
date:
type: integer
status:
type: string
'401':
$ref: '#/components/responses/UnauthorizedError'
post:
summary: Accept, decline or propose a new schedule for the appointment
tags:
- Ext (Messaging)
- appointment
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
action:
type: string
enum: [accept, refuse, propose]
data:
type: object
description: context dependant response (can be null)
responses:
'201':
description: Done
'401':
$ref: '#/components/responses/UnauthorizedError'
# general
/users:
get:
summary: list all users
@ -1234,7 +1842,3 @@ components:
responses:
UnauthorizedError:
description: Unauthorized access or missing bearer