@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
34 lines (33 loc) • 1.57 kB
JavaScript
import { __decorate } from "tslib";
import { rtfm } from '@twurple/common';
import { EventSubChannelAutomaticRewardRedemptionAddV2Event } from '../events/EventSubChannelAutomaticRewardRedemptionAddV2Event.js';
import { EventSubSubscription } from './EventSubSubscription.js';
/** @internal */
let EventSubChannelAutomaticRewardRedemptionAddV2Subscription = class EventSubChannelAutomaticRewardRedemptionAddV2Subscription extends EventSubSubscription {
_userId;
/** @protected */ _cliName = '';
constructor(handler, client, _userId) {
super(handler, client);
this._userId = _userId;
}
get id() {
return `channel.channel_points_automatic_reward_redemption.add.v2.${this._userId}`;
}
get authUserId() {
return this._userId;
}
transformData(data) {
return this._client._config.managed
? new EventSubChannelAutomaticRewardRedemptionAddV2Event(data, this._client._config.apiClient)
: new EventSubChannelAutomaticRewardRedemptionAddV2Event(data);
}
async _subscribe() {
return this._client._config.managed
? await this._client._config.apiClient.eventSub.subscribeToChannelAutomaticRewardRedemptionAddV2Events(this._userId, await this._getTransportOptions())
: undefined;
}
};
EventSubChannelAutomaticRewardRedemptionAddV2Subscription = __decorate([
rtfm('eventsub-base', 'EventSubSubscription')
], EventSubChannelAutomaticRewardRedemptionAddV2Subscription);
export { EventSubChannelAutomaticRewardRedemptionAddV2Subscription };