Skip to content

Commit 5017b5c

Browse files
committed
Bulk Regex Add of CancellationToken Parameters
1 parent 22eeea9 commit 5017b5c

File tree

155 files changed

+1677
-1545
lines changed

Some content is hidden

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

155 files changed

+1677
-1545
lines changed

src/Twilio/Rest/PreviewIam/Organizations/AccountResource.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ public static AccountResource Fetch(FetchAccountOptions options, ITwilioRestClie
8484
/// <param name="options"> Fetch Account parameters </param>
8585
/// <param name="client"> Client to make requests to Twilio </param>
8686
/// <returns> Task that resolves to A single instance of Account </returns>
87-
public static async System.Threading.Tasks.Task<AccountResource> FetchAsync(FetchAccountOptions options, ITwilioRestClient client = null)
87+
public static async System.Threading.Tasks.Task<AccountResource> FetchAsync(FetchAccountOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
8888
{
8989
client = client ?? TwilioClient.GetRestClient();
90-
var response = await client.RequestAsync(BuildFetchRequest(options, client));
90+
var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken);
9191
return FromJson(response.Content);
9292
}
9393
#endif
@@ -114,7 +114,7 @@ public static AccountResource Fetch(
114114
public static async System.Threading.Tasks.Task<AccountResource> FetchAsync(string pathOrganizationSid, string pathAccountSid, ITwilioRestClient client = null)
115115
{
116116
var options = new FetchAccountOptions(pathOrganizationSid, pathAccountSid){ };
117-
return await FetchAsync(options, client);
117+
return await FetchAsync(options, client, cancellationToken);
118118
}
119119
#endif
120120

@@ -151,10 +151,10 @@ public static ResourceSet<AccountResource> Read(ReadAccountOptions options, ITwi
151151
/// <param name="options"> Read Account parameters </param>
152152
/// <param name="client"> Client to make requests to Twilio </param>
153153
/// <returns> Task that resolves to A single instance of Account </returns>
154-
public static async System.Threading.Tasks.Task<ResourceSet<AccountResource>> ReadAsync(ReadAccountOptions options, ITwilioRestClient client = null)
154+
public static async System.Threading.Tasks.Task<ResourceSet<AccountResource>> ReadAsync(ReadAccountOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
155155
{
156156
client = client ?? TwilioClient.GetRestClient();
157-
var response = await client.RequestAsync(BuildReadRequest(options, client));
157+
var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken);
158158

159159
var page = Page<AccountResource>.FromJson("content", response.Content);
160160
return new ResourceSet<AccountResource>(page, options, client);
@@ -190,7 +190,7 @@ public static async System.Threading.Tasks.Task<ResourceSet<AccountResource>> Re
190190
ITwilioRestClient client = null)
191191
{
192192
var options = new ReadAccountOptions(pathOrganizationSid){ PageSize = pageSize, Limit = limit};
193-
return await ReadAsync(options, client);
193+
return await ReadAsync(options, client, cancellationToken);
194194
}
195195
#endif
196196

src/Twilio/Rest/PreviewIam/Organizations/RoleAssignmentResource.cs

+11-10
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ public static RoleAssignmentResource Create(CreateRoleAssignmentOptions options,
105105
/// <param name="options"> Create RoleAssignment parameters </param>
106106
/// <param name="client"> Client to make requests to Twilio </param>
107107
/// <returns> Task that resolves to A single instance of RoleAssignment </returns>
108-
public static async System.Threading.Tasks.Task<RoleAssignmentResource> CreateAsync(CreateRoleAssignmentOptions options, ITwilioRestClient client = null)
108+
public static async System.Threading.Tasks.Task<RoleAssignmentResource> CreateAsync(CreateRoleAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
109109
{
110110
client = client ?? TwilioClient.GetRestClient();
111-
var response = await client.RequestAsync(BuildCreateRequest(options, client));
111+
var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken);
112112
return FromJson(response.Content);
113113
}
114114
#endif
@@ -139,7 +139,7 @@ public static async System.Threading.Tasks.Task<RoleAssignmentResource> CreateAs
139139
ITwilioRestClient client = null)
140140
{
141141
var options = new CreateRoleAssignmentOptions(pathOrganizationSid, publicApiCreateRoleAssignmentRequest){ };
142-
return await CreateAsync(options, client);
142+
return await CreateAsync(options, client, cancellationToken);
143143
}
144144
#endif
145145

@@ -182,11 +182,12 @@ public static bool Delete(DeleteRoleAssignmentOptions options, ITwilioRestClient
182182
/// <param name="options"> Delete RoleAssignment parameters </param>
183183
/// <param name="client"> Client to make requests to Twilio </param>
184184
/// <returns> Task that resolves to A single instance of RoleAssignment </returns>
185-
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteRoleAssignmentOptions options,
186-
ITwilioRestClient client = null)
185+
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteRoleAssignmentOptions options,
186+
ITwilioRestClient client = null,
187+
CancellationToken cancellationToken = default)
187188
{
188189
client = client ?? TwilioClient.GetRestClient();
189-
var response = await client.RequestAsync(BuildDeleteRequest(options, client));
190+
var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken);
190191
return response.StatusCode == System.Net.HttpStatusCode.NoContent;
191192
}
192193
#endif
@@ -211,7 +212,7 @@ public static bool Delete(string pathOrganizationSid, string pathRoleAssignmentS
211212
public static async System.Threading.Tasks.Task<bool> DeleteAsync(string pathOrganizationSid, string pathRoleAssignmentSid, ITwilioRestClient client = null)
212213
{
213214
var options = new DeleteRoleAssignmentOptions(pathOrganizationSid, pathRoleAssignmentSid) ;
214-
return await DeleteAsync(options, client);
215+
return await DeleteAsync(options, client, cancellationToken);
215216
}
216217
#endif
217218

@@ -248,10 +249,10 @@ public static ResourceSet<RoleAssignmentResource> Read(ReadRoleAssignmentOptions
248249
/// <param name="options"> Read RoleAssignment parameters </param>
249250
/// <param name="client"> Client to make requests to Twilio </param>
250251
/// <returns> Task that resolves to A single instance of RoleAssignment </returns>
251-
public static async System.Threading.Tasks.Task<ResourceSet<RoleAssignmentResource>> ReadAsync(ReadRoleAssignmentOptions options, ITwilioRestClient client = null)
252+
public static async System.Threading.Tasks.Task<ResourceSet<RoleAssignmentResource>> ReadAsync(ReadRoleAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
252253
{
253254
client = client ?? TwilioClient.GetRestClient();
254-
var response = await client.RequestAsync(BuildReadRequest(options, client));
255+
var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken);
255256

256257
var page = Page<RoleAssignmentResource>.FromJson("content", response.Content);
257258
return new ResourceSet<RoleAssignmentResource>(page, options, client);
@@ -295,7 +296,7 @@ public static async System.Threading.Tasks.Task<ResourceSet<RoleAssignmentResour
295296
ITwilioRestClient client = null)
296297
{
297298
var options = new ReadRoleAssignmentOptions(pathOrganizationSid){ PageSize = pageSize, Identity = identity, Scope = scope, Limit = limit};
298-
return await ReadAsync(options, client);
299+
return await ReadAsync(options, client, cancellationToken);
299300
}
300301
#endif
301302

src/Twilio/Rest/PreviewIam/Organizations/UserResource.cs

+19-17
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ public static UserResource Create(CreateUserOptions options, ITwilioRestClient c
269269
/// <param name="options"> Create User parameters </param>
270270
/// <param name="client"> Client to make requests to Twilio </param>
271271
/// <returns> Task that resolves to A single instance of User </returns>
272-
public static async System.Threading.Tasks.Task<UserResource> CreateAsync(CreateUserOptions options, ITwilioRestClient client = null)
272+
public static async System.Threading.Tasks.Task<UserResource> CreateAsync(CreateUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
273273
{
274274
client = client ?? TwilioClient.GetRestClient();
275-
var response = await client.RequestAsync(BuildCreateRequest(options, client));
275+
var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken);
276276
return FromJson(response.Content);
277277
}
278278
#endif
@@ -303,7 +303,7 @@ public static async System.Threading.Tasks.Task<UserResource> CreateAsync(
303303
ITwilioRestClient client = null)
304304
{
305305
var options = new CreateUserOptions(pathOrganizationSid, scimUser){ };
306-
return await CreateAsync(options, client);
306+
return await CreateAsync(options, client, cancellationToken);
307307
}
308308
#endif
309309

@@ -346,11 +346,12 @@ public static bool Delete(DeleteUserOptions options, ITwilioRestClient client =
346346
/// <param name="options"> Delete User parameters </param>
347347
/// <param name="client"> Client to make requests to Twilio </param>
348348
/// <returns> Task that resolves to A single instance of User </returns>
349-
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteUserOptions options,
350-
ITwilioRestClient client = null)
349+
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteUserOptions options,
350+
ITwilioRestClient client = null,
351+
CancellationToken cancellationToken = default)
351352
{
352353
client = client ?? TwilioClient.GetRestClient();
353-
var response = await client.RequestAsync(BuildDeleteRequest(options, client));
354+
var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken);
354355
return response.StatusCode == System.Net.HttpStatusCode.NoContent;
355356
}
356357
#endif
@@ -375,7 +376,7 @@ public static bool Delete(string pathOrganizationSid, string pathUserSid, ITwili
375376
public static async System.Threading.Tasks.Task<bool> DeleteAsync(string pathOrganizationSid, string pathUserSid, ITwilioRestClient client = null)
376377
{
377378
var options = new DeleteUserOptions(pathOrganizationSid, pathUserSid) ;
378-
return await DeleteAsync(options, client);
379+
return await DeleteAsync(options, client, cancellationToken);
379380
}
380381
#endif
381382

@@ -414,10 +415,10 @@ public static UserResource Fetch(FetchUserOptions options, ITwilioRestClient cli
414415
/// <param name="options"> Fetch User parameters </param>
415416
/// <param name="client"> Client to make requests to Twilio </param>
416417
/// <returns> Task that resolves to A single instance of User </returns>
417-
public static async System.Threading.Tasks.Task<UserResource> FetchAsync(FetchUserOptions options, ITwilioRestClient client = null)
418+
public static async System.Threading.Tasks.Task<UserResource> FetchAsync(FetchUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
418419
{
419420
client = client ?? TwilioClient.GetRestClient();
420-
var response = await client.RequestAsync(BuildFetchRequest(options, client));
421+
var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken);
421422
return FromJson(response.Content);
422423
}
423424
#endif
@@ -444,7 +445,7 @@ public static UserResource Fetch(
444445
public static async System.Threading.Tasks.Task<UserResource> FetchAsync(string pathOrganizationSid, string pathUserSid, ITwilioRestClient client = null)
445446
{
446447
var options = new FetchUserOptions(pathOrganizationSid, pathUserSid){ };
447-
return await FetchAsync(options, client);
448+
return await FetchAsync(options, client, cancellationToken);
448449
}
449450
#endif
450451

@@ -481,10 +482,10 @@ public static ResourceSet<UserResource> Read(ReadUserOptions options, ITwilioRes
481482
/// <param name="options"> Read User parameters </param>
482483
/// <param name="client"> Client to make requests to Twilio </param>
483484
/// <returns> Task that resolves to A single instance of User </returns>
484-
public static async System.Threading.Tasks.Task<ResourceSet<UserResource>> ReadAsync(ReadUserOptions options, ITwilioRestClient client = null)
485+
public static async System.Threading.Tasks.Task<ResourceSet<UserResource>> ReadAsync(ReadUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
485486
{
486487
client = client ?? TwilioClient.GetRestClient();
487-
var response = await client.RequestAsync(BuildReadRequest(options, client));
488+
var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken);
488489

489490
var page = Page<UserResource>.FromJson("Resources", response.Content);
490491
return new ResourceSet<UserResource>(page, options, client);
@@ -520,7 +521,7 @@ public static async System.Threading.Tasks.Task<ResourceSet<UserResource>> ReadA
520521
ITwilioRestClient client = null)
521522
{
522523
var options = new ReadUserOptions(pathOrganizationSid){ Filter = filter, Limit = limit};
523-
return await ReadAsync(options, client);
524+
return await ReadAsync(options, client, cancellationToken);
524525
}
525526
#endif
526527

@@ -610,11 +611,12 @@ public static UserResource Update(UpdateUserOptions options, ITwilioRestClient c
610611
/// <param name="client"> Client to make requests to Twilio </param>
611612
/// <returns> Task that resolves to A single instance of User </returns>
612613
#if !NET35
613-
public static async System.Threading.Tasks.Task<UserResource> UpdateAsync(UpdateUserOptions options,
614-
ITwilioRestClient client = null)
614+
public static async System.Threading.Tasks.Task<UserResource> UpdateAsync(UpdateUserOptions options,
615+
ITwilioRestClient client = null,
616+
CancellationToken cancellationToken = default)
615617
{
616618
client = client ?? TwilioClient.GetRestClient();
617-
var response = await client.RequestAsync(BuildUpdateRequest(options, client));
619+
var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken);
618620
return FromJson(response.Content);
619621
}
620622
#endif
@@ -653,7 +655,7 @@ public static async System.Threading.Tasks.Task<UserResource> UpdateAsync(
653655
ITwilioRestClient client = null)
654656
{
655657
var options = new UpdateUserOptions(pathOrganizationSid, pathUserSid, scimUser){ IfMatch = ifMatch };
656-
return await UpdateAsync(options, client);
658+
return await UpdateAsync(options, client, cancellationToken);
657659
}
658660
#endif
659661

src/Twilio/Rest/PreviewIam/V1/AuthorizeResource.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ public static AuthorizeResource Fetch(FetchAuthorizeOptions options, ITwilioRest
6565
/// <param name="options"> Fetch Authorize parameters </param>
6666
/// <param name="client"> Client to make requests to Twilio </param>
6767
/// <returns> Task that resolves to A single instance of Authorize </returns>
68-
public static async System.Threading.Tasks.Task<AuthorizeResource> FetchAsync(FetchAuthorizeOptions options, ITwilioRestClient client = null)
68+
public static async System.Threading.Tasks.Task<AuthorizeResource> FetchAsync(FetchAuthorizeOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
6969
{
7070
client = client ?? TwilioClient.GetNoAuthRestClient();
71-
var response = await client.RequestAsync(BuildFetchRequest(options, client));
71+
var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken);
7272
return FromJson(response.Content);
7373
}
7474
#endif
@@ -104,7 +104,7 @@ public static AuthorizeResource Fetch(
104104
public static async System.Threading.Tasks.Task<AuthorizeResource> FetchAsync(string responseType = null, string clientId = null, string redirectUri = null, string scope = null, string state = null, ITwilioRestClient client = null)
105105
{
106106
var options = new FetchAuthorizeOptions(){ ResponseType = responseType,ClientId = clientId,RedirectUri = redirectUri,Scope = scope,State = state };
107-
return await FetchAsync(options, client);
107+
return await FetchAsync(options, client, cancellationToken);
108108
}
109109
#endif
110110

src/Twilio/Rest/PreviewIam/V1/TokenResource.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ public static TokenResource Create(CreateTokenOptions options, ITwilioRestClient
6666
/// <param name="options"> Create Token parameters </param>
6767
/// <param name="client"> Client to make requests to Twilio </param>
6868
/// <returns> Task that resolves to A single instance of Token </returns>
69-
public static async System.Threading.Tasks.Task<TokenResource> CreateAsync(CreateTokenOptions options, ITwilioRestClient client = null)
69+
public static async System.Threading.Tasks.Task<TokenResource> CreateAsync(CreateTokenOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
7070
{
7171
client = client ?? TwilioClient.GetNoAuthRestClient();
72-
var response = await client.RequestAsync(BuildCreateRequest(options, client));
72+
var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken);
7373
return FromJson(response.Content);
7474
}
7575
#endif
@@ -124,7 +124,7 @@ public static async System.Threading.Tasks.Task<TokenResource> CreateAsync(
124124
ITwilioRestClient client = null)
125125
{
126126
var options = new CreateTokenOptions(grantType, clientId){ ClientSecret = clientSecret, Code = code, RedirectUri = redirectUri, Audience = audience, RefreshToken = refreshToken, Scope = scope };
127-
return await CreateAsync(options, client);
127+
return await CreateAsync(options, client, cancellationToken);
128128
}
129129
#endif
130130

0 commit comments

Comments
 (0)