lunify.js
Version:
A basic api wrapper for the spotify api covering the oauth routes.
69 lines • 1.9 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 {
client;
totalTracks;
markets;
externalUrls;
url;
id;
images;
name;
release;
releasePrecision;
restrictions;
type;
uri;
artists;
constructor(client, data) {
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 = data.restrictions?.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 {
client;
tracks;
copyrights;
externalIds;
genres;
label;
popularity;
constructor(client, data) {
super(client, data);
this.client = client;
this.tracks = {
...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