UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

32 lines (31 loc) 1.42 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 this._client._config.managed ? new EventSubDropEntitlementGrantEvent(data, this._client._config.apiClient) : new EventSubDropEntitlementGrantEvent(data); } async _subscribe() { return this._client._config.managed ? await this._client._config.apiClient.eventSub.subscribeToDropEntitlementGrantEvents(this._filter, await this._getTransportOptions()) : undefined; } }; EventSubDropEntitlementGrantSubscription = __decorate([ rtfm('eventsub-base', 'EventSubSubscription') ], EventSubDropEntitlementGrantSubscription); export { EventSubDropEntitlementGrantSubscription };