@twurple/api
Version:
Interact with Twitch's API.
134 lines (133 loc) • 4.33 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HelixUnbanRequest = void 0;
const tslib_1 = require("tslib");
const shared_utils_1 = require("@d-fischer/shared-utils");
const common_1 = require("@twurple/common");
/**
* A request from a user to be unbanned from a channel.
*/
let HelixUnbanRequest = class HelixUnbanRequest extends common_1.DataObject {
/** @internal */
constructor(data, client) {
super(data);
this._client = client;
}
/**
* Unban request ID.
*/
get id() {
return this[common_1.rawDataSymbol].id;
}
/**
* The ID of the broadcaster whose channel is receiving the unban request.
*/
get broadcasterId() {
return this[common_1.rawDataSymbol].broadcaster_id;
}
/**
* The name of the broadcaster whose channel is receiving the unban request.
*/
get broadcasterName() {
return this[common_1.rawDataSymbol].broadcaster_id;
}
/**
* The display name of the broadcaster whose channel is receiving the unban request.
*/
get broadcasterDisplayName() {
return this[common_1.rawDataSymbol].broadcaster_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 moderator who resolved the unban request.
*
* Can be `null` if the request is not resolved.
*/
get moderatorId() {
return this[common_1.rawDataSymbol].moderator_id;
}
/**
* The name of the moderator who resolved the unban request.
*
* Can be `null` if the request is not resolved.
*/
get moderatorName() {
return this[common_1.rawDataSymbol].moderator_login;
}
/**
* The display name of the moderator who resolved the unban request.
*
* Can be `null` if the request is not resolved.
*/
get moderatorDisplayName() {
return this[common_1.rawDataSymbol].moderator_name;
}
/**
* 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 user who requested to be unbanned.
*/
get userId() {
return this[common_1.rawDataSymbol].user_id;
}
/**
* The name of the user who requested to be unbanned.
*/
get userName() {
return this[common_1.rawDataSymbol].user_login;
}
/**
* The display name of the user who requested to be unbanned.
*/
get userDisplayName() {
return this[common_1.rawDataSymbol].user_name;
}
/**
* Gets more information about the user.
*/
async getUser() {
return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].user_id));
}
/**
* Text message of the unban request from the requesting user.
*/
get message() {
return this[common_1.rawDataSymbol].text;
}
/**
* The date of when the unban request was created.
*/
get creationDate() {
return new Date(this[common_1.rawDataSymbol].created_at);
}
/**
* The message written by the moderator who resolved the unban request, or `null` if it has not been resolved yet.
*/
get resolutionMessage() {
// Can be empty string and null
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
return this[common_1.rawDataSymbol].resolution_text || null;
}
/**
* The date when the unban request was resolved, or `null` if it has not been resolved yet.
*/
get resolutionDate() {
return (0, shared_utils_1.mapNullable)(this[common_1.rawDataSymbol].resolved_at, val => new Date(val));
}
};
exports.HelixUnbanRequest = HelixUnbanRequest;
tslib_1.__decorate([
(0, shared_utils_1.Enumerable)(false)
], HelixUnbanRequest.prototype, "_client", void 0);
exports.HelixUnbanRequest = HelixUnbanRequest = tslib_1.__decorate([
(0, common_1.rtfm)('api', 'HelixUnbanRequest', 'id')
], HelixUnbanRequest);