- Authentication
- User
- Health
- Friends
- Search
- Rooms
- Messages
Endpoint: /auth/login
Method: POST
Description: Login user
Request body:
type Request = {
login: string; // can be username or email
password: string;
}
Endpoint: /auth/register
Method: POST
Description: Register user
Request body:
type Request = {
email: string,
username: string,
password: string,
}
Endpoint: /auth/user
Method: GET
Description: Get user data
Request body: null
(because it's a GET request)
Headers: Authorization: Bearer token
Endpoint: /auth/logout
Method: GET
Description: Logout user
Endpoint: /user
Method: PUT
Description: Change user data
Headers: Authorization: Bearer token
Request body:
type Request = {
newUsername: string,
}
Endpoint: /ping
Method: GET
Description: Get health of the server (normal)
Endpoint: /ping/authed
Method: GET
Description: Get health of the server (authed)
Headers: Authorization: Bearer token
Endpoint: /friends
Method: GET
Description: Get friends of the user
Headers: Authorization: Bearer token
Endpoint: /friends
Method: POST
Description: Add friend to the user
Headers: Authorization: Bearer token
Request body:
type Request = {
username: string,
}
Endpoint: /friends
Method: DELETE
Description: Remove friend from the user
Headers: Authorization: Bearer token
Request body:
type Request = {
username: string,
}
Endpoint: /search/users
Method: POST
Description: Search users
Headers: Authorization: Bearer token
Request body:
type Request = {
username: string,
}
Endpoint: /rooms
Method: GET
Description: Get rooms of the user
Headers: Authorization: Bearer token
Response body:
type Response = []{
id: string,
name: string,
users: string[],
}
Endpoint: /rooms
Method: POST
Description: Create room
Headers: Authorization: Bearer token
Request body:
type Request = {
name: string,
usersTarget: string[],
}
Endpoint: /rooms/:id
Method: GET
Description: Get room
Headers: Authorization: Bearer token
Response body:
type Response = {
id: string,
name: string,
users: string[],
}
Endpoint: /rooms
Method: DELETE
Description: Delete room
Headers: Authorization: Bearer token
Request body:
type Request = {
id: string,
}
Endpoint: /rooms/:id
Method: POST
Description: Add user to room
Headers: Authorization: Bearer token
Request body:
type Request = {
usernames: string[],
}
Endpoint: /rooms/join
Method: POST
Description: Join room
Headers: Authorization: Bearer token
Request body:
type Request = {
id: string,
}
Endpoint: /rooms/leave
Method: POST
Description: Leave room
Headers: Authorization: Bearer token
Request body:
type Request = {
id: string,
}
Protocol: websocket
Query: /messages
Description: Get messages from room (with range)
Headers: Authorization: Bearer token
Request body:
type Request = {
roomId: string,
range: {
start: number,
end: number,
},
}
Response body:
type Message = {
id: string,
content: string,
user_id: string,
}
type Response = []Message
Protocol: websocket
Query: /send
Description: Send Message to room
Headers: Authorization: Bearer token
Request body:
type Request = {
roomId: string,
message: string,
}