WebhookSubscription
A subscription created within a WebhookConnection.
Extends
Subscription
<T
>
Type parameters
Type parameter | Value |
---|---|
T extends SubscriptionTypes | SubscriptionTypes |
Constructors
new WebhookSubscription()
Builds up a new WebhookSubscription.
Parameters
Parameter | Type | Description |
---|---|---|
connection | WebhookConnection | The connection used for this subscription. |
options | SubscriptionOptions <T > | The options for the subscription. |
data | PostEventSubSubscription | The data for the subscription. |
secret | string | The secret used for creating this subscription. |
Returns
Overrides
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookSubscription.ts:38
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
callbacks | readonly | WebhookSubscriptionCallbackManager <T > | The callbacks for this subscription. | - |
connection | readonly | WebhookConnection | The connection used for this subscription. | - |
cost | readonly | number | The cost of the subscription. If the subscription doesn’t needs an authorization this could be 1 (or 0 if the target user has authorized within your application) if not it will be 0. Maximum accumulated cost for webhooks subscriptions is 10000 while for websocket subscriptions is 3. | Subscription .cost |
createdAt | readonly | Date | The date when the subscription was created. | Subscription .createdAt |
id | readonly | string | The ID of the subscription. | Subscription .id |
nonce | public | string | The nonce of the subscription. An unique identifier which you can set to separate same type subscriptions. | Subscription .nonce |
options | readonly | SubscriptionTypeOptions [T ] | The options used to create the subscription. | Subscription .options |
secret | readonly | string | The secret used for creating this subscription. | - |
status | public | string | The status of the subscription. Normally is ‘enabled’. | Subscription .status |
type | readonly | T | The type of the subscription. | Subscription .type |
version | readonly | string | The version of the subscription. This version is the latest version of the subscription type. | Subscription .version |
Methods
checkSubscriptionType()
Checks if the subscription is of a specific type.
Type parameters
Type parameter |
---|
U extends SubscriptionTypes |
Parameters
Parameter | Type | Description |
---|---|---|
type | U | The type to check. |
Returns
this is WebhookSubscription<U>
Whether the subscription is of the type.
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookSubscription.ts:70
delete()
Deletes the subscription.
Returns
Promise
<void
>
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookSubscription.ts:77
onMessage()
Adds a new callback to the subscription. This callback will be executed when a message within this subscription is received.
Parameters
Parameter | Type | Description |
---|---|---|
callback | WebhookSubscriptionCallback <T > | The callback to add. |
Returns
void
Source
twitchfy/packages/eventsub/src/webhook/structures/WebhookSubscription.ts:59