extra-life
Version:
Extra Life API wrapper for JavaScript in the browser and Node.js.
3 lines (2 loc) • 1.45 kB
JavaScript
var a=a=>fetch(a).then(a=>a.json().then(t=>({headers:a.headers,status:a.status,json:t}))).then(({headers:a,status:t,json:s})=>{if(t>=400)return new Error(`Bad Request: ${t}`);const n=a.get("num-records");return null!==n?{totalRecords:parseInt(n),records:s}:s}).catch(a=>a);const t="https://www.extra-life.org/api",s=(a,t)=>{const s=parseInt(a),n=parseInt(t);return`?limit=${a=s||100}&offset=${1===(t=n||1||1)?1:a*(t-1)}`},n=async(n,i)=>await a(`${t}/participants${s(n,i)}`),i=async s=>await a(`${t}/participants/${s}`),e=async s=>await a(`${t}/participants/${s}/activity`),$=async s=>await a(`${t}/participants/${s}/badges`),r=async(n,i,e)=>await a(`${t}/participants/${n}/donations${s(i,e)}`),c=async(n,i,e)=>await a(`${t}/participants/${n}/donors${s(i,e)}`),o=async(n,i)=>await a(`${t}/teams${s(n,i)}`),p=async s=>await a(`${t}/teams/${s}`),w=async s=>await a(`${t}/teams/${s}/activity`),y=async s=>await a(`${t}/teams/${s}/badges`),d=async(n,i,e)=>await a(`${t}/teams/${n}/donations${s(i,e)}`),h=async(n,i,e)=>await a(`${t}/teams/${n}/donors${s(i,e)}`),m=async(n,i,e)=>await a(`${t}/teams/${n}/participants${s(i,e)}`);export{i as getParticipant,e as getParticipantActivity,$ as getParticipantBadges,r as getParticipantDonations,c as getParticipantDonors,n as getParticipants,p as getTeam,w as getTeamActivity,y as getTeamBadges,d as getTeamDonations,h as getTeamDonors,m as getTeamParticipants,o as getTeams};
//# sourceMappingURL=module.js.map