lunify.js
Version:
A basic api wrapper for the spotify api covering the oauth routes.
26 lines • 1.32 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CurrentPlayback = void 0;
const __1 = require("../..");
const Device_1 = require("./Device");
class CurrentPlayback {
constructor(client, user, data) {
var _a, _b, _c, _d;
this.client = client;
this.user = user;
this.device = new Device_1.PlayerDevice(this.client, user, data.device);
this.repeat = data.repeat_state !== 'off' ? data.repeat_state : false;
this.shuffle = data.shuffle_state;
this.context = { type: ((_a = data.context) === null || _a === void 0 ? void 0 : _a.type) || null, url: ((_b = data.context) === null || _b === void 0 ? void 0 : _b.href) || null, externalUrls: ((_c = data.context) === null || _c === void 0 ? void 0 : _c.external_urls) || null, uri: ((_d = data.context) === null || _d === void 0 ? void 0 : _d.uri) || null };
this.timestamp = data.timestamp;
this.progress = data.progress_ms;
this.playing = data.is_playing;
if (data.item.type === 'track')
this.item = new __1.Track(client, data.item);
else
this.item = data.item;
this.playingType = data.currently_playing_type;
}
}
exports.CurrentPlayback = CurrentPlayback;
//# sourceMappingURL=CurrentPlayback.js.map