@@ -88,7 +88,7 @@ public TwitchApiProxy(string token, string refreshToken, DateTime tokenExpires,
88
88
public virtual async Task < TwitchAccessToken ? > CreateAccessToken ( string code , CancellationToken token = new ( ) ) {
89
89
ITwitchAPI api = GetApi ( ) ;
90
90
AuthCodeResponse ? response = await api . Auth . GetAccessTokenFromCodeAsync ( code , TwitchAppConfig ? . ClientSecret ,
91
- TwitchAppConfig ? . ClientRedirect ) ;
91
+ TwitchAppConfig ? . ClientRedirect ) . ConfigureAwait ( false ) ;
92
92
if ( null == response ) {
93
93
return null ;
94
94
}
@@ -109,7 +109,7 @@ public TwitchApiProxy(string token, string refreshToken, DateTime tokenExpires,
109
109
}
110
110
111
111
ITwitchAPI api = GetApi ( ) ;
112
- RefreshResponse ? response = await api . Auth . RefreshAuthTokenAsync ( OAuth ? . RefreshToken , TwitchAppConfig ? . ClientSecret , TwitchAppConfig ? . ClientId ) ;
112
+ RefreshResponse ? response = await api . Auth . RefreshAuthTokenAsync ( OAuth ? . RefreshToken , TwitchAppConfig ? . ClientSecret , TwitchAppConfig ? . ClientId ) . ConfigureAwait ( false ) ;
113
113
if ( null == response ) {
114
114
return null ;
115
115
}
@@ -129,7 +129,7 @@ public TwitchApiProxy(string token, string refreshToken, DateTime tokenExpires,
129
129
/// <inheritdoc />
130
130
public async Task < bool > GetAccessTokenIsValid ( CancellationToken token = new ( ) ) {
131
131
try {
132
- return ! string . IsNullOrWhiteSpace ( ( await GetUser ( token ) ) ? . Id ) ;
132
+ return ! string . IsNullOrWhiteSpace ( ( await GetUser ( token ) . ConfigureAwait ( false ) ) ? . Id ) ;
133
133
}
134
134
catch {
135
135
return false ;
@@ -140,40 +140,40 @@ public TwitchApiProxy(string token, string refreshToken, DateTime tokenExpires,
140
140
public virtual async Task < User ? > GetUser ( CancellationToken token = new ( ) ) {
141
141
return await Retry . Execute ( async ( ) => {
142
142
ITwitchAPI api = GetApi ( ) ;
143
- GetUsersResponse ? response = await api . Helix . Users . GetUsersAsync ( ) ;
143
+ GetUsersResponse ? response = await api . Helix . Users . GetUsersAsync ( ) . ConfigureAwait ( false ) ;
144
144
if ( null == response ) {
145
145
return null ;
146
146
}
147
147
148
148
return response . Users . FirstOrDefault ( ) ;
149
- } , Retries , token ) ;
149
+ } , Retries , token ) . ConfigureAwait ( false ) ;
150
150
}
151
151
152
152
/// <inheritdoc />
153
153
public virtual async Task < ( string ? id , string ? username ) > GetUser ( string username , CancellationToken token = new ( ) ) {
154
154
return await Retry . Execute ( async ( ) => {
155
155
ITwitchAPI api = GetApi ( ) ;
156
- GetUsersResponse ? response = await api . Helix . Users . GetUsersAsync ( logins : [ username ] ) ;
156
+ GetUsersResponse ? response = await api . Helix . Users . GetUsersAsync ( logins : [ username ] ) . ConfigureAwait ( false ) ;
157
157
if ( null == response ) {
158
158
return ( null , null ) ;
159
159
}
160
160
161
161
User ? user = response . Users . FirstOrDefault ( ) ;
162
162
return ( user ? . Id , user ? . Login ) ;
163
- } , Retries , token ) ;
163
+ } , Retries , token ) . ConfigureAwait ( false ) ;
164
164
}
165
165
166
166
/// <inheritdoc />
167
167
public virtual async Task < string ? > GetUserEmail ( CancellationToken token = new ( ) ) {
168
168
return await Retry . Execute ( async ( ) => {
169
169
ITwitchAPI api = GetApi ( ) ;
170
- GetUsersResponse ? response = await api . Helix . Users . GetUsersAsync ( ) ;
170
+ GetUsersResponse ? response = await api . Helix . Users . GetUsersAsync ( ) . ConfigureAwait ( false ) ;
171
171
if ( null == response ) {
172
172
return null ;
173
173
}
174
174
175
175
return response . Users . FirstOrDefault ( ) ? . Email ;
176
- } , Retries , token ) ;
176
+ } , Retries , token ) . ConfigureAwait ( false ) ;
177
177
}
178
178
179
179
/// <inheritdoc />
@@ -192,9 +192,9 @@ public virtual async Task<IEnumerable<TwitchModeratedChannel>> GetUserModChannel
192
192
request . Headers . Add ( "Authorization" , $ "Bearer { OAuth ? . AccessToken } ") ;
193
193
request . Headers . Add ( "Client-Id" , TwitchAppConfig ? . ClientId ) ;
194
194
195
- using HttpResponseMessage response = await client . SendAsync ( request ) ;
195
+ using HttpResponseMessage response = await client . SendAsync ( request ) . ConfigureAwait ( false ) ;
196
196
response . EnsureSuccessStatusCode ( ) ;
197
- string responseBody = await response . Content . ReadAsStringAsync ( ) ;
197
+ string responseBody = await response . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
198
198
var moderatedChannels = JsonConvert . DeserializeObject < TwitchModeratedChannelsResponse > ( responseBody ) ;
199
199
if ( null == moderatedChannels ) {
200
200
break ;
@@ -219,7 +219,7 @@ public virtual async Task<IEnumerable<BannedUser>> BanChannelUsers(string channe
219
219
BanUserResponse ? response = await api . Helix . Moderation . BanUserAsync ( channelId , botId , new BanUserRequest {
220
220
UserId = user . Id ,
221
221
Reason = reason
222
- } ) ;
222
+ } ) . ConfigureAwait ( false ) ;
223
223
224
224
if ( null == response || null == response . Data ) {
225
225
continue ;
@@ -229,7 +229,7 @@ public virtual async Task<IEnumerable<BannedUser>> BanChannelUsers(string channe
229
229
LOG . Info ( $ "Banned { user . Username } ({ user . Id } ) in { channelId } : { reason } ") ;
230
230
}
231
231
catch ( HttpResponseException ex ) {
232
- string exceptionReason = await ex . HttpResponse . Content . ReadAsStringAsync ( token ) ;
232
+ string exceptionReason = await ex . HttpResponse . Content . ReadAsStringAsync ( token ) . ConfigureAwait ( false ) ;
233
233
LOG . Debug ( $ "Failed to ban { user . Username } ({ user . Id } ) in { channelId } : { exceptionReason } ", ex ) ;
234
234
}
235
235
catch ( Exception ex ) {
@@ -238,7 +238,7 @@ public virtual async Task<IEnumerable<BannedUser>> BanChannelUsers(string channe
238
238
}
239
239
240
240
return bannedUsers ;
241
- } , Retries , token ) ;
241
+ } , Retries , token ) . ConfigureAwait ( false ) ;
242
242
}
243
243
244
244
/// <inheritdoc />
@@ -250,7 +250,7 @@ public virtual async Task<IEnumerable<Chatter>> GetChannelUsers(string channelId
250
250
string ? cursor = null ;
251
251
int total = 0 ;
252
252
do {
253
- GetChattersResponse ? response = await api . Helix . Chat . GetChattersAsync ( channelId , botId , 1000 , cursor ) ;
253
+ GetChattersResponse ? response = await api . Helix . Chat . GetChattersAsync ( channelId , botId , 1000 , cursor ) . ConfigureAwait ( false ) ;
254
254
if ( null == response ) {
255
255
break ;
256
256
}
@@ -262,7 +262,7 @@ public virtual async Task<IEnumerable<Chatter>> GetChannelUsers(string channelId
262
262
263
263
Debug . Assert ( chatters . Count == total ) ;
264
264
return chatters ;
265
- } , Retries , token ) ;
265
+ } , Retries , token ) . ConfigureAwait ( false ) ;
266
266
}
267
267
268
268
/// <inheritdoc />
@@ -279,7 +279,7 @@ public virtual async Task<IEnumerable<string>> GetChannelsLive(IEnumerable<strin
279
279
}
280
280
281
281
GetStreamsResponse ? response =
282
- await api . Helix . Streams . GetStreamsAsync ( userIds : twitchIdsArray [ i ..lastIndex ] . ToList ( ) ) ;
282
+ await api . Helix . Streams . GetStreamsAsync ( userIds : twitchIdsArray [ i ..lastIndex ] . ToList ( ) ) . ConfigureAwait ( false ) ;
283
283
if ( null != response ) {
284
284
liveUsers . AddRange ( response . Streams . Where ( s =>
285
285
"live" . Equals ( s . Type , StringComparison . InvariantCultureIgnoreCase ) ) ) ;
@@ -298,7 +298,7 @@ public virtual async Task<IEnumerable<string>> GetChannelsLive(IEnumerable<strin
298
298
GetModeratorsResponse ? response = null ;
299
299
do {
300
300
response = await api . Helix . Moderation . GetModeratorsAsync ( channelId , first : 100 ,
301
- after : response ? . Pagination ? . Cursor ) ;
301
+ after : response ? . Pagination ? . Cursor ) . ConfigureAwait ( false ) ;
302
302
if ( null == response || null == response . Data ) {
303
303
break ;
304
304
}
@@ -313,16 +313,16 @@ public virtual async Task<IEnumerable<string>> GetChannelsLive(IEnumerable<strin
313
313
} while ( null != response . Pagination ? . Cursor ) ;
314
314
315
315
return results ;
316
- } , Retries , token ) ;
316
+ } , Retries , token ) . ConfigureAwait ( false ) ;
317
317
}
318
318
319
319
/// <inheritdoc />
320
320
public virtual async Task < bool > AddChannelMod ( string channelId , string userId , CancellationToken token = new ( ) ) {
321
321
return await Retry . Execute ( async ( ) => {
322
322
ITwitchAPI api = GetApi ( ) ;
323
- await api . Helix . Moderation . AddChannelModeratorAsync ( channelId , userId ) ;
323
+ await api . Helix . Moderation . AddChannelModeratorAsync ( channelId , userId ) . ConfigureAwait ( false ) ;
324
324
return true ;
325
- } , Retries , token ) ;
325
+ } , Retries , token ) . ConfigureAwait ( false ) ;
326
326
}
327
327
328
328
/// <summary>
0 commit comments