@twurple/api
Version:
Interact with Twitch's API.
54 lines (53 loc) • 1.94 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HelixAdSchedule = void 0;
const tslib_1 = require("tslib");
const common_1 = require("@twurple/common");
/**
* Represents a broadcaster's ad schedule.
*/
let HelixAdSchedule = class HelixAdSchedule extends common_1.DataObject {
/**
* The number of snoozes available for the broadcaster.
*/
get snoozeCount() {
return this[common_1.rawDataSymbol].snooze_count;
}
/**
* The date and time when the broadcaster will gain an additional snooze.
* Returns `null` if all snoozes are already available.
*/
get snoozeRefreshDate() {
return this[common_1.rawDataSymbol].snooze_refresh_at ? new Date(this[common_1.rawDataSymbol].snooze_refresh_at * 1000) : null;
}
/**
* The date and time of the broadcaster's next scheduled ad.
* Returns `null` if channel is not live or has no ad scheduled.
*/
get nextAdDate() {
return this[common_1.rawDataSymbol].next_ad_at ? new Date(this[common_1.rawDataSymbol].next_ad_at * 1000) : null;
}
/**
* The length in seconds of the scheduled upcoming ad break.
*/
get duration() {
return this[common_1.rawDataSymbol].duration;
}
/**
* The date and time of the broadcaster's last ad-break.
* Returns `null` if channel is not live or has not run an ad.
*/
get lastAdDate() {
return this[common_1.rawDataSymbol].last_ad_at ? new Date(this[common_1.rawDataSymbol].last_ad_at * 1000) : null;
}
/**
* The amount of pre-roll free time remaining for the channel in seconds.
*/
get prerollFreeTime() {
return this[common_1.rawDataSymbol].preroll_free_time;
}
};
exports.HelixAdSchedule = HelixAdSchedule;
exports.HelixAdSchedule = HelixAdSchedule = tslib_1.__decorate([
(0, common_1.rtfm)('api', 'HelixAdSchedule')
], HelixAdSchedule);