Package com.gmt2001.twitch.eventsub
Class EventSubSubscriptionType
java.lang.Object
com.gmt2001.twitch.eventsub.EventSubSubscriptionType
- All Implemented Interfaces:
Flow.Subscriber<EventSubInternalEvent>
- Direct Known Subclasses:
AutomodMessage,ChannelFollow,ChannelModerate,ChannelPointsCustomRewardRedemptionAdd,ChannelUpdate,PredictionBegin,PredictionEnd,PredictionLock,PredictionProgress,Revocation,StreamOffline,StreamOnline,Test
public abstract class EventSubSubscriptionType
extends Object
implements Flow.Subscriber<EventSubInternalEvent>
Abstract base class for EventSub Subscription Types
- Author:
- gmt2001
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Flow.Subscriptionprotected Stringprotected ZonedDateTimeprotected EventSubSubscription -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedEventSubSubscriptionType(EventSubSubscription subscription, String messageId, ZonedDateTime messageTimestamp) -
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates a new EventSub subscription, using the parameters provided via other methods or the constructor.delete()Deletes the EventSub subscription matching the parameters in this object, if it can be found in the subscription listDeletes all EventSub subscriptions matching the parameters in this object, if it can be found in the subscription listReturns the subscription id if a subscription already exists in either the ENABLED or WEBHOOK_CALLBACK_VERIFICATION_PENDING states, otherwise nullReturns all subscription ids if a subscription already exists in either the ENABLED or WEBHOOK_CALLBACK_VERIFICATION_PENDING states, otherwise an empty listReturns the existing subscription, if one already exists in either the ENABLED or WEBHOOK_CALLBACK_VERIFICATION_PENDING statesbooleanReturns true if a subscription already exists in either the ENABLED or WEBHOOK_CALLBACK_VERIFICATION_PENDING statesprotected abstract booleanisMatch(EventSubSubscription subscription) Returns true if the provided subscription is an instance of the current subscription type and matches the current subscription conditionsGets the message id, if the object was created as part of a notificationGets the message timestamp, if the object was created as part of a notificationfinal voidfinal voidprotected voidprotected voidprotected voidprotected voidfinal voidonNext(EventSubInternalEvent item) final voidonSubscribe(Flow.Subscription subscription) protected abstract EventSubSubscriptionCompiles the parameters of this object into anEventSubSubscriptionthat can be createdprotected EventSubSubscriptionActually creates the proposedEventSubSubscriptionprotected EventSubTransportCreates a transport for a proposed subscriptionprotected final voidGets the subscription information, if the object was created as part of a notificationprotected abstract voidValidates that the provided parameters are acceptable for use inproposeSubscription()
-
Field Details
-
subscription
-
messageId
-
messageTimestamp
-
flowsubscription
-
-
Constructor Details
-
EventSubSubscriptionType
protected EventSubSubscriptionType() -
EventSubSubscriptionType
protected EventSubSubscriptionType(EventSubSubscription subscription, String messageId, ZonedDateTime messageTimestamp)
-
-
Method Details
-
subscribe
protected final void subscribe() -
onSubscribe
- Specified by:
onSubscribein interfaceFlow.Subscriber<EventSubInternalEvent>
-
onNext
- Specified by:
onNextin interfaceFlow.Subscriber<EventSubInternalEvent>
-
onError
- Specified by:
onErrorin interfaceFlow.Subscriber<EventSubInternalEvent>
-
onComplete
public final void onComplete()- Specified by:
onCompletein interfaceFlow.Subscriber<EventSubInternalEvent>
-
onEventSubInternalEvent
-
onEventSubInternalNotificationEvent
-
onEventSubInternalRevocationEvent
-
onEventSubInternalVerificationEvent
-
create
Creates a new EventSub subscription, using the parameters provided via other methods or the constructor. If a matching subscription already exists, it is returned instead- Returns:
-
delete
Deletes the EventSub subscription matching the parameters in this object, if it can be found in the subscription list- Returns:
-
deleteAll
Deletes all EventSub subscriptions matching the parameters in this object, if it can be found in the subscription list- Returns:
-
proposeSubscription
Compiles the parameters of this object into anEventSubSubscriptionthat can be created- Returns:
-
proposeSubscriptionInternal
protected EventSubSubscription proposeSubscriptionInternal(String type, String version, Map<String, String> condition) Actually creates the proposedEventSubSubscription- Parameters:
type- The subscription type to createversion- The subscription type versioncondition- The conditions which will trigger notifications for this subscription- Returns:
-
proposeTransport
Creates a transport for a proposed subscription- Returns:
-
validateParameters
Validates that the provided parameters are acceptable for use inproposeSubscription()- Throws:
IllegalArgumentException- One of the parameters is not acceptable
-
isAlreadySubscribed
public boolean isAlreadySubscribed()Returns true if a subscription already exists in either the ENABLED or WEBHOOK_CALLBACK_VERIFICATION_PENDING states- Returns:
-
getExistingSubscription
Returns the existing subscription, if one already exists in either the ENABLED or WEBHOOK_CALLBACK_VERIFICATION_PENDING states- Returns:
-
findMatchingSubscriptionId
Returns the subscription id if a subscription already exists in either the ENABLED or WEBHOOK_CALLBACK_VERIFICATION_PENDING states, otherwise null- Returns:
-
findMatchingSubscriptionIds
Returns all subscription ids if a subscription already exists in either the ENABLED or WEBHOOK_CALLBACK_VERIFICATION_PENDING states, otherwise an empty list- Returns:
-
isMatch
Returns true if the provided subscription is an instance of the current subscription type and matches the current subscription conditions- Parameters:
subscription-- Returns:
-
subscription
Gets the subscription information, if the object was created as part of a notification- Returns:
-
messageId
Gets the message id, if the object was created as part of a notification- Returns:
-
messageTimestamp
Gets the message timestamp, if the object was created as part of a notification- Returns:
-