Skip to content

Commit

Permalink
docs: modernize page for GetUserProgress (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
wescopeland authored Feb 25, 2024
1 parent 2f88b0d commit f1932d5
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 53 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Click the function names to open their complete docs on the docs site.
- [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.
- [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.
- [Point Totals](https://api-docs.retroachievements.org/v1/users/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.
- [Specific Games Progress](https://api-docs.retroachievements.org/v1/users/specific-games-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.
- [`GetUserSummary`](https://api-docs.retroachievements.org/v1/users/get-user-summary.html) - Get a user's profile metadata.
- [Completed Games](https://api-docs.retroachievements.org/v1/users/completed-games.html) - Legacy endpoint. Get hardcore and softcore completion metadata about games a user has 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 @@ -91,8 +91,8 @@ export default defineConfig({
link: "/v1/users/points",
},
{
text: "Progress for Multiple Games",
link: "/v1/users/get-user-progress",
text: "Specific Games Progress",
link: "/v1/users/specific-games-progress",
},
{
text: "Recently Played Games",
Expand Down
50 changes: 0 additions & 50 deletions docs/v1/users/get-user-progress.md

This file was deleted.

121 changes: 121 additions & 0 deletions docs/v1/users/specific-games-progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<script setup>
import SampleRequest from '../../components/SampleRequest.vue';
</script>

# User Specific Games Progress

A call to this function will retrieve a given user's progress on a given list of games, targeted by a list of game IDs.

::: warning

Unless you are explicitly wanting summary progress details for specific game IDs, the [All Completion Progress](/v1/users/completion-progress.html) endpoint will almost certainly be better-suited for your use case.

:::

[[toc]]

## HTTP Request

<SampleRequest httpVerb="GET">https://retroachievements.org/API/API_GetUserProgress.php?u=MaxMilyin&i=1,2,3</SampleRequest>

### Query Parameters

| Name | Required? | Description |
| :--- | :-------- | :----------------------------------------------- |
| `z` | Yes | Your username. |
| `y` | Yes | Your web API key. |
| `u` | Yes | The target username. |
| `i` | Yes | The target game IDs, as a comma-separated value. |

## Client Library

::: code-group

```ts [NodeJS]
import { buildAuthorization, getUserProgress } 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 userGamesProgress = await getUserProgress(authorization, {
userName: "MaxMilyin",
gameIds: [1, 2, 3],
});
```

:::

## Response

::: code-group

```json [HTTP Response]
{
"1": {
"NumPossibleAchievements": 23,
"PossibleScore": 251,
"NumAchieved": 23,
"ScoreAchieved": 251,
"NumAchievedHardcore": 23,
"ScoreAchievedHardcore": 251
},
"2": {
"NumPossibleAchievements": 22,
"PossibleScore": 320,
"NumAchieved": 22,
"ScoreAchieved": 320,
"NumAchievedHardcore": 22,
"ScoreAchievedHardcore": 320
},
"3": {
"NumPossibleAchievements": 23,
"PossibleScore": 335,
"NumAchieved": 23,
"ScoreAchieved": 335,
"NumAchievedHardcore": 23,
"ScoreAchievedHardcore": 335
}
}
```

```json [NodeJS]
{
"1": {
"numPossibleAchievements": 23,
"possibleScore": 251,
"numAchieved": 23,
"scoreAchieved": 251,
"numAchievedHardcore": 23,
"scoreAchievedHardcore": 251
},
"2": {
"numPossibleAchievements": 22,
"possibleScore": 320,
"numAchieved": 22,
"scoreAchieved": 320,
"numAchievedHardcore": 22,
"scoreAchievedHardcore": 320
},
"3": {
"numPossibleAchievements": 23,
"possibleScore": 335,
"numAchieved": 23,
"scoreAchieved": 335,
"numAchievedHardcore": 23,
"scoreAchievedHardcore": 335
}
}
```

:::

## Source

| Repo | URL |
| :----------------------- | :---------------------------------------------------------------------------------------- |
| RetroAchievements/RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetUserProgress.php |
| RetroAchievements/api-js | https://github.com/RetroAchievements/api-js/blob/main/src/user/getUserProgress.ts |

0 comments on commit f1932d5

Please sign in to comment.