diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 10ae4ad..05cc92d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ pnpm install This project includes a `__playground.ts` file for testing any local changes. To get started, open the file and replace these lines with values pertinent to your user account on RetroAchievements: ```ts -const userName = "myUserName"; +const username = "myUsername"; const webApiKey = "myWebApiKey"; ``` diff --git a/README.md b/README.md index 4f0fc71..1447982 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,10 @@ To use any endpoint function in the API, you must first be authorized by RetroAc ```ts import { buildAuthorization } from "@retroachievements/api"; -const userName = ""; +const username = ""; const webApiKey = ""; -const authorization = buildAuthorization({ userName, webApiKey }); +const authorization = buildAuthorization({ username, webApiKey }); ``` 4. You now have all you need to use any function in the API. Each function takes this authorization object as its first argument. Here's an example: diff --git a/src/__playground.ts b/src/__playground.ts index 3931397..d563e07 100644 --- a/src/__playground.ts +++ b/src/__playground.ts @@ -17,7 +17,7 @@ import { buildAuthorization, getAchievementCount } from "./index"; // MODIFY THESE VALUES. -const userName = "myUserName"; +const username = "myUsername"; const webApiKey = "myWebApiKey"; const main = async () => { @@ -25,13 +25,13 @@ const main = async () => { // -- Start testing stuff here -- - if (userName === "myUserName" || webApiKey === "myWebApiKey") { + if (username === "myUsername" || webApiKey === "myWebApiKey") { console.error( - "⛔️ ERROR: In __playground.ts, modify the userName and webApiKey variables to match your RA credentials.\n" + "⛔️ ERROR: In __playground.ts, modify the username and webApiKey variables to match your RA credentials.\n" ); } - const authorization = buildAuthorization({ userName, webApiKey }); + const authorization = buildAuthorization({ username, webApiKey }); const achievementCount = await getAchievementCount(authorization, { gameId: 14_402, diff --git a/src/achievement/getAchievementUnlocks.test.ts b/src/achievement/getAchievementUnlocks.test.ts index 0a7296e..cbfe1fb 100644 --- a/src/achievement/getAchievementUnlocks.test.ts +++ b/src/achievement/getAchievementUnlocks.test.ts @@ -22,7 +22,7 @@ describe("Function: getAchievementUnlocks", () => { it("retrieves metadata about unlocks for a target achievement", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/achievement/getAchievementUnlocks.ts b/src/achievement/getAchievementUnlocks.ts index 978a8d9..6e76af2 100644 --- a/src/achievement/getAchievementUnlocks.ts +++ b/src/achievement/getAchievementUnlocks.ts @@ -15,7 +15,7 @@ import type { * A call to this function will retrieve a list of users who * have earned a given achievement, targeted by the achievement's ID. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.achievementId The target achievement we want to diff --git a/src/console/getConsoleIds.test.ts b/src/console/getConsoleIds.test.ts index 0b614bf..5906fe3 100644 --- a/src/console/getConsoleIds.test.ts +++ b/src/console/getConsoleIds.test.ts @@ -24,7 +24,7 @@ describe("Function: getConsoleIds", () => { it("retrieves a list of console IDs and their names and cleans properties", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/console/getConsoleIds.ts b/src/console/getConsoleIds.ts index bb6f074..7ee91a6 100644 --- a/src/console/getConsoleIds.ts +++ b/src/console/getConsoleIds.ts @@ -12,7 +12,7 @@ import type { ConsoleId, GetConsoleIdsResponse } from "./models"; * of console ID and name pairs on the RetroAchievements.org * platform. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @example diff --git a/src/console/getGameList.test.ts b/src/console/getGameList.test.ts index 7b13f94..06adeda 100644 --- a/src/console/getGameList.test.ts +++ b/src/console/getGameList.test.ts @@ -24,7 +24,7 @@ describe("Function: getGameList", () => { it("retrieves a list of games and cleans their properties", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/console/getGameList.ts b/src/console/getGameList.ts index 6008682..c5c761a 100644 --- a/src/console/getGameList.ts +++ b/src/console/getGameList.ts @@ -12,7 +12,7 @@ import type { GameList, GetGameListResponse } from "./models"; * of games for a specified console on the RetroAchievements.org * platform. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.consoleId The unique console ID to retrieve a list of diff --git a/src/feed/getAchievementOfTheWeek.test.ts b/src/feed/getAchievementOfTheWeek.test.ts index 9d2c16a..128ae70 100644 --- a/src/feed/getAchievementOfTheWeek.test.ts +++ b/src/feed/getAchievementOfTheWeek.test.ts @@ -27,7 +27,7 @@ describe("Function: getAchievementOfTheWeek", () => { it("retrieves metadata about the current achievement of the week and cleans properties", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -105,7 +105,7 @@ describe("Function: getAchievementOfTheWeek", () => { it("properly sets the hardcore boolean value when cleaning properties", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/feed/getAchievementOfTheWeek.ts b/src/feed/getAchievementOfTheWeek.ts index fa877f7..bfedbee 100644 --- a/src/feed/getAchievementOfTheWeek.ts +++ b/src/feed/getAchievementOfTheWeek.ts @@ -14,7 +14,7 @@ import type { * A call to this function will retrieve comprehensive * metadata about the current Achievement of the Week. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @example diff --git a/src/feed/getActiveClaims.test.ts b/src/feed/getActiveClaims.test.ts index 500ed4a..25cc266 100644 --- a/src/feed/getActiveClaims.test.ts +++ b/src/feed/getActiveClaims.test.ts @@ -24,7 +24,7 @@ describe("Function: getActiveClaims", () => { it("retrieves metadata about current active claims", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/feed/getActiveClaims.ts b/src/feed/getActiveClaims.ts index 2846438..ab9bac9 100644 --- a/src/feed/getActiveClaims.ts +++ b/src/feed/getActiveClaims.ts @@ -11,7 +11,7 @@ import type { GetSetClaimsResponse, SetClaim } from "./models"; * A call to this function returns information about all * (1000 max) active set claims. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @example diff --git a/src/feed/getClaims.test.ts b/src/feed/getClaims.test.ts index 26506d9..2007068 100644 --- a/src/feed/getClaims.test.ts +++ b/src/feed/getClaims.test.ts @@ -24,7 +24,7 @@ describe("Function: getClaims", () => { it("retrieves metadata about a requested kind of claims", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/feed/getTopTenUsers.test.ts b/src/feed/getTopTenUsers.test.ts index 5680b1e..0b9e0dc 100644 --- a/src/feed/getTopTenUsers.test.ts +++ b/src/feed/getTopTenUsers.test.ts @@ -22,7 +22,7 @@ describe("Function: getTopTenUsers", () => { it("retrieves metadata about the current top ten users on the site", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -51,48 +51,48 @@ describe("Function: getTopTenUsers", () => { // ASSERT expect(response).toEqual([ { - userName: "MaxMilyin", + username: "MaxMilyin", totalPoints: 346_289, totalRatioPoints: 995_092, }, { - userName: "HippopotamusRex", + username: "HippopotamusRex", totalPoints: 312_118, totalRatioPoints: 1_151_351, }, { - userName: "Sarconius", + username: "Sarconius", totalPoints: 257_862, totalRatioPoints: 1_181_770, }, - { userName: "guineu", totalPoints: 241_623, totalRatioPoints: 672_597 }, + { username: "guineu", totalPoints: 241_623, totalRatioPoints: 672_597 }, { - userName: "Andrey199650", + username: "Andrey199650", totalPoints: 240_101, totalRatioPoints: 567_522, }, { - userName: "Wendigo", + username: "Wendigo", totalPoints: 227_903, totalRatioPoints: 1_099_685, }, { - userName: "donutweegee", + username: "donutweegee", totalPoints: 204_701, totalRatioPoints: 587_221, }, { - userName: "AmericanNinja", + username: "AmericanNinja", totalPoints: 202_980, totalRatioPoints: 567_618, }, { - userName: "Infernum", + username: "Infernum", totalPoints: 202_171, totalRatioPoints: 689_967, }, { - userName: "FabricioPrie", + username: "FabricioPrie", totalPoints: 196_974, totalRatioPoints: 450_436, }, diff --git a/src/feed/getTopTenUsers.ts b/src/feed/getTopTenUsers.ts index cd2244c..d7bad0a 100644 --- a/src/feed/getTopTenUsers.ts +++ b/src/feed/getTopTenUsers.ts @@ -10,7 +10,7 @@ import type { * A call to this function will retrieve the current top ten users * on the site. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @example @@ -21,8 +21,8 @@ import type { * @returns An array containing the list of top ten users. * ```json * [ - * { userName: "MockUser", totalPoints: 350000, totalRatioPoints: 995000 }, - * { userName: "MockUser2", totalPoints: 345000, totalRatioPoints: 994000 }, + * { username: "MockUser", totalPoints: 350000, totalRatioPoints: 995000 }, + * { username: "MockUser2", totalPoints: 345000, totalRatioPoints: 994000 }, * // ... * ] * ``` @@ -41,7 +41,7 @@ export const getTopTenUsers = async ( const sanitizedTopTenUsers: TopTenUsersEntity[] = []; for (const rawUser of rawTopTenUsers) { sanitizedTopTenUsers.push({ - userName: rawUser["1"], + username: rawUser["1"], totalPoints: Number(rawUser["2"]), totalRatioPoints: Number(rawUser["3"]), }); diff --git a/src/feed/models/top-ten-users-entity.model.ts b/src/feed/models/top-ten-users-entity.model.ts index 9e522c5..bcd9f6e 100644 --- a/src/feed/models/top-ten-users-entity.model.ts +++ b/src/feed/models/top-ten-users-entity.model.ts @@ -1,5 +1,5 @@ export interface TopTenUsersEntity { - userName: string; + username: string; totalPoints: number; totalRatioPoints: number; } diff --git a/src/game/getAchievementCount.test.ts b/src/game/getAchievementCount.test.ts index 2087cb0..0a4ed73 100644 --- a/src/game/getAchievementCount.test.ts +++ b/src/game/getAchievementCount.test.ts @@ -22,7 +22,7 @@ describe("Function: getAchievementCount", () => { it("given a game ID, retrieves the list of achievement IDs associated with the game and cleans properties", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/game/getAchievementCount.ts b/src/game/getAchievementCount.ts index 72c691f..f952fb6 100644 --- a/src/game/getAchievementCount.ts +++ b/src/game/getAchievementCount.ts @@ -12,7 +12,7 @@ import type { AchievementCount, GetAchievementCountResponse } from "./models"; * A call to this function will retrieve the list of * achievement IDs for a game, targeted by game ID. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.gameId The unique game ID. If you are unsure, open the diff --git a/src/game/getAchievementDistribution.test.ts b/src/game/getAchievementDistribution.test.ts index 7ff4853..acfbe0c 100644 --- a/src/game/getAchievementDistribution.test.ts +++ b/src/game/getAchievementDistribution.test.ts @@ -23,7 +23,7 @@ describe("Function: getAchievementDistribution", () => { it("given a game ID, retrieves the achievement distribution associated with the game", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -61,7 +61,7 @@ describe("Function: getAchievementDistribution", () => { it("given flags, successfully attaches the option to the call", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -101,7 +101,7 @@ describe("Function: getAchievementDistribution", () => { it("given a truthy hardcore value, successfully attaches the option to the call", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -138,7 +138,7 @@ describe("Function: getAchievementDistribution", () => { it("given a falsy hardcore value, successfully attaches the option to the call", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/game/getAchievementDistribution.ts b/src/game/getAchievementDistribution.ts index 5a85997..88acc26 100644 --- a/src/game/getAchievementDistribution.ts +++ b/src/game/getAchievementDistribution.ts @@ -11,7 +11,7 @@ import type { * of the number of players who have earned a specific * number of achievements for a given game ID. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.gameId The unique game ID. If you are unsure, open the diff --git a/src/game/getGame.test.ts b/src/game/getGame.test.ts index a906fe5..f29e244 100644 --- a/src/game/getGame.test.ts +++ b/src/game/getGame.test.ts @@ -24,7 +24,7 @@ describe("Function: getGame", () => { it("given a game ID, retrieves basic metadata about the game", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/game/getGame.ts b/src/game/getGame.ts index 17e127a..4f2e6f7 100644 --- a/src/game/getGame.ts +++ b/src/game/getGame.ts @@ -12,7 +12,7 @@ import type { Game, GetGameResponse } from "./models"; * A call to this function will retrieve basic metadata about * a game, targeted via its unique ID. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.gameId The unique game ID. If you are unsure, open the diff --git a/src/game/getGameExtended.test.ts b/src/game/getGameExtended.test.ts index 23ec396..590b6ff 100644 --- a/src/game/getGameExtended.test.ts +++ b/src/game/getGameExtended.test.ts @@ -24,7 +24,7 @@ describe("Function: getGameExtended", () => { it("given a game ID, retrieves extended metadata about the game", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/game/getGameExtended.ts b/src/game/getGameExtended.ts index 053981c..37da0b0 100644 --- a/src/game/getGameExtended.ts +++ b/src/game/getGameExtended.ts @@ -12,7 +12,7 @@ import type { GameExtended, GetGameExtendedResponse } from "./models"; * A call to this function will retrieve extended metadata * about a game, targeted via its unique ID. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.gameId The unique game ID. If you are unsure, open the diff --git a/src/game/getGameRankAndScore.test.ts b/src/game/getGameRankAndScore.test.ts index 5c6d60b..5a24b67 100644 --- a/src/game/getGameRankAndScore.test.ts +++ b/src/game/getGameRankAndScore.test.ts @@ -24,7 +24,7 @@ describe("Function: getGameRankAndScore", () => { it("given a game ID, retrieves metadata about latest masteries for a game", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/game/getGameRankAndScore.ts b/src/game/getGameRankAndScore.ts index 78726e5..7d8367d 100644 --- a/src/game/getGameRankAndScore.ts +++ b/src/game/getGameRankAndScore.ts @@ -17,7 +17,7 @@ import type { * points earners for a game. The game is targeted via * its unique ID. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.gameId The unique game ID. If you are unsure, open the diff --git a/src/game/getGameRating.test.ts b/src/game/getGameRating.test.ts index e1ed339..a569112 100644 --- a/src/game/getGameRating.test.ts +++ b/src/game/getGameRating.test.ts @@ -22,7 +22,7 @@ describe("Function: getGameRating", () => { it("given a game ID, retrieves metadata about how users have rated it", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/game/getGameRating.ts b/src/game/getGameRating.ts index 99ff07f..a0dd400 100644 --- a/src/game/getGameRating.ts +++ b/src/game/getGameRating.ts @@ -12,7 +12,7 @@ import type { GameRating, GetGameRatingResponse } from "./models"; * A call to this function will retrieve metadata about * how users have rated the game and its set. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.gameId The unique game ID. If you are unsure, open the diff --git a/src/ticket/getTicketData.test.ts b/src/ticket/getTicketData.test.ts index 8e4e751..7102bb4 100644 --- a/src/ticket/getTicketData.test.ts +++ b/src/ticket/getTicketData.test.ts @@ -28,7 +28,7 @@ describe("Function: getTicketData", () => { it("given only a ticket ID, retrieves ticket data", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -96,7 +96,7 @@ describe("Function: getTicketData", () => { it("given no IDs, retrieves a list of recent tickets", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -184,7 +184,7 @@ describe("Function: getTicketData", () => { it("can retrieve a list of the most ticketed games", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -244,7 +244,7 @@ describe("Function: getTicketData", () => { it("can retrieve metadata about a user's tickets", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -264,7 +264,7 @@ describe("Function: getTicketData", () => { ); // ACT - const response = await getTicketData(authorization, { userName: "xelnia" }); + const response = await getTicketData(authorization, { username: "xelnia" }); // ASSERT expect(response).toEqual({ @@ -280,7 +280,7 @@ describe("Function: getTicketData", () => { it("can retrieve metadata about a game's tickets", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -314,7 +314,7 @@ describe("Function: getTicketData", () => { it("can retrieve metadata about an achievement's tickets", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); diff --git a/src/ticket/getTicketData.ts b/src/ticket/getTicketData.ts index 4593546..98e5e39 100644 --- a/src/ticket/getTicketData.ts +++ b/src/ticket/getTicketData.ts @@ -20,7 +20,7 @@ interface GetTicketDataAllPayloadValues { offset?: number; count?: number; isGettingMostTicketedGames?: true; - userName?: string; + username?: string; gameId?: string | number; isGettingTicketsForUnofficialAchievements?: true; shouldReturnTicketsList?: true; @@ -35,7 +35,7 @@ interface GetTicketDataAllPayloadValues { * A call to this function will retrieve ticket metadata information * about a single achievement ticket, targeted by its ticket ID. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.ticketId The ID of the ticket to get information about. @@ -59,7 +59,7 @@ export function getTicketData( * A call to this function will retrieve ticket metadata information * about the latest opened achievement tickets on RetroAchievements. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.count Optional. Defaults to 10. Max is 100. @@ -84,7 +84,7 @@ export function getTicketData( * A call to this function will retrieve the games on the site with * the highest count of opened achievement tickets. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.count Optional. Defaults to 10. Max is 100. @@ -112,17 +112,17 @@ export function getTicketData( * A call to this function will retrieve an achievement developer's * ticket stats, targeted by that developer's username. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The developer's account username to retrieve + * @param payload.username The developer's account username to retrieve * ticket stats for. * * @example * ``` * const ticketData = await getTicketData( * authorization, - * { userName: "xelnia" } + * { username: "xelnia" } * ); * ``` * @@ -130,7 +130,7 @@ export function getTicketData( */ export function getTicketData( authorization: AuthObject, - payload: { userName: string } + payload: { username: string } ): Promise; /** @@ -138,7 +138,7 @@ export function getTicketData( * by the game's ID. If you are unsure of a game's ID, visit its page * on the RetroAchievements website and copy the number at the end of the URL. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.gameId The game ID to fetch ticket stats for. @@ -174,7 +174,7 @@ export function getTicketData( * of an achievement's ID, open its page on the RetroAchievements * website and copy the number at the end of the URL. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.achievementId The ID of the achievement to fetch ticket @@ -234,7 +234,7 @@ const buildGetTicketDataQueryParams = ( const { ticketId, isGettingMostTicketedGames, - userName, + username, gameId, isGettingTicketsForUnofficialAchievements, shouldReturnTicketsList, @@ -248,8 +248,8 @@ const buildGetTicketDataQueryParams = ( } else if (isGettingMostTicketedGames) { queryParams["f"] = "1"; queryParams = applyPaginationQueryParams(queryParams, payload); - } else if (userName) { - queryParams["u"] = userName; + } else if (username) { + queryParams["u"] = username; } else if (gameId) { queryParams["g"] = gameId; diff --git a/src/user/getAchievementsEarnedBetween.test.ts b/src/user/getAchievementsEarnedBetween.test.ts index b4304db..7c47819 100644 --- a/src/user/getAchievementsEarnedBetween.test.ts +++ b/src/user/getAchievementsEarnedBetween.test.ts @@ -25,7 +25,7 @@ describe("Function: getAchievementsEarnedBetween", () => { it("retrieves a list of user achievements earned between a set of dates", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -58,7 +58,7 @@ describe("Function: getAchievementsEarnedBetween", () => { // ACT const response = await getAchievementsEarnedBetween(authorization, { - userName: "xelnia", + username: "xelnia", fromDate: new Date("2022-10-12"), toDate: new Date("2022-10-13"), }); diff --git a/src/user/getAchievementsEarnedBetween.ts b/src/user/getAchievementsEarnedBetween.ts index 03368be..a496b22 100644 --- a/src/user/getAchievementsEarnedBetween.ts +++ b/src/user/getAchievementsEarnedBetween.ts @@ -14,10 +14,10 @@ import type { * A call to this function will retrieve a list of achievements * earned by a given user between two provided dates. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the + * @param payload.username The user for which to retrieve the * list of achievements for. * * @param payload.fromDate A Date object specifying when @@ -31,7 +31,7 @@ import type { * const achievementsEarnedBetween = await getAchievementsEarnedBetween( * authorization, * { - * userName: "xelnia", + * username: "xelnia", * fromDate: new Date("2022-10-12"), * toDate: new Date("2022-10-13") * } @@ -65,16 +65,16 @@ import type { */ export const getAchievementsEarnedBetween = async ( authorization: AuthObject, - payload: { userName: string; fromDate: Date; toDate: Date } + payload: { username: string; fromDate: Date; toDate: Date } ): Promise => { - const { userName, fromDate, toDate } = payload; + const { username, fromDate, toDate } = payload; const url = buildRequestUrl( apiBaseUrl, "/API_GetAchievementsEarnedBetween.php", authorization, { - u: userName, + u: username, f: (fromDate.getTime() / 1000).toFixed(0), t: (toDate.getTime() / 1000).toFixed(0), } diff --git a/src/user/getAchievementsEarnedOnDay.test.ts b/src/user/getAchievementsEarnedOnDay.test.ts index 6a3ccba..ea856f2 100644 --- a/src/user/getAchievementsEarnedOnDay.test.ts +++ b/src/user/getAchievementsEarnedOnDay.test.ts @@ -25,7 +25,7 @@ describe("Function: getAchievementsEarnedOnDay", () => { it("retrieves a list of user achievements earned on a specified date", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -58,7 +58,7 @@ describe("Function: getAchievementsEarnedOnDay", () => { // ACT const response = await getAchievementsEarnedOnDay(authorization, { - userName: "xelnia", + username: "xelnia", onDate: new Date("2022-10-12"), }); diff --git a/src/user/getAchievementsEarnedOnDay.ts b/src/user/getAchievementsEarnedOnDay.ts index 890cbc7..8867b8d 100644 --- a/src/user/getAchievementsEarnedOnDay.ts +++ b/src/user/getAchievementsEarnedOnDay.ts @@ -14,10 +14,10 @@ import type { * A call to this function will retrieve a list of achievements * earned by a given user on a specified date. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the + * @param payload.username The user for which to retrieve the * list of achievements for. * * @param payload.fromDate A Date object specifying when @@ -31,7 +31,7 @@ import type { * const achievementsEarnedOnDay = await getAchievementsEarnedOnDay( * authorization, * { - * userName: "xelnia", + * username: "xelnia", * onDate: new Date("2022-10-13") * } * ); @@ -64,16 +64,16 @@ import type { */ export const getAchievementsEarnedOnDay = async ( authorization: AuthObject, - payload: { userName: string; onDate: Date } + payload: { username: string; onDate: Date } ): Promise => { - const { userName, onDate } = payload; + const { username, onDate } = payload; const url = buildRequestUrl( apiBaseUrl, "/API_GetAchievementsEarnedOnDay.php", authorization, { - u: userName, + u: username, // YYYY-MM-DD d: `${onDate.getFullYear()}-${onDate.getMonth() + 1}-${onDate.getDate()}`, } diff --git a/src/user/getGameInfoAndUserProgress.test.ts b/src/user/getGameInfoAndUserProgress.test.ts index 03ee518..4d0a73a 100644 --- a/src/user/getGameInfoAndUserProgress.test.ts +++ b/src/user/getGameInfoAndUserProgress.test.ts @@ -24,7 +24,7 @@ describe("Function: getGameInfoAndUserProgress", () => { it("given a game ID and a username, retrieves extended metadata about the game and that user`s progress", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -82,7 +82,7 @@ describe("Function: getGameInfoAndUserProgress", () => { // ACT const response = await getGameInfoAndUserProgress(authorization, { gameId: 14_402, - userName: "xelnia", + username: "xelnia", }); // ASSERT diff --git a/src/user/getGameInfoAndUserProgress.ts b/src/user/getGameInfoAndUserProgress.ts index 57e1c88..d383a0b 100644 --- a/src/user/getGameInfoAndUserProgress.ts +++ b/src/user/getGameInfoAndUserProgress.ts @@ -16,7 +16,7 @@ import type { * about a game, in addition to a user's progress about a game. * This is targeted via a game's unique ID and a given username. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.gameId The unique game ID. If you are unsure, open the @@ -24,14 +24,14 @@ import type { * URL is https://retroachievements.org/game/14402. We can see from the * URL that the game ID is "14402". * - * @param payload.userName The user for which to retrieve the + * @param payload.username The user for which to retrieve the * game progress for. * * @example * ``` * const gameInfoAndUserProgress = await getGameInfoAndUserProgress( * authorization, - * { gameId: 14402, userName: "wv_pinball" } + * { gameId: 14402, username: "wv_pinball" } * ); * ``` * @@ -87,9 +87,9 @@ import type { */ export const getGameInfoAndUserProgress = async ( authorization: AuthObject, - payload: { gameId: ID; userName: string } + payload: { gameId: ID; username: string } ): Promise => { - const { gameId, userName } = payload; + const { gameId, username } = payload; const url = buildRequestUrl( apiBaseUrl, @@ -97,7 +97,7 @@ export const getGameInfoAndUserProgress = async ( authorization, { g: gameId, - u: userName, + u: username, } ); diff --git a/src/user/getUserAwards.test.ts b/src/user/getUserAwards.test.ts index 94a7541..b420c8f 100644 --- a/src/user/getUserAwards.test.ts +++ b/src/user/getUserAwards.test.ts @@ -22,7 +22,7 @@ describe("Function: getUserAwards", () => { it("retrieves a list of a target user awards", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -57,7 +57,7 @@ describe("Function: getUserAwards", () => { ); // ACT - const response = await getUserAwards(authorization, { userName: "xelnia" }); + const response = await getUserAwards(authorization, { username: "xelnia" }); // ASSERT expect(response).toEqual({ diff --git a/src/user/getUserAwards.ts b/src/user/getUserAwards.ts index 6a3638d..b45f9eb 100644 --- a/src/user/getUserAwards.ts +++ b/src/user/getUserAwards.ts @@ -11,16 +11,16 @@ import type { GetUserAwardsResponse, UserAwards } from "./models"; * A call to this function will retrieve metadata about the target user's * site awards, via their username. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the site awards for. + * @param payload.username The user for which to retrieve the site awards for. * * @example * ``` * const userAwards = await getUserAwards( * authorization, - * { userName: "xelnia" } + * { username: "xelnia" } * ) * ``` * @@ -53,11 +53,11 @@ import type { GetUserAwardsResponse, UserAwards } from "./models"; */ export const getUserAwards = async ( authorization: AuthObject, - payload: { userName: string } + payload: { username: string } ): Promise => { - const { userName } = payload; + const { username } = payload; - const queryParams: Record = { u: userName }; + const queryParams: Record = { u: username }; const url = buildRequestUrl( apiBaseUrl, diff --git a/src/user/getUserClaims.test.ts b/src/user/getUserClaims.test.ts index bb9b850..6a1ef0b 100644 --- a/src/user/getUserClaims.test.ts +++ b/src/user/getUserClaims.test.ts @@ -23,7 +23,7 @@ describe("Function: getUserClaims", () => { it("given a username, retrieves a list of achievement set claims for the user", async () => { const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -55,7 +55,7 @@ describe("Function: getUserClaims", () => { // ACT const response = await getUserClaims(authorization, { - userName: "Jamiras", + username: "Jamiras", }); // ASSERT diff --git a/src/user/getUserClaims.ts b/src/user/getUserClaims.ts index d47d5f1..c4c4f71 100644 --- a/src/user/getUserClaims.ts +++ b/src/user/getUserClaims.ts @@ -12,17 +12,17 @@ import type { GetUserClaimsResponse, UserClaims } from "./models"; * achievement set claims made over the lifetime of a given * user, targeted by their username. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the historical + * @param payload.username The user for which to retrieve the historical * achievement set claims list for. * * @example * ``` * const userClaims = await getUserClaims( * authorization, - * { userName: "Jamiras" } + * { username: "Jamiras" } * ); * ``` * @@ -31,15 +31,15 @@ import type { GetUserClaimsResponse, UserClaims } from "./models"; */ export const getUserClaims = async ( authorization: AuthObject, - payload: { userName: string } + payload: { username: string } ): Promise => { - const { userName } = payload; + const { username } = payload; const url = buildRequestUrl( apiBaseUrl, "/API_GetUserClaims.php", authorization, - { u: userName } + { u: username } ); const rawResponse = await call({ url }); diff --git a/src/user/getUserCompletedGames.test.ts b/src/user/getUserCompletedGames.test.ts index d062c2c..9bd781a 100644 --- a/src/user/getUserCompletedGames.test.ts +++ b/src/user/getUserCompletedGames.test.ts @@ -24,7 +24,7 @@ describe("Function: getUserCompletedGames", () => { it("given a username, returns completion metadata", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -61,7 +61,7 @@ describe("Function: getUserCompletedGames", () => { // ACT const response = await getUserCompletedGames(authorization, { - userName: "xelnia", + username: "xelnia", }); // ASSERT diff --git a/src/user/getUserCompletedGames.ts b/src/user/getUserCompletedGames.ts index c675a0e..e37679e 100644 --- a/src/user/getUserCompletedGames.ts +++ b/src/user/getUserCompletedGames.ts @@ -17,17 +17,17 @@ import type { * one for the hardcore completion. These are designated by * the `hardcoreMode` property on each completion object. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the + * @param payload.username The user for which to retrieve the * completion metadata for. * * @example * ``` * const userCompletedGames = await getUserCompletedGames( * authorization, - * { userName: "xelnia" } + * { username: "xelnia" } * ); * ``` * @@ -63,15 +63,15 @@ import type { */ export const getUserCompletedGames = async ( authorization: AuthObject, - payload: { userName: string } + payload: { username: string } ): Promise => { - const { userName } = payload; + const { username } = payload; const url = buildRequestUrl( apiBaseUrl, "/API_GetUserCompletedGames.php", authorization, - { u: userName } + { u: username } ); const rawResponse = await call({ url }); diff --git a/src/user/getUserCompletionProgress.test.ts b/src/user/getUserCompletionProgress.test.ts index 16efff0..b50b985 100644 --- a/src/user/getUserCompletionProgress.test.ts +++ b/src/user/getUserCompletionProgress.test.ts @@ -22,7 +22,7 @@ describe("Function: getUserCompletionProgress", () => { it("retrieves completion progress by username", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -54,7 +54,7 @@ describe("Function: getUserCompletionProgress", () => { // ACT const response = await getUserCompletionProgress(authorization, { - userName: "xelnia", + username: "xelnia", }); // ASSERT diff --git a/src/user/getUserCompletionProgress.ts b/src/user/getUserCompletionProgress.ts index 3802051..a888035 100644 --- a/src/user/getUserCompletionProgress.ts +++ b/src/user/getUserCompletionProgress.ts @@ -14,10 +14,10 @@ import type { * A call to this function will retrieve a given user's completion * progress, targeted by their username. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the progress for. + * @param payload.username The user for which to retrieve the progress for. * * @param payload.offset Defaults to 0. The number of entries to skip. * @@ -27,7 +27,7 @@ import type { * ``` * const userCompletionProgress = await getUserCompletionProgress( * authorization, - * { userName: "xelnia" } + * { username: "xelnia" } * ); * ``` * @@ -56,12 +56,12 @@ import type { */ export const getUserCompletionProgress = async ( authorization: AuthObject, - payload: { userName: string; offset?: number; count?: number } + payload: { username: string; offset?: number; count?: number } ): Promise => { - const { userName, offset, count } = payload; + const { username, offset, count } = payload; const params: Record = { - u: userName, + u: username, }; if (offset) { params["o"] = offset; diff --git a/src/user/getUserGameRankAndScore.test.ts b/src/user/getUserGameRankAndScore.test.ts index bfe4c48..349d09d 100644 --- a/src/user/getUserGameRankAndScore.test.ts +++ b/src/user/getUserGameRankAndScore.test.ts @@ -22,7 +22,7 @@ describe("Function: getUserGameRankAndScore", () => { it("given a game ID and a user name, retrieves metadata about how that user ranks on the given game", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -43,7 +43,7 @@ describe("Function: getUserGameRankAndScore", () => { // ACT const response = await getUserGameRankAndScore(authorization, { - userName: "xelnia", + username: "xelnia", gameId: 14_402, }); diff --git a/src/user/getUserGameRankAndScore.ts b/src/user/getUserGameRankAndScore.ts index 1fab4f4..77aabd6 100644 --- a/src/user/getUserGameRankAndScore.ts +++ b/src/user/getUserGameRankAndScore.ts @@ -16,7 +16,7 @@ import type { * how a particular user has performed/ranked on a particular * game, targeted by game ID. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * * @param payload.gameId The unique game ID. If you are unsure, open the @@ -24,14 +24,14 @@ import type { * URL is https://retroachievements.org/game/14402. We can see from the * URL that the game ID is "14402". * - * @param payload.userName The user for which to retrieve the + * @param payload.username The user for which to retrieve the * game ranking metadata for. * * @example * ``` * const userGameRankAndScore = await getUserGameRankAndScore( * authorization, - * { gameId: 14402, userName: "xelnia" } + * { gameId: 14402, username: "xelnia" } * ); * ``` * @@ -51,15 +51,15 @@ import type { */ export const getUserGameRankAndScore = async ( authorization: AuthObject, - payload: { gameId: ID; userName: string } + payload: { gameId: ID; username: string } ): Promise => { - const { gameId, userName } = payload; + const { gameId, username } = payload; const url = buildRequestUrl( apiBaseUrl, "/API_GetUserGameRankAndScore.php", authorization, - { g: gameId, u: userName } + { g: gameId, u: username } ); const rawResponse = await call({ url }); diff --git a/src/user/getUserPoints.test.ts b/src/user/getUserPoints.test.ts index 3718434..48f95b3 100644 --- a/src/user/getUserPoints.test.ts +++ b/src/user/getUserPoints.test.ts @@ -22,7 +22,7 @@ describe("Function: getUserPoints", () => { it("given a username, retrieves the point values associated with the user", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -38,7 +38,7 @@ describe("Function: getUserPoints", () => { ); // ACT - const response = await getUserPoints(authorization, { userName: "xelnia" }); + const response = await getUserPoints(authorization, { username: "xelnia" }); // ASSERT expect(response).toEqual({ diff --git a/src/user/getUserPoints.ts b/src/user/getUserPoints.ts index d9f7725..2b75e37 100644 --- a/src/user/getUserPoints.ts +++ b/src/user/getUserPoints.ts @@ -11,16 +11,16 @@ import type { GetUserPointsResponse, UserPoints } from "./models"; * A call to this function will retrieve a given user's hardcore * and softcore points. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the point totals for. + * @param payload.username The user for which to retrieve the point totals for. * * @example * ``` * const userPoints = await getUserPoints( * authorization, - * { userName: "xelnia" } + * { username: "xelnia" } * ); * ``` * @@ -34,15 +34,15 @@ import type { GetUserPointsResponse, UserPoints } from "./models"; */ export const getUserPoints = async ( authorization: AuthObject, - payload: { userName: string } + payload: { username: string } ): Promise => { - const { userName } = payload; + const { username } = payload; const url = buildRequestUrl( apiBaseUrl, "/API_GetUserPoints.php", authorization, - { u: userName } + { u: username } ); const rawResponse = await call({ url }); diff --git a/src/user/getUserProfile.test.ts b/src/user/getUserProfile.test.ts index d52cc4a..e908223 100644 --- a/src/user/getUserProfile.test.ts +++ b/src/user/getUserProfile.test.ts @@ -22,7 +22,7 @@ describe("Function: getUserProfile", () => { it("given a username, retrieves minimal user profile information about the user", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -53,7 +53,7 @@ describe("Function: getUserProfile", () => { // ACT const response = await getUserProfile(authorization, { - userName: "WCopeland", + username: "WCopeland", }); // ASSERT diff --git a/src/user/getUserProfile.ts b/src/user/getUserProfile.ts index a6879c2..2e6b4eb 100644 --- a/src/user/getUserProfile.ts +++ b/src/user/getUserProfile.ts @@ -11,16 +11,16 @@ import type { GetUserProfileResponse, UserProfile } from "./models"; * A call to this function will retrieve summary information about * a given user, targeted by username. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the summary for. + * @param payload.username The user for which to retrieve the summary for. * * @example * ``` * const userSummary = await getUserProfile( * authorization, - * { userName: "xelnia" } + * { username: "xelnia" } * ); * ``` * @@ -29,16 +29,16 @@ import type { GetUserProfileResponse, UserProfile } from "./models"; export const getUserProfile = async ( authorization: AuthObject, payload: { - userName: string; + username: string; } ): Promise => { - const { userName } = payload; + const { username } = payload; const url = buildRequestUrl( apiBaseUrl, "/API_GetUserProfile.php", authorization, - { u: userName } + { u: username } ); const rawResponse = await call({ url }); diff --git a/src/user/getUserProgress.test.ts b/src/user/getUserProgress.test.ts index 298a7e1..6551cfd 100644 --- a/src/user/getUserProgress.test.ts +++ b/src/user/getUserProgress.test.ts @@ -22,7 +22,7 @@ describe("Function: getUserProgress", () => { it(`retrieves a map of a user's progress by game IDs`, async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -53,7 +53,7 @@ describe("Function: getUserProgress", () => { // ACT const response = await getUserProgress(authorization, { - userName: "xelnia", + username: "xelnia", gameIds: [1, 14_402], }); diff --git a/src/user/getUserProgress.ts b/src/user/getUserProgress.ts index 30a7b09..a06cae1 100644 --- a/src/user/getUserProgress.ts +++ b/src/user/getUserProgress.ts @@ -12,10 +12,10 @@ import type { GetUserProgressResponse, UserProgress } from "./models"; * A call to this function will retrieve a given user's * progress on a given list of games, targeted by game ID. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the progress for. + * @param payload.username The user for which to retrieve the progress for. * * @param payload.gameIds An array of RetroAchievements game IDs. If you aren't * sure of the game ID, visit the game's page on the website and copy the number @@ -25,7 +25,7 @@ import type { GetUserProgressResponse, UserProgress } from "./models"; * ``` * const userProgress = await getUserProgress( * authorization, - * { userName: "xelnia", gameIds: [1, 14402] } + * { username: "xelnia", gameIds: [1, 14402] } * ); * ``` * @@ -53,15 +53,15 @@ import type { GetUserProgressResponse, UserProgress } from "./models"; */ export const getUserProgress = async ( authorization: AuthObject, - payload: { userName: string; gameIds: ID[] } + payload: { username: string; gameIds: ID[] } ): Promise => { - const { userName, gameIds } = payload; + const { username, gameIds } = payload; const url = buildRequestUrl( apiBaseUrl, "/API_GetUserProgress.php", authorization, - { u: userName, i: gameIds.join(",") } + { u: username, i: gameIds.join(",") } ); const rawResponse = await call({ url }); diff --git a/src/user/getUserRecentAchievements.test.ts b/src/user/getUserRecentAchievements.test.ts index 3352e94..3f9af47 100644 --- a/src/user/getUserRecentAchievements.test.ts +++ b/src/user/getUserRecentAchievements.test.ts @@ -22,7 +22,7 @@ describe("Function: getUserRecentAchievements", () => { it("retrieves a list of recently-earned user achievements", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -54,7 +54,7 @@ describe("Function: getUserRecentAchievements", () => { // ACT const response = await getUserRecentAchievements(authorization, { - userName: "xelnia", + username: "xelnia", }); // ASSERT diff --git a/src/user/getUserRecentAchievements.ts b/src/user/getUserRecentAchievements.ts index 4738a42..eec65b4 100644 --- a/src/user/getUserRecentAchievements.ts +++ b/src/user/getUserRecentAchievements.ts @@ -15,10 +15,10 @@ import type { * recently earned achievements, via their username. By default, it * fetches achievements earned in the last hour. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the recent achievements for. + * @param payload.username The user for which to retrieve the recent achievements for. * * @param payload.recentMinutes Optional. Defaults to 60. How many minutes * back to fetch for the given user. @@ -27,7 +27,7 @@ import type { * ``` * const userRecentAchievements = await getUserRecentAchievements( * authorization, - * { userName: "xelnia" } + * { username: "xelnia" } * ); * ``` * @@ -55,11 +55,11 @@ import type { */ export const getUserRecentAchievements = async ( authorization: AuthObject, - payload: { userName: string; recentMinutes?: number } + payload: { username: string; recentMinutes?: number } ): Promise => { - const { userName, recentMinutes } = payload; + const { username, recentMinutes } = payload; - const queryParams: Record = { u: userName }; + const queryParams: Record = { u: username }; if (recentMinutes !== undefined) { queryParams["m"] = recentMinutes; diff --git a/src/user/getUserRecentlyPlayedGames.test.ts b/src/user/getUserRecentlyPlayedGames.test.ts index 6cd9d2c..7922838 100644 --- a/src/user/getUserRecentlyPlayedGames.test.ts +++ b/src/user/getUserRecentlyPlayedGames.test.ts @@ -22,7 +22,7 @@ describe("Function: getUserRecentlyPlayedGames", () => { it(`retrieves a list of a given user's recently played games`, async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -52,7 +52,7 @@ describe("Function: getUserRecentlyPlayedGames", () => { // ACT const response = await getUserRecentlyPlayedGames(authorization, { - userName: "xelnia", + username: "xelnia", }); // ASSERT diff --git a/src/user/getUserRecentlyPlayedGames.ts b/src/user/getUserRecentlyPlayedGames.ts index 9784ee0..47dbe62 100644 --- a/src/user/getUserRecentlyPlayedGames.ts +++ b/src/user/getUserRecentlyPlayedGames.ts @@ -14,10 +14,10 @@ import type { * A call to this function will retrieve a list of a target user's * recently played games, via their username. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the summary for. + * @param payload.username The user for which to retrieve the summary for. * * @param payload.count Optional. Defaults to 10. Max is 50. How many * recently played games for the user to retrieve. @@ -29,7 +29,7 @@ import type { * ``` * const userRecentlyPlayedGames = await getUserRecentlyPlayedGames( * authorization, - * { userName: "xelnia" } + * { username: "xelnia" } * ); * ``` * @@ -55,11 +55,11 @@ import type { */ export const getUserRecentlyPlayedGames = async ( authorization: AuthObject, - payload: { userName: string; offset?: number; count?: number } + payload: { username: string; offset?: number; count?: number } ): Promise => { - const { userName, offset, count } = payload; + const { username, offset, count } = payload; - const queryParams: Record = { u: userName }; + const queryParams: Record = { u: username }; if (offset !== undefined) { queryParams["o"] = offset; diff --git a/src/user/getUserSummary.test.ts b/src/user/getUserSummary.test.ts index fc7bb2f..0d7a754 100644 --- a/src/user/getUserSummary.test.ts +++ b/src/user/getUserSummary.test.ts @@ -24,7 +24,7 @@ describe("Function: getUserSummary", () => { it("given a username, retrieves user summary information about the user", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -38,7 +38,7 @@ describe("Function: getUserSummary", () => { // ACT const response = await getUserSummary(authorization, { - userName: "WCopeland", + username: "WCopeland", }); // ASSERT @@ -48,7 +48,7 @@ describe("Function: getUserSummary", () => { it("given the API returns a 503, throws an error", async () => { // ARRANGE const authorization = buildAuthorization({ - userName: "mockUserName", + username: "mockUserName", webApiKey: "mockWebApiKey", }); @@ -62,7 +62,7 @@ describe("Function: getUserSummary", () => { // ASSERT await expect( - getUserSummary(authorization, { userName: "WCopeland" }) + getUserSummary(authorization, { username: "WCopeland" }) ).rejects.toThrow(); }); }); diff --git a/src/user/getUserSummary.ts b/src/user/getUserSummary.ts index d5916de..e1176a1 100644 --- a/src/user/getUserSummary.ts +++ b/src/user/getUserSummary.ts @@ -11,10 +11,10 @@ import type { GetUserSummaryResponse, UserSummary } from "./models"; * A call to this function will retrieve summary information about * a given user, targeted by username. * - * @param authorization An object containing your userName and webApiKey. + * @param authorization An object containing your username and webApiKey. * This can be constructed with `buildAuthorization()`. * - * @param payload.userName The user for which to retrieve the summary for. + * @param payload.username The user for which to retrieve the summary for. * * @param payload.recentGamesCount Optional. The number of recent games to return. * This defaults to 0. @@ -26,7 +26,7 @@ import type { GetUserSummaryResponse, UserSummary } from "./models"; * ``` * const userSummary = await getUserSummary( * authorization, - * { userName: "xelnia" } + * { username: "xelnia" } * ); * ``` * @@ -35,14 +35,14 @@ import type { GetUserSummaryResponse, UserSummary } from "./models"; export const getUserSummary = async ( authorization: AuthObject, payload: { - userName: string; + username: string; recentGamesCount?: number; recentAchievementsCount?: number; } ): Promise => { - const { userName, recentGamesCount, recentAchievementsCount } = payload; + const { username, recentGamesCount, recentAchievementsCount } = payload; - const queryParams: Record = { u: userName }; + const queryParams: Record = { u: username }; if (recentGamesCount !== undefined) { queryParams["g"] = recentGamesCount; diff --git a/src/utils/internal/buildRequestUrl.test.ts b/src/utils/internal/buildRequestUrl.test.ts index e6e7511..decb453 100644 --- a/src/utils/internal/buildRequestUrl.test.ts +++ b/src/utils/internal/buildRequestUrl.test.ts @@ -22,7 +22,7 @@ describe("Util: buildRequestUrl", () => { const requestUrl = buildRequestUrl( baseUrl, endpointUrl, - { userName: "TestUser", webApiKey: "mockWebApiKey" }, + { username: "TestUser", webApiKey: "mockWebApiKey" }, args as any ); @@ -39,7 +39,7 @@ describe("Util: buildRequestUrl", () => { // ACT const requestUrl = buildRequestUrl(baseUrl, endpointUrl, { - userName: "TestUser", + username: "TestUser", webApiKey: "mockWebApiKey", }); diff --git a/src/utils/internal/buildRequestUrl.ts b/src/utils/internal/buildRequestUrl.ts index a8eed9e..0ab00ec 100644 --- a/src/utils/internal/buildRequestUrl.ts +++ b/src/utils/internal/buildRequestUrl.ts @@ -14,7 +14,7 @@ export const buildRequestUrl = ( // `z` and `y` are expected query params from the RA API. // Authentication is handled purely by query params. const queryParamValues: Record = { - z: authObject.userName, + z: authObject.username, y: authObject.webApiKey, }; diff --git a/src/utils/public/buildAuthorization.test.ts b/src/utils/public/buildAuthorization.test.ts index b3638fa..bb6b0a1 100644 --- a/src/utils/public/buildAuthorization.test.ts +++ b/src/utils/public/buildAuthorization.test.ts @@ -9,7 +9,7 @@ describe("Util: buildAuthorization", () => { it("returns the same object it is given", () => { // ARRANGE const myAuth = { - userName: "myUserName", + username: "myUserName", webApiKey: "myWebApiKey", }; @@ -20,7 +20,7 @@ describe("Util: buildAuthorization", () => { expect(authorization).toEqual(myAuth); }); - it("throws an error if missing a userName", () => { + it("throws an error if missing a username", () => { // ASSERT // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - We're assuming the user is not using a TypeScript project. @@ -31,6 +31,6 @@ describe("Util: buildAuthorization", () => { // ASSERT // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - We're assuming the user is not using a TypeScript project. - expect(() => buildAuthorization({ userName: "mockUserName" })).toThrow(); + expect(() => buildAuthorization({ username: "mockUserName" })).toThrow(); }); }); diff --git a/src/utils/public/buildAuthorization.ts b/src/utils/public/buildAuthorization.ts index 08fccf3..d95c007 100644 --- a/src/utils/public/buildAuthorization.ts +++ b/src/utils/public/buildAuthorization.ts @@ -15,19 +15,19 @@ import type { AuthObject } from "./models"; * @example * ``` * const authorization = buildAuthorization({ - * userName: "Scott", + * username: "Scott", * webApiKey: "LtjCwW16nJI7cqOyPIQtXk8v1cfF0tmO" * }); * ``` */ export const buildAuthorization = (options: AuthObject): AuthObject => { - if (!options.userName || !options.webApiKey) { + if (!options.username || !options.webApiKey) { throw new Error(` buildAuthorization() requires an object containing a - userName and webApiKey. eg: + username and webApiKey. eg: const authorization = buildAuthorization({ - userName: "myUserName", + username: "myUserName", webApiKey: "myWebApiKey" }) `); diff --git a/src/utils/public/models/auth-object.model.ts b/src/utils/public/models/auth-object.model.ts index ba2e859..c79f23a 100644 --- a/src/utils/public/models/auth-object.model.ts +++ b/src/utils/public/models/auth-object.model.ts @@ -1,6 +1,6 @@ /** * Each RetroAchievements API call is uniquely authenticated - * using a userName + API key combination. Your account's personal + * using a username + API key combination. Your account's personal * Web API Key can be found on the Settings page. */ export interface AuthObject { @@ -9,7 +9,7 @@ export interface AuthObject { * For example, https://retroachievements.org/user/Scott would have a value * of "Scott". */ - userName: string; + username: string; /** * This can be found in the "Keys" section of your Settings page on the