Class TwitchExtensionsCompatibilityLayer

java.lang.Object
com.github.twitch4j.extensions.compat.TwitchExtensionsCompatibilityLayer
All Implemented Interfaces:
TwitchExtensions

public final class TwitchExtensionsCompatibilityLayer extends Object implements TwitchExtensions
Forwards twitch extensions api calls to the new helix api
  • Constructor Details

    • TwitchExtensionsCompatibilityLayer

      public TwitchExtensionsCompatibilityLayer(String clientId, String clientSecret, String userAgent, Long timeout, Integer requestQueueSize, feign.Logger.Level logLevel, ProxyConfig proxyConfig)
  • Method Details

    • createExtensionSecret

      public com.netflix.hystrix.HystrixCommand<ExtensionSecretList> createExtensionSecret(String clientId, String jsonWebToken, int activationDelaySeconds)
      Description copied from interface: TwitchExtensions
      Creates a new secret for a specified extension, identified by a client ID value assigned to the extension when it is created. Also rotates any current secrets out of service, with enough time for extension clients to gracefully switch over to the new secret.

      Use this function only when you are ready to install the new secret it returns.

      Note: You get the initial secret via the Twitch developer site. Use this endpoint to rotate the secret later, if desired.

      Specified by:
      createExtensionSecret in interface TwitchExtensions
      Parameters:
      clientId - The extension's client ID.
      jsonWebToken - Signed JWT created by the EBS, following the requirements documented in “Signing the JWT” (in Building Extensions).
      activationDelaySeconds - The delay period, between the generation of the new secret and its use by Twitch, is specified by this required parameter. Default (and minimum): 300 (5 minutes).
      Returns:
      ExtensionSecretList
    • getExtensionSecret

      public com.netflix.hystrix.HystrixCommand<ExtensionSecretList> getExtensionSecret(String clientId, String jsonWebToken)
      Description copied from interface: TwitchExtensions
      Retrieves a specified extension’s secret data: a version and an array of secret objects.
      Specified by:
      getExtensionSecret in interface TwitchExtensions
      Parameters:
      clientId - The extension is identified by a client ID value assigned to the extension when it is created.
      jsonWebToken - Signed JWT created by the EBS, following the requirements documented in “Signing the JWT” (in Building Extensions).
      Returns:
      ExtensionSecretList
    • revokeExtensionSecrets

      public com.netflix.hystrix.HystrixCommand<Void> revokeExtensionSecrets(String clientId, String jsonWebToken)
      Description copied from interface: TwitchExtensions
      Deletes all secrets associated with a specified extension, identified by a client ID value assigned to the extension when it is created.

      This immediately breaks all clients until both a new Create Extension Secret is executed and the clients manually refresh themselves. Use this only if a secret is compromised and must be removed immediately from circulation.

      Specified by:
      revokeExtensionSecrets in interface TwitchExtensions
      Parameters:
      clientId - The client ID identifying the extension when it is created.
      jsonWebToken - Signed JWT created by the EBS, following the requirements documented in “Signing the JWT” (in Building Extensions)
      Returns:
      204 No Content on a successful call
    • getLiveChannelsWithExtensionActivated

      public com.netflix.hystrix.HystrixCommand<ChannelList> getLiveChannelsWithExtensionActivated(String clientId, String cursor)
      Description copied from interface: TwitchExtensions
      Returns one page of live channels that have installed and activated a specified extension.

      A channel that just went live may take a few minutes to appear in this list, and a channel may continue to appear on this list for a few minutes after it stops broadcasting.

      Specified by:
      getLiveChannelsWithExtensionActivated in interface TwitchExtensions
      Parameters:
      clientId - The client ID value assigned to the extension when it is created.
      cursor - Cursor for forward pagination.
      Returns:
      ChannelList
    • setExtensionRequiredConfiguration

      public com.netflix.hystrix.HystrixCommand<Void> setExtensionRequiredConfiguration(String clientId, String jsonWebToken, String extensionVersion, String channelId, String requiredConfiguration)
      Description copied from interface: TwitchExtensions
      Enable activation of a specified extension, after any required broadcaster configuration is correct.

      This is for extensions that require broadcaster configuration before activation. Use this if, in extension Capabilities, you select Custom/My Own Service.

      You enforce required broadcaster configuration with a required_configuration string in the extension manifest. The contents of this string can be whatever you want. Once your EBS determines that the extension is correctly configured on a channel, use this endpoint to provide that same configuration string, which enables activation on the channel.

      If a future version of the extension requires a different configuration, change the required_configuration string in your manifest. When the new version is released, broadcasters will be required to re-configure that new version.

      Specified by:
      setExtensionRequiredConfiguration in interface TwitchExtensions
      Parameters:
      clientId - The extension is identified by a client ID value assigned to the extension when it is created.
      jsonWebToken - Signed JWT created by the EBS, following the requirements documented in “Signing the JWT” (in Building Extensions).
      extensionVersion - The extension version.
      channelId - The channel id for the broadcaster.
      requiredConfiguration - The required configuration.
      Returns:
      204 No Content on a successful call
    • setExtensionConfigurationSegment

      public com.netflix.hystrix.HystrixCommand<Void> setExtensionConfigurationSegment(String clientId, String jsonWebToken, ExtensionConfigurationSegment configurationSegment)
      Description copied from interface: TwitchExtensions
      Sets a single configuration segment (any type). The segment type is specified by a required body parameter.

      Each segment is limited to 5 KB and can be set at most 20 times per minute. Updates to this data are not delivered to Extensions that have already rendered.

      Note: Your signed JWT must include the exp, user_id, and role fields, documented in JWT Schema. The role value must be external.

      Specified by:
      setExtensionConfigurationSegment in interface TwitchExtensions
      Parameters:
      clientId - The client ID identifying the extension when it is created.
      jsonWebToken - Signed JWT created by the EBS, following the requirements documented in “Signing the JWT” (in Building Extensions).
      configurationSegment - The updated configuration segment.
      Returns:
      204 No Content on a successful call
    • getExtensionChannelConfiguration

      public com.netflix.hystrix.HystrixCommand<Map<String,ConfigurationSegment>> getExtensionChannelConfiguration(String clientId, String jsonWebToken, String channelId)
      Description copied from interface: TwitchExtensions
      Gets the developer and broadcaster configuration segments for a specified channel.

      Each channel can be retrieved at most 20 times per minute.

      Note: Your signed JWT must include the exp, user_id, and role fields, documented in JWT Schema. The role value must be external.

      Specified by:
      getExtensionChannelConfiguration in interface TwitchExtensions
      Parameters:
      clientId - The client ID identifying the extension when it is created.
      jsonWebToken - Signed JWT created by the EBS, following the requirements documented in “Signing the JWT” (in Building Extensions).
      channelId - The channel id of the broadcaster.
      Returns:
      Map
    • getExtensionConfigurationSegment

      public com.netflix.hystrix.HystrixCommand<Map<String,ConfigurationSegment>> getExtensionConfigurationSegment(String clientId, String jsonWebToken, ConfigurationSegmentType segmentType, String channelId)
      Description copied from interface: TwitchExtensions
      Gets a broadcaster or developer configuration segment for a specified channel, or the global configuration segment.

      Each segment can be retrieved at most 20 times per minute.

      Note: Your signed JWT must include the exp, user_id, and role fields, documented in JWT Schema. The role value must be external.

      Specified by:
      getExtensionConfigurationSegment in interface TwitchExtensions
      Parameters:
      clientId - The client ID identifying the extension when it is created.
      jsonWebToken - Signed JWT created by the EBS, following the requirements documented in “Signing the JWT” (in Building Extensions).
      segmentType - The segment type.
      channelId - The channel id of the broadcaster (must be null for ConfigurationSegmentType.GLOBAL).
      Returns:
      Map
    • sendExtensionPubSubMessage

      public com.netflix.hystrix.HystrixCommand<Void> sendExtensionPubSubMessage(String clientId, String jsonWebToken, String channelId, String message, String targets)
      Description copied from interface: TwitchExtensions
      Twitch provides a publish-subscribe system for your EBS to communicate with both the broadcaster and viewers. Calling this endpoint forwards your message using the same mechanism as the send JavaScript helper function. A message can be sent to either a specified channel or globally (all channels on which your extension is active).

      Note: Your signed JWT must include the channel_id and pubsub_perms fields, documented in JWT Schema.

      Specified by:
      sendExtensionPubSubMessage in interface TwitchExtensions
      Parameters:
      clientId - The client ID identifying the extension when it is created.
      jsonWebToken - Signed JWT (Twitch or EBS JWTs are allowed)
      channelId - Either a specific channel's ID or "all"
      message - Your message to be sent.
      targets - Valid values: "broadcast", "global".
      Returns:
      204 No Content on a successful call
    • sendExtensionChatMessage

      public com.netflix.hystrix.HystrixCommand<Void> sendExtensionChatMessage(String clientId, String jsonWebToken, String extensionVersion, String channelId, String text)
      Description copied from interface: TwitchExtensions
      Sends a specified chat message to a specified channel. The message will appear in the channel’s chat as a normal message. The “username” of the message is the extension name you specified when you created the extension.

      There is a limit of 12 messages per minute, per channel. Extension chat messages use the same rate-limiting functionality as the New Twitch API (see Rate Limits). The maximum message size is 280 characters.

      The channel_id inside the JWT must match the channel ID in the request URL.

      Specified by:
      sendExtensionChatMessage in interface TwitchExtensions
      Parameters:
      clientId - The client ID identifying the extension when it is created.
      jsonWebToken - Signed JWT created by the EBS, following the requirements documented in Signing the JWT (in Building Extensions) or Twitch JWT containing the "broadcaster" role.
      extensionVersion - The extension version.
      channelId - The id of the channel to send the message to.
      text - The message to be sent.
      Returns:
      204 No Content on a successful call
    • getExtensionInformation

      public com.netflix.hystrix.HystrixCommand<ExtensionInformation> getExtensionInformation(String clientId)
      Description copied from interface: TwitchExtensions
      Get Extension Information
      Specified by:
      getExtensionInformation in interface TwitchExtensions
      Parameters:
      clientId - The client ID value assigned to the extension when it is created.
      Returns:
      ExtensionInformation
      See Also:
    • builder