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

docs: modernize page for GetUserGameRankAndScore #21

Merged
merged 3 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Click the function names to open their complete docs on the docs site.
- [All Completion Progress](https://api-docs.retroachievements.org/v1/users/completion-progress.html) - Get metadata about all the user's played games and any awards associated with them.
- [Awards / Badges](https://api-docs.retroachievements.org/v1/users/user-awards.html) - Get a list of a user's site awards/badges.
- [Set Development Claims](https://api-docs.retroachievements.org/v1/users/claims.html) - Get a list of set development claims made over the lifetime of a user.
- [`GetUserGameRankAndScore`](https://api-docs.retroachievements.org/v1/users/get-user-game-rank-and-score.html) - Get metadata about how a user has performed on a given game.
- [Game Rank and Score](https://api-docs.retroachievements.org/v1/users/game-rank-and-score.html) - Get metadata about how a user has performed on a given game.
- [`GetUserPoints`](https://api-docs.retroachievements.org/v1/users/get-user-points.html) - Get a user's total hardcore and softcore points.
- [`GetUserProgress`](https://api-docs.retroachievements.org/v1/users/get-user-progress.html) - Get a user's progress on a list of specified games.
- [`GetUserRecentlyPlayedGames`](https://api-docs.retroachievements.org/v1/users/get-user-recently-played-games.html) - Get a list of games a user has recently played.
Expand Down
4 changes: 2 additions & 2 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export default defineConfig({
link: "/v1/users/claims",
},
{
text: "Rank and Score for Game",
link: "/v1/users/get-user-game-rank-and-score",
text: "Game Rank and Score",
link: "/v1/users/game-rank-and-score",
},
{
text: "Point Totals",
Expand Down
4 changes: 4 additions & 0 deletions docs/v1/users/claims.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ A call to this endpoint will retrieve a list of achievement set claims made over
::: code-group

```ts [NodeJS]
<<<<<<< HEAD
import { buildAuthorization, getUserClaims } from "@retroachievements/api";
=======
import {
buildAuthorization,
getGameInfoAndUserProgress,
} from "@retroachievements/api";
>>>>>>> main

// First, build your authorization object.
const userName = "<your username on RA>";
Expand Down
84 changes: 84 additions & 0 deletions docs/v1/users/game-rank-and-score.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<script setup>
import SampleRequest from '../../components/SampleRequest.vue';
</script>

# Game Rank and Score

A call to this endpoint will retrieve metadata about how a given user has performed/ranked on a given game, targeted by game ID.

[[toc]]

## HTTP Request

<SampleRequest httpVerb="GET">https://retroachievements.org/API/API_GetUserGameRankAndScore.php?g=14402&u=WCopeland</SampleRequest>

### Query Parameters

| Name | Required? | Description |
| :--- | :-------- | :------------------- |
| `z` | Yes | Your username. |
| `y` | Yes | Your web API key. |
| `u` | Yes | The target username. |
| `g` | Yes | The target game ID. |

## Client Library

::: code-group

```ts [NodeJS]
import {
buildAuthorization,
getUserGameRankAndScore,
} 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 userGameRankAndScore = await getUserGameRankAndScore(authorization, {
userName: "WCopeland",
gameId: 14402,
});
```

:::

## Response

::: code-group

```json [HTTP Response]
// If there is no user progress for the game, this array will be empty.
[
{
"User": "WCopeland",
"UserRank": 9,
"TotalScore": 199,
"LastAward": "2023-06-07 14:44:00"
}
]
```

```json [NodeJS]
// If there is no user progress for the game, this array will be empty.
[
{
"user": "WCopeland",
"totalScore": 199,
"lastAward": "2023-06-07 14:44:00",
"userRank": 9
}
]
```

:::

## Source

| Repo | URL |
| :----------------------- | :------------------------------------------------------------------------------------------------ |
| RetroAchievements/RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetUserGameRankAndScore.php |
| RetroAchievements/api-js | https://github.com/RetroAchievements/api-js/blob/main/src/user/getUserGameRankAndScore.ts |
41 changes: 0 additions & 41 deletions docs/v1/users/get-user-game-rank-and-score.md

This file was deleted.

Loading