add pfp and banner endpoints

This commit is contained in:
zkldi
2021-06-28 16:47:24 +01:00
parent b8aeaabf88
commit f00be31b93
2 changed files with 188 additions and 70 deletions
-70
View File
@@ -1,70 +0,0 @@
# Individual User Endpoints
*****
## Change Profile Picture
`PUT /api/v1/users/:userID/pfp`
### Permissions
- customise_profile
- Must be the owner of this profile.
### Parameters
| Property | Type | Description |
| :: | :: | :: |
| `pfp` | JPG, or PNG | The new profile picture to set. |
!!! note
This endpoint expects multipart form data.
### Response
| Property | Type | Description |
| :: | :: | :: |
| `get` | String | This contains the URL to then GET the new profile picture. |
### Example
#### Request
```
PUT /api/v1/users/1/pfp
```
```
// this is not a real multipart request, as those things
// are huge!
pfp=<somefiledata>
```
#### Response
```json
{
"get": "/api/v1/users/1/pfp"
}
```
*****
## Get a user's profile picture.
`GET /api/v1/users/:userID/pfp`
### Parameters
None.
### Response
Not JSON. This returns the actual JPG or PNG stored for
this user.
### Example
N/A
+188
View File
@@ -151,3 +151,191 @@ GET /api/v1/users/1/stats
!!! info
In the event a user has played no games, this will
return an empty array.
*****
## Change Profile Picture
`PUT /api/v1/users/:userID/pfp`
### Permissions
- customise_profile
- Must be the owner of this profile.
### Parameters
| Property | Type | Description |
| :: | :: | :: |
| `pfp` | JPG, or PNG | The new profile picture to set. |
!!! note
This endpoint expects multipart form data.
### Response
| Property | Type | Description |
| :: | :: | :: |
| `get` | String | This contains the URL to then GET the new profile picture. |
### Example
#### Request
```
PUT /api/v1/users/1/pfp
```
```
// this is not a real multipart request, as those things
// are huge!
pfp=<somefiledata>
```
#### Response
```json
{
"get": "/api/v1/users/1/pfp"
}
```
*****
## Get a user's profile picture.
`GET /api/v1/users/:userID/pfp`
### Parameters
None.
### Response
Not JSON. This returns the actual JPG or PNG stored for
this user.
### Example
N/A
*****
*****
## Unset your profile picture.
`DELETE /api/v1/users/:userID/pfp`
!!! note
If you do not have a profile picture set, this is
a 404 error.
### Permissions
- customise_profile
- Must be the owner of this profile.
### Parameters
None.
### Response
None.
### Example
Self-explanatory.
*****
## Change Profile Banner
`PUT /api/v1/users/:userID/banner`
### Permissions
- customise_profile
- Must be the owner of this profile.
### Parameters
| Property | Type | Description |
| :: | :: | :: |
| `banner` | JPG, or PNG | The new profile banner to set. |
!!! note
This endpoint expects multipart form data.
### Response
| Property | Type | Description |
| :: | :: | :: |
| `get` | String | This contains the URL to then GET the new profile banner. |
### Example
#### Request
```
PUT /api/v1/users/1/banner
```
```
// this is not a real multipart request, as those things
// are huge!
banner=<somefiledata>
```
#### Response
```json
{
"get": "/api/v1/users/1/banner"
}
```
*****
## Get a user's profile banner.
`GET /api/v1/users/:userID/banner`
### Parameters
None.
### Response
Not JSON. This returns the actual JPG or PNG stored for
this user.
### Example
N/A
*****
*****
## Unset your profile banner.
`DELETE /api/v1/users/:userID/banner`
!!! note
If you do not have a profile banner set, this is
a 404 error.
### Permissions
- customise_profile
- Must be the owner of this profile.
### Parameters
None.
### Response
None.
### Example
Self-explanatory.