From f00be31b93d33afd685da334f5de37fb14e547aa Mon Sep 17 00:00:00 2001 From: zkldi Date: Mon, 28 Jun 2021 16:47:24 +0100 Subject: [PATCH] add pfp and banner endpoints --- docs/docs/api/routes/user.md | 70 ------------- docs/docs/api/routes/users.md | 188 ++++++++++++++++++++++++++++++++++ 2 files changed, 188 insertions(+), 70 deletions(-) delete mode 100644 docs/docs/api/routes/user.md diff --git a/docs/docs/api/routes/user.md b/docs/docs/api/routes/user.md deleted file mode 100644 index 1d37b34d3..000000000 --- a/docs/docs/api/routes/user.md +++ /dev/null @@ -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= -``` - -#### 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 - - - diff --git a/docs/docs/api/routes/users.md b/docs/docs/api/routes/users.md index ae1ea85da..b67a142ac 100644 --- a/docs/docs/api/routes/users.md +++ b/docs/docs/api/routes/users.md @@ -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= +``` + +#### 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= +``` + +#### 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.