Add documentation for more user-gamept endpoints

This commit is contained in:
zkldi
2021-07-21 21:09:03 +01:00
parent 98748dadf2
commit eb987c2fce
+139
View File
@@ -600,4 +600,143 @@ GET /api/v1/users/zkldi/games/iidx/SP/sessions/highlighted
highlight: true
},
]
```
*****
## Get a user's most played charts.
`GET /api/v1/users/:userID/games/:game/:playtype/most-played`
### Parameters
None.
### Response
| Property | Type | Description |
| :: | :: | :: |
| `songs` | Array<SongDocument> | The array of songs related to the pbs. |
| `charts` | Array<ChartDocument> | The array of charts related to the pbs. |
| `pbs` | Array<(PBDocument & {__playcount: integer})> | An array of PB documents with the `__playcount` property attached. This property dictates how many times the user has played this chart. |
### Example
#### Request
```
GET /api/v1/users/zkldi/games/iidx/SP/most-played
```
#### Response
```js
{
songs: [{
id: 1,
title: "5.1.1.",
// ...
}, {
id: 2,
title: "GAMBOL",
// ...
}],
charts: [{
songID: 1,
difficulty: "ANOTHER",
// ...
}, {
songID: 2,
difficulty: "LEGGENDARIA",
// ...
}, {
songID: 1,
difficulty: "HYPER",
}],
pbs: [{
chartID: "something",
__playcount: 5,
// ...
}, {
chartID: "something_else",
__playcount: 2,
// ...
}, {
chartID: "something_more",
__playcount: 1,
// ...
}]
}
```
*****
## Retrieve a leaderboard around a user.
`GET /api/v1/users/:userID/games/:game/:playtype/leaderboard-adjacent`
### Parameters
| Property | Type | Description |
| :: | :: | :: |
| `alg` | String (Optional) | Optionally, you can provide an override algorithm to use for the leaderboards instead of the game+playtype default. |
### Response
| Property | Type | Description |
| :: | :: | :: |
| `above` | Array<UserGameStats> | Up to 5 users' game stats better than this user. |
| `below` | Array<UserGameStats> | Same as above, but below the user. |
| `users` | Array<UserDocument> | The user documents related to the above statistics. |
| `yourStats` | UserGameStats | The requested user's stats for this game. |
### Example
#### Request
```
GET /api/v1/users/zkldi/games/iidx/SP/leaderboard-adjacent
```
#### Response
```js
{
above: [{
userID: 2,
ratings: {
ktRating: 9
},
classes: {
dan: 10
},
// ...
}],
below: [{
userID: 3,
ratings: {
ktRating: 1
},
classes: {
dan: 5
},
// ...
}],
users: [{
userID: 2,
username: "sptmgtm",
// ...
}, {
userID: 3,
username: "neil.c",
// ...
}],
thisUsersStats: {
userID: 1,
ratings: {
ktRating: 5
},
classes: {
dan: 5
}
}
}
```