@toplast/lastfm
Version:
A typed Last.fm API client for Node.js
66 lines • 2.69 kB
JavaScript
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tag = void 0;
const request_service_1 = require("../request/request.service");
class Tag {
constructor(API_KEY) {
if (!API_KEY) {
throw new Error("API key has not set");
}
this.REQUEST = new request_service_1.ApiRequest();
this.API_KEY = API_KEY;
}
getInfo(params) {
return __awaiter(this, void 0, void 0, function* () {
const data = yield this.REQUEST.lastFm("tag.getInfo", this.API_KEY, params);
return data;
});
}
getSimilar(params) {
return __awaiter(this, void 0, void 0, function* () {
const data = yield this.REQUEST.lastFm("tag.getSimilar", this.API_KEY, params);
return data;
});
}
getTopAlbums(params) {
return __awaiter(this, void 0, void 0, function* () {
const data = yield this.REQUEST.lastFm("tag.getTopAlbums", this.API_KEY, params);
return data;
});
}
getTopArtists(params) {
return __awaiter(this, void 0, void 0, function* () {
const data = yield this.REQUEST.lastFm("tag.getTopArtists", this.API_KEY, params);
return data;
});
}
getTopTags() {
return __awaiter(this, void 0, void 0, function* () {
const data = yield this.REQUEST.lastFm("tag.getTopTags", this.API_KEY);
return data;
});
}
getTopTracks(params) {
return __awaiter(this, void 0, void 0, function* () {
const data = yield this.REQUEST.lastFm("tag.getTopTracks", this.API_KEY, params);
return data;
});
}
getWeeklyChartList(params) {
return __awaiter(this, void 0, void 0, function* () {
const data = yield this.REQUEST.lastFm("tag.getWeeklyChartList", this.API_KEY, params);
return data;
});
}
}
exports.Tag = Tag;
//# sourceMappingURL=tag.service.js.map