143 lines
1.9 KiB
Markdown
143 lines
1.9 KiB
Markdown
## GET /api/v1/user/{id}
|
|
|
|
_Requires an authorization header_
|
|
|
|
Returns a user with id = {id}
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"username": "string",
|
|
"email": "string",
|
|
"description": "string",
|
|
"admin": "boolean",
|
|
"registerDate": "number",
|
|
"lastLogin": "number"
|
|
}
|
|
```
|
|
|
|
## GET /api/v1/user/logged
|
|
|
|
_Requires an authorization header_
|
|
|
|
Returns id of the currently logged user based on the auth token
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string"
|
|
}
|
|
```
|
|
|
|
## POST /api/v1/user
|
|
|
|
_Requires an authorization header_
|
|
|
|
### Request:
|
|
|
|
```json
|
|
{
|
|
"username": "string",
|
|
"password": "string",
|
|
"email": "string?",
|
|
"description": "string?",
|
|
"admin": "boolean?"
|
|
}
|
|
```
|
|
|
|
Creates a new user and returns it
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"username": "string",
|
|
"email": "string",
|
|
"description": "string",
|
|
"admin": "boolean"
|
|
}
|
|
```
|
|
|
|
## PATCH /api/v1/user/{id}
|
|
|
|
_Requires an authorization header_
|
|
|
|
### Request:
|
|
|
|
```json
|
|
{
|
|
"email": "string?",
|
|
"description": "string?"
|
|
}
|
|
```
|
|
|
|
Updates a user with id = {id}
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"email": "string",
|
|
"description": "string"
|
|
}
|
|
```
|
|
|
|
## DELETE /api/v1/user/{id}
|
|
|
|
_Requires an authorization header_
|
|
|
|
Removes a user with id = {id}
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string"
|
|
}
|
|
```
|
|
|
|
## GET /api/v1/user/{id}/sessions
|
|
|
|
_Requires an authorization header_
|
|
|
|
Returns all sessions for a user with id = {id}
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"sessions": [
|
|
{
|
|
"id": "string",
|
|
"userId": "string"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## GET /api/v1/user/{id}/communities
|
|
|
|
_Requires an authorization header_
|
|
|
|
Returns all communities for a user with id = {id}
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"id": "string",
|
|
"communities": [
|
|
{
|
|
"id": "string",
|
|
"name": "string",
|
|
"description": "string"
|
|
}
|
|
]
|
|
}
|
|
```
|