UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

28 lines (27 loc) 1.24 kB
import { __decorate } from "tslib"; import { rtfm } from '@twurple/common'; import { EventSubDropEntitlementGrantEvent } from '../events/EventSubDropEntitlementGrantEvent.js'; import { EventSubSubscription } from './EventSubSubscription.js'; /** @internal */ let EventSubDropEntitlementGrantSubscription = class EventSubDropEntitlementGrantSubscription extends EventSubSubscription { _filter; /** @protected */ _cliName = 'drop'; authUserId = null; constructor(handler, client, _filter) { super(handler, client); this._filter = _filter; } get id() { return `drop.entitlement.grant.${this._filter.organizationId}.${this._filter.categoryId ?? 'all'}.${this._filter.campaignId ?? 'all'}`; } transformData(data) { return new EventSubDropEntitlementGrantEvent(data, this._client._apiClient); } async _subscribe() { return await this._client._apiClient.eventSub.subscribeToDropEntitlementGrantEvents(this._filter, await this._getTransportOptions()); } }; EventSubDropEntitlementGrantSubscription = __decorate([ rtfm('eventsub-base', 'EventSubSubscription') ], EventSubDropEntitlementGrantSubscription); export { EventSubDropEntitlementGrantSubscription };