UNPKG

@twurple/api

Version:

Interact with Twitch's API.

66 lines (65 loc) 2.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HelixWarning = void 0; const tslib_1 = require("tslib"); const shared_utils_1 = require("@d-fischer/shared-utils"); const common_1 = require("@twurple/common"); /** * Information about the warning. */ let HelixWarning = class HelixWarning extends common_1.DataObject { /** @internal */ constructor(data, client) { super(data); this._client = client; } /** * The ID of the channel in which the warning will take effect. */ get broadcasterId() { return this[common_1.rawDataSymbol].user_id; } /** * Gets more information about the broadcaster. */ async getBroadcaster() { return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].broadcaster_id)); } /** * The ID of the user who applied the warning. */ get moderatorId() { return this[common_1.rawDataSymbol].moderator_id; } /** * Gets more information about the moderator. */ async getModerator() { return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].moderator_id)); } /** * The ID of the warned user. */ get userId() { return this[common_1.rawDataSymbol].user_id; } /** * Gets more information about the user. */ async getUser() { return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].user_id)); } /** * The reason provided for the warning. */ get reason() { return this[common_1.rawDataSymbol].reason; } }; exports.HelixWarning = HelixWarning; tslib_1.__decorate([ (0, shared_utils_1.Enumerable)(false) ], HelixWarning.prototype, "_client", void 0); exports.HelixWarning = HelixWarning = tslib_1.__decorate([ (0, common_1.rtfm)('api', 'HelixWarning', 'userId') ], HelixWarning);