From ccf2deac13e28d66f1da0ac778240563b106f978 Mon Sep 17 00:00:00 2001 From: Joshua Raphael Date: Sat, 14 Jun 2025 14:45:01 -0700 Subject: [PATCH] fix: update get-leaderboard-entries to include js client call --- docs/v1/get-leaderboard-entries.md | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/v1/get-leaderboard-entries.md b/docs/v1/get-leaderboard-entries.md index e58a7ca..732f770 100644 --- a/docs/v1/get-leaderboard-entries.md +++ b/docs/v1/get-leaderboard-entries.md @@ -31,6 +31,24 @@ A leaderboards's entries can be found on the leaderboard info page: ::: code-group +```ts [NodeJS] +import { + buildAuthorization, + getLeaderboardEntries, +} from "@retroachievements/api"; + +// First, build your authorization object. +const username = ""; +const webApiKey = ""; + +const authorization = buildAuthorization({ username, webApiKey }); + +// Then, make the API call. +const entries = await getLeaderboardEntries(authorization, { + leaderboardId: 14402, +}); +``` + ```Kotlin val credentials = RetroCredentials("", "") val api: RetroInterface = RetroClient(credentials).api @@ -76,6 +94,24 @@ if (response is NetworkResponse.Success) { } ``` +```json [NodeJS] +{ + "count": 100, + "total": 1287, + "results": [ + { + "rank": 1, + "user": "vani11a", + "ulid": "00003EMFWR7XB8SDPEHB3K56ZQ", + "score": 390490, + "formattedScore": "390,490", + "dateSubmitted": "2024-07-25T15:51:00+00:00" + } + // ... + ] +} +``` + ::: ## Source @@ -83,4 +119,5 @@ if (response is NetworkResponse.Success) { | Repo | URL | | :--------- | :------------------------------------------------------------------------------------------------------------------- | | RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetLeaderboardEntries.php | +| api-js | https://github.com/RetroAchievements/api-js/blob/main/src/leaderboard/getLeaderboardEntries.ts | | api-kotlin | https://github.com/RetroAchievements/api-kotlin/blob/main/src/main/kotlin/org/retroachivements/api/RetroInterface.kt |