UNPKG

@sno2/pex

Version:

An unofficial promise-based Pexels API wrapper with top-notch TypeScript support.

3 lines (2 loc) 1.04 kB
import t from"axios";var a=0;function e(t){return"__private_"+a+++"_"+t}function r(t,a){if(!Object.prototype.hasOwnProperty.call(t,a))throw new TypeError("attempted to use private field on non-instance");return t}var i=e("opts"),s=e("axios");class o{constructor(a){Object.defineProperty(this,i,{writable:!0,value:void 0}),Object.defineProperty(this,s,{writable:!0,value:void 0}),r(this,i)[i]=a,r(this,s)[s]=t.create({baseURL:"https://api.pexels.com",headers:{Authorization:r(this,i)[i].key}})}async getPhoto(t){return(await r(this,s)[s].get(`/v1/photos${t.id}`)).data}async getPhotos(t){return(await r(this,s)[s].get("/v1/search",{params:t})).data}async getCuratedPhotos(t){return(await r(this,s)[s].get("/v1/curated",{params:t})).data}async getVideo(t){return(await r(this,s)[s].get(`/videos/${t.id}`)).data}async getVideos(t){return(await r(this,s)[s].get("/videos/search",{params:t})).data}async getPopularVideos(t){return(await r(this,s)[s].get("/videos/popular",{params:t})).data}}export{o as Pex}; //# sourceMappingURL=index.modern.js.map