Skip to content

Commit 18dd755

Browse files
Bulk Regex Add of CancellationToken Parameters
1 parent 3db9248 commit 18dd755

18 files changed

+173
-160
lines changed

src/Twilio/Rest/Api/V2010/Account/Sip/CredentialList/CredentialResource.cs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public static CredentialResource Create(CreateCredentialOptions options, ITwilio
7070
/// <param name="options"> Create Credential parameters </param>
7171
/// <param name="client"> Client to make requests to Twilio </param>
7272
/// <returns> Task that resolves to A single instance of Credential </returns>
73-
public static async System.Threading.Tasks.Task<CredentialResource> CreateAsync(CreateCredentialOptions options, ITwilioRestClient client = null)
73+
public static async System.Threading.Tasks.Task<CredentialResource> CreateAsync(CreateCredentialOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
7474
{
7575
client = client ?? TwilioClient.GetRestClient();
76-
var response = await client.RequestAsync(BuildCreateRequest(options, client));
76+
var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken);
7777
return FromJson(response.Content);
7878
}
7979
#endif
@@ -112,7 +112,7 @@ public static async System.Threading.Tasks.Task<CredentialResource> CreateAsync(
112112
ITwilioRestClient client = null)
113113
{
114114
var options = new CreateCredentialOptions(pathCredentialListSid, username, password){ PathAccountSid = pathAccountSid };
115-
return await CreateAsync(options, client);
115+
return await CreateAsync(options, client, cancellationToken);
116116
}
117117
#endif
118118

@@ -157,11 +157,12 @@ public static bool Delete(DeleteCredentialOptions options, ITwilioRestClient cli
157157
/// <param name="options"> Delete Credential parameters </param>
158158
/// <param name="client"> Client to make requests to Twilio </param>
159159
/// <returns> Task that resolves to A single instance of Credential </returns>
160-
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteCredentialOptions options,
161-
ITwilioRestClient client = null)
160+
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteCredentialOptions options,
161+
ITwilioRestClient client = null,
162+
CancellationToken cancellationToken = default)
162163
{
163164
client = client ?? TwilioClient.GetRestClient();
164-
var response = await client.RequestAsync(BuildDeleteRequest(options, client));
165+
var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken);
165166
return response.StatusCode == System.Net.HttpStatusCode.NoContent;
166167
}
167168
#endif
@@ -188,7 +189,7 @@ public static bool Delete(string pathCredentialListSid, string pathSid, string p
188189
public static async System.Threading.Tasks.Task<bool> DeleteAsync(string pathCredentialListSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
189190
{
190191
var options = new DeleteCredentialOptions(pathCredentialListSid, pathSid) { PathAccountSid = pathAccountSid };
191-
return await DeleteAsync(options, client);
192+
return await DeleteAsync(options, client, cancellationToken);
192193
}
193194
#endif
194195

@@ -229,10 +230,10 @@ public static CredentialResource Fetch(FetchCredentialOptions options, ITwilioRe
229230
/// <param name="options"> Fetch Credential parameters </param>
230231
/// <param name="client"> Client to make requests to Twilio </param>
231232
/// <returns> Task that resolves to A single instance of Credential </returns>
232-
public static async System.Threading.Tasks.Task<CredentialResource> FetchAsync(FetchCredentialOptions options, ITwilioRestClient client = null)
233+
public static async System.Threading.Tasks.Task<CredentialResource> FetchAsync(FetchCredentialOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
233234
{
234235
client = client ?? TwilioClient.GetRestClient();
235-
var response = await client.RequestAsync(BuildFetchRequest(options, client));
236+
var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken);
236237
return FromJson(response.Content);
237238
}
238239
#endif
@@ -262,7 +263,7 @@ public static CredentialResource Fetch(
262263
public static async System.Threading.Tasks.Task<CredentialResource> FetchAsync(string pathCredentialListSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
263264
{
264265
var options = new FetchCredentialOptions(pathCredentialListSid, pathSid){ PathAccountSid = pathAccountSid };
265-
return await FetchAsync(options, client);
266+
return await FetchAsync(options, client, cancellationToken);
266267
}
267268
#endif
268269

@@ -301,10 +302,10 @@ public static ResourceSet<CredentialResource> Read(ReadCredentialOptions options
301302
/// <param name="options"> Read Credential parameters </param>
302303
/// <param name="client"> Client to make requests to Twilio </param>
303304
/// <returns> Task that resolves to A single instance of Credential </returns>
304-
public static async System.Threading.Tasks.Task<ResourceSet<CredentialResource>> ReadAsync(ReadCredentialOptions options, ITwilioRestClient client = null)
305+
public static async System.Threading.Tasks.Task<ResourceSet<CredentialResource>> ReadAsync(ReadCredentialOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
305306
{
306307
client = client ?? TwilioClient.GetRestClient();
307-
var response = await client.RequestAsync(BuildReadRequest(options, client));
308+
var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken);
308309

309310
var page = Page<CredentialResource>.FromJson("credentials", response.Content);
310311
return new ResourceSet<CredentialResource>(page, options, client);
@@ -344,7 +345,7 @@ public static async System.Threading.Tasks.Task<ResourceSet<CredentialResource>>
344345
ITwilioRestClient client = null)
345346
{
346347
var options = new ReadCredentialOptions(pathCredentialListSid){ PathAccountSid = pathAccountSid, PageSize = pageSize, Limit = limit};
347-
return await ReadAsync(options, client);
348+
return await ReadAsync(options, client, cancellationToken);
348349
}
349350
#endif
350351

@@ -435,11 +436,12 @@ public static CredentialResource Update(UpdateCredentialOptions options, ITwilio
435436
/// <param name="client"> Client to make requests to Twilio </param>
436437
/// <returns> Task that resolves to A single instance of Credential </returns>
437438
#if !NET35
438-
public static async System.Threading.Tasks.Task<CredentialResource> UpdateAsync(UpdateCredentialOptions options,
439-
ITwilioRestClient client = null)
439+
public static async System.Threading.Tasks.Task<CredentialResource> UpdateAsync(UpdateCredentialOptions options,
440+
ITwilioRestClient client = null,
441+
CancellationToken cancellationToken = default)
440442
{
441443
client = client ?? TwilioClient.GetRestClient();
442-
var response = await client.RequestAsync(BuildUpdateRequest(options, client));
444+
var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken);
443445
return FromJson(response.Content);
444446
}
445447
#endif
@@ -478,7 +480,7 @@ public static async System.Threading.Tasks.Task<CredentialResource> UpdateAsync(
478480
ITwilioRestClient client = null)
479481
{
480482
var options = new UpdateCredentialOptions(pathCredentialListSid, pathSid){ PathAccountSid = pathAccountSid, Password = password };
481-
return await UpdateAsync(options, client);
483+
return await UpdateAsync(options, client, cancellationToken);
482484
}
483485
#endif
484486

src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls/AuthCallsCredentialListMappingResource.cs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public static AuthCallsCredentialListMappingResource Create(CreateAuthCallsCrede
7070
/// <param name="options"> Create AuthCallsCredentialListMapping parameters </param>
7171
/// <param name="client"> Client to make requests to Twilio </param>
7272
/// <returns> Task that resolves to A single instance of AuthCallsCredentialListMapping </returns>
73-
public static async System.Threading.Tasks.Task<AuthCallsCredentialListMappingResource> CreateAsync(CreateAuthCallsCredentialListMappingOptions options, ITwilioRestClient client = null)
73+
public static async System.Threading.Tasks.Task<AuthCallsCredentialListMappingResource> CreateAsync(CreateAuthCallsCredentialListMappingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
7474
{
7575
client = client ?? TwilioClient.GetRestClient();
76-
var response = await client.RequestAsync(BuildCreateRequest(options, client));
76+
var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken);
7777
return FromJson(response.Content);
7878
}
7979
#endif
@@ -108,7 +108,7 @@ public static async System.Threading.Tasks.Task<AuthCallsCredentialListMappingRe
108108
ITwilioRestClient client = null)
109109
{
110110
var options = new CreateAuthCallsCredentialListMappingOptions(pathDomainSid, credentialListSid){ PathAccountSid = pathAccountSid };
111-
return await CreateAsync(options, client);
111+
return await CreateAsync(options, client, cancellationToken);
112112
}
113113
#endif
114114

@@ -153,11 +153,12 @@ public static bool Delete(DeleteAuthCallsCredentialListMappingOptions options, I
153153
/// <param name="options"> Delete AuthCallsCredentialListMapping parameters </param>
154154
/// <param name="client"> Client to make requests to Twilio </param>
155155
/// <returns> Task that resolves to A single instance of AuthCallsCredentialListMapping </returns>
156-
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteAuthCallsCredentialListMappingOptions options,
157-
ITwilioRestClient client = null)
156+
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteAuthCallsCredentialListMappingOptions options,
157+
ITwilioRestClient client = null,
158+
CancellationToken cancellationToken = default)
158159
{
159160
client = client ?? TwilioClient.GetRestClient();
160-
var response = await client.RequestAsync(BuildDeleteRequest(options, client));
161+
var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken);
161162
return response.StatusCode == System.Net.HttpStatusCode.NoContent;
162163
}
163164
#endif
@@ -184,7 +185,7 @@ public static bool Delete(string pathDomainSid, string pathSid, string pathAccou
184185
public static async System.Threading.Tasks.Task<bool> DeleteAsync(string pathDomainSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
185186
{
186187
var options = new DeleteAuthCallsCredentialListMappingOptions(pathDomainSid, pathSid) { PathAccountSid = pathAccountSid };
187-
return await DeleteAsync(options, client);
188+
return await DeleteAsync(options, client, cancellationToken);
188189
}
189190
#endif
190191

@@ -225,10 +226,10 @@ public static AuthCallsCredentialListMappingResource Fetch(FetchAuthCallsCredent
225226
/// <param name="options"> Fetch AuthCallsCredentialListMapping parameters </param>
226227
/// <param name="client"> Client to make requests to Twilio </param>
227228
/// <returns> Task that resolves to A single instance of AuthCallsCredentialListMapping </returns>
228-
public static async System.Threading.Tasks.Task<AuthCallsCredentialListMappingResource> FetchAsync(FetchAuthCallsCredentialListMappingOptions options, ITwilioRestClient client = null)
229+
public static async System.Threading.Tasks.Task<AuthCallsCredentialListMappingResource> FetchAsync(FetchAuthCallsCredentialListMappingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
229230
{
230231
client = client ?? TwilioClient.GetRestClient();
231-
var response = await client.RequestAsync(BuildFetchRequest(options, client));
232+
var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken);
232233
return FromJson(response.Content);
233234
}
234235
#endif
@@ -258,7 +259,7 @@ public static AuthCallsCredentialListMappingResource Fetch(
258259
public static async System.Threading.Tasks.Task<AuthCallsCredentialListMappingResource> FetchAsync(string pathDomainSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
259260
{
260261
var options = new FetchAuthCallsCredentialListMappingOptions(pathDomainSid, pathSid){ PathAccountSid = pathAccountSid };
261-
return await FetchAsync(options, client);
262+
return await FetchAsync(options, client, cancellationToken);
262263
}
263264
#endif
264265

@@ -297,10 +298,10 @@ public static ResourceSet<AuthCallsCredentialListMappingResource> Read(ReadAuthC
297298
/// <param name="options"> Read AuthCallsCredentialListMapping parameters </param>
298299
/// <param name="client"> Client to make requests to Twilio </param>
299300
/// <returns> Task that resolves to A single instance of AuthCallsCredentialListMapping </returns>
300-
public static async System.Threading.Tasks.Task<ResourceSet<AuthCallsCredentialListMappingResource>> ReadAsync(ReadAuthCallsCredentialListMappingOptions options, ITwilioRestClient client = null)
301+
public static async System.Threading.Tasks.Task<ResourceSet<AuthCallsCredentialListMappingResource>> ReadAsync(ReadAuthCallsCredentialListMappingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
301302
{
302303
client = client ?? TwilioClient.GetRestClient();
303-
var response = await client.RequestAsync(BuildReadRequest(options, client));
304+
var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken);
304305

305306
var page = Page<AuthCallsCredentialListMappingResource>.FromJson("contents", response.Content);
306307
return new ResourceSet<AuthCallsCredentialListMappingResource>(page, options, client);
@@ -340,7 +341,7 @@ public static async System.Threading.Tasks.Task<ResourceSet<AuthCallsCredentialL
340341
ITwilioRestClient client = null)
341342
{
342343
var options = new ReadAuthCallsCredentialListMappingOptions(pathDomainSid){ PathAccountSid = pathAccountSid, PageSize = pageSize, Limit = limit};
343-
return await ReadAsync(options, client);
344+
return await ReadAsync(options, client, cancellationToken);
344345
}
345346
#endif
346347

0 commit comments

Comments
 (0)