Skip to content

Commit 85cff52

Browse files
committed
Added the rest of the needed cancellation token passing
1 parent 5017b5c commit 85cff52

File tree

510 files changed

+2949
-2913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

510 files changed

+2949
-2913
lines changed

global.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Twilio/Clients/BearerToken/TwilioOrgsTokenRestClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public bool isTokenExpired(string token){
236236
///
237237
/// <param name="request">request to make</param>
238238
/// <returns>Task that resolves to the response of the request</returns>
239-
public async Task<Response> RequestAsync(TokenRequest request, CancellationToken cancellationToken = default)
239+
public async Task<Response> RequestAsync(TokenRequest request, System.Threading.CancellationToken cancellationToken = default)
240240
{
241241
request.SetAuth(_accessToken);
242242

src/Twilio/Clients/ITwilioRestClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public interface ITwilioRestClient
3737
///
3838
/// <param name="request">Request to make</param>
3939
/// <returns>response of the request</returns>
40-
System.Threading.Tasks.Task<Response> RequestAsync(Request request, CancellationToken cancellationToken = default);
40+
System.Threading.Tasks.Task<Response> RequestAsync(Request request, System.Threading.CancellationToken cancellationToken = default);
4141
#endif
4242
}
4343
}

src/Twilio/Clients/TwilioRestClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public Response Request(Request request)
169169
///
170170
/// <param name="request">request to make</param>
171171
/// <returns>Task that resolves to the response of the request</returns>
172-
public async Task<Response> RequestAsync(Request request, CancellationToken cancellationToken = default)
172+
public async Task<Response> RequestAsync(Request request, System.Threading.CancellationToken cancellationToken = default)
173173
{
174174
if(_username != null && _password != null){
175175
request.SetAuth(_username, _password);

src/Twilio/Http/BearerToken/SystemNetTokenHttpClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public override Response MakeRequest(TokenRequest request)
6060
/// </summary>
6161
/// <param name="request">Twilio response</param>
6262
/// <returns>Task that resolves to the response</returns>
63-
public override async Task<Response> MakeRequestAsync(TokenRequest request, CancellationToken cancellationToken = default)
63+
public override async Task<Response> MakeRequestAsync(TokenRequest request, System.Threading.CancellationToken cancellationToken = default)
6464
{
6565
var httpRequest = BuildHttpRequest(request);
6666
if (!Equals(request.Method, HttpMethod.Get))
@@ -87,7 +87,7 @@ public override async Task<Response> MakeRequestAsync(TokenRequest request, Canc
8787
// Create and return a new Response. Keep a reference to the last
8888
// response for debugging, but don't return it as it may be shared
8989
// among threads.
90-
var response = new Response(httpResponse.StatusCode, await reader.ReadToEndAsync(cancellationToken).ConfigureAwait(false), httpResponse.Headers);
90+
var response = new Response(httpResponse.StatusCode, await reader.ReadToEndAsync().ConfigureAwait(false), httpResponse.Headers);
9191
this.LastResponse = response;
9292
return response;
9393
}

src/Twilio/Http/BearerToken/TokenHttpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public abstract class TokenHttpClient
3636
/// <param name="request">request to make</param>
3737
/// <exception>throws exception on network or connection errors.</exception>
3838
/// <returns>response of the request</returns>
39-
public abstract System.Threading.Tasks.Task<Response> MakeRequestAsync(TokenRequest request, CancellationToken cancellationToken = Default);
39+
public abstract System.Threading.Tasks.Task<Response> MakeRequestAsync(TokenRequest request, System.Threading.CancellationToken cancellationToken = default);
4040
#endif
4141

4242
}

src/Twilio/Http/HttpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public abstract class HttpClient
3434
/// <param name="request">request to make</param>
3535
/// <exception>throws exception on network or connection errors.</exception>
3636
/// <returns>response of the request</returns>
37-
public abstract System.Threading.Tasks.Task<Response> MakeRequestAsync(Request request, CancellationToken cancellationToken = default);
37+
public abstract System.Threading.Tasks.Task<Response> MakeRequestAsync(Request request, System.Threading.CancellationToken cancellationToken = default);
3838
#endif
3939

4040
/// <summary>

src/Twilio/Http/SystemNetHttpClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public override Response MakeRequest(Request request)
5858
/// </summary>
5959
/// <param name="request">Twilio response</param>
6060
/// <returns>Task that resolves to the response</returns>
61-
public override async Task<Response> MakeRequestAsync(Request request, CancellationToken cancellationToken = default)
61+
public override async Task<Response> MakeRequestAsync(Request request, System.Threading.CancellationToken cancellationToken = default)
6262
{
6363
var httpRequest = BuildHttpRequest(request);
6464
if (!Equals(request.Method, HttpMethod.Get))
@@ -82,7 +82,7 @@ public override async Task<Response> MakeRequestAsync(Request request, Cancellat
8282
// Create and return a new Response. Keep a reference to the last
8383
// response for debugging, but don't return it as it may be shared
8484
// among threads.
85-
var response = new Response(httpResponse.StatusCode, await reader.ReadToEndAsync(cancellationToken).ConfigureAwait(false), httpResponse.Headers);
85+
var response = new Response(httpResponse.StatusCode, await reader.ReadToEndAsync().ConfigureAwait(false), httpResponse.Headers);
8686
this.LastResponse = response;
8787
return response;
8888
}

src/Twilio/Rest/Accounts/V1/AuthTokenPromotionResource.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static AuthTokenPromotionResource Update(UpdateAuthTokenPromotionOptions
6868
#if !NET35
6969
public static async System.Threading.Tasks.Task<AuthTokenPromotionResource> UpdateAsync(UpdateAuthTokenPromotionOptions options,
7070
ITwilioRestClient client = null,
71-
CancellationToken cancellationToken = default)
71+
System.Threading.CancellationToken cancellationToken = default)
7272
{
7373
client = client ?? TwilioClient.GetRestClient();
7474
var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken);
@@ -92,7 +92,7 @@ public static AuthTokenPromotionResource Update(
9292
/// <returns> Task that resolves to A single instance of AuthTokenPromotion </returns>
9393
public static async System.Threading.Tasks.Task<AuthTokenPromotionResource> UpdateAsync(
9494
ITwilioRestClient client = null,
95-
CancellationToken cancellationToken = default)
95+
System.Threading.CancellationToken cancellationToken = default)
9696
{
9797
var options = new UpdateAuthTokenPromotionOptions(){ };
9898
return await UpdateAsync(options, client, cancellationToken);

src/Twilio/Rest/Accounts/V1/BulkConsentsResource.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static BulkConsentsResource Create(CreateBulkConsentsOptions options, ITw
6666
/// <param name="options"> Create BulkConsents parameters </param>
6767
/// <param name="client"> Client to make requests to Twilio </param>
6868
/// <returns> Task that resolves to A single instance of BulkConsents </returns>
69-
public static async System.Threading.Tasks.Task<BulkConsentsResource> CreateAsync(CreateBulkConsentsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
69+
public static async System.Threading.Tasks.Task<BulkConsentsResource> CreateAsync(CreateBulkConsentsOptions options, ITwilioRestClient client = null, System.Threading.CancellationToken cancellationToken = default)
7070
{
7171
client = client ?? TwilioClient.GetRestClient();
7272
var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken);
@@ -93,7 +93,8 @@ public static BulkConsentsResource Create(
9393
/// <returns> Task that resolves to A single instance of BulkConsents </returns>
9494
public static async System.Threading.Tasks.Task<BulkConsentsResource> CreateAsync(
9595
List<object> items,
96-
ITwilioRestClient client = null)
96+
ITwilioRestClient client = null,
97+
System.Threading.CancellationToken cancellationToken = default)
9798
{
9899
var options = new CreateBulkConsentsOptions(items){ };
99100
return await CreateAsync(options, client, cancellationToken);

0 commit comments

Comments
 (0)