Skip to content

Commit deab674

Browse files
authored
fix: update get-leaderboard-entries to include js client call (#80)
1 parent daa9239 commit deab674

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

docs/v1/get-leaderboard-entries.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ A leaderboards's entries can be found on the leaderboard info page:
3131

3232
::: code-group
3333

34+
```ts [NodeJS]
35+
import {
36+
buildAuthorization,
37+
getLeaderboardEntries,
38+
} from "@retroachievements/api";
39+
40+
// First, build your authorization object.
41+
const username = "<your username on RA>";
42+
const webApiKey = "<your web API key>";
43+
44+
const authorization = buildAuthorization({ username, webApiKey });
45+
46+
// Then, make the API call.
47+
const entries = await getLeaderboardEntries(authorization, {
48+
leaderboardId: 14402,
49+
});
50+
```
51+
3452
```Kotlin
3553
val credentials = RetroCredentials("<username>", "<web api key>")
3654
val api: RetroInterface = RetroClient(credentials).api
@@ -76,11 +94,30 @@ if (response is NetworkResponse.Success) {
7694
}
7795
```
7896

97+
```json [NodeJS]
98+
{
99+
"count": 100,
100+
"total": 1287,
101+
"results": [
102+
{
103+
"rank": 1,
104+
"user": "vani11a",
105+
"ulid": "00003EMFWR7XB8SDPEHB3K56ZQ",
106+
"score": 390490,
107+
"formattedScore": "390,490",
108+
"dateSubmitted": "2024-07-25T15:51:00+00:00"
109+
}
110+
// ...
111+
]
112+
}
113+
```
114+
79115
:::
80116

81117
## Source
82118

83119
| Repo | URL |
84120
| :--------- | :------------------------------------------------------------------------------------------------------------------- |
85121
| RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetLeaderboardEntries.php |
122+
| api-js | https://github.com/RetroAchievements/api-js/blob/main/src/leaderboard/getLeaderboardEntries.ts |
86123
| api-kotlin | https://github.com/RetroAchievements/api-kotlin/blob/main/src/main/kotlin/org/retroachivements/api/RetroInterface.kt |

0 commit comments

Comments
 (0)