Skip to content

Commit 3db9248

Browse files
Bulk Regex Add of CancellationToken Parameters
1 parent 168c8ec commit 3db9248

File tree

10 files changed

+95
-88
lines changed

10 files changed

+95
-88
lines changed

src/Twilio/Rest/Api/V2010/Account/Call/UserDefinedMessageSubscriptionResource.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public static UserDefinedMessageSubscriptionResource Create(CreateUserDefinedMes
7070
/// <param name="options"> Create UserDefinedMessageSubscription parameters </param>
7171
/// <param name="client"> Client to make requests to Twilio </param>
7272
/// <returns> Task that resolves to A single instance of UserDefinedMessageSubscription </returns>
73-
public static async System.Threading.Tasks.Task<UserDefinedMessageSubscriptionResource> CreateAsync(CreateUserDefinedMessageSubscriptionOptions options, ITwilioRestClient client = null)
73+
public static async System.Threading.Tasks.Task<UserDefinedMessageSubscriptionResource> CreateAsync(CreateUserDefinedMessageSubscriptionOptions 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
@@ -116,7 +116,7 @@ public static async System.Threading.Tasks.Task<UserDefinedMessageSubscriptionRe
116116
ITwilioRestClient client = null)
117117
{
118118
var options = new CreateUserDefinedMessageSubscriptionOptions(pathCallSid, callback){ PathAccountSid = pathAccountSid, IdempotencyKey = idempotencyKey, Method = method };
119-
return await CreateAsync(options, client);
119+
return await CreateAsync(options, client, cancellationToken);
120120
}
121121
#endif
122122

@@ -161,11 +161,12 @@ public static bool Delete(DeleteUserDefinedMessageSubscriptionOptions options, I
161161
/// <param name="options"> Delete UserDefinedMessageSubscription parameters </param>
162162
/// <param name="client"> Client to make requests to Twilio </param>
163163
/// <returns> Task that resolves to A single instance of UserDefinedMessageSubscription </returns>
164-
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteUserDefinedMessageSubscriptionOptions options,
165-
ITwilioRestClient client = null)
164+
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteUserDefinedMessageSubscriptionOptions options,
165+
ITwilioRestClient client = null,
166+
CancellationToken cancellationToken = default)
166167
{
167168
client = client ?? TwilioClient.GetRestClient();
168-
var response = await client.RequestAsync(BuildDeleteRequest(options, client));
169+
var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken);
169170
return response.StatusCode == System.Net.HttpStatusCode.NoContent;
170171
}
171172
#endif
@@ -192,7 +193,7 @@ public static bool Delete(string pathCallSid, string pathSid, string pathAccount
192193
public static async System.Threading.Tasks.Task<bool> DeleteAsync(string pathCallSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
193194
{
194195
var options = new DeleteUserDefinedMessageSubscriptionOptions(pathCallSid, pathSid) { PathAccountSid = pathAccountSid };
195-
return await DeleteAsync(options, client);
196+
return await DeleteAsync(options, client, cancellationToken);
196197
}
197198
#endif
198199

src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantResource.cs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ public static ParticipantResource Create(CreateParticipantOptions options, ITwil
8787
/// <param name="options"> Create Participant parameters </param>
8888
/// <param name="client"> Client to make requests to Twilio </param>
8989
/// <returns> Task that resolves to A single instance of Participant </returns>
90-
public static async System.Threading.Tasks.Task<ParticipantResource> CreateAsync(CreateParticipantOptions options, ITwilioRestClient client = null)
90+
public static async System.Threading.Tasks.Task<ParticipantResource> CreateAsync(CreateParticipantOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
9191
{
9292
client = client ?? TwilioClient.GetRestClient();
93-
var response = await client.RequestAsync(BuildCreateRequest(options, client));
93+
var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken);
9494
return FromJson(response.Content);
9595
}
9696
#endif
@@ -313,7 +313,7 @@ public static async System.Threading.Tasks.Task<ParticipantResource> CreateAsync
313313
ITwilioRestClient client = null)
314314
{
315315
var options = new CreateParticipantOptions(pathConferenceSid, from, to){ PathAccountSid = pathAccountSid, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, StatusCallbackEvent = statusCallbackEvent, Label = label, Timeout = timeout, Record = record, Muted = muted, Beep = beep, StartConferenceOnEnter = startConferenceOnEnter, EndConferenceOnExit = endConferenceOnExit, WaitUrl = waitUrl, WaitMethod = waitMethod, EarlyMedia = earlyMedia, MaxParticipants = maxParticipants, ConferenceRecord = conferenceRecord, ConferenceTrim = conferenceTrim, ConferenceStatusCallback = conferenceStatusCallback, ConferenceStatusCallbackMethod = conferenceStatusCallbackMethod, ConferenceStatusCallbackEvent = conferenceStatusCallbackEvent, RecordingChannels = recordingChannels, RecordingStatusCallback = recordingStatusCallback, RecordingStatusCallbackMethod = recordingStatusCallbackMethod, SipAuthUsername = sipAuthUsername, SipAuthPassword = sipAuthPassword, Region = region, ConferenceRecordingStatusCallback = conferenceRecordingStatusCallback, ConferenceRecordingStatusCallbackMethod = conferenceRecordingStatusCallbackMethod, RecordingStatusCallbackEvent = recordingStatusCallbackEvent, ConferenceRecordingStatusCallbackEvent = conferenceRecordingStatusCallbackEvent, Coaching = coaching, CallSidToCoach = callSidToCoach, JitterBufferSize = jitterBufferSize, Byoc = byoc, CallerId = callerId, CallReason = callReason, RecordingTrack = recordingTrack, TimeLimit = timeLimit, MachineDetection = machineDetection, MachineDetectionTimeout = machineDetectionTimeout, MachineDetectionSpeechThreshold = machineDetectionSpeechThreshold, MachineDetectionSpeechEndThreshold = machineDetectionSpeechEndThreshold, MachineDetectionSilenceTimeout = machineDetectionSilenceTimeout, AmdStatusCallback = amdStatusCallback, AmdStatusCallbackMethod = amdStatusCallbackMethod, Trim = trim, CallToken = callToken };
316-
return await CreateAsync(options, client);
316+
return await CreateAsync(options, client, cancellationToken);
317317
}
318318
#endif
319319

@@ -358,11 +358,12 @@ public static bool Delete(DeleteParticipantOptions options, ITwilioRestClient cl
358358
/// <param name="options"> Delete Participant parameters </param>
359359
/// <param name="client"> Client to make requests to Twilio </param>
360360
/// <returns> Task that resolves to A single instance of Participant </returns>
361-
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteParticipantOptions options,
362-
ITwilioRestClient client = null)
361+
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteParticipantOptions options,
362+
ITwilioRestClient client = null,
363+
CancellationToken cancellationToken = default)
363364
{
364365
client = client ?? TwilioClient.GetRestClient();
365-
var response = await client.RequestAsync(BuildDeleteRequest(options, client));
366+
var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken);
366367
return response.StatusCode == System.Net.HttpStatusCode.NoContent;
367368
}
368369
#endif
@@ -389,7 +390,7 @@ public static bool Delete(string pathConferenceSid, string pathCallSid, string p
389390
public static async System.Threading.Tasks.Task<bool> DeleteAsync(string pathConferenceSid, string pathCallSid, string pathAccountSid = null, ITwilioRestClient client = null)
390391
{
391392
var options = new DeleteParticipantOptions(pathConferenceSid, pathCallSid) { PathAccountSid = pathAccountSid };
392-
return await DeleteAsync(options, client);
393+
return await DeleteAsync(options, client, cancellationToken);
393394
}
394395
#endif
395396

@@ -430,10 +431,10 @@ public static ParticipantResource Fetch(FetchParticipantOptions options, ITwilio
430431
/// <param name="options"> Fetch Participant parameters </param>
431432
/// <param name="client"> Client to make requests to Twilio </param>
432433
/// <returns> Task that resolves to A single instance of Participant </returns>
433-
public static async System.Threading.Tasks.Task<ParticipantResource> FetchAsync(FetchParticipantOptions options, ITwilioRestClient client = null)
434+
public static async System.Threading.Tasks.Task<ParticipantResource> FetchAsync(FetchParticipantOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
434435
{
435436
client = client ?? TwilioClient.GetRestClient();
436-
var response = await client.RequestAsync(BuildFetchRequest(options, client));
437+
var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken);
437438
return FromJson(response.Content);
438439
}
439440
#endif
@@ -463,7 +464,7 @@ public static ParticipantResource Fetch(
463464
public static async System.Threading.Tasks.Task<ParticipantResource> FetchAsync(string pathConferenceSid, string pathCallSid, string pathAccountSid = null, ITwilioRestClient client = null)
464465
{
465466
var options = new FetchParticipantOptions(pathConferenceSid, pathCallSid){ PathAccountSid = pathAccountSid };
466-
return await FetchAsync(options, client);
467+
return await FetchAsync(options, client, cancellationToken);
467468
}
468469
#endif
469470

@@ -502,10 +503,10 @@ public static ResourceSet<ParticipantResource> Read(ReadParticipantOptions optio
502503
/// <param name="options"> Read Participant parameters </param>
503504
/// <param name="client"> Client to make requests to Twilio </param>
504505
/// <returns> Task that resolves to A single instance of Participant </returns>
505-
public static async System.Threading.Tasks.Task<ResourceSet<ParticipantResource>> ReadAsync(ReadParticipantOptions options, ITwilioRestClient client = null)
506+
public static async System.Threading.Tasks.Task<ResourceSet<ParticipantResource>> ReadAsync(ReadParticipantOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default)
506507
{
507508
client = client ?? TwilioClient.GetRestClient();
508-
var response = await client.RequestAsync(BuildReadRequest(options, client));
509+
var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken);
509510

510511
var page = Page<ParticipantResource>.FromJson("participants", response.Content);
511512
return new ResourceSet<ParticipantResource>(page, options, client);
@@ -557,7 +558,7 @@ public static async System.Threading.Tasks.Task<ResourceSet<ParticipantResource>
557558
ITwilioRestClient client = null)
558559
{
559560
var options = new ReadParticipantOptions(pathConferenceSid){ PathAccountSid = pathAccountSid, Muted = muted, Hold = hold, Coaching = coaching, PageSize = pageSize, Limit = limit};
560-
return await ReadAsync(options, client);
561+
return await ReadAsync(options, client, cancellationToken);
561562
}
562563
#endif
563564

@@ -648,11 +649,12 @@ public static ParticipantResource Update(UpdateParticipantOptions options, ITwil
648649
/// <param name="client"> Client to make requests to Twilio </param>
649650
/// <returns> Task that resolves to A single instance of Participant </returns>
650651
#if !NET35
651-
public static async System.Threading.Tasks.Task<ParticipantResource> UpdateAsync(UpdateParticipantOptions options,
652-
ITwilioRestClient client = null)
652+
public static async System.Threading.Tasks.Task<ParticipantResource> UpdateAsync(UpdateParticipantOptions options,
653+
ITwilioRestClient client = null,
654+
CancellationToken cancellationToken = default)
653655
{
654656
client = client ?? TwilioClient.GetRestClient();
655-
var response = await client.RequestAsync(BuildUpdateRequest(options, client));
657+
var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken);
656658
return FromJson(response.Content);
657659
}
658660
#endif
@@ -735,7 +737,7 @@ public static async System.Threading.Tasks.Task<ParticipantResource> UpdateAsync
735737
ITwilioRestClient client = null)
736738
{
737739
var options = new UpdateParticipantOptions(pathConferenceSid, pathCallSid){ PathAccountSid = pathAccountSid, Muted = muted, Hold = hold, HoldUrl = holdUrl, HoldMethod = holdMethod, AnnounceUrl = announceUrl, AnnounceMethod = announceMethod, WaitUrl = waitUrl, WaitMethod = waitMethod, BeepOnExit = beepOnExit, EndConferenceOnExit = endConferenceOnExit, Coaching = coaching, CallSidToCoach = callSidToCoach };
738-
return await UpdateAsync(options, client);
740+
return await UpdateAsync(options, client, cancellationToken);
739741
}
740742
#endif
741743

0 commit comments

Comments
 (0)