UNPKG

nuxtify-api

Version:

Lightweight music API for client without third-party libraries.

1 lines 2.13 kB
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(a,s){function o(t){try{n(r.next(t))}catch(t){s(t)}}function c(t){try{n(r.throw(t))}catch(t){s(t)}}function n(t){var e;t.done?a(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,c)}n((r=r.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Nuxtify=void 0;const podcast_1=require("./categories/podcast"),base_1=require("./base"),song_1=require("./categories/song"),search_1=require("./categories/search"),video_1=require("./categories/video"),chart_1=require("./categories/chart");class NuxtifyApi extends base_1.Base{constructor(t,e){super(t,e),this.podcast=new podcast_1.Podcast(t,e),this.song=new song_1.Song(t,e),this.search=new search_1.Search(t,e),this.video=new video_1.Video(t,e),this.chart=new chart_1.Chart(t,e)}getHome(){return __awaiter(this,void 0,void 0,(function*(){try{const t=this.createHomeSig("/api/v2/page/get/home"),e=yield this.createRequest("/api/v2/page/get/home",{page:1,count:30,sig:t});if(e.err)throw new Error(e.msg);return e.data}catch(t){throw t}}))}getTop100(){return __awaiter(this,void 0,void 0,(function*(){try{const t=this.createNoIdSig("/api/v2/page/get/top-100"),e=yield this.createRequest("/api/v2/page/get/top-100",{sig:t});if(e.err)throw new Error(e.msg);return e.data}catch(t){throw t}}))}getArtist(t){return __awaiter(this,void 0,void 0,(function*(){try{const e=this.createNoIdSig("/api/v2/page/get/artist");return yield this.createRequest("/api/v2/page/get/artist",{alias:t,sig:e})}catch(t){throw t}}))}getGenres(){return __awaiter(this,void 0,void 0,(function*(){try{const t=this.createNoIdSig("/api/v2/page/get/hub-home"),e=yield this.createRequest("/api/v2/page/get/hub-home",{sig:t});if(e.err)throw new Error(e.msg);return e.data}catch(t){throw t}}))}getPlaylist(t){return __awaiter(this,void 0,void 0,(function*(){try{const e=this.createIdSig("/api/v2/page/get/playlist",t);return yield this.createRequest("/api/v2/page/get/playlist",{id:t,sig:e})}catch(t){throw t}}))}}const Nuxtify=new NuxtifyApi;exports.Nuxtify=Nuxtify;