@twurple/api
Version:
Interact with Twitch's API.
61 lines (60 loc) • 2.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HelixSharedChatSession = void 0;
const tslib_1 = require("tslib");
const shared_utils_1 = require("@d-fischer/shared-utils");
const common_1 = require("@twurple/common");
const HelixSharedChatSessionParticipant_1 = require("./HelixSharedChatSessionParticipant");
/**
* A shared chat session.
*/
let HelixSharedChatSession = class HelixSharedChatSession extends common_1.DataObject {
/** @internal */
constructor(data, client) {
super(data);
this._client = client;
}
/**
* The unique identifier for the shared chat session.
*/
get sessionId() {
return this[common_1.rawDataSymbol].session_id;
}
/**
* The ID of the host broadcaster.
*/
get hostBroadcasterId() {
return this[common_1.rawDataSymbol].host_broadcaster_id;
}
/**
* Gets information about the host broadcaster.
*/
async getHostBroadcaster() {
return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].host_broadcaster_id));
}
/**
* The list of participants in the session.
*/
get participants() {
return this[common_1.rawDataSymbol].participants.map(data => new HelixSharedChatSessionParticipant_1.HelixSharedChatSessionParticipant(data, this._client));
}
/**
* The date for when the session was created.
*/
get createdDate() {
return new Date(this[common_1.rawDataSymbol].created_at);
}
/**
* The date for when the session was updated.
*/
get updatedDate() {
return new Date(this[common_1.rawDataSymbol].updated_at);
}
};
exports.HelixSharedChatSession = HelixSharedChatSession;
tslib_1.__decorate([
(0, shared_utils_1.Enumerable)(false)
], HelixSharedChatSession.prototype, "_client", void 0);
exports.HelixSharedChatSession = HelixSharedChatSession = tslib_1.__decorate([
(0, common_1.rtfm)('api', 'HelixSharedChatSession', 'sessionId')
], HelixSharedChatSession);