Class TwitchClientBuilder

java.lang.Object
com.github.twitch4j.TwitchClientBuilder

public class TwitchClientBuilder
extends java.lang.Object
Builder to get a TwitchClient Instance by provided various options, to provide the user with a lot of customizable options.
  • Field Details

    • botOwnerIds

      protected java.util.Collection<java.lang.String> botOwnerIds
      User IDs of Bot Owners for applying CommandPermission.OWNER
    • commandPrefixes

      protected final java.util.Set<java.lang.String> commandPrefixes
      IRC Command Handlers
    • chatQueueSize

      protected java.lang.Integer chatQueueSize
      Size of the ChatQueue
    • chatRateLimit

      protected io.github.bucket4j.Bandwidth chatRateLimit
      Custom RateLimit for ChatMessages
  • Method Details

    • withBotOwnerId

      public TwitchClientBuilder withBotOwnerId​(java.lang.String userId)
      With a Bot Owner's User ID
      Parameters:
      userId - the user id
      Returns:
      TwitchClientBuilder
    • withCommandTrigger

      public TwitchClientBuilder withCommandTrigger​(java.lang.String commandTrigger)
      With a CommandTrigger
      Parameters:
      commandTrigger - Command Trigger (Prefix)
      Returns:
      TwitchClientBuilder
    • withHelperThreadRate

      @Deprecated public TwitchClientBuilder withHelperThreadRate​(long helperThreadDelay)
      Deprecated.
      in favor of withHelperThreadDelay
      With a base thread delay for API calls by TwitchClientHelper

      Note: the method name has been a misnomer as it has always set the delay rather than a rate. One can change the rate at any time via TwitchClientHelper.setThreadRate(long).

      Parameters:
      helperThreadDelay - TwitchClientHelper Base Thread Delay
      Returns:
      TwitchClientBuilder
    • builder

      public static TwitchClientBuilder builder()
      Initialize the builder
      Returns:
      Twitch Client Builder
    • build

      public TwitchClient build()
      Initialize
      Returns:
      TwitchClient initialized class
    • getClientId

      public java.lang.String getClientId()
      Client Id
    • getClientSecret

      public java.lang.String getClientSecret()
      Client Secret
    • getUserAgent

      public java.lang.String getUserAgent()
      User Agent
    • getRequestQueueSize

      public java.lang.Integer getRequestQueueSize()
      HTTP Request Queue Size
    • getRedirectUrl

      public java.lang.String getRedirectUrl()
      Redirect Url
    • getTimeout

      public java.lang.Integer getTimeout()
      Default Timeout
    • getEnableExtensions

      public java.lang.Boolean getEnableExtensions()
      Enabled: Extensions
    • getEnableHelix

      public java.lang.Boolean getEnableHelix()
      Enabled: Helix
    • getEnableKraken

      public java.lang.Boolean getEnableKraken()
      Enabled: Kraken
    • getEnableTMI

      public java.lang.Boolean getEnableTMI()
      Enabled: TMI
    • getEnableChat

      public java.lang.Boolean getEnableChat()
      Enabled: Chat
    • getBotOwnerIds

      public java.util.Collection<java.lang.String> getBotOwnerIds()
      User IDs of Bot Owners for applying CommandPermission.OWNER
    • getCommandPrefixes

      public java.util.Set<java.lang.String> getCommandPrefixes()
      IRC Command Handlers
    • getEnablePubSub

      public java.lang.Boolean getEnablePubSub()
      Enabled: PubSub
    • getEnableGraphQL

      public java.lang.Boolean getEnableGraphQL()
      Enabled: GraphQL
    • getChatAccount

      public com.github.philippheuer.credentialmanager.domain.OAuth2Credential getChatAccount()
      Chat Account
    • getEventManager

      public com.github.philippheuer.events4j.core.EventManager getEventManager()
      EventManager
    • getDefaultEventHandler

      public java.lang.Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> getDefaultEventHandler()
      EventManager
    • getChatQueueSize

      public java.lang.Integer getChatQueueSize()
      Size of the ChatQueue
    • getChatRateLimit

      public io.github.bucket4j.Bandwidth getChatRateLimit()
      Custom RateLimit for ChatMessages
    • getChatQueueTimeout

      public long getChatQueueTimeout()
      Wait time for taking items off chat queue in milliseconds. Default recommended
    • getChatServer

      public java.lang.String getChatServer()
      Sets the default server used for chat

      Defaults to TwitchChat.TWITCH_WEB_SOCKET_SERVER, you can use TwitchChat.FDGT_TEST_SOCKET_SERVER for testing

    • getCredentialManager

      public com.github.philippheuer.credentialmanager.CredentialManager getCredentialManager()
      CredentialManager
    • getScheduledThreadPoolExecutor

      public java.util.concurrent.ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
      Scheduler Thread Pool Executor
    • getHelperThreadDelay

      public long getHelperThreadDelay()
      Millisecond Delay for Client Helper Thread
    • getDefaultAuthToken

      public com.github.philippheuer.credentialmanager.domain.OAuth2Credential getDefaultAuthToken()
      Default Auth Token for API Requests
    • getProxyConfig

      public com.github.twitch4j.common.config.ProxyConfig getProxyConfig()
      Proxy Configuration
    • getFeignLogLevel

      public feign.Logger.Level getFeignLogLevel()
      you can overwrite the feign loglevel to print the full requests + responses if needed
    • withClientId

      public TwitchClientBuilder withClientId​(java.lang.String clientId)
      Client Id
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withClientSecret

      public TwitchClientBuilder withClientSecret​(java.lang.String clientSecret)
      Client Secret
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withUserAgent

      public TwitchClientBuilder withUserAgent​(java.lang.String userAgent)
      User Agent
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withRequestQueueSize

      public TwitchClientBuilder withRequestQueueSize​(java.lang.Integer requestQueueSize)
      HTTP Request Queue Size
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withRedirectUrl

      public TwitchClientBuilder withRedirectUrl​(java.lang.String redirectUrl)
      Redirect Url
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withTimeout

      public TwitchClientBuilder withTimeout​(java.lang.Integer timeout)
      Default Timeout
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEnableExtensions

      public TwitchClientBuilder withEnableExtensions​(java.lang.Boolean enableExtensions)
      Enabled: Extensions
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEnableHelix

      public TwitchClientBuilder withEnableHelix​(java.lang.Boolean enableHelix)
      Enabled: Helix
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEnableKraken

      public TwitchClientBuilder withEnableKraken​(java.lang.Boolean enableKraken)
      Enabled: Kraken
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEnableTMI

      public TwitchClientBuilder withEnableTMI​(java.lang.Boolean enableTMI)
      Enabled: TMI
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEnableChat

      public TwitchClientBuilder withEnableChat​(java.lang.Boolean enableChat)
      Enabled: Chat
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • setBotOwnerIds

      public TwitchClientBuilder setBotOwnerIds​(java.util.Collection<java.lang.String> botOwnerIds)
      User IDs of Bot Owners for applying CommandPermission.OWNER
      Returns:
      this.
    • withEnablePubSub

      public TwitchClientBuilder withEnablePubSub​(java.lang.Boolean enablePubSub)
      Enabled: PubSub
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEnableGraphQL

      public TwitchClientBuilder withEnableGraphQL​(java.lang.Boolean enableGraphQL)
      Enabled: GraphQL
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatAccount

      public TwitchClientBuilder withChatAccount​(com.github.philippheuer.credentialmanager.domain.OAuth2Credential chatAccount)
      Chat Account
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEventManager

      public TwitchClientBuilder withEventManager​(com.github.philippheuer.events4j.core.EventManager eventManager)
      EventManager
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withDefaultEventHandler

      public TwitchClientBuilder withDefaultEventHandler​(java.lang.Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> defaultEventHandler)
      EventManager
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatQueueSize

      public TwitchClientBuilder withChatQueueSize​(java.lang.Integer chatQueueSize)
      Size of the ChatQueue
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatRateLimit

      public TwitchClientBuilder withChatRateLimit​(io.github.bucket4j.Bandwidth chatRateLimit)
      Custom RateLimit for ChatMessages
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatQueueTimeout

      public TwitchClientBuilder withChatQueueTimeout​(long chatQueueTimeout)
      Wait time for taking items off chat queue in milliseconds. Default recommended
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatServer

      public TwitchClientBuilder withChatServer​(java.lang.String chatServer)
      Sets the default server used for chat

      Defaults to TwitchChat.TWITCH_WEB_SOCKET_SERVER, you can use TwitchChat.FDGT_TEST_SOCKET_SERVER for testing

      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withCredentialManager

      public TwitchClientBuilder withCredentialManager​(com.github.philippheuer.credentialmanager.CredentialManager credentialManager)
      CredentialManager
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withScheduledThreadPoolExecutor

      public TwitchClientBuilder withScheduledThreadPoolExecutor​(java.util.concurrent.ScheduledThreadPoolExecutor scheduledThreadPoolExecutor)
      Scheduler Thread Pool Executor
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withHelperThreadDelay

      public TwitchClientBuilder withHelperThreadDelay​(long helperThreadDelay)
      Millisecond Delay for Client Helper Thread
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withDefaultAuthToken

      public TwitchClientBuilder withDefaultAuthToken​(com.github.philippheuer.credentialmanager.domain.OAuth2Credential defaultAuthToken)
      Default Auth Token for API Requests
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withProxyConfig

      public TwitchClientBuilder withProxyConfig​(com.github.twitch4j.common.config.ProxyConfig proxyConfig)
      Proxy Configuration
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withFeignLogLevel

      public TwitchClientBuilder withFeignLogLevel​(feign.Logger.Level feignLogLevel)
      you can overwrite the feign loglevel to print the full requests + responses if needed
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).