lunify.js
Version:
A basic api wrapper for the spotify api covering the oauth routes.
45 lines • 1.67 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Album = exports.PartialAlbum = void 0;
const __1 = require("../..");
const artist_1 = require("../artist");
class PartialAlbum {
constructor(client, data) {
var _a;
this.client = client;
this.totalTracks = data.total_tracks;
this.markets = data.available_markets;
this.externalUrls = data.external_urls;
this.url = data.href;
this.id = data.id;
this.images = data.images;
this.name = data.name;
this.release = new Date(data.release_date);
this.restrictions = ((_a = data.restrictions) === null || _a === void 0 ? void 0 : _a.reason) || null;
this.type = data.album_type;
this.uri = data.uri;
this.artists = [];
for (const artist of data.artists)
this.artists.push(new artist_1.Artist(client, artist));
}
}
exports.PartialAlbum = PartialAlbum;
class Album extends PartialAlbum {
constructor(client, data) {
super(client, data);
this.client = client;
this.tracks = Object.assign(Object.assign({}, data.tracks), { url: data.tracks.href, items: (() => {
const items = [];
for (const item of data.tracks.items)
items.push(new __1.PartialTrack(client, item));
return items;
})() });
this.copyrights = data.copyrights;
this.externalIds = data.external_ids;
this.genres = data.genres;
this.label = data.label;
this.popularity = data.popularity;
}
}
exports.Album = Album;
//# sourceMappingURL=index.js.map