Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update get-game-hashes to include js client call #71

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion docs/v1/get-game-hashes.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,22 @@ This data can be found on the Supported Game Files page, for example, [Sonic the

::: code-group

```Kotlin
```ts [NodeJS]
import { buildAuthorization, getGameHashes } from "@retroachievements/api";

// First, build your authorization object.
const username = "<your username on RA>";
const webApiKey = "<your web API key>";

const authorization = buildAuthorization({ username, webApiKey });

// Then, make the API call.
const game = await getGameHashes(authorization, {
gameId: 14402,
});
```

```kotlin [Kotlin]
val credentials = RetroCredentials("<username>", "<web api key>")
val api: RetroInterface = RetroClient(credentials).api

Expand Down Expand Up @@ -75,11 +90,31 @@ if (response is NetworkResponse.Success) {
}
```

```json [NodeJS]
{
"results": [
{
"md5": "1b1d9ac862c387367e904036114c4825",
"name": "Sonic The Hedgehog (USA, Europe) (Ru) (NewGame).md",
"labels": ["nointro", "rapatches"],
"patchUrl": "https://github.com/RetroAchievements/RAPatches/raw/main/MD/Translation/Russian/1-Sonic1-Russian.zip"
},
{
"md5": "1bc674be034e43c96b86487ac69d9293",
"name": "Sonic The Hedgehog (USA, Europe).md",
"labels": ["nointro"],
"patchUrl": null
}
]
}
```

:::

## Source

| Repo | URL |
| :--------- | :------------------------------------------------------------------------------------------------------------------- |
| RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetGameHashes.php |
| api-js | https://github.com/RetroAchievements/api-js/blob/main/src/game/getGameHashes.ts |
| api-kotlin | https://github.com/RetroAchievements/api-kotlin/blob/main/src/main/kotlin/org/retroachivements/api/RetroInterface.kt |