@retroachievements/api 2.9.1 → 2.10.0

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.
Files changed (32) hide show
  1. package/README.md +2 -0
  2. package/dist/api.cjs +1 -1
  3. package/dist/api.cjs.map +1 -1
  4. package/dist/api.modern.js +1 -1
  5. package/dist/api.modern.js.map +1 -1
  6. package/dist/api.module.js +1 -1
  7. package/dist/api.module.js.map +1 -1
  8. package/dist/api.umd.js +1 -1
  9. package/dist/api.umd.js.map +1 -1
  10. package/dist/user/getUserSetRequests.d.ts +54 -0
  11. package/dist/user/getUserSetRequests.test.d.ts +1 -0
  12. package/dist/user/getUsersFollowingMe.d.ts +46 -0
  13. package/dist/user/getUsersFollowingMe.test.d.ts +1 -0
  14. package/dist/user/index.d.ts +2 -0
  15. package/dist/user/models/get-user-set-requests-response.model.d.ts +11 -0
  16. package/dist/user/models/get-users-following-me-response.model.d.ts +11 -0
  17. package/dist/user/models/index.d.ts +5 -0
  18. package/dist/user/models/request-list-type.enum.d.ts +4 -0
  19. package/dist/user/models/user-set-requests.model.d.ts +11 -0
  20. package/dist/user/models/users-following-me.model.d.ts +11 -0
  21. package/package.json +1 -1
  22. package/src/user/getUserSetRequests.test.ts +149 -0
  23. package/src/user/getUserSetRequests.ts +92 -0
  24. package/src/user/getUsersFollowingMe.test.ts +124 -0
  25. package/src/user/getUsersFollowingMe.ts +75 -0
  26. package/src/user/index.ts +2 -0
  27. package/src/user/models/get-user-set-requests-response.model.ts +11 -0
  28. package/src/user/models/get-users-following-me-response.model.ts +11 -0
  29. package/src/user/models/index.ts +5 -0
  30. package/src/user/models/request-list-type.enum.ts +4 -0
  31. package/src/user/models/user-set-requests.model.ts +11 -0
  32. package/src/user/models/users-following-me.model.ts +11 -0
@@ -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;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};
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 u=(e,t={})=>{const{shouldCastToNumbers:o,shouldMapToBooleans:s}=t;let n=e;if(Array.isArray(e)){const o=[];for(const s of e)o.push(u(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,{[i(n)]:u(e,t)})}n=r}return n},i=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:i}=s,c={a:n};a&&(c.o=a),i&&(c.c=i);const l=t(e,"/API_GetAchievementUnlocks.php",o,c),d=await r({url:l});return u(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:i,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.");i&&(d.o=i),c&&(d.c=c);const m=t(e,"/API_GetComments.php",o,d),h=await r({url:m});return u(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 i=t(e,"/API_GetConsoleIDs.php",o,n),c=await r({url:i});return u(c,{shouldCastToNumbers:["ID"]})},h=async(o,s)=>{const{consoleId:n,shouldOnlyRetrieveGamesWithAchievements:i,shouldRetrieveGameHashes:c}=s;let l={i:n};void 0!==i&&(l=a({},l,{f:i?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 u(m,{shouldCastToNumbers:["ID","ConsoleID"]})},p=async o=>{const s=t(e,"/API_GetAchievementOfTheWeek.php",o),n=await r({url:s});return u(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 u(n,{shouldMapToBooleans:["UserIsJrDev"]})},I=async(o,s)=>{const{claimKind:n}=s,a=t(e,"/API_GetClaims.php",o,{k:f[n]}),i=await r({url:a});return u(i,{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),i=await r({url:a});return u(i)},v=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 y,w,T;!function(e){e[e.NewSet=0]="NewSet",e[e.Revision=1]="Revision"}(y||(y={})),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}),i=await r({url:a});return u(i)},b=async(o,s)=>{const{gameId:n,flags:a,hardcore:u}=s,i={i:n};void 0!==a&&(i.f=a),void 0!==u&&(i.h=!0===u?1:0);const c=t(e,"/API_GetAchievementDistribution.php",o,i);return await r({url:c})},C=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetGame.php",o,{i:n}),i=await r({url:a});return u(i,{shouldCastToNumbers:["ID","ForumTopicID","ConsoleID","Flags"]})},g=async(o,s)=>{const{gameId:n,isRequestingUnofficialAchievements:a}=s,i={i:n};a&&(i.f=5);const c=t(e,"/API_GetGameExtended.php",o,i),l=await r({url:c});return u(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}),i=await r({url:a});return u(i)},N=async(o,s)=>{const{gameId:n,hardcore:a}=s,i={i:n};void 0!==a&&(i.h=!0===a?1:0);const c=t(e,"/API_GetGameProgression.php",o,i),l=await r({url:c});return u(l)},U=async(o,s)=>{const{gameId:n,type:a}=s,i=t(e,"/API_GetGameRankAndScore.php",o,{g:n,t:"latest-masters"===a?1:0}),c=await r({url:i});return u(c,{shouldCastToNumbers:["TotalScore"]})},_=async(o,s)=>{const{gameId:n}=s,a=t(e,"/API_GetGameRating.php",o,{i:n}),i=await r({url:a});return u(i)};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),i=await r({url:a});return u(i)},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),i=await r({url:a});return u(i)};async function k(o,s={}){const n=O(s),a=t(e,"/API_GetTicketData.php",o,n),i=await r({url:a});return u(i,{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:u}=e;let i={};return void 0!==t?i.i=t:o?(i.f="1",i=B(i,e)):s?i.u=s:n?(i.g=n,r&&(i.f="5"),a&&(i.d="1")):u?i.a=u:i=B(i,e),i},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},L=async(o,s)=>{const{username:n,fromDate:a,toDate:i}=s,c=t(e,"/API_GetAchievementsEarnedBetween.php",o,{u:n,f:(a.getTime()/1e3).toFixed(0),t:(i.getTime()/1e3).toFixed(0)}),l=await r({url:c});return u(l,{shouldCastToNumbers:["AchievementID","Points","GameID"],shouldMapToBooleans:["HardcoreMode"]})},$=async(o,s)=>{const{username:n,onDate:a}=s,i=t(e,"/API_GetAchievementsEarnedOnDay.php",o,{u:n,d:`${a.getFullYear()}-${a.getMonth()+1}-${a.getDate()}`}),c=await r({url:i});return u(c,{shouldCastToNumbers:["AchievementID","Points","GameID"],shouldMapToBooleans:["HardcoreMode"]})},F=async(o,s)=>{const{gameId:n,username:a,shouldIncludeHighestAwardMetadata:i}=s,c={g:n,u:a};i&&(c.a=1);const l=t(e,"/API_GetGameInfoAndUserProgress.php",o,c),d=await r({url:l});return u(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}),i=await r({url:a});return u(i)},E=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserClaims.php",o,{u:n}),i=await r({url:a});return u(i,{shouldCastToNumbers:["ID","GameID","ClaimType","SetType","Status","Extension","Special","MinutesLeft"]})},q=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserCompletedGames.php",o,{u:n}),i=await r({url:a});return u(i,{shouldCastToNumbers:["GameID","ConsoleID","MaxPossible","NumAwarded","PctWon"],shouldMapToBooleans:["HardcoreMode"]})},x=async(o,s)=>{const{username:n,offset:a,count:i}=s,c={u:n};a&&(c.o=a),i&&(c.c=i);const l=t(e,"/API_GetUserCompletionProgress.php",o,c),d=await r({url:l});return u(d)},K=async(o,s)=>{const{gameId:n,username:a}=s,i=t(e,"/API_GetUserGameRankAndScore.php",o,{g:n,u:a}),c=await r({url:i});return u(c,{shouldCastToNumbers:["TotalScore","UserRank"]})},W=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserPoints.php",o,{u:n}),i=await r({url:a});return u(i)},z=async(o,s)=>{const{username:n}=s,a=t(e,"/API_GetUserProfile.php",o,{u:n}),i=await r({url:a});return u(i,{shouldCastToNumbers:["TotalPoints","TotalSoftcorePoints","TotalTruePoints","Permissions"],shouldMapToBooleans:["Untracked","UserWallActive"]})},J=async(o,s)=>{const{username:n,gameIds:a}=s,i=t(e,"/API_GetUserProgress.php",o,{u:n,i:a.join(",")}),c=await r({url:i});return u(c,{shouldCastToNumbers:["NumPossibleAchievements","PossibleScore","NumAchieved","ScoreAchieved","NumAchievedHardcore","ScoreAchievedHardcore"]})},V=async(o,s)=>{const{username:n,recentMinutes:a}=s,i={u:n};void 0!==a&&(i.m=a);const c=t(e,"/API_GetUserRecentAchievements.php",o,i),l=await r({url:c});return u(l,{shouldMapToBooleans:["HardcoreMode"]})},Y=async(o,s)=>{const{username:n,offset:a,count:i}=s,c={u:n};void 0!==a&&(c.o=a),void 0!==i&&(c.c=i);const l=t(e,"/API_GetUserRecentlyPlayedGames.php",o,c),d=await r({url:l});return u(d,{shouldCastToNumbers:["GameID","ConsoleID","NumPossibleAchievements","PossibleScore","NumAchieved","ScoreAchieved","NumAchievedHardcore","ScoreAchievedHardcore","MyVote"]})},Q=async(o,s)=>{const n={};n.u=s.username,null!=s.requestListType&&(n.t=s.requestListType);const a=t(e,"/API_GetUserSetRequests.php",o,n),i=await r({url:a});return u(i,{shouldCastToNumbers:["GameID","ConsoleID","TotalRequests","PointsForNext"]})},X=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_GetUsersFollowingMe.php",o,n),i=await r({url:a});return u(i,{shouldCastToNumbers:["Points","PointsSoftcore"],shouldMapToBooleans:["AmIFollowing"]})},Z=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),i=await r({url:a});return u(i,{shouldCastToNumbers:["Points","PointsSoftcore"],shouldMapToBooleans:["IsFollowingMe"]})},ee=async(o,s)=>{const{username:n,recentGamesCount:a,recentAchievementsCount:i}=s,c={u:n};void 0!==a&&(c.g=a),void 0!==i&&(c.a=i);const l=t(e,"/API_GetUserSummary.php",o,c),d=await r({url:l});return u(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"]})},te=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),i=await r({url:a});return u(i)};var oe;!function(e){e[e.ActiveRequests=0]="ActiveRequests",e[e.AllRequests=1]="AllRequests"}(oe||(oe={}));const se=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,y as ClaimSetType,w as ClaimStatus,T as ClaimType,oe as RequestListType,se as buildAuthorization,G as getAchievementCount,b as getAchievementDistribution,p as getAchievementOfTheWeek,c as getAchievementUnlocks,L as getAchievementsEarnedBetween,$ as getAchievementsEarnedOnDay,A as getActiveClaims,I as getClaims,d as getComments,m as getConsoleIds,C as getGame,g as getGameExtended,D as getGameHashes,F as getGameInfoAndUserProgress,h as getGameList,N as getGameProgression,U as getGameRankAndScore,_ as getGameRating,M as getLeaderboardEntries,P as getRecentGameAwards,k as getTicketData,v as getTopTenUsers,j as getUserAwards,E as getUserClaims,q as getUserCompletedGames,x as getUserCompletionProgress,H as getUserGameLeaderboards,K as getUserGameRankAndScore,W as getUserPoints,z as getUserProfile,J as getUserProgress,V as getUserRecentAchievements,Y as getUserRecentlyPlayedGames,Q as getUserSetRequests,ee as getUserSummary,te as getUserWantToPlayList,X as getUsersFollowingMe,Z as getUsersIFollow,r as unsafe_call};
2
2
  //# sourceMappingURL=api.modern.js.map