of<T extends BaseTwitchOpenApi> method
Return an instance of subclass BaseTwitchOpenApi. The instances available are:
- TwitchChannelInformation returns generic info about the streamers channel
- TwitchChannelMedia returns all media related data like video or images
- TwitchSearch allows to search information about streams
- TwitchGame get information about game categories
Implementation
T of<T extends BaseTwitchOpenApi>({required String? bearerToken}) {
switch (T) {
case TwitchChannelInformation:
return TwitchChannelInformationImpl(
clientId: clientId,
token: bearerToken,
) as T;
case TwitchSearch:
return TwitchSearchImpl(
clientId: clientId,
token: bearerToken,
) as T;
case TwitchGame:
return TwitchGameImpl(
clientId: clientId,
token: bearerToken,
) as T;
case TwitchChannelMedia:
return TwitchChannelMediaImpl(
clientId: clientId,
token: bearerToken,
) as T;
default:
throw UnsupportedError(
'typeof($T) is not implemented in TwitchManagerOpenApi.getInstance',
);
}
}