@retroachievements/api 2.8.0 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/api.cjs +1 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.modern.js +1 -1
- package/dist/api.modern.js.map +1 -1
- package/dist/api.module.js +1 -1
- package/dist/api.module.js.map +1 -1
- package/dist/api.umd.js +1 -1
- package/dist/api.umd.js.map +1 -1
- package/dist/game/getGameProgression.d.ts +83 -0
- package/dist/game/getGameProgression.test.d.ts +1 -0
- package/dist/game/index.d.ts +1 -0
- package/dist/game/models/game-progression.model.d.ts +32 -0
- package/dist/game/models/get-game-progression-response.model.d.ts +32 -0
- package/dist/game/models/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/game/getGameProgression.test.ts +114 -0
- package/src/game/getGameProgression.ts +112 -0
- package/src/game/index.ts +1 -0
- package/src/game/models/game-progression.model.ts +32 -0
- package/src/game/models/get-game-progression-response.model.ts +32 -0
- package/src/game/models/index.ts +2 -0
- package/src/utils/internal/serializeProperties.test.ts +30 -24
- package/src/utils/internal/serializeProperties.ts +5 -1
package/dist/api.modern.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e="https://retroachievements.org/API",t=(e,t,o,s={})=>{let n=`${e}/${t}`.replaceAll(/([^:]\/)\/+/g,"$1");const r={z:o.username,y:o.webApiKey};for(const[e,t]of Object.entries(s))n.includes(`:${e}`)?n=n.replace(`:${e}`,String(t)):void 0!==t&&(r[e]=String(t));return`${n}?${new URLSearchParams(r).toString()}`};var o,s;const n=null!=(o=null==(s=process.env)?void 0:s.PACKAGE_VERSION)?o:"Unknown",r=async e=>{const{url:t}=e,o=new Headers({"User-Agent":`RetroAchievements-api-js/${n}`}),s=await fetch(t,{headers:o});if(!s.ok)throw new Error(`HTTP Error: Status ${s.status} ${s.statusText}`);return await s.json()};function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s])}return e},a.apply(this,arguments)}const i=(e,t={})=>{const{shouldCastToNumbers:o,shouldMapToBooleans:s}=t;let n=e;if(Array.isArray(e)){const o=[];for(const s of e)o.push(i(s,t));n=o}else if(!Array.isArray(e)&&e instanceof Object){let r={};for(const[n,c]of Object.entries(e)){let e=c;null!=o&&o.includes(n)&&(e=null===c?null:Number(c)),null!=s&&s.includes(n)&&(e=null===c?null:"1"===String(c)),r=a({},r,{[u(n)]:i(e,t)})}n=r}return n},u=e=>{if(e.toUpperCase()===e)return e.toLowerCase();let t=e.charAt(0).toLowerCase()+e.slice(1);return t=t.replaceAll("ULID","Ulid"),t=t.replaceAll("ID","Id"),t=t.replaceAll("URL","Url"),t=t.replaceAll("rA","ra"),t=t.replaceAll("visibleUserawards","visibleUserAwards"),t},c=async(o,s)=>{const{achievementId:n,offset:a,count:u}=s,c={a:n};a&&(c.o=a),u&&(c.c=u);const l=t(e,"/API_GetAchievementUnlocks.php",o,c),d=await r({url:l});return i(d,{shouldCastToNumbers:["ID","Points","TrueRatio","RAPoints","RASoftcorePoints"],shouldMapToBooleans:["HardcoreMode"]})},l={game:1,achievement:2,user:3},d=async(o,s)=>{const{identifier:n,kind:a,offset:u,count:c}=s,d={i:n};if(a)d.t=l[a];else if("number"==typeof n)throw new TypeError("'kind' must be specified when looking up an achievement or game.");u&&(d.o=u),c&&(d.c=c);const m=t(e,"/API_GetComments.php",o,d),h=await r({url:m});return i(h,{shouldCastToNumbers:["Count","Total"]})},m=async(o,s)=>{let n;null!=s&&s.shouldOnlyRetrieveActiveSystems&&(n=a({},n,{a:1})),null!=s&&s.shouldOnlyRetrieveGameSystems&&(n=a({},n,{g:1}));const u=t(e,"/API_GetConsoleIDs.php",o,n),c=await r({url:u});return i(c,{shouldCastToNumbers:["ID"]})},h=async(o,s)=>{const{consoleId:n,shouldOnlyRetrieveGamesWithAchievements:u,shouldRetrieveGameHashes:c}=s;let l={i:n};void 0!==u&&(l=a({},l,{f:u?1:0})),c&&(l=a({},l,{h:c?1:0}));const d=t(e,"/API_GetGameList.php",o,l),m=await r({url:d});return i(m,{shouldCastToNumbers:["ID","ConsoleID"]})},p=async o=>{const s=t(e,"/API_GetAchievementOfTheWeek.php",o),n=await r({url:s});return i(n,{shouldCastToNumbers:["ID","Points","TrueRatio","TotalPlayers","RAPoints","RASoftcorePoints","UnlocksCount"],shouldMapToBooleans:["HardcoreMode"]})},A=async o=>{const s=t(e,"/API_GetActiveClaims.php",o),n=await r({url:s});return i(n,{shouldMapToBooleans:["UserIsJrDev"]})},I=async(o,s)=>{const{claimKind:n}=s,a=t(e,"/API_GetClaims.php",o,{k:f[n]}),u=await r({url:a});return i(u,{shouldMapToBooleans:["UserIsJrDev"]})},f={completed:"1",dropped:"2",expired:"3"},P=async(o,s)=>{const n={};null!=s&&s.startDate&&(n.d=s.startDate),null!=s&&s.offset&&(n.o=s.offset),null!=s&&s.count&&(n.c=s.count),null!=s&&s.desiredAwardKinds&&(n.k=s.desiredAwardKinds.join(","));const a=t(e,"/API_GetRecentGameAwards.php",o,n),u=await r({url:a});return i(u)},y=async o=>{const s=t(e,"/API_GetTopTenUsers.php",o),n=await r({url:s}),a=[];for(const e of n)a.push({username:e[1],totalPoints:Number(e[2]),totalRatioPoints:Number(e[3])});return a};var v,w,T;!function(e){e[e.NewSet=0]="NewSet",e[e.Revision=1]="Revision"}(v||(v={})),function(e){e[e.Active=0]="Active",e[e.Complete=1]="Complete",e[e.Dropped=2]="Dropped"}(w||(w={})),function(e){e[e.Primary=0]="Primary",e[e.Collaboration=1]="Collaboration"}(T||(T={}));const G=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetAchievementCount.php",o,{i:n}),u=await r({url:a});return i(u)},b=async(o,s)=>{const{gameId:n,flags:a,hardcore:i}=s,u={i:n};void 0!==a&&(u.f=a),void 0!==i&&(u.h=!0===i?1:0);const c=t(e,"/API_GetAchievementDistribution.php",o,u);return await r({url:c})},C=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetGame.php",o,{i:n}),u=await r({url:a});return i(u,{shouldCastToNumbers:["ID","ForumTopicID","ConsoleID","Flags"]})},D=async(o,s)=>{const{gameId:n,isRequestingUnofficialAchievements:a}=s,u={i:n};a&&(u.f=5);const c=t(e,"/API_GetGameExtended.php",o,u),l=await r({url:c});return i(l,{shouldCastToNumbers:["ID","NumAwarded","NumAwardedHardcore","Points","TrueRatio","DisplayOrder","NumDistinctPlayersCasual","NumDistinctPlayersHardcore"]})},g=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetGameHashes.php",o,{i:n}),u=await r({url:a});return i(u)},N=async(o,s)=>{const{gameId:n,type:a}=s,u=t(e,"/API_GetGameRankAndScore.php",o,{g:n,t:"latest-masters"===a?1:0}),c=await r({url:u});return i(c,{shouldCastToNumbers:["TotalScore"]})},U=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetGameRating.php",o,{i:n}),u=await r({url:a});return i(u)};var _,S;!function(e){e[e.CoreAchievements=3]="CoreAchievements",e[e.UnofficialAchievements=5]="UnofficialAchievements"}(_||(_={})),function(e){e.Primary="0",e.Collaboration="1"}(S||(S={}));const R=async(o,s)=>{const n={};n.i=s.leaderboardId,null!=s&&s.offset&&(n.o=s.offset),null!=s&&s.count&&(n.c=s.count);const a=t(e,"/API_GetLeaderboardEntries.php",o,n),u=await r({url:a});return i(u)},M=async(o,s)=>{const n={};n.i=s.gameId,n.u=s.username,null!=s&&s.offset&&(n.o=s.offset),null!=s&&s.count&&(n.c=s.count);const a=t(e,"/API_GetUserGameLeaderboards.php",o,n),u=await r({url:a});return i(u)};async function H(o,s={}){const n=k(s),a=t(e,"/API_GetTicketData.php",o,n),u=await r({url:a});return i(u,{shouldCastToNumbers:["ID","AchievementID","Points","GameID","ReportType","ReportState","OpenTickets"],shouldMapToBooleans:["Hardcore"]})}const k=e=>{const{ticketId:t,isGettingMostTicketedGames:o,username:s,gameId:n,isGettingTicketsForUnofficialAchievements:r,shouldReturnTicketsList:a,achievementId:i}=e;let u={};return void 0!==t?u.i=t:o?(u.f="1",u=O(u,e)):s?u.u=s:n?(u.g=n,r&&(u.f="5"),a&&(u.d="1")):i?u.a=i:u=O(u,e),u},O=(e,t)=>{const o=a({},e);return void 0!==t.count&&(o.c=t.count),void 0!==t.offset&&(o.o=t.offset),o},B=async(o,s)=>{const{username:n,fromDate:a,toDate:u}=s,c=t(e,"/API_GetAchievementsEarnedBetween.php",o,{u:n,f:(a.getTime()/1e3).toFixed(0),t:(u.getTime()/1e3).toFixed(0)}),l=await r({url:c});return i(l,{shouldCastToNumbers:["AchievementID","Points","GameID"],shouldMapToBooleans:["HardcoreMode"]})},$=async(o,s)=>{const{username:n,onDate:a}=s,u=t(e,"/API_GetAchievementsEarnedOnDay.php",o,{u:n,d:`${a.getFullYear()}-${a.getMonth()+1}-${a.getDate()}`}),c=await r({url:u});return i(c,{shouldCastToNumbers:["AchievementID","Points","GameID"],shouldMapToBooleans:["HardcoreMode"]})},L=async(o,s)=>{const{gameId:n,username:a,shouldIncludeHighestAwardMetadata:u}=s,c={g:n,u:a};u&&(c.a=1);const l=t(e,"/API_GetGameInfoAndUserProgress.php",o,c),d=await r({url:l});return i(d,{shouldCastToNumbers:["ID","NumAwarded","NumAwardedHardcore","Points","TrueRatio","DisplayOrder","NumDistinctPlayersCasual","NumDistinctPlayersHardcore"]})},j=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserAwards.php",o,{u:n}),u=await r({url:a});return i(u)},E=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserClaims.php",o,{u:n}),u=await r({url:a});return i(u,{shouldCastToNumbers:["ID","GameID","ClaimType","SetType","Status","Extension","Special","MinutesLeft"]})},F=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserCompletedGames.php",o,{u:n}),u=await r({url:a});return i(u,{shouldCastToNumbers:["GameID","ConsoleID","MaxPossible","NumAwarded","PctWon"],shouldMapToBooleans:["HardcoreMode"]})},K=async(o,s)=>{const{username:n,offset:a,count:u}=s,c={u:n};a&&(c.o=a),u&&(c.c=u);const l=t(e,"/API_GetUserCompletionProgress.php",o,c),d=await r({url:l});return i(d)},x=async(o,s)=>{const{gameId:n,username:a}=s,u=t(e,"/API_GetUserGameRankAndScore.php",o,{g:n,u:a}),c=await r({url:u});return i(c,{shouldCastToNumbers:["TotalScore","UserRank"]})},W=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserPoints.php",o,{u:n}),u=await r({url:a});return i(u)},z=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserProfile.php",o,{u:n}),u=await r({url:a});return i(u,{shouldCastToNumbers:["TotalPoints","TotalSoftcorePoints","TotalTruePoints","Permissions"],shouldMapToBooleans:["Untracked","UserWallActive"]})},q=async(o,s)=>{const{username:n,gameIds:a}=s,u=t(e,"/API_GetUserProgress.php",o,{u:n,i:a.join(",")}),c=await r({url:u});return i(c,{shouldCastToNumbers:["NumPossibleAchievements","PossibleScore","NumAchieved","ScoreAchieved","NumAchievedHardcore","ScoreAchievedHardcore"]})},J=async(o,s)=>{const{username:n,recentMinutes:a}=s,u={u:n};void 0!==a&&(u.m=a);const c=t(e,"/API_GetUserRecentAchievements.php",o,u),l=await r({url:c});return i(l,{shouldMapToBooleans:["HardcoreMode"]})},V=async(o,s)=>{const{username:n,offset:a,count:u}=s,c={u:n};void 0!==a&&(c.o=a),void 0!==u&&(c.c=u);const l=t(e,"/API_GetUserRecentlyPlayedGames.php",o,c),d=await r({url:l});return i(d,{shouldCastToNumbers:["GameID","ConsoleID","NumPossibleAchievements","PossibleScore","NumAchieved","ScoreAchieved","NumAchievedHardcore","ScoreAchievedHardcore","MyVote"]})},Y=async(o,s)=>{const n={};null!=(null==s?void 0:s.offset)&&(n.o=s.offset),null!=(null==s?void 0:s.count)&&(n.c=s.count);const a=t(e,"/API_GetUsersIFollow.php",o,n),u=await r({url:a});return i(u,{shouldCastToNumbers:["Points","PointsSoftcore"],shouldMapToBooleans:["IsFollowingMe"]})},Q=async(o,s)=>{const{username:n,recentGamesCount:a,recentAchievementsCount:u}=s,c={u:n};void 0!==a&&(c.g=a),void 0!==u&&(c.a=u);const l=t(e,"/API_GetUserSummary.php",o,c),d=await r({url:l});return i(d,{shouldCastToNumbers:["GameID","ConsoleID","ID","LastGameID","ForumTopicID","activitytype","ContribCount","ContribYield","TotalPoints","TotalSoftcorePoints","TotalTruePoints","Permissions","NumPossibleAchievements","PossibleScore","NumAchieved","ScoreAchieved","NumAchievedHardcore","ScoreAchievedHardcore","Points","SoftcorePoints"],shouldMapToBooleans:["Untracked","UserWallActive","IsAwarded","HardcoreAchieved"]})},X=async(o,s)=>{const n={};n.u=s.username,null!=s&&s.offset&&(n.o=s.offset),null!=s&&s.count&&(n.c=s.count);const a=t(e,"/API_GetUserWantToPlayList.php",o,n),u=await r({url:a});return i(u)},Z=e=>{if(!e.username||!e.webApiKey)throw new Error('\n buildAuthorization() requires an object containing a\n username and webApiKey. eg:\n\n const authorization = buildAuthorization({\n username: "myUserName",\n webApiKey: "myWebApiKey"\n })\n ');return e};export{_ as AchievementDistributionFlags,v as ClaimSetType,w as ClaimStatus,T as ClaimType,Z as buildAuthorization,G as getAchievementCount,b as getAchievementDistribution,p as getAchievementOfTheWeek,c as getAchievementUnlocks,B as getAchievementsEarnedBetween,$ as getAchievementsEarnedOnDay,A as getActiveClaims,I as getClaims,d as getComments,m as getConsoleIds,C as getGame,D as getGameExtended,g as getGameHashes,L as getGameInfoAndUserProgress,h as getGameList,N as getGameRankAndScore,U as getGameRating,R as getLeaderboardEntries,P as getRecentGameAwards,H as getTicketData,y as getTopTenUsers,j as getUserAwards,E as getUserClaims,F as getUserCompletedGames,K as getUserCompletionProgress,M as getUserGameLeaderboards,x as getUserGameRankAndScore,W as getUserPoints,z as getUserProfile,q as getUserProgress,J as getUserRecentAchievements,V as getUserRecentlyPlayedGames,Q as getUserSummary,X as getUserWantToPlayList,Y as getUsersIFollow,r as unsafe_call};
|
|
1
|
+
const e="https://retroachievements.org/API",t=(e,t,o,s={})=>{let n=`${e}/${t}`.replaceAll(/([^:]\/)\/+/g,"$1");const r={z:o.username,y:o.webApiKey};for(const[e,t]of Object.entries(s))n.includes(`:${e}`)?n=n.replace(`:${e}`,String(t)):void 0!==t&&(r[e]=String(t));return`${n}?${new URLSearchParams(r).toString()}`};var o,s;const n=null!=(o=null==(s=process.env)?void 0:s.PACKAGE_VERSION)?o:"Unknown",r=async e=>{const{url:t}=e,o=new Headers({"User-Agent":`RetroAchievements-api-js/${n}`}),s=await fetch(t,{headers:o});if(!s.ok)throw new Error(`HTTP Error: Status ${s.status} ${s.statusText}`);return await s.json()};function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s])}return e},a.apply(this,arguments)}const i=(e,t={})=>{const{shouldCastToNumbers:o,shouldMapToBooleans:s}=t;let n=e;if(Array.isArray(e)){const o=[];for(const s of e)o.push(i(s,t));n=o}else if(!Array.isArray(e)&&e instanceof Object){let r={};for(const[n,c]of Object.entries(e)){let e=c;if(null!=o&&o.includes(n)&&(e=null===c?null:Number(c)),null!=s&&s.includes(n))if(null===c)e=null;else{const t=String(c);e="1"===t||"true"===t}r=a({},r,{[u(n)]:i(e,t)})}n=r}return n},u=e=>{if(e.toUpperCase()===e)return e.toLowerCase();let t=e.charAt(0).toLowerCase()+e.slice(1);return t=t.replaceAll("ULID","Ulid"),t=t.replaceAll("ID","Id"),t=t.replaceAll("URL","Url"),t=t.replaceAll("rA","ra"),t=t.replaceAll("visibleUserawards","visibleUserAwards"),t},c=async(o,s)=>{const{achievementId:n,offset:a,count:u}=s,c={a:n};a&&(c.o=a),u&&(c.c=u);const l=t(e,"/API_GetAchievementUnlocks.php",o,c),d=await r({url:l});return i(d,{shouldCastToNumbers:["ID","Points","TrueRatio","RAPoints","RASoftcorePoints"],shouldMapToBooleans:["HardcoreMode"]})},l={game:1,achievement:2,user:3},d=async(o,s)=>{const{identifier:n,kind:a,offset:u,count:c}=s,d={i:n};if(a)d.t=l[a];else if("number"==typeof n)throw new TypeError("'kind' must be specified when looking up an achievement or game.");u&&(d.o=u),c&&(d.c=c);const m=t(e,"/API_GetComments.php",o,d),h=await r({url:m});return i(h,{shouldCastToNumbers:["Count","Total"]})},m=async(o,s)=>{let n;null!=s&&s.shouldOnlyRetrieveActiveSystems&&(n=a({},n,{a:1})),null!=s&&s.shouldOnlyRetrieveGameSystems&&(n=a({},n,{g:1}));const u=t(e,"/API_GetConsoleIDs.php",o,n),c=await r({url:u});return i(c,{shouldCastToNumbers:["ID"]})},h=async(o,s)=>{const{consoleId:n,shouldOnlyRetrieveGamesWithAchievements:u,shouldRetrieveGameHashes:c}=s;let l={i:n};void 0!==u&&(l=a({},l,{f:u?1:0})),c&&(l=a({},l,{h:c?1:0}));const d=t(e,"/API_GetGameList.php",o,l),m=await r({url:d});return i(m,{shouldCastToNumbers:["ID","ConsoleID"]})},p=async o=>{const s=t(e,"/API_GetAchievementOfTheWeek.php",o),n=await r({url:s});return i(n,{shouldCastToNumbers:["ID","Points","TrueRatio","TotalPlayers","RAPoints","RASoftcorePoints","UnlocksCount"],shouldMapToBooleans:["HardcoreMode"]})},A=async o=>{const s=t(e,"/API_GetActiveClaims.php",o),n=await r({url:s});return i(n,{shouldMapToBooleans:["UserIsJrDev"]})},I=async(o,s)=>{const{claimKind:n}=s,a=t(e,"/API_GetClaims.php",o,{k:f[n]}),u=await r({url:a});return i(u,{shouldMapToBooleans:["UserIsJrDev"]})},f={completed:"1",dropped:"2",expired:"3"},P=async(o,s)=>{const n={};null!=s&&s.startDate&&(n.d=s.startDate),null!=s&&s.offset&&(n.o=s.offset),null!=s&&s.count&&(n.c=s.count),null!=s&&s.desiredAwardKinds&&(n.k=s.desiredAwardKinds.join(","));const a=t(e,"/API_GetRecentGameAwards.php",o,n),u=await r({url:a});return i(u)},y=async o=>{const s=t(e,"/API_GetTopTenUsers.php",o),n=await r({url:s}),a=[];for(const e of n)a.push({username:e[1],totalPoints:Number(e[2]),totalRatioPoints:Number(e[3])});return a};var v,w,T;!function(e){e[e.NewSet=0]="NewSet",e[e.Revision=1]="Revision"}(v||(v={})),function(e){e[e.Active=0]="Active",e[e.Complete=1]="Complete",e[e.Dropped=2]="Dropped"}(w||(w={})),function(e){e[e.Primary=0]="Primary",e[e.Collaboration=1]="Collaboration"}(T||(T={}));const G=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetAchievementCount.php",o,{i:n}),u=await r({url:a});return i(u)},b=async(o,s)=>{const{gameId:n,flags:a,hardcore:i}=s,u={i:n};void 0!==a&&(u.f=a),void 0!==i&&(u.h=!0===i?1:0);const c=t(e,"/API_GetAchievementDistribution.php",o,u);return await r({url:c})},C=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetGame.php",o,{i:n}),u=await r({url:a});return i(u,{shouldCastToNumbers:["ID","ForumTopicID","ConsoleID","Flags"]})},g=async(o,s)=>{const{gameId:n,isRequestingUnofficialAchievements:a}=s,u={i:n};a&&(u.f=5);const c=t(e,"/API_GetGameExtended.php",o,u),l=await r({url:c});return i(l,{shouldCastToNumbers:["ID","NumAwarded","NumAwardedHardcore","Points","TrueRatio","DisplayOrder","NumDistinctPlayersCasual","NumDistinctPlayersHardcore"]})},D=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetGameHashes.php",o,{i:n}),u=await r({url:a});return i(u)},N=async(o,s)=>{const{gameId:n,hardcore:a}=s,u={i:n};void 0!==a&&(u.h=!0===a?1:0);const c=t(e,"/API_GetGameProgression.php",o,u),l=await r({url:c});return i(l)},U=async(o,s)=>{const{gameId:n,type:a}=s,u=t(e,"/API_GetGameRankAndScore.php",o,{g:n,t:"latest-masters"===a?1:0}),c=await r({url:u});return i(c,{shouldCastToNumbers:["TotalScore"]})},_=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetGameRating.php",o,{i:n}),u=await r({url:a});return i(u)};var S,R;!function(e){e[e.CoreAchievements=3]="CoreAchievements",e[e.UnofficialAchievements=5]="UnofficialAchievements"}(S||(S={})),function(e){e.Primary="0",e.Collaboration="1"}(R||(R={}));const M=async(o,s)=>{const n={};n.i=s.leaderboardId,null!=s&&s.offset&&(n.o=s.offset),null!=s&&s.count&&(n.c=s.count);const a=t(e,"/API_GetLeaderboardEntries.php",o,n),u=await r({url:a});return i(u)},H=async(o,s)=>{const n={};n.i=s.gameId,n.u=s.username,null!=s&&s.offset&&(n.o=s.offset),null!=s&&s.count&&(n.c=s.count);const a=t(e,"/API_GetUserGameLeaderboards.php",o,n),u=await r({url:a});return i(u)};async function k(o,s={}){const n=O(s),a=t(e,"/API_GetTicketData.php",o,n),u=await r({url:a});return i(u,{shouldCastToNumbers:["ID","AchievementID","Points","GameID","ReportType","ReportState","OpenTickets"],shouldMapToBooleans:["Hardcore"]})}const O=e=>{const{ticketId:t,isGettingMostTicketedGames:o,username:s,gameId:n,isGettingTicketsForUnofficialAchievements:r,shouldReturnTicketsList:a,achievementId:i}=e;let u={};return void 0!==t?u.i=t:o?(u.f="1",u=B(u,e)):s?u.u=s:n?(u.g=n,r&&(u.f="5"),a&&(u.d="1")):i?u.a=i:u=B(u,e),u},B=(e,t)=>{const o=a({},e);return void 0!==t.count&&(o.c=t.count),void 0!==t.offset&&(o.o=t.offset),o},$=async(o,s)=>{const{username:n,fromDate:a,toDate:u}=s,c=t(e,"/API_GetAchievementsEarnedBetween.php",o,{u:n,f:(a.getTime()/1e3).toFixed(0),t:(u.getTime()/1e3).toFixed(0)}),l=await r({url:c});return i(l,{shouldCastToNumbers:["AchievementID","Points","GameID"],shouldMapToBooleans:["HardcoreMode"]})},L=async(o,s)=>{const{username:n,onDate:a}=s,u=t(e,"/API_GetAchievementsEarnedOnDay.php",o,{u:n,d:`${a.getFullYear()}-${a.getMonth()+1}-${a.getDate()}`}),c=await r({url:u});return i(c,{shouldCastToNumbers:["AchievementID","Points","GameID"],shouldMapToBooleans:["HardcoreMode"]})},j=async(o,s)=>{const{gameId:n,username:a,shouldIncludeHighestAwardMetadata:u}=s,c={g:n,u:a};u&&(c.a=1);const l=t(e,"/API_GetGameInfoAndUserProgress.php",o,c),d=await r({url:l});return i(d,{shouldCastToNumbers:["ID","NumAwarded","NumAwardedHardcore","Points","TrueRatio","DisplayOrder","NumDistinctPlayersCasual","NumDistinctPlayersHardcore"]})},E=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserAwards.php",o,{u:n}),u=await r({url:a});return i(u)},F=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserClaims.php",o,{u:n}),u=await r({url:a});return i(u,{shouldCastToNumbers:["ID","GameID","ClaimType","SetType","Status","Extension","Special","MinutesLeft"]})},K=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserCompletedGames.php",o,{u:n}),u=await r({url:a});return i(u,{shouldCastToNumbers:["GameID","ConsoleID","MaxPossible","NumAwarded","PctWon"],shouldMapToBooleans:["HardcoreMode"]})},x=async(o,s)=>{const{username:n,offset:a,count:u}=s,c={u:n};a&&(c.o=a),u&&(c.c=u);const l=t(e,"/API_GetUserCompletionProgress.php",o,c),d=await r({url:l});return i(d)},W=async(o,s)=>{const{gameId:n,username:a}=s,u=t(e,"/API_GetUserGameRankAndScore.php",o,{g:n,u:a}),c=await r({url:u});return i(c,{shouldCastToNumbers:["TotalScore","UserRank"]})},z=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserPoints.php",o,{u:n}),u=await r({url:a});return i(u)},q=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserProfile.php",o,{u:n}),u=await r({url:a});return i(u,{shouldCastToNumbers:["TotalPoints","TotalSoftcorePoints","TotalTruePoints","Permissions"],shouldMapToBooleans:["Untracked","UserWallActive"]})},J=async(o,s)=>{const{username:n,gameIds:a}=s,u=t(e,"/API_GetUserProgress.php",o,{u:n,i:a.join(",")}),c=await r({url:u});return i(c,{shouldCastToNumbers:["NumPossibleAchievements","PossibleScore","NumAchieved","ScoreAchieved","NumAchievedHardcore","ScoreAchievedHardcore"]})},V=async(o,s)=>{const{username:n,recentMinutes:a}=s,u={u:n};void 0!==a&&(u.m=a);const c=t(e,"/API_GetUserRecentAchievements.php",o,u),l=await r({url:c});return i(l,{shouldMapToBooleans:["HardcoreMode"]})},Y=async(o,s)=>{const{username:n,offset:a,count:u}=s,c={u:n};void 0!==a&&(c.o=a),void 0!==u&&(c.c=u);const l=t(e,"/API_GetUserRecentlyPlayedGames.php",o,c),d=await r({url:l});return i(d,{shouldCastToNumbers:["GameID","ConsoleID","NumPossibleAchievements","PossibleScore","NumAchieved","ScoreAchieved","NumAchievedHardcore","ScoreAchievedHardcore","MyVote"]})},Q=async(o,s)=>{const n={};null!=(null==s?void 0:s.offset)&&(n.o=s.offset),null!=(null==s?void 0:s.count)&&(n.c=s.count);const a=t(e,"/API_GetUsersIFollow.php",o,n),u=await r({url:a});return i(u,{shouldCastToNumbers:["Points","PointsSoftcore"],shouldMapToBooleans:["IsFollowingMe"]})},X=async(o,s)=>{const{username:n,recentGamesCount:a,recentAchievementsCount:u}=s,c={u:n};void 0!==a&&(c.g=a),void 0!==u&&(c.a=u);const l=t(e,"/API_GetUserSummary.php",o,c),d=await r({url:l});return i(d,{shouldCastToNumbers:["GameID","ConsoleID","ID","LastGameID","ForumTopicID","activitytype","ContribCount","ContribYield","TotalPoints","TotalSoftcorePoints","TotalTruePoints","Permissions","NumPossibleAchievements","PossibleScore","NumAchieved","ScoreAchieved","NumAchievedHardcore","ScoreAchievedHardcore","Points","SoftcorePoints"],shouldMapToBooleans:["Untracked","UserWallActive","IsAwarded","HardcoreAchieved"]})},Z=async(o,s)=>{const n={};n.u=s.username,null!=s&&s.offset&&(n.o=s.offset),null!=s&&s.count&&(n.c=s.count);const a=t(e,"/API_GetUserWantToPlayList.php",o,n),u=await r({url:a});return i(u)},ee=e=>{if(!e.username||!e.webApiKey)throw new Error('\n buildAuthorization() requires an object containing a\n username and webApiKey. eg:\n\n const authorization = buildAuthorization({\n username: "myUserName",\n webApiKey: "myWebApiKey"\n })\n ');return e};export{S as AchievementDistributionFlags,v as ClaimSetType,w as ClaimStatus,T as ClaimType,ee as buildAuthorization,G as getAchievementCount,b as getAchievementDistribution,p as getAchievementOfTheWeek,c as getAchievementUnlocks,$ as getAchievementsEarnedBetween,L as getAchievementsEarnedOnDay,A as getActiveClaims,I as getClaims,d as getComments,m as getConsoleIds,C as getGame,g as getGameExtended,D as getGameHashes,j as getGameInfoAndUserProgress,h as getGameList,N as getGameProgression,U as getGameRankAndScore,_ as getGameRating,M as getLeaderboardEntries,P as getRecentGameAwards,k as getTicketData,y as getTopTenUsers,E as getUserAwards,F as getUserClaims,K as getUserCompletedGames,x as getUserCompletionProgress,H as getUserGameLeaderboards,W as getUserGameRankAndScore,z as getUserPoints,q as getUserProfile,J as getUserProgress,V as getUserRecentAchievements,Y as getUserRecentlyPlayedGames,X as getUserSummary,Z as getUserWantToPlayList,Q as getUsersIFollow,r as unsafe_call};
|
|
2
2
|
//# sourceMappingURL=api.modern.js.map
|