From 2f7fac1ec1ce761323b57db3af5e1adf26ee292c Mon Sep 17 00:00:00 2001 From: StiefelJackal Date: Thu, 15 Jan 2026 08:25:24 -0500 Subject: [PATCH 1/5] docs: condense Kotlin example --- docs/v1/get-comments.md | 55 ++++++++++------------------------------- 1 file changed, 13 insertions(+), 42 deletions(-) diff --git a/docs/v1/get-comments.md b/docs/v1/get-comments.md index 74386a3..cfcf9b4 100644 --- a/docs/v1/get-comments.md +++ b/docs/v1/get-comments.md @@ -27,55 +27,26 @@ A call to this endpoint returns comments of a specified kind: game, achievement, ::: code-group -```Kotlin [User] +```Kotlin val credentials = RetroCredentials("", "") val api: RetroInterface = RetroClient(credentials).api +// get comments currently on user's wall val response: NetworkResponse = api.getCommentsOnUserWall( username = "MaxMilyin", ) -if (response is NetworkResponse.Success) { - // handle the data - val comments: GetComments.Response = response.body - -} else if (response is NetworkResponse.Error) { - // if the server returns an error it be found here - val errorResponse: ErrorResponse? = response.body - - // if the api (locally) had an internal error, it'll be found here - val internalError: Throwable? = response.error -} -``` - -```Kotlin [Game] -val credentials = RetroCredentials("", "") -val api: RetroInterface = RetroClient(credentials).api - -val response: NetworkResponse = api.getCommentsOnGameWall( - gameId = 14402, -) - -if (response is NetworkResponse.Success) { - // handle the data - val comments: GetComments.Response = response.body - -} else if (response is NetworkResponse.Error) { - // if the server returns an error it be found here - val errorResponse: ErrorResponse? = response.body - - // if the api (locally) had an internal error, it'll be found here - val internalError: Throwable? = response.error -} -``` - -```Kotlin [Achievement] -val credentials = RetroCredentials("", "") -val api: RetroInterface = RetroClient(credentials).api - -val response: NetworkResponse = api.getCommentsOnAchievementWall( - achievementId = 14402, -) +// to get comments from a game's wall, use the following: +// +// val response: NetworkResponse = api.getCommentsOnGameWall( +// gameId = 14402, +// ) + +// to get comments from an achievement's wall, use the following: +// +// val response: NetworkResponse = api.getCommentsOnAchievementWall( +// achievementId = 14402, +// ) if (response is NetworkResponse.Success) { // handle the data From beb2978ff030201131131953ccbbd7fa8c267e09 Mon Sep 17 00:00:00 2001 From: StiefelJackal Date: Thu, 15 Jan 2026 08:33:17 -0500 Subject: [PATCH 2/5] docs: add getComments JS function example --- docs/v1/get-comments.md | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/docs/v1/get-comments.md b/docs/v1/get-comments.md index cfcf9b4..3e03c0a 100644 --- a/docs/v1/get-comments.md +++ b/docs/v1/get-comments.md @@ -27,6 +27,35 @@ A call to this endpoint returns comments of a specified kind: game, achievement, ::: code-group +```ts [NodeJS] +import { buildAuthorization, getComments } from "@retroachievements/api"; + +// First, build your authorization object. +const username = ""; +const webApiKey = ""; + +const authorization = buildAuthorization({ username, webApiKey }); + +// Then, make the API call depending on what kind of comments you want. + +// For comments on a user's wall, call the following: +const userWallComments = await getComments(authorization, { + identifier: "MaxMilyin", +}); + +// For comments on a game's wall, call the following: +const gameWallComments = await getComments(authorization, { + identifier: 14402, + kind: "game", +}); + +// For comments on an achievement's wall, call the following: +const achievementWallComments = await getComments(authorization, { + identifier: 14402, + kind: "achievement", +}); +``` + ```Kotlin val credentials = RetroCredentials("", "") val api: RetroInterface = RetroClient(credentials).api @@ -83,6 +112,22 @@ if (response is NetworkResponse.Success) { ] ``` +```json [NodeJS] +[ + "count": 4, + "total": 4, + "results": [ + { + "user": "PlayTester", + "ulid": "00003EMFWR7XB8SDPEHB3K56ZQ", + "submitted": "2024-07-31T11:22:23.000000Z", + "commentText": "Comment 1" + }, + // ... + ] +] +``` + ::: ## Source @@ -90,4 +135,5 @@ if (response is NetworkResponse.Success) { | Repo | URL | | :--------- | :------------------------------------------------------------------------------------------------------------------- | | RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetComments.php | +| api-js | https://github.com/RetroAchievements/api-js/blob/main/src/comment/getComments.ts | | api-kotlin | https://github.com/RetroAchievements/api-kotlin/blob/main/src/main/kotlin/org/retroachivements/api/RetroInterface.kt | From caec996bad7679bfd55943b8cc556c032c416fc6 Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Tue, 3 Feb 2026 20:10:15 -0500 Subject: [PATCH 3/5] Update docs/v1/get-comments.md --- docs/v1/get-comments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/v1/get-comments.md b/docs/v1/get-comments.md index 3e03c0a..59b56cb 100644 --- a/docs/v1/get-comments.md +++ b/docs/v1/get-comments.md @@ -113,7 +113,7 @@ if (response is NetworkResponse.Success) { ``` ```json [NodeJS] -[ +{ "count": 4, "total": 4, "results": [ From 48fdad7a80b262080986942027db3f89ef060b2e Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Tue, 3 Feb 2026 20:10:20 -0500 Subject: [PATCH 4/5] Update docs/v1/get-comments.md --- docs/v1/get-comments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/v1/get-comments.md b/docs/v1/get-comments.md index 59b56cb..7dd31ae 100644 --- a/docs/v1/get-comments.md +++ b/docs/v1/get-comments.md @@ -125,7 +125,7 @@ if (response is NetworkResponse.Success) { }, // ... ] -] +} ``` ::: From 1aba8794a8ab036b8891e6da0a4852c26a9599ab Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Tue, 3 Feb 2026 20:11:12 -0500 Subject: [PATCH 5/5] chore: prettier --- docs/v1/get-comments.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/v1/get-comments.md b/docs/v1/get-comments.md index 7dd31ae..c1824a5 100644 --- a/docs/v1/get-comments.md +++ b/docs/v1/get-comments.md @@ -114,17 +114,17 @@ if (response is NetworkResponse.Success) { ```json [NodeJS] { - "count": 4, - "total": 4, - "results": [ - { - "user": "PlayTester", - "ulid": "00003EMFWR7XB8SDPEHB3K56ZQ", - "submitted": "2024-07-31T11:22:23.000000Z", - "commentText": "Comment 1" - }, - // ... - ] + "count": 4, + "total": 4, + "results": [ + { + "user": "PlayTester", + "ulid": "00003EMFWR7XB8SDPEHB3K56ZQ", + "submitted": "2024-07-31T11:22:23.000000Z", + "commentText": "Comment 1" + } + // ... + ] } ```