From eb987c2fce5da87aa4610220c7bd4721510c9655 Mon Sep 17 00:00:00 2001 From: zkldi Date: Wed, 21 Jul 2021 21:09:03 +0100 Subject: [PATCH] Add documentation for more user-gamept endpoints --- docs/docs/api/routes/user-gamept.md | 139 ++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/docs/docs/api/routes/user-gamept.md b/docs/docs/api/routes/user-gamept.md index 37354b5aa..c362c310b 100644 --- a/docs/docs/api/routes/user-gamept.md +++ b/docs/docs/api/routes/user-gamept.md @@ -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 + } + } +} ``` \ No newline at end of file