This version is a major step towards decoupling the chat and PubSub packages from the main API client (package twitch
) by moving the responsibility to create AuthProvider
instances into a new package, twitch-auth
. You can gradually migrate to the new way of instantiating the client classes - the old way is deprecated, but still works (this is SemVer after all!).
Still, it also contains some minor features and fixes.
Here are all significant changes compared to version 4.1.4:
Deprecations
- [all] default exports are discouraged, produce a warning and are scheduled for complete removal in 5.0 (b28451c, #151)
- [all] all symbols are now strictly camel case (as opposed to some exceptions there were before, like
TwitchAPICallType
, nowTwitchApiCallType
). The respective old names have been deprecated and scheduled for removal in 5.0. (c497452, #136) - [twitch]
TwitchClient.withCredentials
,TwitchClient.withClientCredentials
(construct the providers fromtwitch-auth
directly and pass them to theApiClient
constructor instead) (fe6ace2) - [twitch] static methods that were moved to
twitch-api-call
:ApiClient.callApi
->callTwitchApi
,ApiClient.getAccessToken
->exchangeCode
,ApiClient.getAppAccessToken
->getAppToken
,ApiClient.refreshAccessToken
->refreshUserToken
,ApiClient.getTokenInfo
->getTokenInfo
(fe6ace2) - [twitch-chat-client]
ChatClient.forTwitchClient
- use theChatClient
constructor with exactly the same parameters instead (fe6ace2) - [twitch-chat-client] passing an
ApiClient
instance to theChatClient
constructor; pass anAuthProvider
instead (fe6ace2) - [twitch-chat-client]
ChatClient#onPrivmsg
(useonMessage
instead) (9885659)
Features
- [twitch]
ApiClient
can be intermittently used as anAuthProvider
to support the previous usage, but you should migrate to using theAuthProvider
implementations (e.g. fromtwitch-auth
) directly (fe6ace2) - [twitch] add possibility to select the badge description language (fe4ed23, #143, #144)
- [twitch] add Kraken video API methods (961b74c, #131)
- [twitch-auth] add new package, contains all authentication helpers, the
AuthProvider
interface and its default implementations (fe6ace2, #140) - [twitch-auth] add
revokeToken
helper (dd5d324, #134) - [twitch-api-call] add new package, a thin wrapper around
fetch
for Twitch API calls (fe6ace2) - [twitch-chat-client] add
onMessage
handler which is like the oldonPrivmsg
but filters some internal messages (9885659) - [twitch-pubsub-client]
PubSubClient#registerUserListener
: return user ID for convenience (2345706) - [twitch-pubsub-client] add giftDuration to chat and pubsub gift sub events (6ada0a9, #159)
Fixes
- [twitch] fix getUsersByIds and getUsersByNames falling back to token based lookup (d0145e3, #157)
- [twitch-chat-client] fix
onHosted
returningNaN
as count (a21a0b7) - [twitch-chat-client] add rudimentary check whether an emote code is a regex, and properly anchor codes (bc2a8a5, #165)
- [twitch-pubsub-client] automatically disconnect SingleUserPubSubClient underlying client when no topics are left (3ee00c1, #166)
- [twitch-webhooks] fix deep import of webhook option object breaking the ESM build (b08fbfa)