Class: Api
HTTP client for Twitch Helix API with token refresh handling.
Constructor
import TwitchJs from 'twitch-js'
const { api } = new TwitchJs({
token: 'your_access_token',
clientId: 'your_client_id'
})Methods
get()
GET request to Helix API.
const response = await api.get('users', {
search: { login: 'channelname' }
})Get Stream Status
const streams = await api.get('streams', {
search: { user_login: 'channelname' }
})
if (streams.data.length > 0) {
console.log(`Live: ${streams.data[0].viewer_count} viewers`)
}