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(GetUserProfile): add notes about client lib usage #12

Merged
merged 1 commit into from
Jan 14, 2024
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
41 changes: 39 additions & 2 deletions docs/v1/users/profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,24 @@ This information can be found near the top of [any user page](https://retroachie

## Client Library

Not yet supported.
::: code-group

```ts [NodeJS]
import { buildAuthorization, getUserProfile } 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 userProfile = await getUserProfile(authorization, {
userName: "xelnia",
});
```

:::

## Response

Expand All @@ -54,11 +71,31 @@ Not yet supported.
}
```

```json [NodeJS]
{
"user": "MaxMilyin",
"userPic": "/UserPic/MaxMilyin.png",
"memberSince": "2016-01-02 00:43:04",
"richPresenceMsg": "Playing ~Hack~ 11th Annual Vanilla Level Design Contest, The",
"lastGameId": 19504,
"contribCount": 0,
"contribYield": 0,
"totalPoints": 399597,
"totalSoftcorePoints": 0,
"totalTruePoints": 1599212,
"permissions": 1,
"untracked": false,
"id": 16446,
"userWallActive": true,
"motto": "Join me on Twitch! GameSquadSquad for live RA"
}
```

:::

## Source

| Repo | URL |
| :----------------------- | :--------------------------------------------------------------------------------------- |
| RetroAchievements/RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetUserProfile.php |
| RetroAchievements/api-js | not yet supported |
| RetroAchievements/api-js | https://github.com/RetroAchievements/api-js/blob/main/src/user/getUserProfile.ts |