Interface IClientHelper

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
TwitchClientHelper

public interface IClientHelper extends AutoCloseable
  • Method Details

    • getTwitchHelix

      TwitchHelix getTwitchHelix()
    • enableStreamEventListener

      boolean enableStreamEventListener(String channelId, String channelName)
      Enable StreamEvent Listener, without invoking a Helix API call
      Parameters:
      channelId - Channel Id
      channelName - Channel Name
      Returns:
      true if the channel was added, false otherwise
    • disableStreamEventListenerForId

      boolean disableStreamEventListenerForId(String channelId)
      Disable StreamEventListener, without invoking a Helix API call
      Parameters:
      channelId - Channel Id
      Returns:
      true if the channel was removed, false otherwise
    • enableFollowEventListener

      boolean enableFollowEventListener(String channelId, String channelName)
      Enable Follow Listener, without invoking a Helix API call

      For FollowEvent to fire, defaultAuthToken must be a user access token from a moderator of the channel with the TwitchScopes.HELIX_CHANNEL_FOLLOWERS_READ scope. Otherwise, the client helper can only fire ChannelFollowCountUpdateEvent due to Twitch restrictions implemented on 2023-09-12.

      Parameters:
      channelId - Channel Id
      channelName - Channel Name
      Returns:
      true if the channel was added, false otherwise
    • disableFollowEventListenerForId

      boolean disableFollowEventListenerForId(String channelId)
      Disable Follow Listener, without invoking a Helix API call
      Parameters:
      channelId - Channel Id
      Returns:
      true when a previously-tracked channel was removed, false otherwise
    • enableClipEventListener

      boolean enableClipEventListener(String channelId, String channelName, Instant startedAt)
      Enable Clip Creation Listener, without invoking a Helix API call, starting at a custom timestamp
      Parameters:
      channelId - Channel Id
      channelName - Channel Name
      startedAt - The oldest clip creation timestamp to start the queries at
      Returns:
      whether the channel was added
    • disableClipEventListenerForId

      boolean disableClipEventListenerForId(String channelId)
      Disable Clip Creation Listener, without invoking a Helix API call
      Parameters:
      channelId - Channel Id
      Returns:
      whether a previously-tracked channel was removed
    • getCachedInformation

      Optional<ChannelCache> getCachedInformation(String channelId)
      Get cached information for a channel's stream status and follower count.

      For this information to be valid, the respective event listeners need to be enabled for the channel.

      For thread safety, the setters on this object should not be used; only getters.

      Parameters:
      channelId - The ID of the channel whose cache is to be retrieved.
      Returns:
      ChannelCache in an optional wrapper.
    • setThreadDelay

      void setThreadDelay(long threadDelay)
      Updates ExponentialBackoffStrategy.getBaseMillis() for each of the independent listeners (i.e. stream status and followers)
      Parameters:
      threadDelay - the minimum milliseconds delay between each api call
    • enableStreamEventListener

      @Nullable default @Nullable User enableStreamEventListener(String channelName)
      Enable StreamEvent Listener
      Parameters:
      channelName - Channel Name
    • enableStreamEventListener

      default Collection<User> enableStreamEventListener(Iterable<String> channelNames)
      Enable StreamEvent Listener for the given channel names
      Parameters:
      channelNames - the channel names to be added
    • disableStreamEventListener

      default void disableStreamEventListener(String channelName)
      Disable StreamEvent Listener
      Parameters:
      channelName - Channel Name
    • disableStreamEventListener

      default void disableStreamEventListener(Iterable<String> channelNames)
      Disable StreamEvent Listener for the given channel names
      Parameters:
      channelNames - the channel names to be removed
    • enableFollowEventListener

      @Nullable default @Nullable User enableFollowEventListener(String channelName)
      Enable Follow Listener for the given channel name

      For FollowEvent to fire, defaultAuthToken must be a user access token from a moderator of the channel with the TwitchScopes.HELIX_CHANNEL_FOLLOWERS_READ scope. Otherwise, the client helper can only fire ChannelFollowCountUpdateEvent due to Twitch restrictions implemented on 2023-09-12.

      Parameters:
      channelName - Channel Name
    • enableFollowEventListener

      default Collection<User> enableFollowEventListener(Iterable<String> channelNames)
      Enable Follow Listener for the given channel names

      For FollowEvent to fire, defaultAuthToken must be a user access token from a moderator of the channel with the TwitchScopes.HELIX_CHANNEL_FOLLOWERS_READ scope. Otherwise, the client helper can only fire ChannelFollowCountUpdateEvent due to Twitch restrictions implemented on 2023-09-12.

      Parameters:
      channelNames - the channel names to be added
    • disableFollowEventListener

      default void disableFollowEventListener(String channelName)
      Disable Follow Listener
      Parameters:
      channelName - Channel Name
    • disableFollowEventListener

      default void disableFollowEventListener(Iterable<String> channelNames)
      Disable Follow Listener for the given channel names
      Parameters:
      channelNames - the channel names to be removed
    • enableClipEventListener

      default boolean enableClipEventListener(String channelId, String channelName)
      Enable Clip Creation Listener, without invoking a Helix API call
      Parameters:
      channelId - Channel Id
      channelName - Channel Name
      Returns:
      whether the channel was added
    • enableClipEventListener

      @Nullable default @Nullable User enableClipEventListener(String channelName)
      Clip Creation Listener
      Parameters:
      channelName - Channel Name
      Returns:
      the channel whose clip creations are now tracked, or null (if unable to resolve or already tracking)
    • enableClipEventListener

      default Collection<User> enableClipEventListener(Iterable<String> channelNames)
      Enable Clip Creation Listener for the given channel names
      Parameters:
      channelNames - the channel names to be added
      Returns:
      the channels that are freshly tracked for clip creations
    • disableClipEventListener

      default boolean disableClipEventListener(String channelName)
      Disable Clip Creation Listener
      Parameters:
      channelName - Channel Name
      Returns:
      whether a previously-tracked channel was removed
    • disableClipEventListener

      default void disableClipEventListener(Iterable<String> channelNames)
      Disable Clip Creation Listener for the given channel names
      Parameters:
      channelNames - the channel names to be removed
    • setThreadRate

      default void setThreadRate(long threadRate)
      Updates ExponentialBackoffStrategy.getBaseMillis() for each of the independent listeners (i.e. stream status and followers)
      Parameters:
      threadRate - the maximum rate of api calls per second