Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TwitchClient

Provides a convenient interface for Twitch API requests with an automatically set and updated extension client id.

Should not normally be created directly, instead an instance is made available and namespaced appropriately when using Muxy.TwitchClient.

example

const twitchClient = new Muxy.TwitchClient(); twitchClient.getAllState().then((state) => { console.log(state); });

Hierarchy

  • TwitchClient

Index

Properties

extensionId

extensionId: string

promise

promise: Promise<any>

Methods

getTwitchUsers

  • getTwitchUsers(usernames: string[]): Promise<TwitchUser[]>
  • Returns a list of Twitch User objects for a given list of usernames.

    async
    since

    1.0.0

    throws

    {TypeError} Will throw an error if users is not an array of strings.

    example

    twitchClient.getTwitchUsers(['muxy'], (response) => { console.log(response.users[0].display_name); });

    Parameters

    • usernames: string[]

      A list of usernames to lookup on Twitch.

    Returns Promise<TwitchUser[]>

    Resolves with a list of TwitchUser objects for each of the usernames provided.

getTwitchUsersByID

  • Returns a list of Twitch User objects for a given list of user IDs.

    async
    throws

    {TypeError} Will throw an error if userIDs is not an array of strings.

    example

    twitchClient.getTwitchUsersByID(['126955211'], (response) => { console.log(response.users[0].display_name); });

    Parameters

    • userIDs: string[]

      A list of user IDs to lookup on Twitch.

    Returns Promise<HelixTwitchUser[]>

    Resolves with a list of HelixTwitchUser objects for each of the user IDs provided.

getUserGoods

  • getUserGoods(JWT: any): Promise<any>
  • Gets a list of the digital goods the current user has.

    Parameters

    • JWT: any

      Signed JWT, accessible from sdk.user.twitchJWT

    Returns Promise<any>

    Resolves with a list of {@link ExtensionGood} objects for each of the goods the user is entitled to.

loaded

  • loaded(): Promise<any>
  • Returns a promise which will resolve once the TwitchClient is available for use.

    since

    1.0.0

    Returns Promise<any>

    Will resolve when the TwitchClient is ready for use.

updateFulfilledGoods

  • updateFulfilledGoods(JWT: any, receipts: any): Promise<any>
  • Sets the fulfillment status for the specified receipts (purchases).

    Parameters

    • JWT: any

      Signed JWT, accessible from sdk.user.twitchJWT

    • receipts: any

    Returns Promise<any>

    Resolves with a list of results, one for each Receipt in the Receipts parameter.

Generated using TypeDoc