File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff 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
3553val credentials = RetroCredentials (" <username>" , " <web api key>" )
3654val 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 |
You can’t perform that action at this time.
0 commit comments