1414using TwitchLib . Api . Helix . Models . Moderation . GetModerators ;
1515using TwitchLib . Api . Helix . Models . Streams . GetStreams ;
1616using TwitchLib . Api . Helix . Models . Users . GetUsers ;
17+ using TwitchLib . Api . Interfaces ;
1718
1819using Stream = TwitchLib . Api . Helix . Models . Streams . GetStreams . Stream ;
1920
@@ -73,7 +74,7 @@ public TwitchApiProxy(string token, string refreshToken, DateTime tokenExpires)
7374
7475 /// <inheritdoc />
7576 public async Task < TwitchAccessToken ? > CreateAccessToken ( string code , CancellationToken token = new ( ) ) {
76- TwitchAPI api = GetApi ( ) ;
77+ ITwitchAPI api = GetApi ( ) ;
7778 AuthCodeResponse ? response = await api . Auth . GetAccessTokenFromCodeAsync ( code , ClientSecret , ClientRedirect ) ;
7879 if ( null == response ) {
7980 return null ;
@@ -90,7 +91,7 @@ public TwitchApiProxy(string token, string refreshToken, DateTime tokenExpires)
9091 /// <inheritdoc />
9192 public async Task < TwitchAccessToken ? > RefreshAccessToken ( CancellationToken token = new ( ) ) {
9293 try {
93- TwitchAPI api = GetApi ( ) ;
94+ ITwitchAPI api = GetApi ( ) ;
9495 RefreshResponse ? response = await api . Auth . RefreshAuthTokenAsync ( OAuth ? . RefreshToken , ClientSecret , ClientId ) ;
9596 if ( null == response ) {
9697 return null ;
@@ -116,7 +117,7 @@ public TwitchApiProxy(string token, string refreshToken, DateTime tokenExpires)
116117 /// <inheritdoc />
117118 public async Task < ( string ? id , string ? username ) > GetUser ( CancellationToken token = new ( ) ) {
118119 return await Retry . Execute ( async ( ) => {
119- TwitchAPI api = GetApi ( ) ;
120+ ITwitchAPI api = GetApi ( ) ;
120121 GetUsersResponse ? response = await api . Helix . Users . GetUsersAsync ( ) ;
121122 if ( null == response ) {
122123 return ( null , null ) ;
@@ -130,7 +131,7 @@ public TwitchApiProxy(string token, string refreshToken, DateTime tokenExpires)
130131 /// <inheritdoc />
131132 public async Task < string ? > GetUserEmail ( CancellationToken token = new ( ) ) {
132133 return await Retry . Execute ( async ( ) => {
133- TwitchAPI api = GetApi ( ) ;
134+ ITwitchAPI api = GetApi ( ) ;
134135 GetUsersResponse ? response = await api . Helix . Users . GetUsersAsync ( ) ;
135136 if ( null == response ) {
136137 return null ;
@@ -175,7 +176,7 @@ public async Task<IEnumerable<TwitchModeratedChannel>> GetUserModChannels(string
175176 public async Task < IEnumerable < BannedUser > > BanChannelUsers ( string channelId , string botId ,
176177 IEnumerable < ( string Id , string Username ) > users , string reason , CancellationToken token = new ( ) ) {
177178 return await Retry . Execute ( async ( ) => {
178- TwitchAPI api = GetApi ( ) ;
179+ ITwitchAPI api = GetApi ( ) ;
179180
180181 var bannedUsers = new List < BannedUser > ( ) ;
181182 foreach ( ( string Id , string Username ) user in users ) {
@@ -209,7 +210,7 @@ public async Task<IEnumerable<BannedUser>> BanChannelUsers(string channelId, str
209210 public async Task < IEnumerable < Chatter > > GetChannelUsers ( string channelId , string botId ,
210211 CancellationToken token = new ( ) ) {
211212 return await Retry . Execute ( async ( ) => {
212- TwitchAPI api = GetApi ( ) ;
213+ ITwitchAPI api = GetApi ( ) ;
213214 var chatters = new List < Chatter > ( ) ;
214215 string ? cursor = null ;
215216 int total = 0 ;
@@ -231,7 +232,7 @@ public async Task<IEnumerable<Chatter>> GetChannelUsers(string channelId, string
231232
232233 /// <inheritdoc />
233234 public async Task < IEnumerable < string > > GetChannelsLive ( IEnumerable < string > userIds ) {
234- TwitchAPI api = GetApi ( ) ;
235+ ITwitchAPI api = GetApi ( ) ;
235236
236237 // We can only query 100 at a time, so throttle the search.
237238 var liveUsers = new List < Stream > ( ) ;
@@ -256,7 +257,7 @@ public async Task<IEnumerable<string>> GetChannelsLive(IEnumerable<string> userI
256257 /// <inheritdoc />
257258 public async Task < IEnumerable < Moderator > > GetChannelMods ( string channelId , CancellationToken token = new ( ) ) {
258259 return await Retry . Execute ( async ( ) => {
259- TwitchAPI api = GetApi ( ) ;
260+ ITwitchAPI api = GetApi ( ) ;
260261
261262 var results = new List < Moderator > ( ) ;
262263 GetModeratorsResponse ? response = null ;
@@ -283,7 +284,7 @@ public async Task<IEnumerable<string>> GetChannelsLive(IEnumerable<string> userI
283284 /// <inheritdoc />
284285 public async Task < bool > AddChannelMod ( string channelId , string userId , CancellationToken token = new ( ) ) {
285286 return await Retry . Execute ( async ( ) => {
286- TwitchAPI api = GetApi ( ) ;
287+ ITwitchAPI api = GetApi ( ) ;
287288 await api . Helix . Moderation . AddChannelModeratorAsync ( channelId , userId ) ;
288289 return true ;
289290 } , Retries , token ) ;
@@ -293,7 +294,7 @@ public async Task<IEnumerable<string>> GetChannelsLive(IEnumerable<string> userI
293294 /// Gets a new instance of the <see cref="TwitchAPI" />.
294295 /// </summary>
295296 /// <returns>A new instance of the <see cref="TwitchAPI" />.</returns>
296- private TwitchAPI GetApi ( ) {
297+ protected ITwitchAPI GetApi ( ) {
297298 var api = new TwitchAPI {
298299 Settings = {
299300 ClientId = ClientId ,
0 commit comments