twitch_client 0.0.11 copy "twitch_client: ^0.0.11" to clipboard
twitch_client: ^0.0.11 copied to clipboard

A package for developers to interact with the Twitch API easily, not all endpoints are implemented yet but they will eventually.

🚧 Work in Progress 🚧 #

📝 PS: Event subs are still a work in progress but since it's out of beta you can start playing with it with the 0.0.8.

Twitch Client 🎮🎙 #

Twitch Client is a package that allows you to connect with the Twitch API and interact with data like Bits, Channels, Chats, Games, and Moderation. You can find the Twitch API documentation here.

Features #

Getting started #

Register an app here : https://dev.twitch.tv/console The redirection URL and the client id are needed to connect with the API.

Usage #

Create a TwitchInterface object.

var twitchInterface = TwitchInterface(
    redirectionURL: 'url',
    clientid: 'clientID';

Retrieve the URL you will use in a webview to let the user connect with its account. The method getConnectionUrl must have a list of scopes, all scopes are available in the library.

final uri = twitchInterface.getConnectionUrl(
              scopes: TwitchApiScopes.allScopes);

Once the connection is done, the redirection URL will contain the user access token. Something like: Give the URL that was returned after using logged in to the package and it will parse the URL to keep the access token and add it to the TwitchInterface, this information is not kept across sessions, you will have to do this logic yourself.

twitchInterface.init(url: 'url');

Now you should be connected, here's how to call a method :

  final data = await twitchInterface.streamsRepository.getFollowedStreams(props: GetFollowedStreamsProps(userId: twitchInterface.userId));

To get the id of the user that isConnected :

 twitchInterface.userId

Additional information #

⚠️ IMPORTANT: Verify token ⚠️

As per twitch documentation, you should validate the access token every hour, they can audit your app and ask you to resolve the issue if you don't do it. More here: https://dev.twitch.tv/docs/authentication/validate-tokens#who-must-validate-tokens

Please call validateToken() to do this request.

Available requests so far : #

  • Start Commercial
  • Get Extension Analytics
  • Get Game Analytics
  • Get Bits Leaderboard
  • Get Cheermotes
  • Get Channel Information
  • Modify Channel Information
  • Get Channel Editors
  • Get Followed Channels
  • Get Channel Followers
  • Get Chatters
  • Get Chat Settings
  • Update Chat Settings
  • Ban User
  • Unban User
  • Get Moderators
  • Add Channel Moderator
  • Remove Channel Moderator
  • Get VIPs
  • Add Channel VIP
  • Remove Channel VIP
  • Get Polls
  • Create Poll
  • End Poll
  • Get Predictions
  • Create Prediction
  • End Prediction
  • Get Users
  • Update User
  • Get Users Follows
  • Get User Block List
  • Block User
  • Unblock User
  • Get Videos
  • Delete Videos
  • Create Custom Rewards
  • Delete Custom Rewards
  • Get Custom Rewards
  • Get Custom Reward Redemptions
  • Update Custom Reward
  • Update Custom Reward Redemption
  • Get Streams
  • Get Followed Streams
  • Get Stream Key
  • Send Chat Announcement
  • Add Blocked Terms
  • Get Blocked Terms
  • Remove Blocked Terms
  • Create Clip
  • Get Clip
  • Get AutoMod Settings
  • Update AutoMod Settings
  • Get Broadcaster Subscriptions
  • Start a raid
  • Cancel a raid
  • Get Top Games
  • Get Games
3
likes
100
pub points
43%
popularity

Publisher

unverified uploader

A package for developers to interact with the Twitch API easily, not all endpoints are implemented yet but they will eventually.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

dartz, dio, flutter, freezed_annotation, http_mock_adapter, json_annotation, web_socket_channel

More

Packages that depend on twitch_client