Skip to content

Commit 5f26196

Browse files
authored
fix: update get-user-game-leaderboards to include js client call (#81)
1 parent deab674 commit 5f26196

File tree

1 file changed

+52
-6
lines changed

1 file changed

+52
-6
lines changed

docs/v1/get-user-game-leaderboards.md

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,27 @@ You must query the user by either their username or their ULID. Please note the
3434

3535
## Client Library
3636

37-
Not yet supported.
37+
::: code-group
38+
39+
```ts [NodeJS]
40+
import {
41+
buildAuthorization,
42+
getUserGameLeaderboards,
43+
} from "@retroachievements/api";
44+
45+
// First, build your authorization object.
46+
const username = "<your username on RA>";
47+
const webApiKey = "<your web API key>";
48+
49+
const authorization = buildAuthorization({ username, webApiKey });
50+
51+
// Then, make the API call.
52+
const gameLeaderboards = await getUserGameLeaderboards(authorization, {
53+
gameId: 14402,
54+
});
55+
```
56+
57+
:::
3858

3959
## Response
4060

@@ -59,8 +79,33 @@ Not yet supported.
5979
"Rank": 2,
6080
"DateUpdated": "2024-12-12T16:40:59+00:00"
6181
}
62-
},
63-
...
82+
}
83+
// ...
84+
]
85+
}
86+
```
87+
88+
```json [NodeJS]
89+
{
90+
"count": 10,
91+
"total": 64,
92+
"results": [
93+
{
94+
"id": 19062,
95+
"rankAsc": true,
96+
"title": "New Zealand One",
97+
"description": "Complete New Zealand S1 in least time",
98+
"format": "MILLISECS",
99+
"userEntry": {
100+
"user": "zuliman92",
101+
"ulid": "00003EMFWR7XB8SDPEHB3K56ZQ",
102+
"score": 12620,
103+
"formattedScore": "2:06.20",
104+
"rank": 2,
105+
"dateUpdated": "2024-12-12T16:40:59+00:00"
106+
}
107+
}
108+
// ...
64109
]
65110
}
66111
```
@@ -69,6 +114,7 @@ Not yet supported.
69114

70115
## Source
71116

72-
| Repo | URL |
73-
| :---- | :------------------------------------------------------------------------------------------------ |
74-
| RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetUserGameLeaderboards.php |
117+
| Repo | URL |
118+
| :----- | :------------------------------------------------------------------------------------------------ |
119+
| RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetUserGameLeaderboards.php |
120+
| api-js | https://github.com/RetroAchievements/api-js/blob/main/src/leaderboard/getUserGameLeaderboards.ts |

0 commit comments

Comments
 (0)