From 53130612adbaf33f49316eef980bc16e6e22bf43 Mon Sep 17 00:00:00 2001 From: Joseph Livecchi Date: Fri, 10 Jan 2025 12:48:39 -0500 Subject: [PATCH] Bulk Regex Add of CancellationToken Parameters --- .../Organizations/AccountResource.cs | 12 +++--- .../Organizations/RoleAssignmentResource.cs | 21 +++++----- .../PreviewIam/Organizations/UserResource.cs | 36 +++++++++-------- .../Rest/PreviewIam/V1/AuthorizeResource.cs | 6 +-- .../Rest/PreviewIam/V1/TokenResource.cs | 6 +-- .../Rest/Routes/V2/PhoneNumberResource.cs | 17 ++++---- .../Rest/Routes/V2/SipDomainResource.cs | 17 ++++---- src/Twilio/Rest/Routes/V2/TrunkResource.cs | 17 ++++---- .../V1/Service/Asset/AssetVersionResource.cs | 12 +++--- .../Serverless/V1/Service/AssetResource.cs | 36 +++++++++-------- .../V1/Service/Build/BuildStatusResource.cs | 6 +-- .../Serverless/V1/Service/BuildResource.cs | 27 +++++++------ .../Service/Environment/DeploymentResource.cs | 18 ++++----- .../V1/Service/Environment/LogResource.cs | 12 +++--- .../Service/Environment/VariableResource.cs | 36 +++++++++-------- .../V1/Service/EnvironmentResource.cs | 27 +++++++------ .../FunctionVersionContentResource.cs | 6 +-- .../Function/FunctionVersionResource.cs | 12 +++--- .../Serverless/V1/Service/FunctionResource.cs | 36 +++++++++-------- .../Rest/Serverless/V1/ServiceResource.cs | 40 ++++++++++--------- .../Engagement/EngagementContextResource.cs | 6 +-- .../Engagement/Step/StepContextResource.cs | 6 +-- .../Studio/V1/Flow/Engagement/StepResource.cs | 12 +++--- .../Rest/Studio/V1/Flow/EngagementResource.cs | 27 +++++++------ .../Execution/ExecutionContextResource.cs | 6 +-- .../ExecutionStepContextResource.cs | 6 +-- .../Flow/Execution/ExecutionStepResource.cs | 12 +++--- .../Rest/Studio/V1/Flow/ExecutionResource.cs | 36 +++++++++-------- src/Twilio/Rest/Studio/V1/FlowResource.cs | 25 ++++++------ .../Execution/ExecutionContextResource.cs | 6 +-- .../ExecutionStepContextResource.cs | 6 +-- .../Flow/Execution/ExecutionStepResource.cs | 12 +++--- .../Rest/Studio/V2/Flow/ExecutionResource.cs | 36 +++++++++-------- .../Studio/V2/Flow/FlowRevisionResource.cs | 12 +++--- .../Studio/V2/Flow/FlowTestUserResource.cs | 17 ++++---- src/Twilio/Rest/Studio/V2/FlowResource.cs | 40 ++++++++++--------- .../Rest/Studio/V2/FlowValidateResource.cs | 9 +++-- .../Rest/Supersim/V1/EsimProfileResource.cs | 20 +++++----- src/Twilio/Rest/Supersim/V1/FleetResource.cs | 29 +++++++------- .../Rest/Supersim/V1/IpCommandResource.cs | 20 +++++----- .../NetworkAccessProfileNetworkResource.cs | 27 +++++++------ .../V1/NetworkAccessProfileResource.cs | 29 +++++++------- .../Rest/Supersim/V1/NetworkResource.cs | 14 +++---- .../Supersim/V1/SettingsUpdateResource.cs | 6 +-- .../Supersim/V1/Sim/BillingPeriodResource.cs | 6 +-- .../Supersim/V1/Sim/SimIpAddressResource.cs | 6 +-- src/Twilio/Rest/Supersim/V1/SimResource.cs | 29 +++++++------- .../Rest/Supersim/V1/SmsCommandResource.cs | 20 +++++----- .../Rest/Supersim/V1/UsageRecordResource.cs | 6 +-- .../Document/DocumentPermissionResource.cs | 30 +++++++------- .../Rest/Sync/V1/Service/DocumentResource.cs | 36 +++++++++-------- .../Service/SyncList/SyncListItemResource.cs | 36 +++++++++-------- .../SyncList/SyncListPermissionResource.cs | 30 +++++++------- .../Rest/Sync/V1/Service/SyncListResource.cs | 36 +++++++++-------- .../V1/Service/SyncMap/SyncMapItemResource.cs | 36 +++++++++-------- .../SyncMap/SyncMapPermissionResource.cs | 30 +++++++------- .../Rest/Sync/V1/Service/SyncMapResource.cs | 36 +++++++++-------- .../SyncStream/StreamMessageResource.cs | 6 +-- .../Sync/V1/Service/SyncStreamResource.cs | 36 +++++++++-------- src/Twilio/Rest/Sync/V1/ServiceResource.cs | 40 ++++++++++--------- .../V1/Workspace/ActivityResource.cs | 36 +++++++++-------- .../Taskrouter/V1/Workspace/EventResource.cs | 12 +++--- .../V1/Workspace/Task/ReservationResource.cs | 21 +++++----- .../V1/Workspace/TaskChannelResource.cs | 36 +++++++++-------- ...TaskQueueBulkRealTimeStatisticsResource.cs | 6 +-- .../TaskQueueCumulativeStatisticsResource.cs | 6 +-- .../TaskQueueRealTimeStatisticsResource.cs | 6 +-- .../TaskQueue/TaskQueueStatisticsResource.cs | 6 +-- .../TaskQueue/TaskQueuesStatisticsResource.cs | 6 +-- .../V1/Workspace/TaskQueueResource.cs | 36 +++++++++-------- .../Taskrouter/V1/Workspace/TaskResource.cs | 36 +++++++++-------- .../Workspace/Worker/ReservationResource.cs | 21 +++++----- .../Workspace/Worker/WorkerChannelResource.cs | 21 +++++----- .../Worker/WorkerStatisticsResource.cs | 6 +-- .../WorkersCumulativeStatisticsResource.cs | 6 +-- .../WorkersRealTimeStatisticsResource.cs | 6 +-- .../Worker/WorkersStatisticsResource.cs | 6 +-- .../Taskrouter/V1/Workspace/WorkerResource.cs | 36 +++++++++-------- .../WorkflowCumulativeStatisticsResource.cs | 6 +-- .../WorkflowRealTimeStatisticsResource.cs | 6 +-- .../Workflow/WorkflowStatisticsResource.cs | 6 +-- .../V1/Workspace/WorkflowResource.cs | 36 +++++++++-------- .../WorkspaceCumulativeStatisticsResource.cs | 6 +-- .../WorkspaceRealTimeStatisticsResource.cs | 6 +-- .../Workspace/WorkspaceStatisticsResource.cs | 6 +-- .../Rest/Taskrouter/V1/WorkspaceResource.cs | 40 ++++++++++--------- .../V1/Trunk/CredentialListResource.cs | 27 +++++++------ .../V1/Trunk/IpAccessControlListResource.cs | 27 +++++++------ .../V1/Trunk/OriginationUrlResource.cs | 36 +++++++++-------- .../Trunking/V1/Trunk/PhoneNumberResource.cs | 27 +++++++------ .../Trunking/V1/Trunk/RecordingResource.cs | 17 ++++---- src/Twilio/Rest/Trunking/V1/TrunkResource.cs | 40 ++++++++++--------- .../V1/ComplianceInquiriesResource.cs | 15 +++---- ...ComplianceRegistrationInquiriesResource.cs | 15 +++---- .../V1/ComplianceTollfreeInquiriesResource.cs | 6 +-- ...ofilesChannelEndpointAssignmentResource.cs | 27 +++++++------ ...stomerProfilesEntityAssignmentsResource.cs | 27 +++++++------ .../CustomerProfilesEvaluationsResource.cs | 18 ++++----- .../Trusthub/V1/CustomerProfilesResource.cs | 40 ++++++++++--------- .../Rest/Trusthub/V1/EndUserResource.cs | 40 ++++++++++--------- .../Rest/Trusthub/V1/EndUserTypeResource.cs | 14 +++---- .../Rest/Trusthub/V1/PoliciesResource.cs | 14 +++---- .../Trusthub/V1/SupportingDocumentResource.cs | 40 ++++++++++--------- .../V1/SupportingDocumentTypeResource.cs | 14 +++---- ...oductsChannelEndpointAssignmentResource.cs | 27 +++++++------ .../TrustProductsEntityAssignmentsResource.cs | 27 +++++++------ .../TrustProductsEvaluationsResource.cs | 18 ++++----- .../Rest/Trusthub/V1/TrustProductsResource.cs | 40 ++++++++++--------- src/Twilio/Rest/Verify/V2/FormResource.cs | 6 +-- src/Twilio/Rest/Verify/V2/SafelistResource.cs | 25 ++++++------ .../Verify/V2/Service/AccessTokenResource.cs | 12 +++--- .../Entity/Challenge/NotificationResource.cs | 6 +-- .../V2/Service/Entity/ChallengeResource.cs | 27 +++++++------ .../V2/Service/Entity/FactorResource.cs | 30 +++++++------- .../V2/Service/Entity/NewFactorResource.cs | 6 +-- .../Rest/Verify/V2/Service/EntityResource.cs | 27 +++++++------ .../Service/MessagingConfigurationResource.cs | 36 +++++++++-------- .../V2/Service/RateLimit/BucketResource.cs | 36 +++++++++-------- .../Verify/V2/Service/RateLimitResource.cs | 36 +++++++++-------- .../V2/Service/VerificationCheckResource.cs | 6 +-- .../Verify/V2/Service/VerificationResource.cs | 21 +++++----- .../Rest/Verify/V2/Service/WebhookResource.cs | 36 +++++++++-------- src/Twilio/Rest/Verify/V2/ServiceResource.cs | 40 ++++++++++--------- src/Twilio/Rest/Verify/V2/TemplateResource.cs | 6 +-- .../Verify/V2/VerificationAttemptResource.cs | 14 +++---- .../V2/VerificationAttemptsSummaryResource.cs | 6 +-- .../Rest/Video/V1/CompositionHookResource.cs | 40 ++++++++++--------- .../Rest/Video/V1/CompositionResource.cs | 31 +++++++------- .../Video/V1/CompositionSettingsResource.cs | 14 +++---- src/Twilio/Rest/Video/V1/RecordingResource.cs | 25 ++++++------ .../Video/V1/RecordingSettingsResource.cs | 14 +++---- .../V1/Room/Participant/AnonymizeResource.cs | 9 +++-- .../Participant/PublishedTrackResource.cs | 12 +++--- .../Participant/SubscribeRulesResource.cs | 15 +++---- .../Participant/SubscribedTrackResource.cs | 12 +++--- .../Rest/Video/V1/Room/ParticipantResource.cs | 21 +++++----- .../Video/V1/Room/RecordingRulesResource.cs | 17 ++++---- .../Video/V1/Room/RoomRecordingResource.cs | 21 +++++----- src/Twilio/Rest/Video/V1/RoomResource.cs | 29 +++++++------- .../Rest/Voice/V1/ArchivedCallResource.cs | 9 +++-- src/Twilio/Rest/Voice/V1/ByocTrunkResource.cs | 40 ++++++++++--------- .../ConnectionPolicyTargetResource.cs | 36 +++++++++-------- .../Rest/Voice/V1/ConnectionPolicyResource.cs | 40 ++++++++++--------- .../BulkCountryUpdateResource.cs | 6 +-- .../Country/HighriskSpecialPrefixResource.cs | 6 +-- .../V1/DialingPermissions/CountryResource.cs | 14 +++---- .../V1/DialingPermissions/SettingsResource.cs | 17 ++++---- src/Twilio/Rest/Voice/V1/IpRecordResource.cs | 40 ++++++++++--------- .../Rest/Voice/V1/SourceIpMappingResource.cs | 40 ++++++++++--------- .../Rest/Wireless/V1/CommandResource.cs | 31 +++++++------- .../Rest/Wireless/V1/RatePlanResource.cs | 40 ++++++++++--------- .../Wireless/V1/Sim/DataSessionResource.cs | 6 +-- .../Wireless/V1/Sim/UsageRecordResource.cs | 6 +-- src/Twilio/Rest/Wireless/V1/SimResource.cs | 34 ++++++++-------- .../Rest/Wireless/V1/UsageRecordResource.cs | 6 +-- 155 files changed, 1677 insertions(+), 1545 deletions(-) diff --git a/src/Twilio/Rest/PreviewIam/Organizations/AccountResource.cs b/src/Twilio/Rest/PreviewIam/Organizations/AccountResource.cs index 54b1fc6d2..22687cb7b 100644 --- a/src/Twilio/Rest/PreviewIam/Organizations/AccountResource.cs +++ b/src/Twilio/Rest/PreviewIam/Organizations/AccountResource.cs @@ -84,10 +84,10 @@ public static AccountResource Fetch(FetchAccountOptions options, ITwilioRestClie /// Fetch Account parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Account - public static async System.Threading.Tasks.Task FetchAsync(FetchAccountOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchAccountOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -114,7 +114,7 @@ public static AccountResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathOrganizationSid, string pathAccountSid, ITwilioRestClient client = null) { var options = new FetchAccountOptions(pathOrganizationSid, pathAccountSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -151,10 +151,10 @@ public static ResourceSet Read(ReadAccountOptions options, ITwi /// Read Account parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Account - public static async System.Threading.Tasks.Task> ReadAsync(ReadAccountOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadAccountOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("content", response.Content); return new ResourceSet(page, options, client); @@ -190,7 +190,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadAccountOptions(pathOrganizationSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/PreviewIam/Organizations/RoleAssignmentResource.cs b/src/Twilio/Rest/PreviewIam/Organizations/RoleAssignmentResource.cs index c334b792e..0d38bf639 100644 --- a/src/Twilio/Rest/PreviewIam/Organizations/RoleAssignmentResource.cs +++ b/src/Twilio/Rest/PreviewIam/Organizations/RoleAssignmentResource.cs @@ -105,10 +105,10 @@ public static RoleAssignmentResource Create(CreateRoleAssignmentOptions options, /// Create RoleAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RoleAssignment - public static async System.Threading.Tasks.Task CreateAsync(CreateRoleAssignmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateRoleAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -139,7 +139,7 @@ public static async System.Threading.Tasks.Task CreateAs ITwilioRestClient client = null) { var options = new CreateRoleAssignmentOptions(pathOrganizationSid, publicApiCreateRoleAssignmentRequest){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -182,11 +182,12 @@ public static bool Delete(DeleteRoleAssignmentOptions options, ITwilioRestClient /// Delete RoleAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RoleAssignment - public static async System.Threading.Tasks.Task DeleteAsync(DeleteRoleAssignmentOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteRoleAssignmentOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -211,7 +212,7 @@ public static bool Delete(string pathOrganizationSid, string pathRoleAssignmentS public static async System.Threading.Tasks.Task DeleteAsync(string pathOrganizationSid, string pathRoleAssignmentSid, ITwilioRestClient client = null) { var options = new DeleteRoleAssignmentOptions(pathOrganizationSid, pathRoleAssignmentSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -248,10 +249,10 @@ public static ResourceSet Read(ReadRoleAssignmentOptions /// Read RoleAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RoleAssignment - public static async System.Threading.Tasks.Task> ReadAsync(ReadRoleAssignmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadRoleAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("content", response.Content); return new ResourceSet(page, options, client); @@ -295,7 +296,7 @@ public static async System.Threading.Tasks.Task Create User parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task CreateAsync(CreateUserOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -303,7 +303,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateUserOptions(pathOrganizationSid, scimUser){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -346,11 +346,12 @@ public static bool Delete(DeleteUserOptions options, ITwilioRestClient client = /// Delete User parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task DeleteAsync(DeleteUserOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteUserOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -375,7 +376,7 @@ public static bool Delete(string pathOrganizationSid, string pathUserSid, ITwili public static async System.Threading.Tasks.Task DeleteAsync(string pathOrganizationSid, string pathUserSid, ITwilioRestClient client = null) { var options = new DeleteUserOptions(pathOrganizationSid, pathUserSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -414,10 +415,10 @@ public static UserResource Fetch(FetchUserOptions options, ITwilioRestClient cli /// Fetch User parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task FetchAsync(FetchUserOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -444,7 +445,7 @@ public static UserResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathOrganizationSid, string pathUserSid, ITwilioRestClient client = null) { var options = new FetchUserOptions(pathOrganizationSid, pathUserSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -481,10 +482,10 @@ public static ResourceSet Read(ReadUserOptions options, ITwilioRes /// Read User parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task> ReadAsync(ReadUserOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("Resources", response.Content); return new ResourceSet(page, options, client); @@ -520,7 +521,7 @@ public static async System.Threading.Tasks.Task> ReadA ITwilioRestClient client = null) { var options = new ReadUserOptions(pathOrganizationSid){ Filter = filter, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -610,11 +611,12 @@ public static UserResource Update(UpdateUserOptions options, ITwilioRestClient c /// Client to make requests to Twilio /// Task that resolves to A single instance of User #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateUserOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateUserOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -653,7 +655,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateUserOptions(pathOrganizationSid, pathUserSid, scimUser){ IfMatch = ifMatch }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/PreviewIam/V1/AuthorizeResource.cs b/src/Twilio/Rest/PreviewIam/V1/AuthorizeResource.cs index 95c78a2f6..ccf0ebb55 100644 --- a/src/Twilio/Rest/PreviewIam/V1/AuthorizeResource.cs +++ b/src/Twilio/Rest/PreviewIam/V1/AuthorizeResource.cs @@ -65,10 +65,10 @@ public static AuthorizeResource Fetch(FetchAuthorizeOptions options, ITwilioRest /// Fetch Authorize parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Authorize - public static async System.Threading.Tasks.Task FetchAsync(FetchAuthorizeOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchAuthorizeOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetNoAuthRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static AuthorizeResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string responseType = null, string clientId = null, string redirectUri = null, string scope = null, string state = null, ITwilioRestClient client = null) { var options = new FetchAuthorizeOptions(){ ResponseType = responseType,ClientId = clientId,RedirectUri = redirectUri,Scope = scope,State = state }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/PreviewIam/V1/TokenResource.cs b/src/Twilio/Rest/PreviewIam/V1/TokenResource.cs index 311407ac9..93c731eb0 100644 --- a/src/Twilio/Rest/PreviewIam/V1/TokenResource.cs +++ b/src/Twilio/Rest/PreviewIam/V1/TokenResource.cs @@ -66,10 +66,10 @@ public static TokenResource Create(CreateTokenOptions options, ITwilioRestClient /// Create Token parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Token - public static async System.Threading.Tasks.Task CreateAsync(CreateTokenOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTokenOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetNoAuthRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -124,7 +124,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateTokenOptions(grantType, clientId){ ClientSecret = clientSecret, Code = code, RedirectUri = redirectUri, Audience = audience, RefreshToken = refreshToken, Scope = scope }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Routes/V2/PhoneNumberResource.cs b/src/Twilio/Rest/Routes/V2/PhoneNumberResource.cs index 0b58e238c..35321bfd0 100644 --- a/src/Twilio/Rest/Routes/V2/PhoneNumberResource.cs +++ b/src/Twilio/Rest/Routes/V2/PhoneNumberResource.cs @@ -67,10 +67,10 @@ public static PhoneNumberResource Fetch(FetchPhoneNumberOptions options, ITwilio /// Fetch PhoneNumber parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of PhoneNumber - public static async System.Threading.Tasks.Task FetchAsync(FetchPhoneNumberOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchPhoneNumberOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static PhoneNumberResource Fetch( /// The phone number in E.164 format /// Client to make requests to Twilio /// Task that resolves to A single instance of PhoneNumber - public static async System.Threading.Tasks.Task FetchAsync(string pathPhoneNumber, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathPhoneNumber, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchPhoneNumberOptions(pathPhoneNumber){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -132,11 +132,12 @@ public static PhoneNumberResource Update(UpdatePhoneNumberOptions options, ITwil /// Client to make requests to Twilio /// Task that resolves to A single instance of PhoneNumber #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdatePhoneNumberOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdatePhoneNumberOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -171,7 +172,7 @@ public static async System.Threading.Tasks.Task UpdateAsync ITwilioRestClient client = null) { var options = new UpdatePhoneNumberOptions(pathPhoneNumber){ VoiceRegion = voiceRegion, FriendlyName = friendlyName }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Routes/V2/SipDomainResource.cs b/src/Twilio/Rest/Routes/V2/SipDomainResource.cs index c6c4331aa..ebc6679ca 100644 --- a/src/Twilio/Rest/Routes/V2/SipDomainResource.cs +++ b/src/Twilio/Rest/Routes/V2/SipDomainResource.cs @@ -67,10 +67,10 @@ public static SipDomainResource Fetch(FetchSipDomainOptions options, ITwilioRest /// Fetch SipDomain parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SipDomain - public static async System.Threading.Tasks.Task FetchAsync(FetchSipDomainOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSipDomainOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static SipDomainResource Fetch( /// /// Client to make requests to Twilio /// Task that resolves to A single instance of SipDomain - public static async System.Threading.Tasks.Task FetchAsync(string pathSipDomain, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSipDomain, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchSipDomainOptions(pathSipDomain){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -132,11 +132,12 @@ public static SipDomainResource Update(UpdateSipDomainOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of SipDomain #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSipDomainOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSipDomainOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -171,7 +172,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateSipDomainOptions(pathSipDomain){ VoiceRegion = voiceRegion, FriendlyName = friendlyName }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Routes/V2/TrunkResource.cs b/src/Twilio/Rest/Routes/V2/TrunkResource.cs index 2dad3c67b..b98c313a7 100644 --- a/src/Twilio/Rest/Routes/V2/TrunkResource.cs +++ b/src/Twilio/Rest/Routes/V2/TrunkResource.cs @@ -67,10 +67,10 @@ public static TrunkResource Fetch(FetchTrunkOptions options, ITwilioRestClient c /// Fetch Trunk parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk - public static async System.Threading.Tasks.Task FetchAsync(FetchTrunkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTrunkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static TrunkResource Fetch( /// The absolute URL of the SIP Trunk /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk - public static async System.Threading.Tasks.Task FetchAsync(string pathSipTrunkDomain, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSipTrunkDomain, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchTrunkOptions(pathSipTrunkDomain){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -132,11 +132,12 @@ public static TrunkResource Update(UpdateTrunkOptions options, ITwilioRestClient /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateTrunkOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateTrunkOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -171,7 +172,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateTrunkOptions(pathSipTrunkDomain){ VoiceRegion = voiceRegion, FriendlyName = friendlyName }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/Service/Asset/AssetVersionResource.cs b/src/Twilio/Rest/Serverless/V1/Service/Asset/AssetVersionResource.cs index 68826ab4c..5db21920e 100644 --- a/src/Twilio/Rest/Serverless/V1/Service/Asset/AssetVersionResource.cs +++ b/src/Twilio/Rest/Serverless/V1/Service/Asset/AssetVersionResource.cs @@ -85,10 +85,10 @@ public static AssetVersionResource Fetch(FetchAssetVersionOptions options, ITwil /// Fetch AssetVersion parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of AssetVersion - public static async System.Threading.Tasks.Task FetchAsync(FetchAssetVersionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchAssetVersionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -118,7 +118,7 @@ public static AssetVersionResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathAssetSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchAssetVersionOptions(pathServiceSid, pathAssetSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -157,10 +157,10 @@ public static ResourceSet Read(ReadAssetVersionOptions opt /// Read AssetVersion parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of AssetVersion - public static async System.Threading.Tasks.Task> ReadAsync(ReadAssetVersionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadAssetVersionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("asset_versions", response.Content); return new ResourceSet(page, options, client); @@ -200,7 +200,7 @@ public static async System.Threading.Tasks.Task Create Asset parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Asset - public static async System.Threading.Tasks.Task CreateAsync(CreateAssetOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateAssetOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateAssetOptions(pathServiceSid, friendlyName){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -145,11 +145,12 @@ public static bool Delete(DeleteAssetOptions options, ITwilioRestClient client = /// Delete Asset parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Asset - public static async System.Threading.Tasks.Task DeleteAsync(DeleteAssetOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteAssetOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -174,7 +175,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteAssetOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -213,10 +214,10 @@ public static AssetResource Fetch(FetchAssetOptions options, ITwilioRestClient c /// Fetch Asset parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Asset - public static async System.Threading.Tasks.Task FetchAsync(FetchAssetOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchAssetOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -243,7 +244,7 @@ public static AssetResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchAssetOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -280,10 +281,10 @@ public static ResourceSet Read(ReadAssetOptions options, ITwilioR /// Read Asset parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Asset - public static async System.Threading.Tasks.Task> ReadAsync(ReadAssetOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadAssetOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("assets", response.Content); return new ResourceSet(page, options, client); @@ -319,7 +320,7 @@ public static async System.Threading.Tasks.Task> Read ITwilioRestClient client = null) { var options = new ReadAssetOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -408,11 +409,12 @@ public static AssetResource Update(UpdateAssetOptions options, ITwilioRestClient /// Client to make requests to Twilio /// Task that resolves to A single instance of Asset #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateAssetOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateAssetOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -447,7 +449,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateAssetOptions(pathServiceSid, pathSid, friendlyName){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/Service/Build/BuildStatusResource.cs b/src/Twilio/Rest/Serverless/V1/Service/Build/BuildStatusResource.cs index 09d0d3022..56b56794c 100644 --- a/src/Twilio/Rest/Serverless/V1/Service/Build/BuildStatusResource.cs +++ b/src/Twilio/Rest/Serverless/V1/Service/Build/BuildStatusResource.cs @@ -83,10 +83,10 @@ public static BuildStatusResource Fetch(FetchBuildStatusOptions options, ITwilio /// Fetch BuildStatus parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of BuildStatus - public static async System.Threading.Tasks.Task FetchAsync(FetchBuildStatusOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchBuildStatusOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -113,7 +113,7 @@ public static BuildStatusResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchBuildStatusOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/Service/BuildResource.cs b/src/Twilio/Rest/Serverless/V1/Service/BuildResource.cs index 52bfa2a50..16b4c680d 100644 --- a/src/Twilio/Rest/Serverless/V1/Service/BuildResource.cs +++ b/src/Twilio/Rest/Serverless/V1/Service/BuildResource.cs @@ -99,10 +99,10 @@ public static BuildResource Create(CreateBuildOptions options, ITwilioRestClient /// Create Build parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Build - public static async System.Threading.Tasks.Task CreateAsync(CreateBuildOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateBuildOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -145,7 +145,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateBuildOptions(pathServiceSid){ AssetVersions = assetVersions, FunctionVersions = functionVersions, Dependencies = dependencies, Runtime = runtime }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -188,11 +188,12 @@ public static bool Delete(DeleteBuildOptions options, ITwilioRestClient client = /// Delete Build parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Build - public static async System.Threading.Tasks.Task DeleteAsync(DeleteBuildOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteBuildOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -217,7 +218,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteBuildOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -256,10 +257,10 @@ public static BuildResource Fetch(FetchBuildOptions options, ITwilioRestClient c /// Fetch Build parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Build - public static async System.Threading.Tasks.Task FetchAsync(FetchBuildOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchBuildOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -286,7 +287,7 @@ public static BuildResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchBuildOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -323,10 +324,10 @@ public static ResourceSet Read(ReadBuildOptions options, ITwilioR /// Read Build parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Build - public static async System.Threading.Tasks.Task> ReadAsync(ReadBuildOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadBuildOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("builds", response.Content); return new ResourceSet(page, options, client); @@ -362,7 +363,7 @@ public static async System.Threading.Tasks.Task> Read ITwilioRestClient client = null) { var options = new ReadBuildOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/Service/Environment/DeploymentResource.cs b/src/Twilio/Rest/Serverless/V1/Service/Environment/DeploymentResource.cs index 644d94ac1..44b74c337 100644 --- a/src/Twilio/Rest/Serverless/V1/Service/Environment/DeploymentResource.cs +++ b/src/Twilio/Rest/Serverless/V1/Service/Environment/DeploymentResource.cs @@ -70,10 +70,10 @@ public static DeploymentResource Create(CreateDeploymentOptions options, ITwilio /// Create Deployment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Deployment - public static async System.Threading.Tasks.Task CreateAsync(CreateDeploymentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateDeploymentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -112,7 +112,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateDeploymentOptions(pathServiceSid, pathEnvironmentSid){ BuildSid = buildSid, IsPlugin = isPlugin }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -153,10 +153,10 @@ public static DeploymentResource Fetch(FetchDeploymentOptions options, ITwilioRe /// Fetch Deployment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Deployment - public static async System.Threading.Tasks.Task FetchAsync(FetchDeploymentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchDeploymentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -186,7 +186,7 @@ public static DeploymentResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathEnvironmentSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchDeploymentOptions(pathServiceSid, pathEnvironmentSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -225,10 +225,10 @@ public static ResourceSet Read(ReadDeploymentOptions options /// Read Deployment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Deployment - public static async System.Threading.Tasks.Task> ReadAsync(ReadDeploymentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadDeploymentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("deployments", response.Content); return new ResourceSet(page, options, client); @@ -268,7 +268,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadDeploymentOptions(pathServiceSid, pathEnvironmentSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/Service/Environment/LogResource.cs b/src/Twilio/Rest/Serverless/V1/Service/Environment/LogResource.cs index de7d2fdc8..d46bf77f6 100644 --- a/src/Twilio/Rest/Serverless/V1/Service/Environment/LogResource.cs +++ b/src/Twilio/Rest/Serverless/V1/Service/Environment/LogResource.cs @@ -85,10 +85,10 @@ public static LogResource Fetch(FetchLogOptions options, ITwilioRestClient clien /// Fetch Log parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Log - public static async System.Threading.Tasks.Task FetchAsync(FetchLogOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchLogOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -118,7 +118,7 @@ public static LogResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathEnvironmentSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchLogOptions(pathServiceSid, pathEnvironmentSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -157,10 +157,10 @@ public static ResourceSet Read(ReadLogOptions options, ITwilioRestC /// Read Log parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Log - public static async System.Threading.Tasks.Task> ReadAsync(ReadLogOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadLogOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("logs", response.Content); return new ResourceSet(page, options, client); @@ -212,7 +212,7 @@ public static async System.Threading.Tasks.Task> ReadAs ITwilioRestClient client = null) { var options = new ReadLogOptions(pathServiceSid, pathEnvironmentSid){ FunctionSid = functionSid, StartDate = startDate, EndDate = endDate, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/Service/Environment/VariableResource.cs b/src/Twilio/Rest/Serverless/V1/Service/Environment/VariableResource.cs index ca80aad3c..a82811113 100644 --- a/src/Twilio/Rest/Serverless/V1/Service/Environment/VariableResource.cs +++ b/src/Twilio/Rest/Serverless/V1/Service/Environment/VariableResource.cs @@ -70,10 +70,10 @@ public static VariableResource Create(CreateVariableOptions options, ITwilioRest /// Create Variable parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Variable - public static async System.Threading.Tasks.Task CreateAsync(CreateVariableOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateVariableOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -112,7 +112,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateVariableOptions(pathServiceSid, pathEnvironmentSid, key, value){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -157,11 +157,12 @@ public static bool Delete(DeleteVariableOptions options, ITwilioRestClient clien /// Delete Variable parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Variable - public static async System.Threading.Tasks.Task DeleteAsync(DeleteVariableOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteVariableOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -188,7 +189,7 @@ public static bool Delete(string pathServiceSid, string pathEnvironmentSid, stri public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathEnvironmentSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteVariableOptions(pathServiceSid, pathEnvironmentSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -229,10 +230,10 @@ public static VariableResource Fetch(FetchVariableOptions options, ITwilioRestCl /// Fetch Variable parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Variable - public static async System.Threading.Tasks.Task FetchAsync(FetchVariableOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchVariableOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -262,7 +263,7 @@ public static VariableResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathEnvironmentSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchVariableOptions(pathServiceSid, pathEnvironmentSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -301,10 +302,10 @@ public static ResourceSet Read(ReadVariableOptions options, IT /// Read Variable parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Variable - public static async System.Threading.Tasks.Task> ReadAsync(ReadVariableOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadVariableOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("variables", response.Content); return new ResourceSet(page, options, client); @@ -344,7 +345,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadVariableOptions(pathServiceSid, pathEnvironmentSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -435,11 +436,12 @@ public static VariableResource Update(UpdateVariableOptions options, ITwilioRest /// Client to make requests to Twilio /// Task that resolves to A single instance of Variable #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateVariableOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateVariableOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -482,7 +484,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateVariableOptions(pathServiceSid, pathEnvironmentSid, pathSid){ Key = key, Value = value }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/Service/EnvironmentResource.cs b/src/Twilio/Rest/Serverless/V1/Service/EnvironmentResource.cs index 951f4c522..cae84b6a2 100644 --- a/src/Twilio/Rest/Serverless/V1/Service/EnvironmentResource.cs +++ b/src/Twilio/Rest/Serverless/V1/Service/EnvironmentResource.cs @@ -68,10 +68,10 @@ public static EnvironmentResource Create(CreateEnvironmentOptions options, ITwil /// Create Environment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Environment - public static async System.Threading.Tasks.Task CreateAsync(CreateEnvironmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateEnvironmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -106,7 +106,7 @@ public static async System.Threading.Tasks.Task CreateAsync ITwilioRestClient client = null) { var options = new CreateEnvironmentOptions(pathServiceSid, uniqueName){ DomainSuffix = domainSuffix }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -149,11 +149,12 @@ public static bool Delete(DeleteEnvironmentOptions options, ITwilioRestClient cl /// Delete Environment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Environment - public static async System.Threading.Tasks.Task DeleteAsync(DeleteEnvironmentOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteEnvironmentOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -178,7 +179,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteEnvironmentOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -217,10 +218,10 @@ public static EnvironmentResource Fetch(FetchEnvironmentOptions options, ITwilio /// Fetch Environment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Environment - public static async System.Threading.Tasks.Task FetchAsync(FetchEnvironmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchEnvironmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -247,7 +248,7 @@ public static EnvironmentResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchEnvironmentOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -284,10 +285,10 @@ public static ResourceSet Read(ReadEnvironmentOptions optio /// Read Environment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Environment - public static async System.Threading.Tasks.Task> ReadAsync(ReadEnvironmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadEnvironmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("environments", response.Content); return new ResourceSet(page, options, client); @@ -323,7 +324,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadEnvironmentOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/Service/Function/FunctionVersion/FunctionVersionContentResource.cs b/src/Twilio/Rest/Serverless/V1/Service/Function/FunctionVersion/FunctionVersionContentResource.cs index 601a16610..0b984d25e 100644 --- a/src/Twilio/Rest/Serverless/V1/Service/Function/FunctionVersion/FunctionVersionContentResource.cs +++ b/src/Twilio/Rest/Serverless/V1/Service/Function/FunctionVersion/FunctionVersionContentResource.cs @@ -71,10 +71,10 @@ public static FunctionVersionContentResource Fetch(FetchFunctionVersionContentOp /// Fetch FunctionVersionContent parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of FunctionVersionContent - public static async System.Threading.Tasks.Task FetchAsync(FetchFunctionVersionContentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFunctionVersionContentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static FunctionVersionContentResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathFunctionSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchFunctionVersionContentOptions(pathServiceSid, pathFunctionSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/Service/Function/FunctionVersionResource.cs b/src/Twilio/Rest/Serverless/V1/Service/Function/FunctionVersionResource.cs index 0b391e294..16f80204b 100644 --- a/src/Twilio/Rest/Serverless/V1/Service/Function/FunctionVersionResource.cs +++ b/src/Twilio/Rest/Serverless/V1/Service/Function/FunctionVersionResource.cs @@ -85,10 +85,10 @@ public static FunctionVersionResource Fetch(FetchFunctionVersionOptions options, /// Fetch FunctionVersion parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of FunctionVersion - public static async System.Threading.Tasks.Task FetchAsync(FetchFunctionVersionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFunctionVersionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -118,7 +118,7 @@ public static FunctionVersionResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathFunctionSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchFunctionVersionOptions(pathServiceSid, pathFunctionSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -157,10 +157,10 @@ public static ResourceSet Read(ReadFunctionVersionOptio /// Read FunctionVersion parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of FunctionVersion - public static async System.Threading.Tasks.Task> ReadAsync(ReadFunctionVersionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadFunctionVersionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("function_versions", response.Content); return new ResourceSet(page, options, client); @@ -200,7 +200,7 @@ public static async System.Threading.Tasks.Task Create Function parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Function - public static async System.Threading.Tasks.Task CreateAsync(CreateFunctionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateFunctionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateFunctionOptions(pathServiceSid, friendlyName){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -145,11 +145,12 @@ public static bool Delete(DeleteFunctionOptions options, ITwilioRestClient clien /// Delete Function parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Function - public static async System.Threading.Tasks.Task DeleteAsync(DeleteFunctionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteFunctionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -174,7 +175,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteFunctionOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -213,10 +214,10 @@ public static FunctionResource Fetch(FetchFunctionOptions options, ITwilioRestCl /// Fetch Function parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Function - public static async System.Threading.Tasks.Task FetchAsync(FetchFunctionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFunctionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -243,7 +244,7 @@ public static FunctionResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchFunctionOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -280,10 +281,10 @@ public static ResourceSet Read(ReadFunctionOptions options, IT /// Read Function parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Function - public static async System.Threading.Tasks.Task> ReadAsync(ReadFunctionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadFunctionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("functions", response.Content); return new ResourceSet(page, options, client); @@ -319,7 +320,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadFunctionOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -408,11 +409,12 @@ public static FunctionResource Update(UpdateFunctionOptions options, ITwilioRest /// Client to make requests to Twilio /// Task that resolves to A single instance of Function #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateFunctionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateFunctionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -447,7 +449,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateFunctionOptions(pathServiceSid, pathSid, friendlyName){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Serverless/V1/ServiceResource.cs b/src/Twilio/Rest/Serverless/V1/ServiceResource.cs index 6caf7e157..6a4b60f21 100644 --- a/src/Twilio/Rest/Serverless/V1/ServiceResource.cs +++ b/src/Twilio/Rest/Serverless/V1/ServiceResource.cs @@ -66,10 +66,10 @@ public static ServiceResource Create(CreateServiceOptions options, ITwilioRestCl /// Create Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task CreateAsync(CreateServiceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateServiceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -108,7 +108,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateServiceOptions(uniqueName, friendlyName){ IncludeCredentials = includeCredentials, UiEditable = uiEditable }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -149,11 +149,12 @@ public static bool Delete(DeleteServiceOptions options, ITwilioRestClient client /// Delete Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task DeleteAsync(DeleteServiceOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteServiceOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -173,10 +174,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The `sid` or `unique_name` of the Service resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteServiceOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -213,10 +214,10 @@ public static ServiceResource Fetch(FetchServiceOptions options, ITwilioRestClie /// Fetch Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task FetchAsync(FetchServiceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchServiceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -237,10 +238,10 @@ public static ServiceResource Fetch( /// The `sid` or `unique_name` of the Service resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchServiceOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -275,10 +276,10 @@ public static ResourceSet Read(ReadServiceOptions options, ITwi /// Read Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task> ReadAsync(ReadServiceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadServiceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("services", response.Content); return new ResourceSet(page, options, client); @@ -310,7 +311,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadServiceOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -397,11 +398,12 @@ public static ServiceResource Update(UpdateServiceOptions options, ITwilioRestCl /// Client to make requests to Twilio /// Task that resolves to A single instance of Service #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateServiceOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateServiceOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -440,7 +442,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateServiceOptions(pathSid){ IncludeCredentials = includeCredentials, FriendlyName = friendlyName, UiEditable = uiEditable }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextResource.cs index c1f22e98c..d840f1d0c 100644 --- a/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextResource.cs +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextResource.cs @@ -69,10 +69,10 @@ public static EngagementContextResource Fetch(FetchEngagementContextOptions opti /// Fetch EngagementContext parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EngagementContext - public static async System.Threading.Tasks.Task FetchAsync(FetchEngagementContextOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchEngagementContextOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -99,7 +99,7 @@ public static EngagementContextResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathEngagementSid, ITwilioRestClient client = null) { var options = new FetchEngagementContextOptions(pathFlowSid, pathEngagementSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextResource.cs index 297bf2f3a..2f064a8fd 100644 --- a/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextResource.cs +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextResource.cs @@ -71,10 +71,10 @@ public static StepContextResource Fetch(FetchStepContextOptions options, ITwilio /// Fetch StepContext parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of StepContext - public static async System.Threading.Tasks.Task FetchAsync(FetchStepContextOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchStepContextOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static StepContextResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathEngagementSid, string pathStepSid, ITwilioRestClient client = null) { var options = new FetchStepContextOptions(pathFlowSid, pathEngagementSid, pathStepSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs index 6a8e237e7..b12d1921f 100644 --- a/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs @@ -71,10 +71,10 @@ public static StepResource Fetch(FetchStepOptions options, ITwilioRestClient cli /// Fetch Step parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Step - public static async System.Threading.Tasks.Task FetchAsync(FetchStepOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchStepOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static StepResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathEngagementSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchStepOptions(pathFlowSid, pathEngagementSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -143,10 +143,10 @@ public static ResourceSet Read(ReadStepOptions options, ITwilioRes /// Read Step parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Step - public static async System.Threading.Tasks.Task> ReadAsync(ReadStepOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadStepOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("steps", response.Content); return new ResourceSet(page, options, client); @@ -186,7 +186,7 @@ public static async System.Threading.Tasks.Task> ReadA ITwilioRestClient client = null) { var options = new ReadStepOptions(pathFlowSid, pathEngagementSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs b/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs index dc374cf38..88fdcee29 100644 --- a/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs +++ b/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs @@ -81,10 +81,10 @@ public static EngagementResource Create(CreateEngagementOptions options, ITwilio /// Create Engagement parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Engagement - public static async System.Threading.Tasks.Task CreateAsync(CreateEngagementOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateEngagementOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -123,7 +123,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateEngagementOptions(pathFlowSid, to, from){ Parameters = parameters }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -166,11 +166,12 @@ public static bool Delete(DeleteEngagementOptions options, ITwilioRestClient cli /// Delete Engagement parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Engagement - public static async System.Threading.Tasks.Task DeleteAsync(DeleteEngagementOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteEngagementOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -195,7 +196,7 @@ public static bool Delete(string pathFlowSid, string pathSid, ITwilioRestClient public static async System.Threading.Tasks.Task DeleteAsync(string pathFlowSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteEngagementOptions(pathFlowSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -234,10 +235,10 @@ public static EngagementResource Fetch(FetchEngagementOptions options, ITwilioRe /// Fetch Engagement parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Engagement - public static async System.Threading.Tasks.Task FetchAsync(FetchEngagementOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchEngagementOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -264,7 +265,7 @@ public static EngagementResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchEngagementOptions(pathFlowSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -301,10 +302,10 @@ public static ResourceSet Read(ReadEngagementOptions options /// Read Engagement parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Engagement - public static async System.Threading.Tasks.Task> ReadAsync(ReadEngagementOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadEngagementOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("engagements", response.Content); return new ResourceSet(page, options, client); @@ -340,7 +341,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadEngagementOptions(pathFlowSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionContextResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionContextResource.cs index 960052b96..59ecd8951 100644 --- a/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionContextResource.cs +++ b/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionContextResource.cs @@ -69,10 +69,10 @@ public static ExecutionContextResource Fetch(FetchExecutionContextOptions option /// Fetch ExecutionContext parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ExecutionContext - public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionContextOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionContextOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -99,7 +99,7 @@ public static ExecutionContextResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathExecutionSid, ITwilioRestClient client = null) { var options = new FetchExecutionContextOptions(pathFlowSid, pathExecutionSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStep/ExecutionStepContextResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStep/ExecutionStepContextResource.cs index fe092f6fc..af1c551b1 100644 --- a/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStep/ExecutionStepContextResource.cs +++ b/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStep/ExecutionStepContextResource.cs @@ -71,10 +71,10 @@ public static ExecutionStepContextResource Fetch(FetchExecutionStepContextOption /// Fetch ExecutionStepContext parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ExecutionStepContext - public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionStepContextOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionStepContextOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static ExecutionStepContextResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathExecutionSid, string pathStepSid, ITwilioRestClient client = null) { var options = new FetchExecutionStepContextOptions(pathFlowSid, pathExecutionSid, pathStepSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStepResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStepResource.cs index 8e0231b80..d4e2a6e64 100644 --- a/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStepResource.cs +++ b/src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStepResource.cs @@ -71,10 +71,10 @@ public static ExecutionStepResource Fetch(FetchExecutionStepOptions options, ITw /// Fetch ExecutionStep parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ExecutionStep - public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionStepOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionStepOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static ExecutionStepResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathExecutionSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchExecutionStepOptions(pathFlowSid, pathExecutionSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -143,10 +143,10 @@ public static ResourceSet Read(ReadExecutionStepOptions o /// Read ExecutionStep parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ExecutionStep - public static async System.Threading.Tasks.Task> ReadAsync(ReadExecutionStepOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadExecutionStepOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("steps", response.Content); return new ResourceSet(page, options, client); @@ -186,7 +186,7 @@ public static async System.Threading.Tasks.Task Create Execution parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution - public static async System.Threading.Tasks.Task CreateAsync(CreateExecutionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateExecutionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -123,7 +123,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateExecutionOptions(pathFlowSid, to, from){ Parameters = parameters }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -166,11 +166,12 @@ public static bool Delete(DeleteExecutionOptions options, ITwilioRestClient clie /// Delete Execution parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution - public static async System.Threading.Tasks.Task DeleteAsync(DeleteExecutionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteExecutionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -195,7 +196,7 @@ public static bool Delete(string pathFlowSid, string pathSid, ITwilioRestClient public static async System.Threading.Tasks.Task DeleteAsync(string pathFlowSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteExecutionOptions(pathFlowSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -234,10 +235,10 @@ public static ExecutionResource Fetch(FetchExecutionOptions options, ITwilioRest /// Fetch Execution parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution - public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -264,7 +265,7 @@ public static ExecutionResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchExecutionOptions(pathFlowSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -301,10 +302,10 @@ public static ResourceSet Read(ReadExecutionOptions options, /// Read Execution parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution - public static async System.Threading.Tasks.Task> ReadAsync(ReadExecutionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadExecutionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("executions", response.Content); return new ResourceSet(page, options, client); @@ -348,7 +349,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadExecutionOptions(pathFlowSid){ DateCreatedFrom = dateCreatedFrom, DateCreatedTo = dateCreatedTo, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -437,11 +438,12 @@ public static ExecutionResource Update(UpdateExecutionOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateExecutionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateExecutionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -476,7 +478,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateExecutionOptions(pathFlowSid, pathSid, status){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V1/FlowResource.cs b/src/Twilio/Rest/Studio/V1/FlowResource.cs index bfb8b5e09..81faf6348 100644 --- a/src/Twilio/Rest/Studio/V1/FlowResource.cs +++ b/src/Twilio/Rest/Studio/V1/FlowResource.cs @@ -84,11 +84,12 @@ public static bool Delete(DeleteFlowOptions options, ITwilioRestClient client = /// Delete Flow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task DeleteAsync(DeleteFlowOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteFlowOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -108,10 +109,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID of the Flow resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteFlowOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -148,10 +149,10 @@ public static FlowResource Fetch(FetchFlowOptions options, ITwilioRestClient cli /// Fetch Flow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task FetchAsync(FetchFlowOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFlowOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -172,10 +173,10 @@ public static FlowResource Fetch( /// The SID of the Flow resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchFlowOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -210,10 +211,10 @@ public static ResourceSet Read(ReadFlowOptions options, ITwilioRes /// Read Flow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task> ReadAsync(ReadFlowOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadFlowOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("flows", response.Content); return new ResourceSet(page, options, client); @@ -245,7 +246,7 @@ public static async System.Threading.Tasks.Task> ReadA ITwilioRestClient client = null) { var options = new ReadFlowOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionContextResource.cs b/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionContextResource.cs index 13360590b..b76bd48fb 100644 --- a/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionContextResource.cs +++ b/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionContextResource.cs @@ -69,10 +69,10 @@ public static ExecutionContextResource Fetch(FetchExecutionContextOptions option /// Fetch ExecutionContext parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ExecutionContext - public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionContextOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionContextOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -99,7 +99,7 @@ public static ExecutionContextResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathExecutionSid, ITwilioRestClient client = null) { var options = new FetchExecutionContextOptions(pathFlowSid, pathExecutionSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStep/ExecutionStepContextResource.cs b/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStep/ExecutionStepContextResource.cs index db3f27390..e10449f79 100644 --- a/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStep/ExecutionStepContextResource.cs +++ b/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStep/ExecutionStepContextResource.cs @@ -71,10 +71,10 @@ public static ExecutionStepContextResource Fetch(FetchExecutionStepContextOption /// Fetch ExecutionStepContext parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ExecutionStepContext - public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionStepContextOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionStepContextOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static ExecutionStepContextResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathExecutionSid, string pathStepSid, ITwilioRestClient client = null) { var options = new FetchExecutionStepContextOptions(pathFlowSid, pathExecutionSid, pathStepSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStepResource.cs b/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStepResource.cs index d53c414d1..2b3d3c965 100644 --- a/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStepResource.cs +++ b/src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStepResource.cs @@ -71,10 +71,10 @@ public static ExecutionStepResource Fetch(FetchExecutionStepOptions options, ITw /// Fetch ExecutionStep parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ExecutionStep - public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionStepOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionStepOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static ExecutionStepResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathExecutionSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchExecutionStepOptions(pathFlowSid, pathExecutionSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -143,10 +143,10 @@ public static ResourceSet Read(ReadExecutionStepOptions o /// Read ExecutionStep parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ExecutionStep - public static async System.Threading.Tasks.Task> ReadAsync(ReadExecutionStepOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadExecutionStepOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("steps", response.Content); return new ResourceSet(page, options, client); @@ -186,7 +186,7 @@ public static async System.Threading.Tasks.Task Create Execution parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution - public static async System.Threading.Tasks.Task CreateAsync(CreateExecutionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateExecutionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -123,7 +123,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateExecutionOptions(pathFlowSid, to, from){ Parameters = parameters }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -166,11 +166,12 @@ public static bool Delete(DeleteExecutionOptions options, ITwilioRestClient clie /// Delete Execution parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution - public static async System.Threading.Tasks.Task DeleteAsync(DeleteExecutionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteExecutionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -195,7 +196,7 @@ public static bool Delete(string pathFlowSid, string pathSid, ITwilioRestClient public static async System.Threading.Tasks.Task DeleteAsync(string pathFlowSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteExecutionOptions(pathFlowSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -234,10 +235,10 @@ public static ExecutionResource Fetch(FetchExecutionOptions options, ITwilioRest /// Fetch Execution parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution - public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchExecutionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -264,7 +265,7 @@ public static ExecutionResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchExecutionOptions(pathFlowSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -301,10 +302,10 @@ public static ResourceSet Read(ReadExecutionOptions options, /// Read Execution parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution - public static async System.Threading.Tasks.Task> ReadAsync(ReadExecutionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadExecutionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("executions", response.Content); return new ResourceSet(page, options, client); @@ -348,7 +349,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadExecutionOptions(pathFlowSid){ DateCreatedFrom = dateCreatedFrom, DateCreatedTo = dateCreatedTo, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -437,11 +438,12 @@ public static ExecutionResource Update(UpdateExecutionOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of Execution #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateExecutionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateExecutionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -476,7 +478,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateExecutionOptions(pathFlowSid, pathSid, status){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V2/Flow/FlowRevisionResource.cs b/src/Twilio/Rest/Studio/V2/Flow/FlowRevisionResource.cs index 14de8b753..0f628c3c9 100644 --- a/src/Twilio/Rest/Studio/V2/Flow/FlowRevisionResource.cs +++ b/src/Twilio/Rest/Studio/V2/Flow/FlowRevisionResource.cs @@ -82,10 +82,10 @@ public static FlowRevisionResource Fetch(FetchFlowRevisionOptions options, ITwil /// Fetch FlowRevision parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of FlowRevision - public static async System.Threading.Tasks.Task FetchAsync(FetchFlowRevisionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFlowRevisionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -112,7 +112,7 @@ public static FlowRevisionResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathSid, string pathRevision, ITwilioRestClient client = null) { var options = new FetchFlowRevisionOptions(pathSid, pathRevision){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -149,10 +149,10 @@ public static ResourceSet Read(ReadFlowRevisionOptions opt /// Read FlowRevision parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of FlowRevision - public static async System.Threading.Tasks.Task> ReadAsync(ReadFlowRevisionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadFlowRevisionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("revisions", response.Content); return new ResourceSet(page, options, client); @@ -188,7 +188,7 @@ public static async System.Threading.Tasks.Task Fetch FlowTestUser parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of FlowTestUser - public static async System.Threading.Tasks.Task FetchAsync(FetchFlowTestUserOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFlowTestUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static FlowTestUserResource Fetch( /// Unique identifier of the flow. /// Client to make requests to Twilio /// Task that resolves to A single instance of FlowTestUser - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchFlowTestUserOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -132,11 +132,12 @@ public static FlowTestUserResource Update(UpdateFlowTestUserOptions options, ITw /// Client to make requests to Twilio /// Task that resolves to A single instance of FlowTestUser #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateFlowTestUserOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateFlowTestUserOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -167,7 +168,7 @@ public static async System.Threading.Tasks.Task UpdateAsyn ITwilioRestClient client = null) { var options = new UpdateFlowTestUserOptions(pathSid, testUsers){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V2/FlowResource.cs b/src/Twilio/Rest/Studio/V2/FlowResource.cs index ad8648173..f5f27a199 100644 --- a/src/Twilio/Rest/Studio/V2/FlowResource.cs +++ b/src/Twilio/Rest/Studio/V2/FlowResource.cs @@ -79,10 +79,10 @@ public static FlowResource Create(CreateFlowOptions options, ITwilioRestClient c /// Create Flow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task CreateAsync(CreateFlowOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateFlowOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -121,7 +121,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateFlowOptions(friendlyName, status, definition){ CommitMessage = commitMessage }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -162,11 +162,12 @@ public static bool Delete(DeleteFlowOptions options, ITwilioRestClient client = /// Delete Flow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task DeleteAsync(DeleteFlowOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteFlowOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -186,10 +187,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID of the Flow resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteFlowOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -226,10 +227,10 @@ public static FlowResource Fetch(FetchFlowOptions options, ITwilioRestClient cli /// Fetch Flow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task FetchAsync(FetchFlowOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFlowOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -250,10 +251,10 @@ public static FlowResource Fetch( /// The SID of the Flow resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchFlowOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -288,10 +289,10 @@ public static ResourceSet Read(ReadFlowOptions options, ITwilioRes /// Read Flow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow - public static async System.Threading.Tasks.Task> ReadAsync(ReadFlowOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadFlowOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("flows", response.Content); return new ResourceSet(page, options, client); @@ -323,7 +324,7 @@ public static async System.Threading.Tasks.Task> ReadA ITwilioRestClient client = null) { var options = new ReadFlowOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -410,11 +411,12 @@ public static FlowResource Update(UpdateFlowOptions options, ITwilioRestClient c /// Client to make requests to Twilio /// Task that resolves to A single instance of Flow #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateFlowOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateFlowOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -457,7 +459,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateFlowOptions(pathSid, status){ FriendlyName = friendlyName, Definition = definition, CommitMessage = commitMessage }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Studio/V2/FlowValidateResource.cs b/src/Twilio/Rest/Studio/V2/FlowValidateResource.cs index 9d547def7..cff6d614f 100644 --- a/src/Twilio/Rest/Studio/V2/FlowValidateResource.cs +++ b/src/Twilio/Rest/Studio/V2/FlowValidateResource.cs @@ -78,11 +78,12 @@ public static FlowValidateResource Update(UpdateFlowValidateOptions options, ITw /// Client to make requests to Twilio /// Task that resolves to A single instance of FlowValidate #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateFlowValidateOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateFlowValidateOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -121,7 +122,7 @@ public static async System.Threading.Tasks.Task UpdateAsyn ITwilioRestClient client = null) { var options = new UpdateFlowValidateOptions(friendlyName, status, definition){ CommitMessage = commitMessage }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Supersim/V1/EsimProfileResource.cs b/src/Twilio/Rest/Supersim/V1/EsimProfileResource.cs index 477df9b9b..dc6a9bae9 100644 --- a/src/Twilio/Rest/Supersim/V1/EsimProfileResource.cs +++ b/src/Twilio/Rest/Supersim/V1/EsimProfileResource.cs @@ -83,10 +83,10 @@ public static EsimProfileResource Create(CreateEsimProfileOptions options, ITwil /// Create EsimProfile parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EsimProfile - public static async System.Threading.Tasks.Task CreateAsync(CreateEsimProfileOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateEsimProfileOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -125,7 +125,7 @@ public static async System.Threading.Tasks.Task CreateAsync ITwilioRestClient client = null) { var options = new CreateEsimProfileOptions(){ CallbackUrl = callbackUrl, CallbackMethod = callbackMethod, GenerateMatchingId = generateMatchingId, Eid = eid }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -162,10 +162,10 @@ public static EsimProfileResource Fetch(FetchEsimProfileOptions options, ITwilio /// Fetch EsimProfile parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EsimProfile - public static async System.Threading.Tasks.Task FetchAsync(FetchEsimProfileOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchEsimProfileOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -186,10 +186,10 @@ public static EsimProfileResource Fetch( /// The SID of the eSIM Profile resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of EsimProfile - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchEsimProfileOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -224,10 +224,10 @@ public static ResourceSet Read(ReadEsimProfileOptions optio /// Read EsimProfile parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EsimProfile - public static async System.Threading.Tasks.Task> ReadAsync(ReadEsimProfileOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadEsimProfileOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("esim_profiles", response.Content); return new ResourceSet(page, options, client); @@ -271,7 +271,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadEsimProfileOptions(){ Eid = eid, SimSid = simSid, Status = status, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Supersim/V1/FleetResource.cs b/src/Twilio/Rest/Supersim/V1/FleetResource.cs index f469b26cb..aad060c92 100644 --- a/src/Twilio/Rest/Supersim/V1/FleetResource.cs +++ b/src/Twilio/Rest/Supersim/V1/FleetResource.cs @@ -78,10 +78,10 @@ public static FleetResource Create(CreateFleetOptions options, ITwilioRestClient /// Create Fleet parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Fleet - public static async System.Threading.Tasks.Task CreateAsync(CreateFleetOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateFleetOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -140,7 +140,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateFleetOptions(networkAccessProfile){ UniqueName = uniqueName, DataEnabled = dataEnabled, DataLimit = dataLimit, IpCommandsUrl = ipCommandsUrl, IpCommandsMethod = ipCommandsMethod, SmsCommandsEnabled = smsCommandsEnabled, SmsCommandsUrl = smsCommandsUrl, SmsCommandsMethod = smsCommandsMethod }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -177,10 +177,10 @@ public static FleetResource Fetch(FetchFleetOptions options, ITwilioRestClient c /// Fetch Fleet parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Fleet - public static async System.Threading.Tasks.Task FetchAsync(FetchFleetOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFleetOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -201,10 +201,10 @@ public static FleetResource Fetch( /// The SID of the Fleet resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Fleet - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchFleetOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -239,10 +239,10 @@ public static ResourceSet Read(ReadFleetOptions options, ITwilioR /// Read Fleet parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Fleet - public static async System.Threading.Tasks.Task> ReadAsync(ReadFleetOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadFleetOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("fleets", response.Content); return new ResourceSet(page, options, client); @@ -278,7 +278,7 @@ public static async System.Threading.Tasks.Task> Read ITwilioRestClient client = null) { var options = new ReadFleetOptions(){ NetworkAccessProfile = networkAccessProfile, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -365,11 +365,12 @@ public static FleetResource Update(UpdateFleetOptions options, ITwilioRestClient /// Client to make requests to Twilio /// Task that resolves to A single instance of Fleet #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateFleetOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateFleetOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -424,7 +425,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateFleetOptions(pathSid){ UniqueName = uniqueName, NetworkAccessProfile = networkAccessProfile, IpCommandsUrl = ipCommandsUrl, IpCommandsMethod = ipCommandsMethod, SmsCommandsUrl = smsCommandsUrl, SmsCommandsMethod = smsCommandsMethod, DataLimit = dataLimit }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Supersim/V1/IpCommandResource.cs b/src/Twilio/Rest/Supersim/V1/IpCommandResource.cs index 0fb0b6a7f..810f54e39 100644 --- a/src/Twilio/Rest/Supersim/V1/IpCommandResource.cs +++ b/src/Twilio/Rest/Supersim/V1/IpCommandResource.cs @@ -107,10 +107,10 @@ public static IpCommandResource Create(CreateIpCommandOptions options, ITwilioRe /// Create IpCommand parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpCommand - public static async System.Threading.Tasks.Task CreateAsync(CreateIpCommandOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateIpCommandOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -157,7 +157,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateIpCommandOptions(sim, payload, devicePort){ PayloadType = payloadType, CallbackUrl = callbackUrl, CallbackMethod = callbackMethod }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -194,10 +194,10 @@ public static IpCommandResource Fetch(FetchIpCommandOptions options, ITwilioRest /// Fetch IpCommand parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpCommand - public static async System.Threading.Tasks.Task FetchAsync(FetchIpCommandOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchIpCommandOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -218,10 +218,10 @@ public static IpCommandResource Fetch( /// The SID of the IP Command resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of IpCommand - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchIpCommandOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -256,10 +256,10 @@ public static ResourceSet Read(ReadIpCommandOptions options, /// Read IpCommand parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpCommand - public static async System.Threading.Tasks.Task> ReadAsync(ReadIpCommandOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadIpCommandOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("ip_commands", response.Content); return new ResourceSet(page, options, client); @@ -307,7 +307,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadIpCommandOptions(){ Sim = sim, SimIccid = simIccid, Status = status, Direction = direction, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Supersim/V1/NetworkAccessProfile/NetworkAccessProfileNetworkResource.cs b/src/Twilio/Rest/Supersim/V1/NetworkAccessProfile/NetworkAccessProfileNetworkResource.cs index e37a75a19..fb4082666 100644 --- a/src/Twilio/Rest/Supersim/V1/NetworkAccessProfile/NetworkAccessProfileNetworkResource.cs +++ b/src/Twilio/Rest/Supersim/V1/NetworkAccessProfile/NetworkAccessProfileNetworkResource.cs @@ -68,10 +68,10 @@ public static NetworkAccessProfileNetworkResource Create(CreateNetworkAccessProf /// Create NetworkAccessProfileNetwork parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of NetworkAccessProfileNetwork - public static async System.Threading.Tasks.Task CreateAsync(CreateNetworkAccessProfileNetworkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateNetworkAccessProfileNetworkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static async System.Threading.Tasks.Task Delete NetworkAccessProfileNetwork parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of NetworkAccessProfileNetwork - public static async System.Threading.Tasks.Task DeleteAsync(DeleteNetworkAccessProfileNetworkOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteNetworkAccessProfileNetworkOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -174,7 +175,7 @@ public static bool Delete(string pathNetworkAccessProfileSid, string pathSid, IT public static async System.Threading.Tasks.Task DeleteAsync(string pathNetworkAccessProfileSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteNetworkAccessProfileNetworkOptions(pathNetworkAccessProfileSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -213,10 +214,10 @@ public static NetworkAccessProfileNetworkResource Fetch(FetchNetworkAccessProfil /// Fetch NetworkAccessProfileNetwork parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of NetworkAccessProfileNetwork - public static async System.Threading.Tasks.Task FetchAsync(FetchNetworkAccessProfileNetworkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchNetworkAccessProfileNetworkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -243,7 +244,7 @@ public static NetworkAccessProfileNetworkResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathNetworkAccessProfileSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchNetworkAccessProfileNetworkOptions(pathNetworkAccessProfileSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -280,10 +281,10 @@ public static ResourceSet Read(ReadNetworkA /// Read NetworkAccessProfileNetwork parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of NetworkAccessProfileNetwork - public static async System.Threading.Tasks.Task> ReadAsync(ReadNetworkAccessProfileNetworkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadNetworkAccessProfileNetworkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("networks", response.Content); return new ResourceSet(page, options, client); @@ -319,7 +320,7 @@ public static async System.Threading.Tasks.Task Create NetworkAccessProfile parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of NetworkAccessProfile - public static async System.Threading.Tasks.Task CreateAsync(CreateNetworkAccessProfileOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateNetworkAccessProfileOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -100,7 +100,7 @@ public static async System.Threading.Tasks.Task Cr ITwilioRestClient client = null) { var options = new CreateNetworkAccessProfileOptions(){ UniqueName = uniqueName, Networks = networks }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -137,10 +137,10 @@ public static NetworkAccessProfileResource Fetch(FetchNetworkAccessProfileOption /// Fetch NetworkAccessProfile parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of NetworkAccessProfile - public static async System.Threading.Tasks.Task FetchAsync(FetchNetworkAccessProfileOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchNetworkAccessProfileOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -161,10 +161,10 @@ public static NetworkAccessProfileResource Fetch( /// The SID of the Network Access Profile resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of NetworkAccessProfile - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchNetworkAccessProfileOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -199,10 +199,10 @@ public static ResourceSet Read(ReadNetworkAccessPr /// Read NetworkAccessProfile parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of NetworkAccessProfile - public static async System.Threading.Tasks.Task> ReadAsync(ReadNetworkAccessProfileOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadNetworkAccessProfileOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("network_access_profiles", response.Content); return new ResourceSet(page, options, client); @@ -234,7 +234,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of NetworkAccessProfile #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateNetworkAccessProfileOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateNetworkAccessProfileOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -356,7 +357,7 @@ public static async System.Threading.Tasks.Task Up ITwilioRestClient client = null) { var options = new UpdateNetworkAccessProfileOptions(pathSid){ UniqueName = uniqueName }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Supersim/V1/NetworkResource.cs b/src/Twilio/Rest/Supersim/V1/NetworkResource.cs index 63343664a..120342c7f 100644 --- a/src/Twilio/Rest/Supersim/V1/NetworkResource.cs +++ b/src/Twilio/Rest/Supersim/V1/NetworkResource.cs @@ -67,10 +67,10 @@ public static NetworkResource Fetch(FetchNetworkOptions options, ITwilioRestClie /// Fetch Network parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Network - public static async System.Threading.Tasks.Task FetchAsync(FetchNetworkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchNetworkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static NetworkResource Fetch( /// The SID of the Network resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Network - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchNetworkOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -129,10 +129,10 @@ public static ResourceSet Read(ReadNetworkOptions options, ITwi /// Read Network parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Network - public static async System.Threading.Tasks.Task> ReadAsync(ReadNetworkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadNetworkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("networks", response.Content); return new ResourceSet(page, options, client); @@ -176,7 +176,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadNetworkOptions(){ IsoCountry = isoCountry, Mcc = mcc, Mnc = mnc, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Supersim/V1/SettingsUpdateResource.cs b/src/Twilio/Rest/Supersim/V1/SettingsUpdateResource.cs index 3bbcee46e..334a26014 100644 --- a/src/Twilio/Rest/Supersim/V1/SettingsUpdateResource.cs +++ b/src/Twilio/Rest/Supersim/V1/SettingsUpdateResource.cs @@ -80,10 +80,10 @@ public static ResourceSet Read(ReadSettingsUpdateOptions /// Read SettingsUpdate parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SettingsUpdate - public static async System.Threading.Tasks.Task> ReadAsync(ReadSettingsUpdateOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSettingsUpdateOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("settings_updates", response.Content); return new ResourceSet(page, options, client); @@ -123,7 +123,7 @@ public static async System.Threading.Tasks.Task Read(ReadBillingPeriodOptions o /// Read BillingPeriod parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of BillingPeriod - public static async System.Threading.Tasks.Task> ReadAsync(ReadBillingPeriodOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadBillingPeriodOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("billing_periods", response.Content); return new ResourceSet(page, options, client); @@ -119,7 +119,7 @@ public static async System.Threading.Tasks.Task Read(ReadSimIpAddressOptions opt /// Read SimIpAddress parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SimIpAddress - public static async System.Threading.Tasks.Task> ReadAsync(ReadSimIpAddressOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSimIpAddressOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("ip_addresses", response.Content); return new ResourceSet(page, options, client); @@ -119,7 +119,7 @@ public static async System.Threading.Tasks.Task Create Sim parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim - public static async System.Threading.Tasks.Task CreateAsync(CreateSimOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSimOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -129,7 +129,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateSimOptions(iccid, registrationCode){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -166,10 +166,10 @@ public static SimResource Fetch(FetchSimOptions options, ITwilioRestClient clien /// Fetch Sim parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim - public static async System.Threading.Tasks.Task FetchAsync(FetchSimOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSimOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -190,10 +190,10 @@ public static SimResource Fetch( /// The SID of the Sim resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchSimOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -228,10 +228,10 @@ public static ResourceSet Read(ReadSimOptions options, ITwilioRestC /// Read Sim parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim - public static async System.Threading.Tasks.Task> ReadAsync(ReadSimOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSimOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("sims", response.Content); return new ResourceSet(page, options, client); @@ -275,7 +275,7 @@ public static async System.Threading.Tasks.Task> ReadAs ITwilioRestClient client = null) { var options = new ReadSimOptions(){ Status = status, Fleet = fleet, Iccid = iccid, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -362,11 +362,12 @@ public static SimResource Update(UpdateSimOptions options, ITwilioRestClient cli /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSimOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSimOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -417,7 +418,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateSimOptions(pathSid){ UniqueName = uniqueName, Status = status, Fleet = fleet, CallbackUrl = callbackUrl, CallbackMethod = callbackMethod, AccountSid = accountSid }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Supersim/V1/SmsCommandResource.cs b/src/Twilio/Rest/Supersim/V1/SmsCommandResource.cs index e1eaed2cc..379b7c615 100644 --- a/src/Twilio/Rest/Supersim/V1/SmsCommandResource.cs +++ b/src/Twilio/Rest/Supersim/V1/SmsCommandResource.cs @@ -95,10 +95,10 @@ public static SmsCommandResource Create(CreateSmsCommandOptions options, ITwilio /// Create SmsCommand parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SmsCommand - public static async System.Threading.Tasks.Task CreateAsync(CreateSmsCommandOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSmsCommandOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -137,7 +137,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateSmsCommandOptions(sim, payload){ CallbackMethod = callbackMethod, CallbackUrl = callbackUrl }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -174,10 +174,10 @@ public static SmsCommandResource Fetch(FetchSmsCommandOptions options, ITwilioRe /// Fetch SmsCommand parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SmsCommand - public static async System.Threading.Tasks.Task FetchAsync(FetchSmsCommandOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSmsCommandOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -198,10 +198,10 @@ public static SmsCommandResource Fetch( /// The SID of the SMS Command resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of SmsCommand - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchSmsCommandOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -236,10 +236,10 @@ public static ResourceSet Read(ReadSmsCommandOptions options /// Read SmsCommand parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SmsCommand - public static async System.Threading.Tasks.Task> ReadAsync(ReadSmsCommandOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSmsCommandOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("sms_commands", response.Content); return new ResourceSet(page, options, client); @@ -283,7 +283,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadSmsCommandOptions(){ Sim = sim, Status = status, Direction = direction, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Supersim/V1/UsageRecordResource.cs b/src/Twilio/Rest/Supersim/V1/UsageRecordResource.cs index f5e612fd1..02cb8d544 100644 --- a/src/Twilio/Rest/Supersim/V1/UsageRecordResource.cs +++ b/src/Twilio/Rest/Supersim/V1/UsageRecordResource.cs @@ -92,10 +92,10 @@ public static ResourceSet Read(ReadUsageRecordOptions optio /// Read UsageRecord parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of UsageRecord - public static async System.Threading.Tasks.Task> ReadAsync(ReadUsageRecordOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadUsageRecordOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("usage_records", response.Content); return new ResourceSet(page, options, client); @@ -159,7 +159,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadUsageRecordOptions(){ Sim = sim, Fleet = fleet, Network = network, IsoCountry = isoCountry, Group = group, Granularity = granularity, StartTime = startTime, EndTime = endTime, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/Document/DocumentPermissionResource.cs b/src/Twilio/Rest/Sync/V1/Service/Document/DocumentPermissionResource.cs index 23f640012..0558730b3 100644 --- a/src/Twilio/Rest/Sync/V1/Service/Document/DocumentPermissionResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/Document/DocumentPermissionResource.cs @@ -75,11 +75,12 @@ public static bool Delete(DeleteDocumentPermissionOptions options, ITwilioRestCl /// Delete DocumentPermission parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of DocumentPermission - public static async System.Threading.Tasks.Task DeleteAsync(DeleteDocumentPermissionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteDocumentPermissionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -106,7 +107,7 @@ public static bool Delete(string pathServiceSid, string pathDocumentSid, string public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathDocumentSid, string pathIdentity, ITwilioRestClient client = null) { var options = new DeleteDocumentPermissionOptions(pathServiceSid, pathDocumentSid, pathIdentity) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -147,10 +148,10 @@ public static DocumentPermissionResource Fetch(FetchDocumentPermissionOptions op /// Fetch DocumentPermission parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of DocumentPermission - public static async System.Threading.Tasks.Task FetchAsync(FetchDocumentPermissionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchDocumentPermissionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -180,7 +181,7 @@ public static DocumentPermissionResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathDocumentSid, string pathIdentity, ITwilioRestClient client = null) { var options = new FetchDocumentPermissionOptions(pathServiceSid, pathDocumentSid, pathIdentity){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -219,10 +220,10 @@ public static ResourceSet Read(ReadDocumentPermissio /// Read DocumentPermission parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of DocumentPermission - public static async System.Threading.Tasks.Task> ReadAsync(ReadDocumentPermissionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadDocumentPermissionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("permissions", response.Content); return new ResourceSet(page, options, client); @@ -262,7 +263,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of DocumentPermission #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateDocumentPermissionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateDocumentPermissionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -404,7 +406,7 @@ public static async System.Threading.Tasks.Task Upda ITwilioRestClient client = null) { var options = new UpdateDocumentPermissionOptions(pathServiceSid, pathDocumentSid, pathIdentity, read, write, manage){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/DocumentResource.cs b/src/Twilio/Rest/Sync/V1/Service/DocumentResource.cs index 7e143a879..b0238b501 100644 --- a/src/Twilio/Rest/Sync/V1/Service/DocumentResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/DocumentResource.cs @@ -68,10 +68,10 @@ public static DocumentResource Create(CreateDocumentOptions options, ITwilioRest /// Create Document parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Document - public static async System.Threading.Tasks.Task CreateAsync(CreateDocumentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateDocumentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -110,7 +110,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateDocumentOptions(pathServiceSid){ UniqueName = uniqueName, Data = data, Ttl = ttl }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -153,11 +153,12 @@ public static bool Delete(DeleteDocumentOptions options, ITwilioRestClient clien /// Delete Document parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Document - public static async System.Threading.Tasks.Task DeleteAsync(DeleteDocumentOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteDocumentOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -182,7 +183,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteDocumentOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -221,10 +222,10 @@ public static DocumentResource Fetch(FetchDocumentOptions options, ITwilioRestCl /// Fetch Document parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Document - public static async System.Threading.Tasks.Task FetchAsync(FetchDocumentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchDocumentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -251,7 +252,7 @@ public static DocumentResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchDocumentOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -288,10 +289,10 @@ public static ResourceSet Read(ReadDocumentOptions options, IT /// Read Document parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Document - public static async System.Threading.Tasks.Task> ReadAsync(ReadDocumentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadDocumentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("documents", response.Content); return new ResourceSet(page, options, client); @@ -327,7 +328,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadDocumentOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -416,11 +417,12 @@ public static DocumentResource Update(UpdateDocumentOptions options, ITwilioRest /// Client to make requests to Twilio /// Task that resolves to A single instance of Document #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateDocumentOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateDocumentOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -463,7 +465,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateDocumentOptions(pathServiceSid, pathSid){ Data = data, Ttl = ttl, IfMatch = ifMatch }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemResource.cs index d924fac79..7b396f355 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemResource.cs @@ -94,10 +94,10 @@ public static SyncListItemResource Create(CreateSyncListItemOptions options, ITw /// Create SyncListItem parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListItem - public static async System.Threading.Tasks.Task CreateAsync(CreateSyncListItemOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSyncListItemOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -144,7 +144,7 @@ public static async System.Threading.Tasks.Task CreateAsyn ITwilioRestClient client = null) { var options = new CreateSyncListItemOptions(pathServiceSid, pathListSid, data){ Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -189,11 +189,12 @@ public static bool Delete(DeleteSyncListItemOptions options, ITwilioRestClient c /// Delete SyncListItem parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListItem - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncListItemOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncListItemOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -222,7 +223,7 @@ public static bool Delete(string pathServiceSid, string pathListSid, int? pathIn public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathListSid, int? pathIndex, string ifMatch = null, ITwilioRestClient client = null) { var options = new DeleteSyncListItemOptions(pathServiceSid, pathListSid, pathIndex) { IfMatch = ifMatch }; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -263,10 +264,10 @@ public static SyncListItemResource Fetch(FetchSyncListItemOptions options, ITwil /// Fetch SyncListItem parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListItem - public static async System.Threading.Tasks.Task FetchAsync(FetchSyncListItemOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSyncListItemOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -296,7 +297,7 @@ public static SyncListItemResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathListSid, int? pathIndex, ITwilioRestClient client = null) { var options = new FetchSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -335,10 +336,10 @@ public static ResourceSet Read(ReadSyncListItemOptions opt /// Read SyncListItem parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListItem - public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncListItemOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncListItemOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("items", response.Content); return new ResourceSet(page, options, client); @@ -390,7 +391,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of SyncListItem #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncListItemOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncListItemOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -540,7 +542,7 @@ public static async System.Threading.Tasks.Task UpdateAsyn ITwilioRestClient client = null) { var options = new UpdateSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){ Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl, IfMatch = ifMatch }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermissionResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermissionResource.cs index 7eb2b2c32..4625fadce 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermissionResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermissionResource.cs @@ -75,11 +75,12 @@ public static bool Delete(DeleteSyncListPermissionOptions options, ITwilioRestCl /// Delete SyncListPermission parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListPermission - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncListPermissionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncListPermissionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -106,7 +107,7 @@ public static bool Delete(string pathServiceSid, string pathListSid, string path public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathListSid, string pathIdentity, ITwilioRestClient client = null) { var options = new DeleteSyncListPermissionOptions(pathServiceSid, pathListSid, pathIdentity) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -147,10 +148,10 @@ public static SyncListPermissionResource Fetch(FetchSyncListPermissionOptions op /// Fetch SyncListPermission parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListPermission - public static async System.Threading.Tasks.Task FetchAsync(FetchSyncListPermissionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSyncListPermissionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -180,7 +181,7 @@ public static SyncListPermissionResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathListSid, string pathIdentity, ITwilioRestClient client = null) { var options = new FetchSyncListPermissionOptions(pathServiceSid, pathListSid, pathIdentity){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -219,10 +220,10 @@ public static ResourceSet Read(ReadSyncListPermissio /// Read SyncListPermission parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListPermission - public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncListPermissionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncListPermissionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("permissions", response.Content); return new ResourceSet(page, options, client); @@ -262,7 +263,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of SyncListPermission #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncListPermissionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncListPermissionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -404,7 +406,7 @@ public static async System.Threading.Tasks.Task Upda ITwilioRestClient client = null) { var options = new UpdateSyncListPermissionOptions(pathServiceSid, pathListSid, pathIdentity, read, write, manage){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncListResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncListResource.cs index 61cc128ca..14af2633f 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncListResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncListResource.cs @@ -68,10 +68,10 @@ public static SyncListResource Create(CreateSyncListOptions options, ITwilioRest /// Create SyncList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncList - public static async System.Threading.Tasks.Task CreateAsync(CreateSyncListOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSyncListOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -110,7 +110,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateSyncListOptions(pathServiceSid){ UniqueName = uniqueName, Ttl = ttl, CollectionTtl = collectionTtl }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -153,11 +153,12 @@ public static bool Delete(DeleteSyncListOptions options, ITwilioRestClient clien /// Delete SyncList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncList - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncListOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncListOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -182,7 +183,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteSyncListOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -221,10 +222,10 @@ public static SyncListResource Fetch(FetchSyncListOptions options, ITwilioRestCl /// Fetch SyncList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncList - public static async System.Threading.Tasks.Task FetchAsync(FetchSyncListOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSyncListOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -251,7 +252,7 @@ public static SyncListResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchSyncListOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -288,10 +289,10 @@ public static ResourceSet Read(ReadSyncListOptions options, IT /// Read SyncList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncList - public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncListOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncListOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("lists", response.Content); return new ResourceSet(page, options, client); @@ -327,7 +328,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadSyncListOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -416,11 +417,12 @@ public static SyncListResource Update(UpdateSyncListOptions options, ITwilioRest /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncList #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncListOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncListOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -459,7 +461,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateSyncListOptions(pathServiceSid, pathSid){ Ttl = ttl, CollectionTtl = collectionTtl }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemResource.cs index 523232c75..760b27b0b 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemResource.cs @@ -94,10 +94,10 @@ public static SyncMapItemResource Create(CreateSyncMapItemOptions options, ITwil /// Create SyncMapItem parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapItem - public static async System.Threading.Tasks.Task CreateAsync(CreateSyncMapItemOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSyncMapItemOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -148,7 +148,7 @@ public static async System.Threading.Tasks.Task CreateAsync ITwilioRestClient client = null) { var options = new CreateSyncMapItemOptions(pathServiceSid, pathMapSid, key, data){ Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -193,11 +193,12 @@ public static bool Delete(DeleteSyncMapItemOptions options, ITwilioRestClient cl /// Delete SyncMapItem parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapItem - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncMapItemOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncMapItemOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -226,7 +227,7 @@ public static bool Delete(string pathServiceSid, string pathMapSid, string pathK public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathMapSid, string pathKey, string ifMatch = null, ITwilioRestClient client = null) { var options = new DeleteSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey) { IfMatch = ifMatch }; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -267,10 +268,10 @@ public static SyncMapItemResource Fetch(FetchSyncMapItemOptions options, ITwilio /// Fetch SyncMapItem parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapItem - public static async System.Threading.Tasks.Task FetchAsync(FetchSyncMapItemOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSyncMapItemOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -300,7 +301,7 @@ public static SyncMapItemResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathMapSid, string pathKey, ITwilioRestClient client = null) { var options = new FetchSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -339,10 +340,10 @@ public static ResourceSet Read(ReadSyncMapItemOptions optio /// Read SyncMapItem parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapItem - public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncMapItemOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncMapItemOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("items", response.Content); return new ResourceSet(page, options, client); @@ -394,7 +395,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadSyncMapItemOptions(pathServiceSid, pathMapSid){ Order = order, From = from, Bounds = bounds, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -485,11 +486,12 @@ public static SyncMapItemResource Update(UpdateSyncMapItemOptions options, ITwil /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapItem #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncMapItemOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncMapItemOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -544,7 +546,7 @@ public static async System.Threading.Tasks.Task UpdateAsync ITwilioRestClient client = null) { var options = new UpdateSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){ Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl, IfMatch = ifMatch }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapPermissionResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapPermissionResource.cs index f6d3ace6d..9646ada23 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapPermissionResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapPermissionResource.cs @@ -75,11 +75,12 @@ public static bool Delete(DeleteSyncMapPermissionOptions options, ITwilioRestCli /// Delete SyncMapPermission parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapPermission - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncMapPermissionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncMapPermissionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -106,7 +107,7 @@ public static bool Delete(string pathServiceSid, string pathMapSid, string pathI public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathMapSid, string pathIdentity, ITwilioRestClient client = null) { var options = new DeleteSyncMapPermissionOptions(pathServiceSid, pathMapSid, pathIdentity) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -147,10 +148,10 @@ public static SyncMapPermissionResource Fetch(FetchSyncMapPermissionOptions opti /// Fetch SyncMapPermission parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapPermission - public static async System.Threading.Tasks.Task FetchAsync(FetchSyncMapPermissionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSyncMapPermissionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -180,7 +181,7 @@ public static SyncMapPermissionResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathMapSid, string pathIdentity, ITwilioRestClient client = null) { var options = new FetchSyncMapPermissionOptions(pathServiceSid, pathMapSid, pathIdentity){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -219,10 +220,10 @@ public static ResourceSet Read(ReadSyncMapPermissionO /// Read SyncMapPermission parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapPermission - public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncMapPermissionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncMapPermissionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("permissions", response.Content); return new ResourceSet(page, options, client); @@ -262,7 +263,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapPermission #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncMapPermissionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncMapPermissionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -404,7 +406,7 @@ public static async System.Threading.Tasks.Task Updat ITwilioRestClient client = null) { var options = new UpdateSyncMapPermissionOptions(pathServiceSid, pathMapSid, pathIdentity, read, write, manage){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncMapResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncMapResource.cs index afb4be3c2..a07dd63f6 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncMapResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncMapResource.cs @@ -68,10 +68,10 @@ public static SyncMapResource Create(CreateSyncMapOptions options, ITwilioRestCl /// Create SyncMap parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMap - public static async System.Threading.Tasks.Task CreateAsync(CreateSyncMapOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSyncMapOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -110,7 +110,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateSyncMapOptions(pathServiceSid){ UniqueName = uniqueName, Ttl = ttl, CollectionTtl = collectionTtl }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -153,11 +153,12 @@ public static bool Delete(DeleteSyncMapOptions options, ITwilioRestClient client /// Delete SyncMap parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMap - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncMapOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncMapOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -182,7 +183,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteSyncMapOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -221,10 +222,10 @@ public static SyncMapResource Fetch(FetchSyncMapOptions options, ITwilioRestClie /// Fetch SyncMap parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMap - public static async System.Threading.Tasks.Task FetchAsync(FetchSyncMapOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSyncMapOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -251,7 +252,7 @@ public static SyncMapResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchSyncMapOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -288,10 +289,10 @@ public static ResourceSet Read(ReadSyncMapOptions options, ITwi /// Read SyncMap parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMap - public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncMapOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncMapOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("maps", response.Content); return new ResourceSet(page, options, client); @@ -327,7 +328,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadSyncMapOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -416,11 +417,12 @@ public static SyncMapResource Update(UpdateSyncMapOptions options, ITwilioRestCl /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMap #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncMapOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncMapOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -459,7 +461,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateSyncMapOptions(pathServiceSid, pathSid){ Ttl = ttl, CollectionTtl = collectionTtl }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncStream/StreamMessageResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncStream/StreamMessageResource.cs index b5a33f3d8..b25d4ffd5 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncStream/StreamMessageResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncStream/StreamMessageResource.cs @@ -70,10 +70,10 @@ public static StreamMessageResource Create(CreateStreamMessageOptions options, I /// Create StreamMessage parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of StreamMessage - public static async System.Threading.Tasks.Task CreateAsync(CreateStreamMessageOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateStreamMessageOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -108,7 +108,7 @@ public static async System.Threading.Tasks.Task CreateAsy ITwilioRestClient client = null) { var options = new CreateStreamMessageOptions(pathServiceSid, pathStreamSid, data){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncStreamResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncStreamResource.cs index 1392ca5e9..3db535502 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncStreamResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncStreamResource.cs @@ -68,10 +68,10 @@ public static SyncStreamResource Create(CreateSyncStreamOptions options, ITwilio /// Create SyncStream parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncStream - public static async System.Threading.Tasks.Task CreateAsync(CreateSyncStreamOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSyncStreamOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -106,7 +106,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateSyncStreamOptions(pathServiceSid){ UniqueName = uniqueName, Ttl = ttl }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -149,11 +149,12 @@ public static bool Delete(DeleteSyncStreamOptions options, ITwilioRestClient cli /// Delete SyncStream parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncStream - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncStreamOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncStreamOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -178,7 +179,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteSyncStreamOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -217,10 +218,10 @@ public static SyncStreamResource Fetch(FetchSyncStreamOptions options, ITwilioRe /// Fetch SyncStream parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncStream - public static async System.Threading.Tasks.Task FetchAsync(FetchSyncStreamOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSyncStreamOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -247,7 +248,7 @@ public static SyncStreamResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchSyncStreamOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -284,10 +285,10 @@ public static ResourceSet Read(ReadSyncStreamOptions options /// Read SyncStream parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncStream - public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncStreamOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSyncStreamOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("streams", response.Content); return new ResourceSet(page, options, client); @@ -323,7 +324,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadSyncStreamOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -412,11 +413,12 @@ public static SyncStreamResource Update(UpdateSyncStreamOptions options, ITwilio /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncStream #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncStreamOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSyncStreamOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -451,7 +453,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateSyncStreamOptions(pathServiceSid, pathSid){ Ttl = ttl }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Sync/V1/ServiceResource.cs b/src/Twilio/Rest/Sync/V1/ServiceResource.cs index c45098787..4de1cde12 100644 --- a/src/Twilio/Rest/Sync/V1/ServiceResource.cs +++ b/src/Twilio/Rest/Sync/V1/ServiceResource.cs @@ -66,10 +66,10 @@ public static ServiceResource Create(CreateServiceOptions options, ITwilioRestCl /// Create Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task CreateAsync(CreateServiceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateServiceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -120,7 +120,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateServiceOptions(){ FriendlyName = friendlyName, WebhookUrl = webhookUrl, ReachabilityWebhooksEnabled = reachabilityWebhooksEnabled, AclEnabled = aclEnabled, ReachabilityDebouncingEnabled = reachabilityDebouncingEnabled, ReachabilityDebouncingWindow = reachabilityDebouncingWindow, WebhooksFromRestEnabled = webhooksFromRestEnabled }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -161,11 +161,12 @@ public static bool Delete(DeleteServiceOptions options, ITwilioRestClient client /// Delete Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task DeleteAsync(DeleteServiceOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteServiceOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -185,10 +186,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID of the Service resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteServiceOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -225,10 +226,10 @@ public static ServiceResource Fetch(FetchServiceOptions options, ITwilioRestClie /// Fetch Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task FetchAsync(FetchServiceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchServiceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -249,10 +250,10 @@ public static ServiceResource Fetch( /// The SID of the Service resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchServiceOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -287,10 +288,10 @@ public static ResourceSet Read(ReadServiceOptions options, ITwi /// Read Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task> ReadAsync(ReadServiceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadServiceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("services", response.Content); return new ResourceSet(page, options, client); @@ -322,7 +323,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadServiceOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -409,11 +410,12 @@ public static ServiceResource Update(UpdateServiceOptions options, ITwilioRestCl /// Client to make requests to Twilio /// Task that resolves to A single instance of Service #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateServiceOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateServiceOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -468,7 +470,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateServiceOptions(pathSid){ WebhookUrl = webhookUrl, FriendlyName = friendlyName, ReachabilityWebhooksEnabled = reachabilityWebhooksEnabled, AclEnabled = aclEnabled, ReachabilityDebouncingEnabled = reachabilityDebouncingEnabled, ReachabilityDebouncingWindow = reachabilityDebouncingWindow, WebhooksFromRestEnabled = webhooksFromRestEnabled }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/ActivityResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/ActivityResource.cs index 305eb4f57..0939d6a36 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/ActivityResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/ActivityResource.cs @@ -68,10 +68,10 @@ public static ActivityResource Create(CreateActivityOptions options, ITwilioRest /// Create Activity parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Activity - public static async System.Threading.Tasks.Task CreateAsync(CreateActivityOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateActivityOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -106,7 +106,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateActivityOptions(pathWorkspaceSid, friendlyName){ Available = available }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -149,11 +149,12 @@ public static bool Delete(DeleteActivityOptions options, ITwilioRestClient clien /// Delete Activity parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Activity - public static async System.Threading.Tasks.Task DeleteAsync(DeleteActivityOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteActivityOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -178,7 +179,7 @@ public static bool Delete(string pathWorkspaceSid, string pathSid, ITwilioRestCl public static async System.Threading.Tasks.Task DeleteAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteActivityOptions(pathWorkspaceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -217,10 +218,10 @@ public static ActivityResource Fetch(FetchActivityOptions options, ITwilioRestCl /// Fetch Activity parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Activity - public static async System.Threading.Tasks.Task FetchAsync(FetchActivityOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchActivityOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -247,7 +248,7 @@ public static ActivityResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchActivityOptions(pathWorkspaceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -284,10 +285,10 @@ public static ResourceSet Read(ReadActivityOptions options, IT /// Read Activity parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Activity - public static async System.Threading.Tasks.Task> ReadAsync(ReadActivityOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadActivityOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("activities", response.Content); return new ResourceSet(page, options, client); @@ -331,7 +332,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadActivityOptions(pathWorkspaceSid){ FriendlyName = friendlyName, Available = available, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -420,11 +421,12 @@ public static ActivityResource Update(UpdateActivityOptions options, ITwilioRest /// Client to make requests to Twilio /// Task that resolves to A single instance of Activity #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateActivityOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateActivityOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -459,7 +461,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateActivityOptions(pathWorkspaceSid, pathSid){ FriendlyName = friendlyName }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/EventResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/EventResource.cs index 0116441e8..b0f3f4910 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/EventResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/EventResource.cs @@ -69,10 +69,10 @@ public static EventResource Fetch(FetchEventOptions options, ITwilioRestClient c /// Fetch Event parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Event - public static async System.Threading.Tasks.Task FetchAsync(FetchEventOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchEventOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -99,7 +99,7 @@ public static EventResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchEventOptions(pathWorkspaceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -136,10 +136,10 @@ public static ResourceSet Read(ReadEventOptions options, ITwilioR /// Read Event parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Event - public static async System.Threading.Tasks.Task> ReadAsync(ReadEventOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadEventOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("events", response.Content); return new ResourceSet(page, options, client); @@ -219,7 +219,7 @@ public static async System.Threading.Tasks.Task> Read ITwilioRestClient client = null) { var options = new ReadEventOptions(pathWorkspaceSid){ EndDate = endDate, EventType = eventType, Minutes = minutes, ReservationSid = reservationSid, StartDate = startDate, TaskQueueSid = taskQueueSid, TaskSid = taskSid, WorkerSid = workerSid, WorkflowSid = workflowSid, TaskChannel = taskChannel, Sid = sid, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationResource.cs index d0d5323c9..dc4a016de 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationResource.cs @@ -134,10 +134,10 @@ public static ReservationResource Fetch(FetchReservationOptions options, ITwilio /// Fetch Reservation parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Reservation - public static async System.Threading.Tasks.Task FetchAsync(FetchReservationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchReservationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -167,7 +167,7 @@ public static ReservationResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathTaskSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchReservationOptions(pathWorkspaceSid, pathTaskSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -206,10 +206,10 @@ public static ResourceSet Read(ReadReservationOptions optio /// Read Reservation parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Reservation - public static async System.Threading.Tasks.Task> ReadAsync(ReadReservationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadReservationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("reservations", response.Content); return new ResourceSet(page, options, client); @@ -257,7 +257,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadReservationOptions(pathWorkspaceSid, pathTaskSid){ ReservationStatus = reservationStatus, WorkerSid = workerSid, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -348,11 +348,12 @@ public static ReservationResource Update(UpdateReservationOptions options, ITwil /// Client to make requests to Twilio /// Task that resolves to A single instance of Reservation #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateReservationOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateReservationOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -607,7 +608,7 @@ public static async System.Threading.Tasks.Task UpdateAsync ITwilioRestClient client = null) { var options = new UpdateReservationOptions(pathWorkspaceSid, pathTaskSid, pathSid){ ReservationStatus = reservationStatus, WorkerActivitySid = workerActivitySid, Instruction = instruction, DequeuePostWorkActivitySid = dequeuePostWorkActivitySid, DequeueFrom = dequeueFrom, DequeueRecord = dequeueRecord, DequeueTimeout = dequeueTimeout, DequeueTo = dequeueTo, DequeueStatusCallbackUrl = dequeueStatusCallbackUrl, CallFrom = callFrom, CallRecord = callRecord, CallTimeout = callTimeout, CallTo = callTo, CallUrl = callUrl, CallStatusCallbackUrl = callStatusCallbackUrl, CallAccept = callAccept, RedirectCallSid = redirectCallSid, RedirectAccept = redirectAccept, RedirectUrl = redirectUrl, To = to, From = from, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, StatusCallbackEvent = statusCallbackEvent, Timeout = timeout, Record = record, Muted = muted, Beep = beep, StartConferenceOnEnter = startConferenceOnEnter, EndConferenceOnExit = endConferenceOnExit, WaitUrl = waitUrl, WaitMethod = waitMethod, EarlyMedia = earlyMedia, MaxParticipants = maxParticipants, ConferenceStatusCallback = conferenceStatusCallback, ConferenceStatusCallbackMethod = conferenceStatusCallbackMethod, ConferenceStatusCallbackEvent = conferenceStatusCallbackEvent, ConferenceRecord = conferenceRecord, ConferenceTrim = conferenceTrim, RecordingChannels = recordingChannels, RecordingStatusCallback = recordingStatusCallback, RecordingStatusCallbackMethod = recordingStatusCallbackMethod, ConferenceRecordingStatusCallback = conferenceRecordingStatusCallback, ConferenceRecordingStatusCallbackMethod = conferenceRecordingStatusCallbackMethod, Region = region, SipAuthUsername = sipAuthUsername, SipAuthPassword = sipAuthPassword, DequeueStatusCallbackEvent = dequeueStatusCallbackEvent, PostWorkActivitySid = postWorkActivitySid, SupervisorMode = supervisorMode, Supervisor = supervisor, EndConferenceOnCustomerExit = endConferenceOnCustomerExit, BeepOnCustomerEntrance = beepOnCustomerEntrance, JitterBufferSize = jitterBufferSize, IfMatch = ifMatch }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskChannelResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskChannelResource.cs index 9abf127a1..3b6a8a7c0 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskChannelResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskChannelResource.cs @@ -68,10 +68,10 @@ public static TaskChannelResource Create(CreateTaskChannelOptions options, ITwil /// Create TaskChannel parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskChannel - public static async System.Threading.Tasks.Task CreateAsync(CreateTaskChannelOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTaskChannelOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -110,7 +110,7 @@ public static async System.Threading.Tasks.Task CreateAsync ITwilioRestClient client = null) { var options = new CreateTaskChannelOptions(pathWorkspaceSid, friendlyName, uniqueName){ ChannelOptimizedRouting = channelOptimizedRouting }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -153,11 +153,12 @@ public static bool Delete(DeleteTaskChannelOptions options, ITwilioRestClient cl /// Delete TaskChannel parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskChannel - public static async System.Threading.Tasks.Task DeleteAsync(DeleteTaskChannelOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteTaskChannelOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -182,7 +183,7 @@ public static bool Delete(string pathWorkspaceSid, string pathSid, ITwilioRestCl public static async System.Threading.Tasks.Task DeleteAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteTaskChannelOptions(pathWorkspaceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -221,10 +222,10 @@ public static TaskChannelResource Fetch(FetchTaskChannelOptions options, ITwilio /// Fetch TaskChannel parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskChannel - public static async System.Threading.Tasks.Task FetchAsync(FetchTaskChannelOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTaskChannelOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -251,7 +252,7 @@ public static TaskChannelResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchTaskChannelOptions(pathWorkspaceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -288,10 +289,10 @@ public static ResourceSet Read(ReadTaskChannelOptions optio /// Read TaskChannel parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskChannel - public static async System.Threading.Tasks.Task> ReadAsync(ReadTaskChannelOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTaskChannelOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("channels", response.Content); return new ResourceSet(page, options, client); @@ -327,7 +328,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadTaskChannelOptions(pathWorkspaceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -416,11 +417,12 @@ public static TaskChannelResource Update(UpdateTaskChannelOptions options, ITwil /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskChannel #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateTaskChannelOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateTaskChannelOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -459,7 +461,7 @@ public static async System.Threading.Tasks.Task UpdateAsync ITwilioRestClient client = null) { var options = new UpdateTaskChannelOptions(pathWorkspaceSid, pathSid){ FriendlyName = friendlyName, ChannelOptimizedRouting = channelOptimizedRouting }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueBulkRealTimeStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueBulkRealTimeStatisticsResource.cs index 30895d2f5..b482781dd 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueBulkRealTimeStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueBulkRealTimeStatisticsResource.cs @@ -69,10 +69,10 @@ public static TaskQueueBulkRealTimeStatisticsResource Create(CreateTaskQueueBulk /// Create TaskQueueBulkRealTimeStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueueBulkRealTimeStatistics - public static async System.Threading.Tasks.Task CreateAsync(CreateTaskQueueBulkRealTimeStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTaskQueueBulkRealTimeStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -99,7 +99,7 @@ public static async System.Threading.Tasks.Task Fetch TaskQueueCumulativeStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueueCumulativeStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchTaskQueueCumulativeStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTaskQueueCumulativeStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -114,7 +114,7 @@ public static TaskQueueCumulativeStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathTaskQueueSid, DateTime? endDate = null, int? minutes = null, DateTime? startDate = null, string taskChannel = null, string splitByWaitTime = null, ITwilioRestClient client = null) { var options = new FetchTaskQueueCumulativeStatisticsOptions(pathWorkspaceSid, pathTaskQueueSid){ EndDate = endDate,Minutes = minutes,StartDate = startDate,TaskChannel = taskChannel,SplitByWaitTime = splitByWaitTime }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueRealTimeStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueRealTimeStatisticsResource.cs index 09d44030d..6cfc912b5 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueRealTimeStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueRealTimeStatisticsResource.cs @@ -69,10 +69,10 @@ public static TaskQueueRealTimeStatisticsResource Fetch(FetchTaskQueueRealTimeSt /// Fetch TaskQueueRealTimeStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueueRealTimeStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchTaskQueueRealTimeStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTaskQueueRealTimeStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static TaskQueueRealTimeStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathTaskQueueSid, string taskChannel = null, ITwilioRestClient client = null) { var options = new FetchTaskQueueRealTimeStatisticsOptions(pathWorkspaceSid, pathTaskQueueSid){ TaskChannel = taskChannel }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueStatisticsResource.cs index 24967937e..f6ae4166c 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueStatisticsResource.cs @@ -69,10 +69,10 @@ public static TaskQueueStatisticsResource Fetch(FetchTaskQueueStatisticsOptions /// Fetch TaskQueueStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueueStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchTaskQueueStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTaskQueueStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -114,7 +114,7 @@ public static TaskQueueStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathTaskQueueSid, DateTime? endDate = null, int? minutes = null, DateTime? startDate = null, string taskChannel = null, string splitByWaitTime = null, ITwilioRestClient client = null) { var options = new FetchTaskQueueStatisticsOptions(pathWorkspaceSid, pathTaskQueueSid){ EndDate = endDate,Minutes = minutes,StartDate = startDate,TaskChannel = taskChannel,SplitByWaitTime = splitByWaitTime }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueuesStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueuesStatisticsResource.cs index 3f23d3a0a..9a5c7fff2 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueuesStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueuesStatisticsResource.cs @@ -67,10 +67,10 @@ public static ResourceSet Read(ReadTaskQueuesStati /// Read TaskQueuesStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueuesStatistics - public static async System.Threading.Tasks.Task> ReadAsync(ReadTaskQueuesStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTaskQueuesStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("task_queues_statistics", response.Content); return new ResourceSet(page, options, client); @@ -130,7 +130,7 @@ public static async System.Threading.Tasks.Task Create TaskQueue parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueue - public static async System.Threading.Tasks.Task CreateAsync(CreateTaskQueueOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTaskQueueOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -135,7 +135,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateTaskQueueOptions(pathWorkspaceSid, friendlyName){ TargetWorkers = targetWorkers, MaxReservedWorkers = maxReservedWorkers, TaskOrder = taskOrder, ReservationActivitySid = reservationActivitySid, AssignmentActivitySid = assignmentActivitySid }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -178,11 +178,12 @@ public static bool Delete(DeleteTaskQueueOptions options, ITwilioRestClient clie /// Delete TaskQueue parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueue - public static async System.Threading.Tasks.Task DeleteAsync(DeleteTaskQueueOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteTaskQueueOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -207,7 +208,7 @@ public static bool Delete(string pathWorkspaceSid, string pathSid, ITwilioRestCl public static async System.Threading.Tasks.Task DeleteAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteTaskQueueOptions(pathWorkspaceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -246,10 +247,10 @@ public static TaskQueueResource Fetch(FetchTaskQueueOptions options, ITwilioRest /// Fetch TaskQueue parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueue - public static async System.Threading.Tasks.Task FetchAsync(FetchTaskQueueOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTaskQueueOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -276,7 +277,7 @@ public static TaskQueueResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchTaskQueueOptions(pathWorkspaceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -313,10 +314,10 @@ public static ResourceSet Read(ReadTaskQueueOptions options, /// Read TaskQueue parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueue - public static async System.Threading.Tasks.Task> ReadAsync(ReadTaskQueueOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTaskQueueOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("task_queues", response.Content); return new ResourceSet(page, options, client); @@ -368,7 +369,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadTaskQueueOptions(pathWorkspaceSid){ FriendlyName = friendlyName, EvaluateWorkerAttributes = evaluateWorkerAttributes, WorkerSid = workerSid, Ordering = ordering, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -457,11 +458,12 @@ public static TaskQueueResource Update(UpdateTaskQueueOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of TaskQueue #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateTaskQueueOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateTaskQueueOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -516,7 +518,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateTaskQueueOptions(pathWorkspaceSid, pathSid){ FriendlyName = friendlyName, TargetWorkers = targetWorkers, ReservationActivitySid = reservationActivitySid, AssignmentActivitySid = assignmentActivitySid, MaxReservedWorkers = maxReservedWorkers, TaskOrder = taskOrder }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskResource.cs index 306641a06..d20ab2193 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/TaskResource.cs @@ -85,10 +85,10 @@ public static TaskResource Create(CreateTaskOptions options, ITwilioRestClient c /// Create Task parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Task - public static async System.Threading.Tasks.Task CreateAsync(CreateTaskOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTaskOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -151,7 +151,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateTaskOptions(pathWorkspaceSid){ Timeout = timeout, Priority = priority, TaskChannel = taskChannel, WorkflowSid = workflowSid, Attributes = attributes, VirtualStartTime = virtualStartTime, RoutingTarget = routingTarget, IgnoreCapacity = ignoreCapacity, TaskQueueSid = taskQueueSid }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -194,11 +194,12 @@ public static bool Delete(DeleteTaskOptions options, ITwilioRestClient client = /// Delete Task parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Task - public static async System.Threading.Tasks.Task DeleteAsync(DeleteTaskOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteTaskOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -225,7 +226,7 @@ public static bool Delete(string pathWorkspaceSid, string pathSid, string ifMatc public static async System.Threading.Tasks.Task DeleteAsync(string pathWorkspaceSid, string pathSid, string ifMatch = null, ITwilioRestClient client = null) { var options = new DeleteTaskOptions(pathWorkspaceSid, pathSid) { IfMatch = ifMatch }; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -264,10 +265,10 @@ public static TaskResource Fetch(FetchTaskOptions options, ITwilioRestClient cli /// Fetch Task parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Task - public static async System.Threading.Tasks.Task FetchAsync(FetchTaskOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTaskOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -294,7 +295,7 @@ public static TaskResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchTaskOptions(pathWorkspaceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -331,10 +332,10 @@ public static ResourceSet Read(ReadTaskOptions options, ITwilioRes /// Read Task parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Task - public static async System.Threading.Tasks.Task> ReadAsync(ReadTaskOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTaskOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("tasks", response.Content); return new ResourceSet(page, options, client); @@ -410,7 +411,7 @@ public static async System.Threading.Tasks.Task> ReadA ITwilioRestClient client = null) { var options = new ReadTaskOptions(pathWorkspaceSid){ Priority = priority, AssignmentStatus = assignmentStatus, WorkflowSid = workflowSid, WorkflowName = workflowName, TaskQueueSid = taskQueueSid, TaskQueueName = taskQueueName, EvaluateTaskAttributes = evaluateTaskAttributes, RoutingTarget = routingTarget, Ordering = ordering, HasAddons = hasAddons, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -499,11 +500,12 @@ public static TaskResource Update(UpdateTaskOptions options, ITwilioRestClient c /// Client to make requests to Twilio /// Task that resolves to A single instance of Task #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateTaskOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateTaskOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -562,7 +564,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateTaskOptions(pathWorkspaceSid, pathSid){ Attributes = attributes, AssignmentStatus = assignmentStatus, Reason = reason, Priority = priority, TaskChannel = taskChannel, VirtualStartTime = virtualStartTime, IfMatch = ifMatch }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationResource.cs index 1093973bf..00c2290b6 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationResource.cs @@ -121,10 +121,10 @@ public static ReservationResource Fetch(FetchReservationOptions options, ITwilio /// Fetch Reservation parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Reservation - public static async System.Threading.Tasks.Task FetchAsync(FetchReservationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchReservationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -154,7 +154,7 @@ public static ReservationResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathWorkerSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchReservationOptions(pathWorkspaceSid, pathWorkerSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -193,10 +193,10 @@ public static ResourceSet Read(ReadReservationOptions optio /// Read Reservation parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Reservation - public static async System.Threading.Tasks.Task> ReadAsync(ReadReservationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadReservationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("reservations", response.Content); return new ResourceSet(page, options, client); @@ -240,7 +240,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadReservationOptions(pathWorkspaceSid, pathWorkerSid){ ReservationStatus = reservationStatus, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -331,11 +331,12 @@ public static ReservationResource Update(UpdateReservationOptions options, ITwil /// Client to make requests to Twilio /// Task that resolves to A single instance of Reservation #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateReservationOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateReservationOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -582,7 +583,7 @@ public static async System.Threading.Tasks.Task UpdateAsync ITwilioRestClient client = null) { var options = new UpdateReservationOptions(pathWorkspaceSid, pathWorkerSid, pathSid){ ReservationStatus = reservationStatus, WorkerActivitySid = workerActivitySid, Instruction = instruction, DequeuePostWorkActivitySid = dequeuePostWorkActivitySid, DequeueFrom = dequeueFrom, DequeueRecord = dequeueRecord, DequeueTimeout = dequeueTimeout, DequeueTo = dequeueTo, DequeueStatusCallbackUrl = dequeueStatusCallbackUrl, CallFrom = callFrom, CallRecord = callRecord, CallTimeout = callTimeout, CallTo = callTo, CallUrl = callUrl, CallStatusCallbackUrl = callStatusCallbackUrl, CallAccept = callAccept, RedirectCallSid = redirectCallSid, RedirectAccept = redirectAccept, RedirectUrl = redirectUrl, To = to, From = from, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, StatusCallbackEvent = statusCallbackEvent, Timeout = timeout, Record = record, Muted = muted, Beep = beep, StartConferenceOnEnter = startConferenceOnEnter, EndConferenceOnExit = endConferenceOnExit, WaitUrl = waitUrl, WaitMethod = waitMethod, EarlyMedia = earlyMedia, MaxParticipants = maxParticipants, ConferenceStatusCallback = conferenceStatusCallback, ConferenceStatusCallbackMethod = conferenceStatusCallbackMethod, ConferenceStatusCallbackEvent = conferenceStatusCallbackEvent, ConferenceRecord = conferenceRecord, ConferenceTrim = conferenceTrim, RecordingChannels = recordingChannels, RecordingStatusCallback = recordingStatusCallback, RecordingStatusCallbackMethod = recordingStatusCallbackMethod, ConferenceRecordingStatusCallback = conferenceRecordingStatusCallback, ConferenceRecordingStatusCallbackMethod = conferenceRecordingStatusCallbackMethod, Region = region, SipAuthUsername = sipAuthUsername, SipAuthPassword = sipAuthPassword, DequeueStatusCallbackEvent = dequeueStatusCallbackEvent, PostWorkActivitySid = postWorkActivitySid, EndConferenceOnCustomerExit = endConferenceOnCustomerExit, BeepOnCustomerEntrance = beepOnCustomerEntrance, JitterBufferSize = jitterBufferSize, IfMatch = ifMatch }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerChannelResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerChannelResource.cs index 7167cae1c..41fa7ae7c 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerChannelResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerChannelResource.cs @@ -71,10 +71,10 @@ public static WorkerChannelResource Fetch(FetchWorkerChannelOptions options, ITw /// Fetch WorkerChannel parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkerChannel - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkerChannelOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkerChannelOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static WorkerChannelResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathWorkerSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchWorkerChannelOptions(pathWorkspaceSid, pathWorkerSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -143,10 +143,10 @@ public static ResourceSet Read(ReadWorkerChannelOptions o /// Read WorkerChannel parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkerChannel - public static async System.Threading.Tasks.Task> ReadAsync(ReadWorkerChannelOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadWorkerChannelOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("channels", response.Content); return new ResourceSet(page, options, client); @@ -186,7 +186,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of WorkerChannel #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateWorkerChannelOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateWorkerChannelOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -324,7 +325,7 @@ public static async System.Threading.Tasks.Task UpdateAsy ITwilioRestClient client = null) { var options = new UpdateWorkerChannelOptions(pathWorkspaceSid, pathWorkerSid, pathSid){ Capacity = capacity, Available = available }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerStatisticsResource.cs index bdeffe5e6..b0744c560 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerStatisticsResource.cs @@ -69,10 +69,10 @@ public static WorkerStatisticsResource Fetch(FetchWorkerStatisticsOptions option /// Fetch WorkerStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkerStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkerStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkerStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -111,7 +111,7 @@ public static WorkerStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathWorkerSid, int? minutes = null, DateTime? startDate = null, DateTime? endDate = null, string taskChannel = null, ITwilioRestClient client = null) { var options = new FetchWorkerStatisticsOptions(pathWorkspaceSid, pathWorkerSid){ Minutes = minutes,StartDate = startDate,EndDate = endDate,TaskChannel = taskChannel }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersCumulativeStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersCumulativeStatisticsResource.cs index fb6cb3a70..d30bcfd92 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersCumulativeStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersCumulativeStatisticsResource.cs @@ -67,10 +67,10 @@ public static WorkersCumulativeStatisticsResource Fetch(FetchWorkersCumulativeSt /// Fetch WorkersCumulativeStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkersCumulativeStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkersCumulativeStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkersCumulativeStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -106,7 +106,7 @@ public static WorkersCumulativeStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, DateTime? endDate = null, int? minutes = null, DateTime? startDate = null, string taskChannel = null, ITwilioRestClient client = null) { var options = new FetchWorkersCumulativeStatisticsOptions(pathWorkspaceSid){ EndDate = endDate,Minutes = minutes,StartDate = startDate,TaskChannel = taskChannel }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersRealTimeStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersRealTimeStatisticsResource.cs index dc95ecebb..7f3aa7ebf 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersRealTimeStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersRealTimeStatisticsResource.cs @@ -67,10 +67,10 @@ public static WorkersRealTimeStatisticsResource Fetch(FetchWorkersRealTimeStatis /// Fetch WorkersRealTimeStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkersRealTimeStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkersRealTimeStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkersRealTimeStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -97,7 +97,7 @@ public static WorkersRealTimeStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string taskChannel = null, ITwilioRestClient client = null) { var options = new FetchWorkersRealTimeStatisticsOptions(pathWorkspaceSid){ TaskChannel = taskChannel }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersStatisticsResource.cs index ce8e87392..070a115cc 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersStatisticsResource.cs @@ -67,10 +67,10 @@ public static WorkersStatisticsResource Fetch(FetchWorkersStatisticsOptions opti /// Fetch WorkersStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkersStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkersStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkersStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -115,7 +115,7 @@ public static WorkersStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, int? minutes = null, DateTime? startDate = null, DateTime? endDate = null, string taskQueueSid = null, string taskQueueName = null, string friendlyName = null, string taskChannel = null, ITwilioRestClient client = null) { var options = new FetchWorkersStatisticsOptions(pathWorkspaceSid){ Minutes = minutes,StartDate = startDate,EndDate = endDate,TaskQueueSid = taskQueueSid,TaskQueueName = taskQueueName,FriendlyName = friendlyName,TaskChannel = taskChannel }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkerResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkerResource.cs index 0c576e748..50cf06fe0 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkerResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkerResource.cs @@ -68,10 +68,10 @@ public static WorkerResource Create(CreateWorkerOptions options, ITwilioRestClie /// Create Worker parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Worker - public static async System.Threading.Tasks.Task CreateAsync(CreateWorkerOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateWorkerOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -110,7 +110,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateWorkerOptions(pathWorkspaceSid, friendlyName){ ActivitySid = activitySid, Attributes = attributes }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -153,11 +153,12 @@ public static bool Delete(DeleteWorkerOptions options, ITwilioRestClient client /// Delete Worker parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Worker - public static async System.Threading.Tasks.Task DeleteAsync(DeleteWorkerOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteWorkerOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -184,7 +185,7 @@ public static bool Delete(string pathWorkspaceSid, string pathSid, string ifMatc public static async System.Threading.Tasks.Task DeleteAsync(string pathWorkspaceSid, string pathSid, string ifMatch = null, ITwilioRestClient client = null) { var options = new DeleteWorkerOptions(pathWorkspaceSid, pathSid) { IfMatch = ifMatch }; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -223,10 +224,10 @@ public static WorkerResource Fetch(FetchWorkerOptions options, ITwilioRestClient /// Fetch Worker parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Worker - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkerOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkerOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -253,7 +254,7 @@ public static WorkerResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchWorkerOptions(pathWorkspaceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -290,10 +291,10 @@ public static ResourceSet Read(ReadWorkerOptions options, ITwili /// Read Worker parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Worker - public static async System.Threading.Tasks.Task> ReadAsync(ReadWorkerOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadWorkerOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("workers", response.Content); return new ResourceSet(page, options, client); @@ -361,7 +362,7 @@ public static async System.Threading.Tasks.Task> Rea ITwilioRestClient client = null) { var options = new ReadWorkerOptions(pathWorkspaceSid){ ActivityName = activityName, ActivitySid = activitySid, Available = available, FriendlyName = friendlyName, TargetWorkersExpression = targetWorkersExpression, TaskQueueName = taskQueueName, TaskQueueSid = taskQueueSid, Ordering = ordering, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -450,11 +451,12 @@ public static WorkerResource Update(UpdateWorkerOptions options, ITwilioRestClie /// Client to make requests to Twilio /// Task that resolves to A single instance of Worker #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateWorkerOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateWorkerOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -505,7 +507,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateWorkerOptions(pathWorkspaceSid, pathSid){ ActivitySid = activitySid, Attributes = attributes, FriendlyName = friendlyName, RejectPendingReservations = rejectPendingReservations, IfMatch = ifMatch }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowCumulativeStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowCumulativeStatisticsResource.cs index dbd08cee3..4199eec1c 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowCumulativeStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowCumulativeStatisticsResource.cs @@ -69,10 +69,10 @@ public static WorkflowCumulativeStatisticsResource Fetch(FetchWorkflowCumulative /// Fetch WorkflowCumulativeStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkflowCumulativeStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkflowCumulativeStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkflowCumulativeStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -114,7 +114,7 @@ public static WorkflowCumulativeStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathWorkflowSid, DateTime? endDate = null, int? minutes = null, DateTime? startDate = null, string taskChannel = null, string splitByWaitTime = null, ITwilioRestClient client = null) { var options = new FetchWorkflowCumulativeStatisticsOptions(pathWorkspaceSid, pathWorkflowSid){ EndDate = endDate,Minutes = minutes,StartDate = startDate,TaskChannel = taskChannel,SplitByWaitTime = splitByWaitTime }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowRealTimeStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowRealTimeStatisticsResource.cs index c0682d4e7..7acff04ba 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowRealTimeStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowRealTimeStatisticsResource.cs @@ -69,10 +69,10 @@ public static WorkflowRealTimeStatisticsResource Fetch(FetchWorkflowRealTimeStat /// Fetch WorkflowRealTimeStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkflowRealTimeStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkflowRealTimeStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkflowRealTimeStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static WorkflowRealTimeStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathWorkflowSid, string taskChannel = null, ITwilioRestClient client = null) { var options = new FetchWorkflowRealTimeStatisticsOptions(pathWorkspaceSid, pathWorkflowSid){ TaskChannel = taskChannel }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatisticsResource.cs index 56ca7dcc2..124c18759 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatisticsResource.cs @@ -69,10 +69,10 @@ public static WorkflowStatisticsResource Fetch(FetchWorkflowStatisticsOptions op /// Fetch WorkflowStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkflowStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkflowStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkflowStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -114,7 +114,7 @@ public static WorkflowStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathWorkflowSid, int? minutes = null, DateTime? startDate = null, DateTime? endDate = null, string taskChannel = null, string splitByWaitTime = null, ITwilioRestClient client = null) { var options = new FetchWorkflowStatisticsOptions(pathWorkspaceSid, pathWorkflowSid){ Minutes = minutes,StartDate = startDate,EndDate = endDate,TaskChannel = taskChannel,SplitByWaitTime = splitByWaitTime }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowResource.cs index 9feff7572..00d2775fd 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowResource.cs @@ -68,10 +68,10 @@ public static WorkflowResource Create(CreateWorkflowOptions options, ITwilioRest /// Create Workflow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Workflow - public static async System.Threading.Tasks.Task CreateAsync(CreateWorkflowOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateWorkflowOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -118,7 +118,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateWorkflowOptions(pathWorkspaceSid, friendlyName, configuration){ AssignmentCallbackUrl = assignmentCallbackUrl, FallbackAssignmentCallbackUrl = fallbackAssignmentCallbackUrl, TaskReservationTimeout = taskReservationTimeout }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -161,11 +161,12 @@ public static bool Delete(DeleteWorkflowOptions options, ITwilioRestClient clien /// Delete Workflow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Workflow - public static async System.Threading.Tasks.Task DeleteAsync(DeleteWorkflowOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteWorkflowOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -190,7 +191,7 @@ public static bool Delete(string pathWorkspaceSid, string pathSid, ITwilioRestCl public static async System.Threading.Tasks.Task DeleteAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteWorkflowOptions(pathWorkspaceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -229,10 +230,10 @@ public static WorkflowResource Fetch(FetchWorkflowOptions options, ITwilioRestCl /// Fetch Workflow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Workflow - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkflowOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkflowOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -259,7 +260,7 @@ public static WorkflowResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchWorkflowOptions(pathWorkspaceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -296,10 +297,10 @@ public static ResourceSet Read(ReadWorkflowOptions options, IT /// Read Workflow parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Workflow - public static async System.Threading.Tasks.Task> ReadAsync(ReadWorkflowOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadWorkflowOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("workflows", response.Content); return new ResourceSet(page, options, client); @@ -339,7 +340,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadWorkflowOptions(pathWorkspaceSid){ FriendlyName = friendlyName, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -428,11 +429,12 @@ public static WorkflowResource Update(UpdateWorkflowOptions options, ITwilioRest /// Client to make requests to Twilio /// Task that resolves to A single instance of Workflow #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateWorkflowOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateWorkflowOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -487,7 +489,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateWorkflowOptions(pathWorkspaceSid, pathSid){ FriendlyName = friendlyName, AssignmentCallbackUrl = assignmentCallbackUrl, FallbackAssignmentCallbackUrl = fallbackAssignmentCallbackUrl, Configuration = configuration, TaskReservationTimeout = taskReservationTimeout, ReEvaluateTasks = reEvaluateTasks }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceCumulativeStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceCumulativeStatisticsResource.cs index ff57ebe0b..5efd1d418 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceCumulativeStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceCumulativeStatisticsResource.cs @@ -67,10 +67,10 @@ public static WorkspaceCumulativeStatisticsResource Fetch(FetchWorkspaceCumulati /// Fetch WorkspaceCumulativeStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkspaceCumulativeStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkspaceCumulativeStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkspaceCumulativeStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -109,7 +109,7 @@ public static WorkspaceCumulativeStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, DateTime? endDate = null, int? minutes = null, DateTime? startDate = null, string taskChannel = null, string splitByWaitTime = null, ITwilioRestClient client = null) { var options = new FetchWorkspaceCumulativeStatisticsOptions(pathWorkspaceSid){ EndDate = endDate,Minutes = minutes,StartDate = startDate,TaskChannel = taskChannel,SplitByWaitTime = splitByWaitTime }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceRealTimeStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceRealTimeStatisticsResource.cs index 5218b1944..fc8a24e8a 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceRealTimeStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceRealTimeStatisticsResource.cs @@ -67,10 +67,10 @@ public static WorkspaceRealTimeStatisticsResource Fetch(FetchWorkspaceRealTimeSt /// Fetch WorkspaceRealTimeStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkspaceRealTimeStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkspaceRealTimeStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkspaceRealTimeStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -97,7 +97,7 @@ public static WorkspaceRealTimeStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, string taskChannel = null, ITwilioRestClient client = null) { var options = new FetchWorkspaceRealTimeStatisticsOptions(pathWorkspaceSid){ TaskChannel = taskChannel }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceStatisticsResource.cs b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceStatisticsResource.cs index 01cd3c30d..12f456d92 100644 --- a/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceStatisticsResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceStatisticsResource.cs @@ -67,10 +67,10 @@ public static WorkspaceStatisticsResource Fetch(FetchWorkspaceStatisticsOptions /// Fetch WorkspaceStatistics parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of WorkspaceStatistics - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkspaceStatisticsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkspaceStatisticsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -109,7 +109,7 @@ public static WorkspaceStatisticsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathWorkspaceSid, int? minutes = null, DateTime? startDate = null, DateTime? endDate = null, string taskChannel = null, string splitByWaitTime = null, ITwilioRestClient client = null) { var options = new FetchWorkspaceStatisticsOptions(pathWorkspaceSid){ Minutes = minutes,StartDate = startDate,EndDate = endDate,TaskChannel = taskChannel,SplitByWaitTime = splitByWaitTime }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Taskrouter/V1/WorkspaceResource.cs b/src/Twilio/Rest/Taskrouter/V1/WorkspaceResource.cs index 7ed13fef8..0452c6ef9 100644 --- a/src/Twilio/Rest/Taskrouter/V1/WorkspaceResource.cs +++ b/src/Twilio/Rest/Taskrouter/V1/WorkspaceResource.cs @@ -79,10 +79,10 @@ public static WorkspaceResource Create(CreateWorkspaceOptions options, ITwilioRe /// Create Workspace parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Workspace - public static async System.Threading.Tasks.Task CreateAsync(CreateWorkspaceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateWorkspaceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -129,7 +129,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateWorkspaceOptions(friendlyName){ EventCallbackUrl = eventCallbackUrl, EventsFilter = eventsFilter, MultiTaskEnabled = multiTaskEnabled, Template = template, PrioritizeQueueOrder = prioritizeQueueOrder }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -170,11 +170,12 @@ public static bool Delete(DeleteWorkspaceOptions options, ITwilioRestClient clie /// Delete Workspace parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Workspace - public static async System.Threading.Tasks.Task DeleteAsync(DeleteWorkspaceOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteWorkspaceOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -194,10 +195,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID of the Workspace resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Workspace - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteWorkspaceOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -234,10 +235,10 @@ public static WorkspaceResource Fetch(FetchWorkspaceOptions options, ITwilioRest /// Fetch Workspace parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Workspace - public static async System.Threading.Tasks.Task FetchAsync(FetchWorkspaceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWorkspaceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -258,10 +259,10 @@ public static WorkspaceResource Fetch( /// The SID of the Workspace resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Workspace - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchWorkspaceOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -296,10 +297,10 @@ public static ResourceSet Read(ReadWorkspaceOptions options, /// Read Workspace parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Workspace - public static async System.Threading.Tasks.Task> ReadAsync(ReadWorkspaceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadWorkspaceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("workspaces", response.Content); return new ResourceSet(page, options, client); @@ -335,7 +336,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadWorkspaceOptions(){ FriendlyName = friendlyName, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -422,11 +423,12 @@ public static WorkspaceResource Update(UpdateWorkspaceOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of Workspace #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateWorkspaceOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateWorkspaceOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -481,7 +483,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateWorkspaceOptions(pathSid){ DefaultActivitySid = defaultActivitySid, EventCallbackUrl = eventCallbackUrl, EventsFilter = eventsFilter, FriendlyName = friendlyName, MultiTaskEnabled = multiTaskEnabled, TimeoutActivitySid = timeoutActivitySid, PrioritizeQueueOrder = prioritizeQueueOrder }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trunking/V1/Trunk/CredentialListResource.cs b/src/Twilio/Rest/Trunking/V1/Trunk/CredentialListResource.cs index d9be4552c..83ea3522a 100644 --- a/src/Twilio/Rest/Trunking/V1/Trunk/CredentialListResource.cs +++ b/src/Twilio/Rest/Trunking/V1/Trunk/CredentialListResource.cs @@ -68,10 +68,10 @@ public static CredentialListResource Create(CreateCredentialListOptions options, /// Create CredentialList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CredentialList - public static async System.Threading.Tasks.Task CreateAsync(CreateCredentialListOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateCredentialListOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static async System.Threading.Tasks.Task CreateAs ITwilioRestClient client = null) { var options = new CreateCredentialListOptions(pathTrunkSid, credentialListSid){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -145,11 +145,12 @@ public static bool Delete(DeleteCredentialListOptions options, ITwilioRestClient /// Delete CredentialList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CredentialList - public static async System.Threading.Tasks.Task DeleteAsync(DeleteCredentialListOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteCredentialListOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -174,7 +175,7 @@ public static bool Delete(string pathTrunkSid, string pathSid, ITwilioRestClient public static async System.Threading.Tasks.Task DeleteAsync(string pathTrunkSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteCredentialListOptions(pathTrunkSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -213,10 +214,10 @@ public static CredentialListResource Fetch(FetchCredentialListOptions options, I /// Fetch CredentialList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CredentialList - public static async System.Threading.Tasks.Task FetchAsync(FetchCredentialListOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCredentialListOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -243,7 +244,7 @@ public static CredentialListResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathTrunkSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchCredentialListOptions(pathTrunkSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -280,10 +281,10 @@ public static ResourceSet Read(ReadCredentialListOptions /// Read CredentialList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CredentialList - public static async System.Threading.Tasks.Task> ReadAsync(ReadCredentialListOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadCredentialListOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("credential_lists", response.Content); return new ResourceSet(page, options, client); @@ -319,7 +320,7 @@ public static async System.Threading.Tasks.Task Create IpAccessControlList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpAccessControlList - public static async System.Threading.Tasks.Task CreateAsync(CreateIpAccessControlListOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateIpAccessControlListOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static async System.Threading.Tasks.Task Cre ITwilioRestClient client = null) { var options = new CreateIpAccessControlListOptions(pathTrunkSid, ipAccessControlListSid){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -145,11 +145,12 @@ public static bool Delete(DeleteIpAccessControlListOptions options, ITwilioRestC /// Delete IpAccessControlList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpAccessControlList - public static async System.Threading.Tasks.Task DeleteAsync(DeleteIpAccessControlListOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteIpAccessControlListOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -174,7 +175,7 @@ public static bool Delete(string pathTrunkSid, string pathSid, ITwilioRestClient public static async System.Threading.Tasks.Task DeleteAsync(string pathTrunkSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteIpAccessControlListOptions(pathTrunkSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -213,10 +214,10 @@ public static IpAccessControlListResource Fetch(FetchIpAccessControlListOptions /// Fetch IpAccessControlList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpAccessControlList - public static async System.Threading.Tasks.Task FetchAsync(FetchIpAccessControlListOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchIpAccessControlListOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -243,7 +244,7 @@ public static IpAccessControlListResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathTrunkSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchIpAccessControlListOptions(pathTrunkSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -280,10 +281,10 @@ public static ResourceSet Read(ReadIpAccessControlL /// Read IpAccessControlList parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpAccessControlList - public static async System.Threading.Tasks.Task> ReadAsync(ReadIpAccessControlListOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadIpAccessControlListOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("ip_access_control_lists", response.Content); return new ResourceSet(page, options, client); @@ -319,7 +320,7 @@ public static async System.Threading.Tasks.Task Create OriginationUrl parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of OriginationUrl - public static async System.Threading.Tasks.Task CreateAsync(CreateOriginationUrlOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateOriginationUrlOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -118,7 +118,7 @@ public static async System.Threading.Tasks.Task CreateAs ITwilioRestClient client = null) { var options = new CreateOriginationUrlOptions(pathTrunkSid, weight, priority, enabled, friendlyName, sipUrl){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -161,11 +161,12 @@ public static bool Delete(DeleteOriginationUrlOptions options, ITwilioRestClient /// Delete OriginationUrl parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of OriginationUrl - public static async System.Threading.Tasks.Task DeleteAsync(DeleteOriginationUrlOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteOriginationUrlOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -190,7 +191,7 @@ public static bool Delete(string pathTrunkSid, string pathSid, ITwilioRestClient public static async System.Threading.Tasks.Task DeleteAsync(string pathTrunkSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteOriginationUrlOptions(pathTrunkSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -229,10 +230,10 @@ public static OriginationUrlResource Fetch(FetchOriginationUrlOptions options, I /// Fetch OriginationUrl parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of OriginationUrl - public static async System.Threading.Tasks.Task FetchAsync(FetchOriginationUrlOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchOriginationUrlOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -259,7 +260,7 @@ public static OriginationUrlResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathTrunkSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchOriginationUrlOptions(pathTrunkSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -296,10 +297,10 @@ public static ResourceSet Read(ReadOriginationUrlOptions /// Read OriginationUrl parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of OriginationUrl - public static async System.Threading.Tasks.Task> ReadAsync(ReadOriginationUrlOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadOriginationUrlOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("origination_urls", response.Content); return new ResourceSet(page, options, client); @@ -335,7 +336,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of OriginationUrl #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateOriginationUrlOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateOriginationUrlOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -479,7 +481,7 @@ public static async System.Threading.Tasks.Task UpdateAs ITwilioRestClient client = null) { var options = new UpdateOriginationUrlOptions(pathTrunkSid, pathSid){ Weight = weight, Priority = priority, Enabled = enabled, FriendlyName = friendlyName, SipUrl = sipUrl }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trunking/V1/Trunk/PhoneNumberResource.cs b/src/Twilio/Rest/Trunking/V1/Trunk/PhoneNumberResource.cs index fad91644b..8112908b7 100644 --- a/src/Twilio/Rest/Trunking/V1/Trunk/PhoneNumberResource.cs +++ b/src/Twilio/Rest/Trunking/V1/Trunk/PhoneNumberResource.cs @@ -83,10 +83,10 @@ public static PhoneNumberResource Create(CreatePhoneNumberOptions options, ITwil /// Create PhoneNumber parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of PhoneNumber - public static async System.Threading.Tasks.Task CreateAsync(CreatePhoneNumberOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreatePhoneNumberOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -117,7 +117,7 @@ public static async System.Threading.Tasks.Task CreateAsync ITwilioRestClient client = null) { var options = new CreatePhoneNumberOptions(pathTrunkSid, phoneNumberSid){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -160,11 +160,12 @@ public static bool Delete(DeletePhoneNumberOptions options, ITwilioRestClient cl /// Delete PhoneNumber parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of PhoneNumber - public static async System.Threading.Tasks.Task DeleteAsync(DeletePhoneNumberOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeletePhoneNumberOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -189,7 +190,7 @@ public static bool Delete(string pathTrunkSid, string pathSid, ITwilioRestClient public static async System.Threading.Tasks.Task DeleteAsync(string pathTrunkSid, string pathSid, ITwilioRestClient client = null) { var options = new DeletePhoneNumberOptions(pathTrunkSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -228,10 +229,10 @@ public static PhoneNumberResource Fetch(FetchPhoneNumberOptions options, ITwilio /// Fetch PhoneNumber parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of PhoneNumber - public static async System.Threading.Tasks.Task FetchAsync(FetchPhoneNumberOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchPhoneNumberOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -258,7 +259,7 @@ public static PhoneNumberResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathTrunkSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchPhoneNumberOptions(pathTrunkSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -295,10 +296,10 @@ public static ResourceSet Read(ReadPhoneNumberOptions optio /// Read PhoneNumber parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of PhoneNumber - public static async System.Threading.Tasks.Task> ReadAsync(ReadPhoneNumberOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadPhoneNumberOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("phone_numbers", response.Content); return new ResourceSet(page, options, client); @@ -334,7 +335,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadPhoneNumberOptions(pathTrunkSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trunking/V1/Trunk/RecordingResource.cs b/src/Twilio/Rest/Trunking/V1/Trunk/RecordingResource.cs index dd1a2720a..ebb2333ce 100644 --- a/src/Twilio/Rest/Trunking/V1/Trunk/RecordingResource.cs +++ b/src/Twilio/Rest/Trunking/V1/Trunk/RecordingResource.cs @@ -96,10 +96,10 @@ public static RecordingResource Fetch(FetchRecordingOptions options, ITwilioRest /// Fetch Recording parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Recording - public static async System.Threading.Tasks.Task FetchAsync(FetchRecordingOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchRecordingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -120,10 +120,10 @@ public static RecordingResource Fetch( /// The SID of the Trunk from which to fetch the recording settings. /// Client to make requests to Twilio /// Task that resolves to A single instance of Recording - public static async System.Threading.Tasks.Task FetchAsync(string pathTrunkSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathTrunkSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchRecordingOptions(pathTrunkSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -161,11 +161,12 @@ public static RecordingResource Update(UpdateRecordingOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of Recording #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateRecordingOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateRecordingOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -200,7 +201,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateRecordingOptions(pathTrunkSid){ Mode = mode, Trim = trim }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trunking/V1/TrunkResource.cs b/src/Twilio/Rest/Trunking/V1/TrunkResource.cs index 4da815862..8708186c9 100644 --- a/src/Twilio/Rest/Trunking/V1/TrunkResource.cs +++ b/src/Twilio/Rest/Trunking/V1/TrunkResource.cs @@ -93,10 +93,10 @@ public static TrunkResource Create(CreateTrunkOptions options, ITwilioRestClient /// Create Trunk parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk - public static async System.Threading.Tasks.Task CreateAsync(CreateTrunkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTrunkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -151,7 +151,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateTrunkOptions(){ FriendlyName = friendlyName, DomainName = domainName, DisasterRecoveryUrl = disasterRecoveryUrl, DisasterRecoveryMethod = disasterRecoveryMethod, TransferMode = transferMode, Secure = secure, CnamLookupEnabled = cnamLookupEnabled, TransferCallerId = transferCallerId }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -192,11 +192,12 @@ public static bool Delete(DeleteTrunkOptions options, ITwilioRestClient client = /// Delete Trunk parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk - public static async System.Threading.Tasks.Task DeleteAsync(DeleteTrunkOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteTrunkOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -216,10 +217,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The unique string that we created to identify the Trunk resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteTrunkOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -256,10 +257,10 @@ public static TrunkResource Fetch(FetchTrunkOptions options, ITwilioRestClient c /// Fetch Trunk parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk - public static async System.Threading.Tasks.Task FetchAsync(FetchTrunkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTrunkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -280,10 +281,10 @@ public static TrunkResource Fetch( /// The unique string that we created to identify the Trunk resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchTrunkOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -318,10 +319,10 @@ public static ResourceSet Read(ReadTrunkOptions options, ITwilioR /// Read Trunk parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk - public static async System.Threading.Tasks.Task> ReadAsync(ReadTrunkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTrunkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("trunks", response.Content); return new ResourceSet(page, options, client); @@ -353,7 +354,7 @@ public static async System.Threading.Tasks.Task> Read ITwilioRestClient client = null) { var options = new ReadTrunkOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -440,11 +441,12 @@ public static TrunkResource Update(UpdateTrunkOptions options, ITwilioRestClient /// Client to make requests to Twilio /// Task that resolves to A single instance of Trunk #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateTrunkOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateTrunkOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -503,7 +505,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateTrunkOptions(pathSid){ FriendlyName = friendlyName, DomainName = domainName, DisasterRecoveryUrl = disasterRecoveryUrl, DisasterRecoveryMethod = disasterRecoveryMethod, TransferMode = transferMode, Secure = secure, CnamLookupEnabled = cnamLookupEnabled, TransferCallerId = transferCallerId }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trusthub/V1/ComplianceInquiriesResource.cs b/src/Twilio/Rest/Trusthub/V1/ComplianceInquiriesResource.cs index 831b0580a..14aa30362 100644 --- a/src/Twilio/Rest/Trusthub/V1/ComplianceInquiriesResource.cs +++ b/src/Twilio/Rest/Trusthub/V1/ComplianceInquiriesResource.cs @@ -66,10 +66,10 @@ public static ComplianceInquiriesResource Create(CreateComplianceInquiriesOption /// Create ComplianceInquiries parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ComplianceInquiries - public static async System.Threading.Tasks.Task CreateAsync(CreateComplianceInquiriesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateComplianceInquiriesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static async System.Threading.Tasks.Task Cre ITwilioRestClient client = null) { var options = new CreateComplianceInquiriesOptions(primaryProfileSid){ NotificationEmail = notificationEmail, ThemeSetId = themeSetId }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -142,11 +142,12 @@ public static ComplianceInquiriesResource Update(UpdateComplianceInquiriesOption /// Client to make requests to Twilio /// Task that resolves to A single instance of ComplianceInquiries #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateComplianceInquiriesOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateComplianceInquiriesOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -181,7 +182,7 @@ public static async System.Threading.Tasks.Task Upd ITwilioRestClient client = null) { var options = new UpdateComplianceInquiriesOptions(pathCustomerId, primaryProfileSid){ ThemeSetId = themeSetId }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trusthub/V1/ComplianceRegistrationInquiriesResource.cs b/src/Twilio/Rest/Trusthub/V1/ComplianceRegistrationInquiriesResource.cs index 489dd007c..3fe83010e 100644 --- a/src/Twilio/Rest/Trusthub/V1/ComplianceRegistrationInquiriesResource.cs +++ b/src/Twilio/Rest/Trusthub/V1/ComplianceRegistrationInquiriesResource.cs @@ -120,10 +120,10 @@ public static ComplianceRegistrationInquiriesResource Create(CreateComplianceReg /// Create ComplianceRegistrationInquiries parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ComplianceRegistrationInquiries - public static async System.Threading.Tasks.Task CreateAsync(CreateComplianceRegistrationInquiriesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateComplianceRegistrationInquiriesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -302,7 +302,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of ComplianceRegistrationInquiries #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateComplianceRegistrationInquiriesOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateComplianceRegistrationInquiriesOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -379,7 +380,7 @@ public static async System.Threading.Tasks.Task Create ComplianceTollfreeInquiries parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ComplianceTollfreeInquiries - public static async System.Threading.Tasks.Task CreateAsync(CreateComplianceTollfreeInquiriesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateComplianceTollfreeInquiriesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -199,7 +199,7 @@ public static async System.Threading.Tasks.Task Create CustomerProfilesChannelEndpointAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesChannelEndpointAssignment - public static async System.Threading.Tasks.Task CreateAsync(CreateCustomerProfilesChannelEndpointAssignmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateCustomerProfilesChannelEndpointAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -106,7 +106,7 @@ public static async System.Threading.Tasks.Task Delete CustomerProfilesChannelEndpointAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesChannelEndpointAssignment - public static async System.Threading.Tasks.Task DeleteAsync(DeleteCustomerProfilesChannelEndpointAssignmentOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteCustomerProfilesChannelEndpointAssignmentOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -178,7 +179,7 @@ public static bool Delete(string pathCustomerProfileSid, string pathSid, ITwilio public static async System.Threading.Tasks.Task DeleteAsync(string pathCustomerProfileSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteCustomerProfilesChannelEndpointAssignmentOptions(pathCustomerProfileSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -217,10 +218,10 @@ public static CustomerProfilesChannelEndpointAssignmentResource Fetch(FetchCusto /// Fetch CustomerProfilesChannelEndpointAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesChannelEndpointAssignment - public static async System.Threading.Tasks.Task FetchAsync(FetchCustomerProfilesChannelEndpointAssignmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCustomerProfilesChannelEndpointAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -247,7 +248,7 @@ public static CustomerProfilesChannelEndpointAssignmentResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathCustomerProfileSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchCustomerProfilesChannelEndpointAssignmentOptions(pathCustomerProfileSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -284,10 +285,10 @@ public static ResourceSet Rea /// Read CustomerProfilesChannelEndpointAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesChannelEndpointAssignment - public static async System.Threading.Tasks.Task> ReadAsync(ReadCustomerProfilesChannelEndpointAssignmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadCustomerProfilesChannelEndpointAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -331,7 +332,7 @@ public static async System.Threading.Tasks.Task Create CustomerProfilesEntityAssignments parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesEntityAssignments - public static async System.Threading.Tasks.Task CreateAsync(CreateCustomerProfilesEntityAssignmentsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateCustomerProfilesEntityAssignmentsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static async System.Threading.Tasks.Task Delete CustomerProfilesEntityAssignments parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesEntityAssignments - public static async System.Threading.Tasks.Task DeleteAsync(DeleteCustomerProfilesEntityAssignmentsOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteCustomerProfilesEntityAssignmentsOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -174,7 +175,7 @@ public static bool Delete(string pathCustomerProfileSid, string pathSid, ITwilio public static async System.Threading.Tasks.Task DeleteAsync(string pathCustomerProfileSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteCustomerProfilesEntityAssignmentsOptions(pathCustomerProfileSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -213,10 +214,10 @@ public static CustomerProfilesEntityAssignmentsResource Fetch(FetchCustomerProfi /// Fetch CustomerProfilesEntityAssignments parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesEntityAssignments - public static async System.Threading.Tasks.Task FetchAsync(FetchCustomerProfilesEntityAssignmentsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCustomerProfilesEntityAssignmentsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -243,7 +244,7 @@ public static CustomerProfilesEntityAssignmentsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathCustomerProfileSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchCustomerProfilesEntityAssignmentsOptions(pathCustomerProfileSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -280,10 +281,10 @@ public static ResourceSet Read(ReadCu /// Read CustomerProfilesEntityAssignments parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesEntityAssignments - public static async System.Threading.Tasks.Task> ReadAsync(ReadCustomerProfilesEntityAssignmentsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadCustomerProfilesEntityAssignmentsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -323,7 +324,7 @@ public static async System.Threading.Tasks.Task Create CustomerProfilesEvaluations parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesEvaluations - public static async System.Threading.Tasks.Task CreateAsync(CreateCustomerProfilesEvaluationsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateCustomerProfilesEvaluationsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -115,7 +115,7 @@ public static async System.Threading.Tasks.Task Fetch CustomerProfilesEvaluations parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesEvaluations - public static async System.Threading.Tasks.Task FetchAsync(FetchCustomerProfilesEvaluationsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCustomerProfilesEvaluationsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -184,7 +184,7 @@ public static CustomerProfilesEvaluationsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathCustomerProfileSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchCustomerProfilesEvaluationsOptions(pathCustomerProfileSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -221,10 +221,10 @@ public static ResourceSet Read(ReadCustomer /// Read CustomerProfilesEvaluations parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfilesEvaluations - public static async System.Threading.Tasks.Task> ReadAsync(ReadCustomerProfilesEvaluationsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadCustomerProfilesEvaluationsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -260,7 +260,7 @@ public static async System.Threading.Tasks.Task Create CustomerProfiles parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfiles - public static async System.Threading.Tasks.Task CreateAsync(CreateCustomerProfilesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateCustomerProfilesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -124,7 +124,7 @@ public static async System.Threading.Tasks.Task Create ITwilioRestClient client = null) { var options = new CreateCustomerProfilesOptions(friendlyName, email, policySid){ StatusCallback = statusCallback }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -165,11 +165,12 @@ public static bool Delete(DeleteCustomerProfilesOptions options, ITwilioRestClie /// Delete CustomerProfiles parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfiles - public static async System.Threading.Tasks.Task DeleteAsync(DeleteCustomerProfilesOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteCustomerProfilesOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -189,10 +190,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The unique string that we created to identify the Customer-Profile resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfiles - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteCustomerProfilesOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -229,10 +230,10 @@ public static CustomerProfilesResource Fetch(FetchCustomerProfilesOptions option /// Fetch CustomerProfiles parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfiles - public static async System.Threading.Tasks.Task FetchAsync(FetchCustomerProfilesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCustomerProfilesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -253,10 +254,10 @@ public static CustomerProfilesResource Fetch( /// The unique string that we created to identify the Customer-Profile resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfiles - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchCustomerProfilesOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -291,10 +292,10 @@ public static ResourceSet Read(ReadCustomerProfilesOpt /// Read CustomerProfiles parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfiles - public static async System.Threading.Tasks.Task> ReadAsync(ReadCustomerProfilesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadCustomerProfilesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -338,7 +339,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of CustomerProfiles #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateCustomerProfilesOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateCustomerProfilesOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -472,7 +474,7 @@ public static async System.Threading.Tasks.Task Update ITwilioRestClient client = null) { var options = new UpdateCustomerProfilesOptions(pathSid){ Status = status, StatusCallback = statusCallback, FriendlyName = friendlyName, Email = email }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trusthub/V1/EndUserResource.cs b/src/Twilio/Rest/Trusthub/V1/EndUserResource.cs index 793de1a35..c862c5fa7 100644 --- a/src/Twilio/Rest/Trusthub/V1/EndUserResource.cs +++ b/src/Twilio/Rest/Trusthub/V1/EndUserResource.cs @@ -66,10 +66,10 @@ public static EndUserResource Create(CreateEndUserOptions options, ITwilioRestCl /// Create EndUser parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUser - public static async System.Threading.Tasks.Task CreateAsync(CreateEndUserOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateEndUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateEndUserOptions(friendlyName, type){ Attributes = attributes }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -145,11 +145,12 @@ public static bool Delete(DeleteEndUserOptions options, ITwilioRestClient client /// Delete EndUser parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUser - public static async System.Threading.Tasks.Task DeleteAsync(DeleteEndUserOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteEndUserOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -169,10 +170,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The unique string created by Twilio to identify the End User resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUser - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteEndUserOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -209,10 +210,10 @@ public static EndUserResource Fetch(FetchEndUserOptions options, ITwilioRestClie /// Fetch EndUser parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUser - public static async System.Threading.Tasks.Task FetchAsync(FetchEndUserOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchEndUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -233,10 +234,10 @@ public static EndUserResource Fetch( /// The unique string created by Twilio to identify the End User resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUser - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchEndUserOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -271,10 +272,10 @@ public static ResourceSet Read(ReadEndUserOptions options, ITwi /// Read EndUser parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUser - public static async System.Threading.Tasks.Task> ReadAsync(ReadEndUserOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadEndUserOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -306,7 +307,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadEndUserOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -393,11 +394,12 @@ public static EndUserResource Update(UpdateEndUserOptions options, ITwilioRestCl /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUser #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateEndUserOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateEndUserOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -432,7 +434,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateEndUserOptions(pathSid){ FriendlyName = friendlyName, Attributes = attributes }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trusthub/V1/EndUserTypeResource.cs b/src/Twilio/Rest/Trusthub/V1/EndUserTypeResource.cs index 6f4772fbf..454ed95f5 100644 --- a/src/Twilio/Rest/Trusthub/V1/EndUserTypeResource.cs +++ b/src/Twilio/Rest/Trusthub/V1/EndUserTypeResource.cs @@ -67,10 +67,10 @@ public static EndUserTypeResource Fetch(FetchEndUserTypeOptions options, ITwilio /// Fetch EndUserType parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUserType - public static async System.Threading.Tasks.Task FetchAsync(FetchEndUserTypeOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchEndUserTypeOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static EndUserTypeResource Fetch( /// The unique string that identifies the End-User Type resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUserType - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchEndUserTypeOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -129,10 +129,10 @@ public static ResourceSet Read(ReadEndUserTypeOptions optio /// Read EndUserType parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of EndUserType - public static async System.Threading.Tasks.Task> ReadAsync(ReadEndUserTypeOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadEndUserTypeOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("end_user_types", response.Content); return new ResourceSet(page, options, client); @@ -164,7 +164,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadEndUserTypeOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trusthub/V1/PoliciesResource.cs b/src/Twilio/Rest/Trusthub/V1/PoliciesResource.cs index 96bc44f6f..2c179bce0 100644 --- a/src/Twilio/Rest/Trusthub/V1/PoliciesResource.cs +++ b/src/Twilio/Rest/Trusthub/V1/PoliciesResource.cs @@ -67,10 +67,10 @@ public static PoliciesResource Fetch(FetchPoliciesOptions options, ITwilioRestCl /// Fetch Policies parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Policies - public static async System.Threading.Tasks.Task FetchAsync(FetchPoliciesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchPoliciesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static PoliciesResource Fetch( /// The unique string that identifies the Policy resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of Policies - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchPoliciesOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -129,10 +129,10 @@ public static ResourceSet Read(ReadPoliciesOptions options, IT /// Read Policies parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Policies - public static async System.Threading.Tasks.Task> ReadAsync(ReadPoliciesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadPoliciesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -164,7 +164,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadPoliciesOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trusthub/V1/SupportingDocumentResource.cs b/src/Twilio/Rest/Trusthub/V1/SupportingDocumentResource.cs index 3e27923f4..3d8bce383 100644 --- a/src/Twilio/Rest/Trusthub/V1/SupportingDocumentResource.cs +++ b/src/Twilio/Rest/Trusthub/V1/SupportingDocumentResource.cs @@ -83,10 +83,10 @@ public static SupportingDocumentResource Create(CreateSupportingDocumentOptions /// Create SupportingDocument parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocument - public static async System.Threading.Tasks.Task CreateAsync(CreateSupportingDocumentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSupportingDocumentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -121,7 +121,7 @@ public static async System.Threading.Tasks.Task Crea ITwilioRestClient client = null) { var options = new CreateSupportingDocumentOptions(friendlyName, type){ Attributes = attributes }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -162,11 +162,12 @@ public static bool Delete(DeleteSupportingDocumentOptions options, ITwilioRestCl /// Delete SupportingDocument parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocument - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSupportingDocumentOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSupportingDocumentOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -186,10 +187,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The unique string created by Twilio to identify the Supporting Document resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocument - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteSupportingDocumentOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -226,10 +227,10 @@ public static SupportingDocumentResource Fetch(FetchSupportingDocumentOptions op /// Fetch SupportingDocument parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocument - public static async System.Threading.Tasks.Task FetchAsync(FetchSupportingDocumentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSupportingDocumentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -250,10 +251,10 @@ public static SupportingDocumentResource Fetch( /// The unique string created by Twilio to identify the Supporting Document resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocument - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchSupportingDocumentOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -288,10 +289,10 @@ public static ResourceSet Read(ReadSupportingDocumen /// Read SupportingDocument parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocument - public static async System.Threading.Tasks.Task> ReadAsync(ReadSupportingDocumentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSupportingDocumentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -323,7 +324,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocument #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSupportingDocumentOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSupportingDocumentOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -449,7 +451,7 @@ public static async System.Threading.Tasks.Task Upda ITwilioRestClient client = null) { var options = new UpdateSupportingDocumentOptions(pathSid){ FriendlyName = friendlyName, Attributes = attributes }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Trusthub/V1/SupportingDocumentTypeResource.cs b/src/Twilio/Rest/Trusthub/V1/SupportingDocumentTypeResource.cs index 2d40c316d..a06620688 100644 --- a/src/Twilio/Rest/Trusthub/V1/SupportingDocumentTypeResource.cs +++ b/src/Twilio/Rest/Trusthub/V1/SupportingDocumentTypeResource.cs @@ -67,10 +67,10 @@ public static SupportingDocumentTypeResource Fetch(FetchSupportingDocumentTypeOp /// Fetch SupportingDocumentType parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocumentType - public static async System.Threading.Tasks.Task FetchAsync(FetchSupportingDocumentTypeOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSupportingDocumentTypeOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static SupportingDocumentTypeResource Fetch( /// The unique string that identifies the Supporting Document Type resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocumentType - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchSupportingDocumentTypeOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -129,10 +129,10 @@ public static ResourceSet Read(ReadSupportingDoc /// Read SupportingDocumentType parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SupportingDocumentType - public static async System.Threading.Tasks.Task> ReadAsync(ReadSupportingDocumentTypeOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSupportingDocumentTypeOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("supporting_document_types", response.Content); return new ResourceSet(page, options, client); @@ -164,7 +164,7 @@ public static async System.Threading.Tasks.Task Create TrustProductsChannelEndpointAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsChannelEndpointAssignment - public static async System.Threading.Tasks.Task CreateAsync(CreateTrustProductsChannelEndpointAssignmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTrustProductsChannelEndpointAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -106,7 +106,7 @@ public static async System.Threading.Tasks.Task Delete TrustProductsChannelEndpointAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsChannelEndpointAssignment - public static async System.Threading.Tasks.Task DeleteAsync(DeleteTrustProductsChannelEndpointAssignmentOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteTrustProductsChannelEndpointAssignmentOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -178,7 +179,7 @@ public static bool Delete(string pathTrustProductSid, string pathSid, ITwilioRes public static async System.Threading.Tasks.Task DeleteAsync(string pathTrustProductSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteTrustProductsChannelEndpointAssignmentOptions(pathTrustProductSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -217,10 +218,10 @@ public static TrustProductsChannelEndpointAssignmentResource Fetch(FetchTrustPro /// Fetch TrustProductsChannelEndpointAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsChannelEndpointAssignment - public static async System.Threading.Tasks.Task FetchAsync(FetchTrustProductsChannelEndpointAssignmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTrustProductsChannelEndpointAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -247,7 +248,7 @@ public static TrustProductsChannelEndpointAssignmentResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathTrustProductSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchTrustProductsChannelEndpointAssignmentOptions(pathTrustProductSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -284,10 +285,10 @@ public static ResourceSet Read(R /// Read TrustProductsChannelEndpointAssignment parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsChannelEndpointAssignment - public static async System.Threading.Tasks.Task> ReadAsync(ReadTrustProductsChannelEndpointAssignmentOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTrustProductsChannelEndpointAssignmentOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -331,7 +332,7 @@ public static async System.Threading.Tasks.Task Create TrustProductsEntityAssignments parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsEntityAssignments - public static async System.Threading.Tasks.Task CreateAsync(CreateTrustProductsEntityAssignmentsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTrustProductsEntityAssignmentsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static async System.Threading.Tasks.Task Delete TrustProductsEntityAssignments parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsEntityAssignments - public static async System.Threading.Tasks.Task DeleteAsync(DeleteTrustProductsEntityAssignmentsOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteTrustProductsEntityAssignmentsOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -174,7 +175,7 @@ public static bool Delete(string pathTrustProductSid, string pathSid, ITwilioRes public static async System.Threading.Tasks.Task DeleteAsync(string pathTrustProductSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteTrustProductsEntityAssignmentsOptions(pathTrustProductSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -213,10 +214,10 @@ public static TrustProductsEntityAssignmentsResource Fetch(FetchTrustProductsEnt /// Fetch TrustProductsEntityAssignments parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsEntityAssignments - public static async System.Threading.Tasks.Task FetchAsync(FetchTrustProductsEntityAssignmentsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTrustProductsEntityAssignmentsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -243,7 +244,7 @@ public static TrustProductsEntityAssignmentsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathTrustProductSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchTrustProductsEntityAssignmentsOptions(pathTrustProductSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -280,10 +281,10 @@ public static ResourceSet Read(ReadTrust /// Read TrustProductsEntityAssignments parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsEntityAssignments - public static async System.Threading.Tasks.Task> ReadAsync(ReadTrustProductsEntityAssignmentsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTrustProductsEntityAssignmentsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -323,7 +324,7 @@ public static async System.Threading.Tasks.Task Create TrustProductsEvaluations parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsEvaluations - public static async System.Threading.Tasks.Task CreateAsync(CreateTrustProductsEvaluationsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTrustProductsEvaluationsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -115,7 +115,7 @@ public static async System.Threading.Tasks.Task Fetch TrustProductsEvaluations parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsEvaluations - public static async System.Threading.Tasks.Task FetchAsync(FetchTrustProductsEvaluationsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTrustProductsEvaluationsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -184,7 +184,7 @@ public static TrustProductsEvaluationsResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathTrustProductSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchTrustProductsEvaluationsOptions(pathTrustProductSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -221,10 +221,10 @@ public static ResourceSet Read(ReadTrustProduc /// Read TrustProductsEvaluations parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProductsEvaluations - public static async System.Threading.Tasks.Task> ReadAsync(ReadTrustProductsEvaluationsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTrustProductsEvaluationsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -260,7 +260,7 @@ public static async System.Threading.Tasks.Task Create TrustProducts parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProducts - public static async System.Threading.Tasks.Task CreateAsync(CreateTrustProductsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTrustProductsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -124,7 +124,7 @@ public static async System.Threading.Tasks.Task CreateAsy ITwilioRestClient client = null) { var options = new CreateTrustProductsOptions(friendlyName, email, policySid){ StatusCallback = statusCallback }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -165,11 +165,12 @@ public static bool Delete(DeleteTrustProductsOptions options, ITwilioRestClient /// Delete TrustProducts parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProducts - public static async System.Threading.Tasks.Task DeleteAsync(DeleteTrustProductsOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteTrustProductsOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -189,10 +190,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The unique string that we created to identify the Trust Product resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProducts - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteTrustProductsOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -229,10 +230,10 @@ public static TrustProductsResource Fetch(FetchTrustProductsOptions options, ITw /// Fetch TrustProducts parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProducts - public static async System.Threading.Tasks.Task FetchAsync(FetchTrustProductsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchTrustProductsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -253,10 +254,10 @@ public static TrustProductsResource Fetch( /// The unique string that we created to identify the Trust Product resource. /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProducts - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchTrustProductsOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -291,10 +292,10 @@ public static ResourceSet Read(ReadTrustProductsOptions o /// Read TrustProducts parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of TrustProducts - public static async System.Threading.Tasks.Task> ReadAsync(ReadTrustProductsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTrustProductsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("results", response.Content); return new ResourceSet(page, options, client); @@ -338,7 +339,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of TrustProducts #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateTrustProductsOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateTrustProductsOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -472,7 +474,7 @@ public static async System.Threading.Tasks.Task UpdateAsy ITwilioRestClient client = null) { var options = new UpdateTrustProductsOptions(pathSid){ Status = status, StatusCallback = statusCallback, FriendlyName = friendlyName, Email = email }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/FormResource.cs b/src/Twilio/Rest/Verify/V2/FormResource.cs index ecaf897e9..273bf3a8c 100644 --- a/src/Twilio/Rest/Verify/V2/FormResource.cs +++ b/src/Twilio/Rest/Verify/V2/FormResource.cs @@ -79,10 +79,10 @@ public static FormResource Fetch(FetchFormOptions options, ITwilioRestClient cli /// Fetch Form parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Form - public static async System.Threading.Tasks.Task FetchAsync(FetchFormOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFormOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -106,7 +106,7 @@ public static FormResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(FormResource.FormTypesEnum pathFormType, ITwilioRestClient client = null) { var options = new FetchFormOptions(pathFormType){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/SafelistResource.cs b/src/Twilio/Rest/Verify/V2/SafelistResource.cs index d403cfd1f..1146a0788 100644 --- a/src/Twilio/Rest/Verify/V2/SafelistResource.cs +++ b/src/Twilio/Rest/Verify/V2/SafelistResource.cs @@ -66,10 +66,10 @@ public static SafelistResource Create(CreateSafelistOptions options, ITwilioRest /// Create Safelist parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Safelist - public static async System.Threading.Tasks.Task CreateAsync(CreateSafelistOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSafelistOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -96,7 +96,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateSafelistOptions(phoneNumber){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -137,11 +137,12 @@ public static bool Delete(DeleteSafelistOptions options, ITwilioRestClient clien /// Delete Safelist parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Safelist - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSafelistOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSafelistOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -161,10 +162,10 @@ public static bool Delete(string pathPhoneNumber, ITwilioRestClient client = nul /// The phone number to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). /// Client to make requests to Twilio /// Task that resolves to A single instance of Safelist - public static async System.Threading.Tasks.Task DeleteAsync(string pathPhoneNumber, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathPhoneNumber, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteSafelistOptions(pathPhoneNumber) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -201,10 +202,10 @@ public static SafelistResource Fetch(FetchSafelistOptions options, ITwilioRestCl /// Fetch Safelist parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Safelist - public static async System.Threading.Tasks.Task FetchAsync(FetchSafelistOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSafelistOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -225,10 +226,10 @@ public static SafelistResource Fetch( /// The phone number to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). /// Client to make requests to Twilio /// Task that resolves to A single instance of Safelist - public static async System.Threading.Tasks.Task FetchAsync(string pathPhoneNumber, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathPhoneNumber, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchSafelistOptions(pathPhoneNumber){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/AccessTokenResource.cs b/src/Twilio/Rest/Verify/V2/Service/AccessTokenResource.cs index e1302904a..019f32c54 100644 --- a/src/Twilio/Rest/Verify/V2/Service/AccessTokenResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/AccessTokenResource.cs @@ -80,10 +80,10 @@ public static AccessTokenResource Create(CreateAccessTokenOptions options, ITwil /// Create AccessToken parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of AccessToken - public static async System.Threading.Tasks.Task CreateAsync(CreateAccessTokenOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateAccessTokenOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -126,7 +126,7 @@ public static async System.Threading.Tasks.Task CreateAsync ITwilioRestClient client = null) { var options = new CreateAccessTokenOptions(pathServiceSid, identity, factorType){ FactorFriendlyName = factorFriendlyName, Ttl = ttl }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -165,10 +165,10 @@ public static AccessTokenResource Fetch(FetchAccessTokenOptions options, ITwilio /// Fetch AccessToken parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of AccessToken - public static async System.Threading.Tasks.Task FetchAsync(FetchAccessTokenOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchAccessTokenOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -195,7 +195,7 @@ public static AccessTokenResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchAccessTokenOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/Entity/Challenge/NotificationResource.cs b/src/Twilio/Rest/Verify/V2/Service/Entity/Challenge/NotificationResource.cs index 10ac7524f..4ad566aa3 100644 --- a/src/Twilio/Rest/Verify/V2/Service/Entity/Challenge/NotificationResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/Entity/Challenge/NotificationResource.cs @@ -72,10 +72,10 @@ public static NotificationResource Create(CreateNotificationOptions options, ITw /// Create Notification parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Notification - public static async System.Threading.Tasks.Task CreateAsync(CreateNotificationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateNotificationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -114,7 +114,7 @@ public static async System.Threading.Tasks.Task CreateAsyn ITwilioRestClient client = null) { var options = new CreateNotificationOptions(pathServiceSid, pathIdentity, pathChallengeSid){ Ttl = ttl }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeResource.cs b/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeResource.cs index 300a97c01..bf56b2fb5 100644 --- a/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeResource.cs @@ -124,10 +124,10 @@ public static ChallengeResource Create(CreateChallengeOptions options, ITwilioRe /// Create Challenge parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Challenge - public static async System.Threading.Tasks.Task CreateAsync(CreateChallengeOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateChallengeOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -182,7 +182,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateChallengeOptions(pathServiceSid, pathIdentity, factorSid){ ExpirationDate = expirationDate, DetailsMessage = detailsMessage, DetailsFields = detailsFields, HiddenDetails = hiddenDetails, AuthPayload = authPayload }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -223,10 +223,10 @@ public static ChallengeResource Fetch(FetchChallengeOptions options, ITwilioRest /// Fetch Challenge parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Challenge - public static async System.Threading.Tasks.Task FetchAsync(FetchChallengeOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchChallengeOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -256,7 +256,7 @@ public static ChallengeResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathIdentity, string pathSid, ITwilioRestClient client = null) { var options = new FetchChallengeOptions(pathServiceSid, pathIdentity, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -295,10 +295,10 @@ public static ResourceSet Read(ReadChallengeOptions options, /// Read Challenge parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Challenge - public static async System.Threading.Tasks.Task> ReadAsync(ReadChallengeOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadChallengeOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("challenges", response.Content); return new ResourceSet(page, options, client); @@ -350,7 +350,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadChallengeOptions(pathServiceSid, pathIdentity){ FactorSid = factorSid, Status = status, Order = order, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -441,11 +441,12 @@ public static ChallengeResource Update(UpdateChallengeOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of Challenge #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateChallengeOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateChallengeOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -488,7 +489,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateChallengeOptions(pathServiceSid, pathIdentity, pathSid){ AuthPayload = authPayload, Metadata = metadata }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/Entity/FactorResource.cs b/src/Twilio/Rest/Verify/V2/Service/Entity/FactorResource.cs index ebe964a9b..1f4348304 100644 --- a/src/Twilio/Rest/Verify/V2/Service/Entity/FactorResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/Entity/FactorResource.cs @@ -114,11 +114,12 @@ public static bool Delete(DeleteFactorOptions options, ITwilioRestClient client /// Delete Factor parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Factor - public static async System.Threading.Tasks.Task DeleteAsync(DeleteFactorOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteFactorOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -145,7 +146,7 @@ public static bool Delete(string pathServiceSid, string pathIdentity, string pat public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathIdentity, string pathSid, ITwilioRestClient client = null) { var options = new DeleteFactorOptions(pathServiceSid, pathIdentity, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -186,10 +187,10 @@ public static FactorResource Fetch(FetchFactorOptions options, ITwilioRestClient /// Fetch Factor parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Factor - public static async System.Threading.Tasks.Task FetchAsync(FetchFactorOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchFactorOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -219,7 +220,7 @@ public static FactorResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathIdentity, string pathSid, ITwilioRestClient client = null) { var options = new FetchFactorOptions(pathServiceSid, pathIdentity, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -258,10 +259,10 @@ public static ResourceSet Read(ReadFactorOptions options, ITwili /// Read Factor parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Factor - public static async System.Threading.Tasks.Task> ReadAsync(ReadFactorOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadFactorOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("factors", response.Content); return new ResourceSet(page, options, client); @@ -301,7 +302,7 @@ public static async System.Threading.Tasks.Task> Rea ITwilioRestClient client = null) { var options = new ReadFactorOptions(pathServiceSid, pathIdentity){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -392,11 +393,12 @@ public static FactorResource Update(UpdateFactorOptions options, ITwilioRestClie /// Client to make requests to Twilio /// Task that resolves to A single instance of Factor #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateFactorOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateFactorOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -467,7 +469,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateFactorOptions(pathServiceSid, pathIdentity, pathSid){ AuthPayload = authPayload, FriendlyName = friendlyName, ConfigNotificationToken = configNotificationToken, ConfigSdkVersion = configSdkVersion, ConfigTimeStep = configTimeStep, ConfigSkew = configSkew, ConfigCodeLength = configCodeLength, ConfigAlg = configAlg, ConfigNotificationPlatform = configNotificationPlatform }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/Entity/NewFactorResource.cs b/src/Twilio/Rest/Verify/V2/Service/Entity/NewFactorResource.cs index 9c4967d3a..7e5e2feac 100644 --- a/src/Twilio/Rest/Verify/V2/Service/Entity/NewFactorResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/Entity/NewFactorResource.cs @@ -122,10 +122,10 @@ public static NewFactorResource Create(CreateNewFactorOptions options, ITwilioRe /// Create NewFactor parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of NewFactor - public static async System.Threading.Tasks.Task CreateAsync(CreateNewFactorOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateNewFactorOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -212,7 +212,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateNewFactorOptions(pathServiceSid, pathIdentity, friendlyName, factorType){ BindingAlg = bindingAlg, BindingPublicKey = bindingPublicKey, ConfigAppId = configAppId, ConfigNotificationPlatform = configNotificationPlatform, ConfigNotificationToken = configNotificationToken, ConfigSdkVersion = configSdkVersion, BindingSecret = bindingSecret, ConfigTimeStep = configTimeStep, ConfigSkew = configSkew, ConfigCodeLength = configCodeLength, ConfigAlg = configAlg, Metadata = metadata }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/EntityResource.cs b/src/Twilio/Rest/Verify/V2/Service/EntityResource.cs index eddc90569..04fd669f3 100644 --- a/src/Twilio/Rest/Verify/V2/Service/EntityResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/EntityResource.cs @@ -68,10 +68,10 @@ public static EntityResource Create(CreateEntityOptions options, ITwilioRestClie /// Create Entity parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Entity - public static async System.Threading.Tasks.Task CreateAsync(CreateEntityOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateEntityOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -102,7 +102,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateEntityOptions(pathServiceSid, identity){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -145,11 +145,12 @@ public static bool Delete(DeleteEntityOptions options, ITwilioRestClient client /// Delete Entity parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Entity - public static async System.Threading.Tasks.Task DeleteAsync(DeleteEntityOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteEntityOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -174,7 +175,7 @@ public static bool Delete(string pathServiceSid, string pathIdentity, ITwilioRes public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathIdentity, ITwilioRestClient client = null) { var options = new DeleteEntityOptions(pathServiceSid, pathIdentity) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -213,10 +214,10 @@ public static EntityResource Fetch(FetchEntityOptions options, ITwilioRestClient /// Fetch Entity parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Entity - public static async System.Threading.Tasks.Task FetchAsync(FetchEntityOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchEntityOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -243,7 +244,7 @@ public static EntityResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathIdentity, ITwilioRestClient client = null) { var options = new FetchEntityOptions(pathServiceSid, pathIdentity){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -280,10 +281,10 @@ public static ResourceSet Read(ReadEntityOptions options, ITwili /// Read Entity parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Entity - public static async System.Threading.Tasks.Task> ReadAsync(ReadEntityOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadEntityOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("entities", response.Content); return new ResourceSet(page, options, client); @@ -319,7 +320,7 @@ public static async System.Threading.Tasks.Task> Rea ITwilioRestClient client = null) { var options = new ReadEntityOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/MessagingConfigurationResource.cs b/src/Twilio/Rest/Verify/V2/Service/MessagingConfigurationResource.cs index 60b4f4617..3a6dc330e 100644 --- a/src/Twilio/Rest/Verify/V2/Service/MessagingConfigurationResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/MessagingConfigurationResource.cs @@ -68,10 +68,10 @@ public static MessagingConfigurationResource Create(CreateMessagingConfiguration /// Create MessagingConfiguration parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of MessagingConfiguration - public static async System.Threading.Tasks.Task CreateAsync(CreateMessagingConfigurationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateMessagingConfigurationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -106,7 +106,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new CreateMessagingConfigurationOptions(pathServiceSid, country, messagingServiceSid){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -149,11 +149,12 @@ public static bool Delete(DeleteMessagingConfigurationOptions options, ITwilioRe /// Delete MessagingConfiguration parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of MessagingConfiguration - public static async System.Threading.Tasks.Task DeleteAsync(DeleteMessagingConfigurationOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteMessagingConfigurationOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -178,7 +179,7 @@ public static bool Delete(string pathServiceSid, string pathCountry, ITwilioRest public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathCountry, ITwilioRestClient client = null) { var options = new DeleteMessagingConfigurationOptions(pathServiceSid, pathCountry) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -217,10 +218,10 @@ public static MessagingConfigurationResource Fetch(FetchMessagingConfigurationOp /// Fetch MessagingConfiguration parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of MessagingConfiguration - public static async System.Threading.Tasks.Task FetchAsync(FetchMessagingConfigurationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchMessagingConfigurationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -247,7 +248,7 @@ public static MessagingConfigurationResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathCountry, ITwilioRestClient client = null) { var options = new FetchMessagingConfigurationOptions(pathServiceSid, pathCountry){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -284,10 +285,10 @@ public static ResourceSet Read(ReadMessagingConf /// Read MessagingConfiguration parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of MessagingConfiguration - public static async System.Threading.Tasks.Task> ReadAsync(ReadMessagingConfigurationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadMessagingConfigurationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("messaging_configurations", response.Content); return new ResourceSet(page, options, client); @@ -323,7 +324,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of MessagingConfiguration #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateMessagingConfigurationOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateMessagingConfigurationOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -451,7 +453,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new UpdateMessagingConfigurationOptions(pathServiceSid, pathCountry, messagingServiceSid){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/RateLimit/BucketResource.cs b/src/Twilio/Rest/Verify/V2/Service/RateLimit/BucketResource.cs index 90ec228ef..d336d5443 100644 --- a/src/Twilio/Rest/Verify/V2/Service/RateLimit/BucketResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/RateLimit/BucketResource.cs @@ -70,10 +70,10 @@ public static BucketResource Create(CreateBucketOptions options, ITwilioRestClie /// Create Bucket parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Bucket - public static async System.Threading.Tasks.Task CreateAsync(CreateBucketOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateBucketOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -112,7 +112,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateBucketOptions(pathServiceSid, pathRateLimitSid, max, interval){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -157,11 +157,12 @@ public static bool Delete(DeleteBucketOptions options, ITwilioRestClient client /// Delete Bucket parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Bucket - public static async System.Threading.Tasks.Task DeleteAsync(DeleteBucketOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteBucketOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -188,7 +189,7 @@ public static bool Delete(string pathServiceSid, string pathRateLimitSid, string public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathRateLimitSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteBucketOptions(pathServiceSid, pathRateLimitSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -229,10 +230,10 @@ public static BucketResource Fetch(FetchBucketOptions options, ITwilioRestClient /// Fetch Bucket parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Bucket - public static async System.Threading.Tasks.Task FetchAsync(FetchBucketOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchBucketOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -262,7 +263,7 @@ public static BucketResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathRateLimitSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchBucketOptions(pathServiceSid, pathRateLimitSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -301,10 +302,10 @@ public static ResourceSet Read(ReadBucketOptions options, ITwili /// Read Bucket parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Bucket - public static async System.Threading.Tasks.Task> ReadAsync(ReadBucketOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadBucketOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("buckets", response.Content); return new ResourceSet(page, options, client); @@ -344,7 +345,7 @@ public static async System.Threading.Tasks.Task> Rea ITwilioRestClient client = null) { var options = new ReadBucketOptions(pathServiceSid, pathRateLimitSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -435,11 +436,12 @@ public static BucketResource Update(UpdateBucketOptions options, ITwilioRestClie /// Client to make requests to Twilio /// Task that resolves to A single instance of Bucket #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateBucketOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateBucketOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -482,7 +484,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateBucketOptions(pathServiceSid, pathRateLimitSid, pathSid){ Max = max, Interval = interval }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/RateLimitResource.cs b/src/Twilio/Rest/Verify/V2/Service/RateLimitResource.cs index 64ba48162..02e2fbb73 100644 --- a/src/Twilio/Rest/Verify/V2/Service/RateLimitResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/RateLimitResource.cs @@ -68,10 +68,10 @@ public static RateLimitResource Create(CreateRateLimitOptions options, ITwilioRe /// Create RateLimit parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RateLimit - public static async System.Threading.Tasks.Task CreateAsync(CreateRateLimitOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateRateLimitOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -106,7 +106,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateRateLimitOptions(pathServiceSid, uniqueName){ Description = description }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -149,11 +149,12 @@ public static bool Delete(DeleteRateLimitOptions options, ITwilioRestClient clie /// Delete RateLimit parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RateLimit - public static async System.Threading.Tasks.Task DeleteAsync(DeleteRateLimitOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteRateLimitOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -178,7 +179,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteRateLimitOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -217,10 +218,10 @@ public static RateLimitResource Fetch(FetchRateLimitOptions options, ITwilioRest /// Fetch RateLimit parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RateLimit - public static async System.Threading.Tasks.Task FetchAsync(FetchRateLimitOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchRateLimitOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -247,7 +248,7 @@ public static RateLimitResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchRateLimitOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -284,10 +285,10 @@ public static ResourceSet Read(ReadRateLimitOptions options, /// Read RateLimit parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RateLimit - public static async System.Threading.Tasks.Task> ReadAsync(ReadRateLimitOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadRateLimitOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("rate_limits", response.Content); return new ResourceSet(page, options, client); @@ -323,7 +324,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadRateLimitOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -412,11 +413,12 @@ public static RateLimitResource Update(UpdateRateLimitOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of RateLimit #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateRateLimitOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateRateLimitOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -451,7 +453,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateRateLimitOptions(pathServiceSid, pathSid){ Description = description }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/VerificationCheckResource.cs b/src/Twilio/Rest/Verify/V2/Service/VerificationCheckResource.cs index 25d7cac21..8f22a0725 100644 --- a/src/Twilio/Rest/Verify/V2/Service/VerificationCheckResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/VerificationCheckResource.cs @@ -84,10 +84,10 @@ public static VerificationCheckResource Create(CreateVerificationCheckOptions op /// Create VerificationCheck parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of VerificationCheck - public static async System.Threading.Tasks.Task CreateAsync(CreateVerificationCheckOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateVerificationCheckOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -138,7 +138,7 @@ public static async System.Threading.Tasks.Task Creat ITwilioRestClient client = null) { var options = new CreateVerificationCheckOptions(pathServiceSid){ Code = code, To = to, VerificationSid = verificationSid, Amount = amount, Payee = payee, SnaClientToken = snaClientToken }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/VerificationResource.cs b/src/Twilio/Rest/Verify/V2/Service/VerificationResource.cs index 51ddd2a49..ab0ab8ed0 100644 --- a/src/Twilio/Rest/Verify/V2/Service/VerificationResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/VerificationResource.cs @@ -108,10 +108,10 @@ public static VerificationResource Create(CreateVerificationOptions options, ITw /// Create Verification parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Verification - public static async System.Threading.Tasks.Task CreateAsync(CreateVerificationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateVerificationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -210,7 +210,7 @@ public static async System.Threading.Tasks.Task CreateAsyn ITwilioRestClient client = null) { var options = new CreateVerificationOptions(pathServiceSid, to, channel){ CustomFriendlyName = customFriendlyName, CustomMessage = customMessage, SendDigits = sendDigits, Locale = locale, CustomCode = customCode, Amount = amount, Payee = payee, RateLimits = rateLimits, ChannelConfiguration = channelConfiguration, AppHash = appHash, TemplateSid = templateSid, TemplateCustomSubstitutions = templateCustomSubstitutions, DeviceIp = deviceIp, EnableSnaClientToken = enableSnaClientToken, RiskCheck = riskCheck, Tags = tags }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -249,10 +249,10 @@ public static VerificationResource Fetch(FetchVerificationOptions options, ITwil /// Fetch Verification parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Verification - public static async System.Threading.Tasks.Task FetchAsync(FetchVerificationOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchVerificationOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -279,7 +279,7 @@ public static VerificationResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchVerificationOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -319,11 +319,12 @@ public static VerificationResource Update(UpdateVerificationOptions options, ITw /// Client to make requests to Twilio /// Task that resolves to A single instance of Verification #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateVerificationOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateVerificationOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -358,7 +359,7 @@ public static async System.Threading.Tasks.Task UpdateAsyn ITwilioRestClient client = null) { var options = new UpdateVerificationOptions(pathServiceSid, pathSid, status){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/WebhookResource.cs b/src/Twilio/Rest/Verify/V2/Service/WebhookResource.cs index 14b90c636..2597acc24 100644 --- a/src/Twilio/Rest/Verify/V2/Service/WebhookResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/WebhookResource.cs @@ -107,10 +107,10 @@ public static WebhookResource Create(CreateWebhookOptions options, ITwilioRestCl /// Create Webhook parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Webhook - public static async System.Threading.Tasks.Task CreateAsync(CreateWebhookOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateWebhookOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -157,7 +157,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateWebhookOptions(pathServiceSid, friendlyName, eventTypes, webhookUrl){ Status = status, Version = version }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -200,11 +200,12 @@ public static bool Delete(DeleteWebhookOptions options, ITwilioRestClient client /// Delete Webhook parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Webhook - public static async System.Threading.Tasks.Task DeleteAsync(DeleteWebhookOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteWebhookOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -229,7 +230,7 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteWebhookOptions(pathServiceSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -268,10 +269,10 @@ public static WebhookResource Fetch(FetchWebhookOptions options, ITwilioRestClie /// Fetch Webhook parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Webhook - public static async System.Threading.Tasks.Task FetchAsync(FetchWebhookOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchWebhookOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -298,7 +299,7 @@ public static WebhookResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchWebhookOptions(pathServiceSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -335,10 +336,10 @@ public static ResourceSet Read(ReadWebhookOptions options, ITwi /// Read Webhook parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Webhook - public static async System.Threading.Tasks.Task> ReadAsync(ReadWebhookOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadWebhookOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("webhooks", response.Content); return new ResourceSet(page, options, client); @@ -374,7 +375,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadWebhookOptions(pathServiceSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -463,11 +464,12 @@ public static WebhookResource Update(UpdateWebhookOptions options, ITwilioRestCl /// Client to make requests to Twilio /// Task that resolves to A single instance of Webhook #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateWebhookOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateWebhookOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -518,7 +520,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateWebhookOptions(pathServiceSid, pathSid){ FriendlyName = friendlyName, EventTypes = eventTypes, WebhookUrl = webhookUrl, Status = status, Version = version }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/ServiceResource.cs b/src/Twilio/Rest/Verify/V2/ServiceResource.cs index 040d9d153..e9aabd7f2 100644 --- a/src/Twilio/Rest/Verify/V2/ServiceResource.cs +++ b/src/Twilio/Rest/Verify/V2/ServiceResource.cs @@ -66,10 +66,10 @@ public static ServiceResource Create(CreateServiceOptions options, ITwilioRestCl /// Create Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task CreateAsync(CreateServiceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateServiceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -172,7 +172,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateServiceOptions(friendlyName){ CodeLength = codeLength, LookupEnabled = lookupEnabled, SkipSmsToLandlines = skipSmsToLandlines, DtmfInputRequired = dtmfInputRequired, TtsName = ttsName, Psd2Enabled = psd2Enabled, DoNotShareWarningEnabled = doNotShareWarningEnabled, CustomCodeEnabled = customCodeEnabled, PushIncludeDate = pushIncludeDate, PushApnCredentialSid = pushApnCredentialSid, PushFcmCredentialSid = pushFcmCredentialSid, TotpIssuer = totpIssuer, TotpTimeStep = totpTimeStep, TotpCodeLength = totpCodeLength, TotpSkew = totpSkew, DefaultTemplateSid = defaultTemplateSid, WhatsappMsgServiceSid = whatsappMsgServiceSid, WhatsappFrom = whatsappFrom, VerifyEventSubscriptionEnabled = verifyEventSubscriptionEnabled }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -213,11 +213,12 @@ public static bool Delete(DeleteServiceOptions options, ITwilioRestClient client /// Delete Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task DeleteAsync(DeleteServiceOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteServiceOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -237,10 +238,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The Twilio-provided string that uniquely identifies the Verification Service resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteServiceOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -277,10 +278,10 @@ public static ServiceResource Fetch(FetchServiceOptions options, ITwilioRestClie /// Fetch Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task FetchAsync(FetchServiceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchServiceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -301,10 +302,10 @@ public static ServiceResource Fetch( /// The Twilio-provided string that uniquely identifies the Verification Service resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchServiceOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -339,10 +340,10 @@ public static ResourceSet Read(ReadServiceOptions options, ITwi /// Read Service parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Service - public static async System.Threading.Tasks.Task> ReadAsync(ReadServiceOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadServiceOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("services", response.Content); return new ResourceSet(page, options, client); @@ -374,7 +375,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadServiceOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -461,11 +462,12 @@ public static ServiceResource Update(UpdateServiceOptions options, ITwilioRestCl /// Client to make requests to Twilio /// Task that resolves to A single instance of Service #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateServiceOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateServiceOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -572,7 +574,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateServiceOptions(pathSid){ FriendlyName = friendlyName, CodeLength = codeLength, LookupEnabled = lookupEnabled, SkipSmsToLandlines = skipSmsToLandlines, DtmfInputRequired = dtmfInputRequired, TtsName = ttsName, Psd2Enabled = psd2Enabled, DoNotShareWarningEnabled = doNotShareWarningEnabled, CustomCodeEnabled = customCodeEnabled, PushIncludeDate = pushIncludeDate, PushApnCredentialSid = pushApnCredentialSid, PushFcmCredentialSid = pushFcmCredentialSid, TotpIssuer = totpIssuer, TotpTimeStep = totpTimeStep, TotpCodeLength = totpCodeLength, TotpSkew = totpSkew, DefaultTemplateSid = defaultTemplateSid, WhatsappMsgServiceSid = whatsappMsgServiceSid, WhatsappFrom = whatsappFrom, VerifyEventSubscriptionEnabled = verifyEventSubscriptionEnabled }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/TemplateResource.cs b/src/Twilio/Rest/Verify/V2/TemplateResource.cs index 2d0fdbe23..9c9539e79 100644 --- a/src/Twilio/Rest/Verify/V2/TemplateResource.cs +++ b/src/Twilio/Rest/Verify/V2/TemplateResource.cs @@ -65,10 +65,10 @@ public static ResourceSet Read(ReadTemplateOptions options, IT /// Read Template parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Template - public static async System.Threading.Tasks.Task> ReadAsync(ReadTemplateOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadTemplateOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("templates", response.Content); return new ResourceSet(page, options, client); @@ -104,7 +104,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadTemplateOptions(){ FriendlyName = friendlyName, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Verify/V2/VerificationAttemptResource.cs b/src/Twilio/Rest/Verify/V2/VerificationAttemptResource.cs index 30ed34d8e..14e9fcd62 100644 --- a/src/Twilio/Rest/Verify/V2/VerificationAttemptResource.cs +++ b/src/Twilio/Rest/Verify/V2/VerificationAttemptResource.cs @@ -95,10 +95,10 @@ public static VerificationAttemptResource Fetch(FetchVerificationAttemptOptions /// Fetch VerificationAttempt parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of VerificationAttempt - public static async System.Threading.Tasks.Task FetchAsync(FetchVerificationAttemptOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchVerificationAttemptOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -119,10 +119,10 @@ public static VerificationAttemptResource Fetch( /// The unique SID identifier of a Verification Attempt /// Client to make requests to Twilio /// Task that resolves to A single instance of VerificationAttempt - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchVerificationAttemptOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -157,10 +157,10 @@ public static ResourceSet Read(ReadVerificationAtte /// Read VerificationAttempt parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of VerificationAttempt - public static async System.Threading.Tasks.Task> ReadAsync(ReadVerificationAttemptOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadVerificationAttemptOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("attempts", response.Content); return new ResourceSet(page, options, client); @@ -224,7 +224,7 @@ public static async System.Threading.Tasks.Task Fetch VerificationAttemptsSummary parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of VerificationAttemptsSummary - public static async System.Threading.Tasks.Task FetchAsync(FetchVerificationAttemptsSummaryOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchVerificationAttemptsSummaryOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -121,7 +121,7 @@ public static VerificationAttemptsSummaryResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string verifyServiceSid = null, DateTime? dateCreatedAfter = null, DateTime? dateCreatedBefore = null, string country = null, VerificationAttemptsSummaryResource.ChannelsEnum channel = null, string destinationPrefix = null, ITwilioRestClient client = null) { var options = new FetchVerificationAttemptsSummaryOptions(){ VerifyServiceSid = verifyServiceSid,DateCreatedAfter = dateCreatedAfter,DateCreatedBefore = dateCreatedBefore,Country = country,Channel = channel,DestinationPrefix = destinationPrefix }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/CompositionHookResource.cs b/src/Twilio/Rest/Video/V1/CompositionHookResource.cs index 8491b7caa..db59b3b82 100644 --- a/src/Twilio/Rest/Video/V1/CompositionHookResource.cs +++ b/src/Twilio/Rest/Video/V1/CompositionHookResource.cs @@ -79,10 +79,10 @@ public static CompositionHookResource Create(CreateCompositionHookOptions option /// Create CompositionHook parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CompositionHook - public static async System.Threading.Tasks.Task CreateAsync(CreateCompositionHookOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateCompositionHookOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -145,7 +145,7 @@ public static async System.Threading.Tasks.Task CreateA ITwilioRestClient client = null) { var options = new CreateCompositionHookOptions(friendlyName){ Enabled = enabled, VideoLayout = videoLayout, AudioSources = audioSources, AudioSourcesExcluded = audioSourcesExcluded, Resolution = resolution, Format = format, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, Trim = trim }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -186,11 +186,12 @@ public static bool Delete(DeleteCompositionHookOptions options, ITwilioRestClien /// Delete CompositionHook parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CompositionHook - public static async System.Threading.Tasks.Task DeleteAsync(DeleteCompositionHookOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteCompositionHookOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -210,10 +211,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID of the CompositionHook resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of CompositionHook - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteCompositionHookOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -250,10 +251,10 @@ public static CompositionHookResource Fetch(FetchCompositionHookOptions options, /// Fetch CompositionHook parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CompositionHook - public static async System.Threading.Tasks.Task FetchAsync(FetchCompositionHookOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCompositionHookOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -274,10 +275,10 @@ public static CompositionHookResource Fetch( /// The SID of the CompositionHook resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of CompositionHook - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchCompositionHookOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -312,10 +313,10 @@ public static ResourceSet Read(ReadCompositionHookOptio /// Read CompositionHook parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CompositionHook - public static async System.Threading.Tasks.Task> ReadAsync(ReadCompositionHookOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadCompositionHookOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("composition_hooks", response.Content); return new ResourceSet(page, options, client); @@ -363,7 +364,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of CompositionHook #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateCompositionHookOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateCompositionHookOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -521,7 +523,7 @@ public static async System.Threading.Tasks.Task UpdateA ITwilioRestClient client = null) { var options = new UpdateCompositionHookOptions(pathSid, friendlyName){ Enabled = enabled, VideoLayout = videoLayout, AudioSources = audioSources, AudioSourcesExcluded = audioSourcesExcluded, Trim = trim, Format = format, Resolution = resolution, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/CompositionResource.cs b/src/Twilio/Rest/Video/V1/CompositionResource.cs index e2e40ed65..94a99f3cd 100644 --- a/src/Twilio/Rest/Video/V1/CompositionResource.cs +++ b/src/Twilio/Rest/Video/V1/CompositionResource.cs @@ -95,10 +95,10 @@ public static CompositionResource Create(CreateCompositionOptions options, ITwil /// Create Composition parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Composition - public static async System.Threading.Tasks.Task CreateAsync(CreateCompositionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateCompositionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -157,7 +157,7 @@ public static async System.Threading.Tasks.Task CreateAsync ITwilioRestClient client = null) { var options = new CreateCompositionOptions(roomSid){ VideoLayout = videoLayout, AudioSources = audioSources, AudioSourcesExcluded = audioSourcesExcluded, Resolution = resolution, Format = format, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, Trim = trim }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -198,11 +198,12 @@ public static bool Delete(DeleteCompositionOptions options, ITwilioRestClient cl /// Delete Composition parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Composition - public static async System.Threading.Tasks.Task DeleteAsync(DeleteCompositionOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteCompositionOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -222,10 +223,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID of the Composition resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Composition - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteCompositionOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -262,10 +263,10 @@ public static CompositionResource Fetch(FetchCompositionOptions options, ITwilio /// Fetch Composition parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Composition - public static async System.Threading.Tasks.Task FetchAsync(FetchCompositionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCompositionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -286,10 +287,10 @@ public static CompositionResource Fetch( /// The SID of the Composition resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Composition - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchCompositionOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -324,10 +325,10 @@ public static ResourceSet Read(ReadCompositionOptions optio /// Read Composition parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Composition - public static async System.Threading.Tasks.Task> ReadAsync(ReadCompositionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadCompositionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("compositions", response.Content); return new ResourceSet(page, options, client); @@ -375,7 +376,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadCompositionOptions(){ Status = status, DateCreatedAfter = dateCreatedAfter, DateCreatedBefore = dateCreatedBefore, RoomSid = roomSid, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/CompositionSettingsResource.cs b/src/Twilio/Rest/Video/V1/CompositionSettingsResource.cs index 1745f6fe3..4cd16f9f7 100644 --- a/src/Twilio/Rest/Video/V1/CompositionSettingsResource.cs +++ b/src/Twilio/Rest/Video/V1/CompositionSettingsResource.cs @@ -66,10 +66,10 @@ public static CompositionSettingsResource Create(CreateCompositionSettingsOption /// Create CompositionSettings parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CompositionSettings - public static async System.Threading.Tasks.Task CreateAsync(CreateCompositionSettingsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateCompositionSettingsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -116,7 +116,7 @@ public static async System.Threading.Tasks.Task Cre ITwilioRestClient client = null) { var options = new CreateCompositionSettingsOptions(friendlyName){ AwsCredentialsSid = awsCredentialsSid, EncryptionKeySid = encryptionKeySid, AwsS3Url = awsS3Url, AwsStorageEnabled = awsStorageEnabled, EncryptionEnabled = encryptionEnabled }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -151,10 +151,10 @@ public static CompositionSettingsResource Fetch(FetchCompositionSettingsOptions /// Fetch CompositionSettings parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of CompositionSettings - public static async System.Threading.Tasks.Task FetchAsync(FetchCompositionSettingsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCompositionSettingsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -172,10 +172,10 @@ public static CompositionSettingsResource Fetch( /// fetch /// Client to make requests to Twilio /// Task that resolves to A single instance of CompositionSettings - public static async System.Threading.Tasks.Task FetchAsync(ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchCompositionSettingsOptions(){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/RecordingResource.cs b/src/Twilio/Rest/Video/V1/RecordingResource.cs index 215e52390..b06451fc1 100644 --- a/src/Twilio/Rest/Video/V1/RecordingResource.cs +++ b/src/Twilio/Rest/Video/V1/RecordingResource.cs @@ -128,11 +128,12 @@ public static bool Delete(DeleteRecordingOptions options, ITwilioRestClient clie /// Delete Recording parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Recording - public static async System.Threading.Tasks.Task DeleteAsync(DeleteRecordingOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteRecordingOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -152,10 +153,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID of the Recording resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Recording - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteRecordingOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -192,10 +193,10 @@ public static RecordingResource Fetch(FetchRecordingOptions options, ITwilioRest /// Fetch Recording parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Recording - public static async System.Threading.Tasks.Task FetchAsync(FetchRecordingOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchRecordingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -216,10 +217,10 @@ public static RecordingResource Fetch( /// The SID of the Recording resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Recording - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchRecordingOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -254,10 +255,10 @@ public static ResourceSet Read(ReadRecordingOptions options, /// Read Recording parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Recording - public static async System.Threading.Tasks.Task> ReadAsync(ReadRecordingOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadRecordingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("recordings", response.Content); return new ResourceSet(page, options, client); @@ -313,7 +314,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadRecordingOptions(){ Status = status, SourceSid = sourceSid, GroupingSid = groupingSid, DateCreatedAfter = dateCreatedAfter, DateCreatedBefore = dateCreatedBefore, MediaType = mediaType, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/RecordingSettingsResource.cs b/src/Twilio/Rest/Video/V1/RecordingSettingsResource.cs index 1a922eb7e..7df052e0f 100644 --- a/src/Twilio/Rest/Video/V1/RecordingSettingsResource.cs +++ b/src/Twilio/Rest/Video/V1/RecordingSettingsResource.cs @@ -66,10 +66,10 @@ public static RecordingSettingsResource Create(CreateRecordingSettingsOptions op /// Create RecordingSettings parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RecordingSettings - public static async System.Threading.Tasks.Task CreateAsync(CreateRecordingSettingsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateRecordingSettingsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -116,7 +116,7 @@ public static async System.Threading.Tasks.Task Creat ITwilioRestClient client = null) { var options = new CreateRecordingSettingsOptions(friendlyName){ AwsCredentialsSid = awsCredentialsSid, EncryptionKeySid = encryptionKeySid, AwsS3Url = awsS3Url, AwsStorageEnabled = awsStorageEnabled, EncryptionEnabled = encryptionEnabled }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -151,10 +151,10 @@ public static RecordingSettingsResource Fetch(FetchRecordingSettingsOptions opti /// Fetch RecordingSettings parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RecordingSettings - public static async System.Threading.Tasks.Task FetchAsync(FetchRecordingSettingsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchRecordingSettingsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -172,10 +172,10 @@ public static RecordingSettingsResource Fetch( /// fetch /// Client to make requests to Twilio /// Task that resolves to A single instance of RecordingSettings - public static async System.Threading.Tasks.Task FetchAsync(ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchRecordingSettingsOptions(){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/Room/Participant/AnonymizeResource.cs b/src/Twilio/Rest/Video/V1/Room/Participant/AnonymizeResource.cs index 7e93fe425..456b59647 100644 --- a/src/Twilio/Rest/Video/V1/Room/Participant/AnonymizeResource.cs +++ b/src/Twilio/Rest/Video/V1/Room/Participant/AnonymizeResource.cs @@ -83,11 +83,12 @@ public static AnonymizeResource Update(UpdateAnonymizeOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of Anonymize #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateAnonymizeOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateAnonymizeOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -118,7 +119,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateAnonymizeOptions(pathRoomSid, pathSid){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/Room/Participant/PublishedTrackResource.cs b/src/Twilio/Rest/Video/V1/Room/Participant/PublishedTrackResource.cs index 9e0ed3f97..c02553627 100644 --- a/src/Twilio/Rest/Video/V1/Room/Participant/PublishedTrackResource.cs +++ b/src/Twilio/Rest/Video/V1/Room/Participant/PublishedTrackResource.cs @@ -85,10 +85,10 @@ public static PublishedTrackResource Fetch(FetchPublishedTrackOptions options, I /// Fetch PublishedTrack parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of PublishedTrack - public static async System.Threading.Tasks.Task FetchAsync(FetchPublishedTrackOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchPublishedTrackOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -118,7 +118,7 @@ public static PublishedTrackResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathRoomSid, string pathParticipantSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchPublishedTrackOptions(pathRoomSid, pathParticipantSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -157,10 +157,10 @@ public static ResourceSet Read(ReadPublishedTrackOptions /// Read PublishedTrack parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of PublishedTrack - public static async System.Threading.Tasks.Task> ReadAsync(ReadPublishedTrackOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadPublishedTrackOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("published_tracks", response.Content); return new ResourceSet(page, options, client); @@ -200,7 +200,7 @@ public static async System.Threading.Tasks.Task Fetch SubscribeRules parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SubscribeRules - public static async System.Threading.Tasks.Task FetchAsync(FetchSubscribeRulesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSubscribeRulesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -99,7 +99,7 @@ public static SubscribeRulesResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathRoomSid, string pathParticipantSid, ITwilioRestClient client = null) { var options = new FetchSubscribeRulesOptions(pathRoomSid, pathParticipantSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -139,11 +139,12 @@ public static SubscribeRulesResource Update(UpdateSubscribeRulesOptions options, /// Client to make requests to Twilio /// Task that resolves to A single instance of SubscribeRules #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSubscribeRulesOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSubscribeRulesOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -178,7 +179,7 @@ public static async System.Threading.Tasks.Task UpdateAs ITwilioRestClient client = null) { var options = new UpdateSubscribeRulesOptions(pathRoomSid, pathParticipantSid){ Rules = rules }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackResource.cs b/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackResource.cs index 5ff832175..0cf4b351b 100644 --- a/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackResource.cs +++ b/src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackResource.cs @@ -85,10 +85,10 @@ public static SubscribedTrackResource Fetch(FetchSubscribedTrackOptions options, /// Fetch SubscribedTrack parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SubscribedTrack - public static async System.Threading.Tasks.Task FetchAsync(FetchSubscribedTrackOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSubscribedTrackOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -118,7 +118,7 @@ public static SubscribedTrackResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathRoomSid, string pathParticipantSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchSubscribedTrackOptions(pathRoomSid, pathParticipantSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -157,10 +157,10 @@ public static ResourceSet Read(ReadSubscribedTrackOptio /// Read SubscribedTrack parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SubscribedTrack - public static async System.Threading.Tasks.Task> ReadAsync(ReadSubscribedTrackOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSubscribedTrackOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("subscribed_tracks", response.Content); return new ResourceSet(page, options, client); @@ -200,7 +200,7 @@ public static async System.Threading.Tasks.Task Fetch Participant parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Participant - public static async System.Threading.Tasks.Task FetchAsync(FetchParticipantOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchParticipantOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -112,7 +112,7 @@ public static ParticipantResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathRoomSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchParticipantOptions(pathRoomSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -149,10 +149,10 @@ public static ResourceSet Read(ReadParticipantOptions optio /// Read Participant parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Participant - public static async System.Threading.Tasks.Task> ReadAsync(ReadParticipantOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadParticipantOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("participants", response.Content); return new ResourceSet(page, options, client); @@ -204,7 +204,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadParticipantOptions(pathRoomSid){ Status = status, Identity = identity, DateCreatedAfter = dateCreatedAfter, DateCreatedBefore = dateCreatedBefore, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -293,11 +293,12 @@ public static ParticipantResource Update(UpdateParticipantOptions options, ITwil /// Client to make requests to Twilio /// Task that resolves to A single instance of Participant #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateParticipantOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateParticipantOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -332,7 +333,7 @@ public static async System.Threading.Tasks.Task UpdateAsync ITwilioRestClient client = null) { var options = new UpdateParticipantOptions(pathRoomSid, pathSid){ Status = status }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/Room/RecordingRulesResource.cs b/src/Twilio/Rest/Video/V1/Room/RecordingRulesResource.cs index ed2ff0b80..f885a248d 100644 --- a/src/Twilio/Rest/Video/V1/Room/RecordingRulesResource.cs +++ b/src/Twilio/Rest/Video/V1/Room/RecordingRulesResource.cs @@ -67,10 +67,10 @@ public static RecordingRulesResource Fetch(FetchRecordingRulesOptions options, I /// Fetch RecordingRules parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RecordingRules - public static async System.Threading.Tasks.Task FetchAsync(FetchRecordingRulesOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchRecordingRulesOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static RecordingRulesResource Fetch( /// The SID of the Room resource where the recording rules to fetch apply. /// Client to make requests to Twilio /// Task that resolves to A single instance of RecordingRules - public static async System.Threading.Tasks.Task FetchAsync(string pathRoomSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathRoomSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchRecordingRulesOptions(pathRoomSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -132,11 +132,12 @@ public static RecordingRulesResource Update(UpdateRecordingRulesOptions options, /// Client to make requests to Twilio /// Task that resolves to A single instance of RecordingRules #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateRecordingRulesOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateRecordingRulesOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -167,7 +168,7 @@ public static async System.Threading.Tasks.Task UpdateAs ITwilioRestClient client = null) { var options = new UpdateRecordingRulesOptions(pathRoomSid){ Rules = rules }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Video/V1/Room/RoomRecordingResource.cs b/src/Twilio/Rest/Video/V1/Room/RoomRecordingResource.cs index 90b183228..80e16062a 100644 --- a/src/Twilio/Rest/Video/V1/Room/RoomRecordingResource.cs +++ b/src/Twilio/Rest/Video/V1/Room/RoomRecordingResource.cs @@ -130,11 +130,12 @@ public static bool Delete(DeleteRoomRecordingOptions options, ITwilioRestClient /// Delete RoomRecording parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RoomRecording - public static async System.Threading.Tasks.Task DeleteAsync(DeleteRoomRecordingOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteRoomRecordingOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -159,7 +160,7 @@ public static bool Delete(string pathRoomSid, string pathSid, ITwilioRestClient public static async System.Threading.Tasks.Task DeleteAsync(string pathRoomSid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteRoomRecordingOptions(pathRoomSid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -198,10 +199,10 @@ public static RoomRecordingResource Fetch(FetchRoomRecordingOptions options, ITw /// Fetch RoomRecording parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RoomRecording - public static async System.Threading.Tasks.Task FetchAsync(FetchRoomRecordingOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchRoomRecordingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -228,7 +229,7 @@ public static RoomRecordingResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathRoomSid, string pathSid, ITwilioRestClient client = null) { var options = new FetchRoomRecordingOptions(pathRoomSid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -265,10 +266,10 @@ public static ResourceSet Read(ReadRoomRecordingOptions o /// Read RoomRecording parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RoomRecording - public static async System.Threading.Tasks.Task> ReadAsync(ReadRoomRecordingOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadRoomRecordingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("recordings", response.Content); return new ResourceSet(page, options, client); @@ -320,7 +321,7 @@ public static async System.Threading.Tasks.Task Create Room parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Room - public static async System.Threading.Tasks.Task CreateAsync(CreateRoomOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateRoomOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -194,7 +194,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateRoomOptions(){ EnableTurn = enableTurn, Type = type, UniqueName = uniqueName, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, MaxParticipants = maxParticipants, RecordParticipantsOnConnect = recordParticipantsOnConnect, VideoCodecs = videoCodecs, MediaRegion = mediaRegion, RecordingRules = recordingRules, AudioOnly = audioOnly, MaxParticipantDuration = maxParticipantDuration, EmptyRoomTimeout = emptyRoomTimeout, UnusedRoomTimeout = unusedRoomTimeout, LargeRoom = largeRoom }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -231,10 +231,10 @@ public static RoomResource Fetch(FetchRoomOptions options, ITwilioRestClient cli /// Fetch Room parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Room - public static async System.Threading.Tasks.Task FetchAsync(FetchRoomOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchRoomOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -255,10 +255,10 @@ public static RoomResource Fetch( /// The SID of the Room resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Room - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchRoomOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -293,10 +293,10 @@ public static ResourceSet Read(ReadRoomOptions options, ITwilioRes /// Read Room parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Room - public static async System.Threading.Tasks.Task> ReadAsync(ReadRoomOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadRoomOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("rooms", response.Content); return new ResourceSet(page, options, client); @@ -344,7 +344,7 @@ public static async System.Threading.Tasks.Task> ReadA ITwilioRestClient client = null) { var options = new ReadRoomOptions(){ Status = status, UniqueName = uniqueName, DateCreatedAfter = dateCreatedAfter, DateCreatedBefore = dateCreatedBefore, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -431,11 +431,12 @@ public static RoomResource Update(UpdateRoomOptions options, ITwilioRestClient c /// Client to make requests to Twilio /// Task that resolves to A single instance of Room #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateRoomOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateRoomOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -466,7 +467,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateRoomOptions(pathSid, status){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Voice/V1/ArchivedCallResource.cs b/src/Twilio/Rest/Voice/V1/ArchivedCallResource.cs index 2e4c4f419..86399e984 100644 --- a/src/Twilio/Rest/Voice/V1/ArchivedCallResource.cs +++ b/src/Twilio/Rest/Voice/V1/ArchivedCallResource.cs @@ -73,11 +73,12 @@ public static bool Delete(DeleteArchivedCallOptions options, ITwilioRestClient c /// Delete ArchivedCall parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ArchivedCall - public static async System.Threading.Tasks.Task DeleteAsync(DeleteArchivedCallOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteArchivedCallOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -102,7 +103,7 @@ public static bool Delete(DateTime? pathDate, string pathSid, ITwilioRestClient public static async System.Threading.Tasks.Task DeleteAsync(DateTime? pathDate, string pathSid, ITwilioRestClient client = null) { var options = new DeleteArchivedCallOptions(pathDate, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Voice/V1/ByocTrunkResource.cs b/src/Twilio/Rest/Voice/V1/ByocTrunkResource.cs index b104f0397..190f44372 100644 --- a/src/Twilio/Rest/Voice/V1/ByocTrunkResource.cs +++ b/src/Twilio/Rest/Voice/V1/ByocTrunkResource.cs @@ -66,10 +66,10 @@ public static ByocTrunkResource Create(CreateByocTrunkOptions options, ITwilioRe /// Create ByocTrunk parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ByocTrunk - public static async System.Threading.Tasks.Task CreateAsync(CreateByocTrunkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateByocTrunkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -132,7 +132,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateByocTrunkOptions(){ FriendlyName = friendlyName, VoiceUrl = voiceUrl, VoiceMethod = voiceMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceFallbackMethod = voiceFallbackMethod, StatusCallbackUrl = statusCallbackUrl, StatusCallbackMethod = statusCallbackMethod, CnamLookupEnabled = cnamLookupEnabled, ConnectionPolicySid = connectionPolicySid, FromDomainSid = fromDomainSid }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -173,11 +173,12 @@ public static bool Delete(DeleteByocTrunkOptions options, ITwilioRestClient clie /// Delete ByocTrunk parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ByocTrunk - public static async System.Threading.Tasks.Task DeleteAsync(DeleteByocTrunkOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteByocTrunkOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -197,10 +198,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The Twilio-provided string that uniquely identifies the BYOC Trunk resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of ByocTrunk - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteByocTrunkOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -237,10 +238,10 @@ public static ByocTrunkResource Fetch(FetchByocTrunkOptions options, ITwilioRest /// Fetch ByocTrunk parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ByocTrunk - public static async System.Threading.Tasks.Task FetchAsync(FetchByocTrunkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchByocTrunkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -261,10 +262,10 @@ public static ByocTrunkResource Fetch( /// The Twilio-provided string that uniquely identifies the BYOC Trunk resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of ByocTrunk - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchByocTrunkOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -299,10 +300,10 @@ public static ResourceSet Read(ReadByocTrunkOptions options, /// Read ByocTrunk parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ByocTrunk - public static async System.Threading.Tasks.Task> ReadAsync(ReadByocTrunkOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadByocTrunkOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("byoc_trunks", response.Content); return new ResourceSet(page, options, client); @@ -334,7 +335,7 @@ public static async System.Threading.Tasks.Task> ITwilioRestClient client = null) { var options = new ReadByocTrunkOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -421,11 +422,12 @@ public static ByocTrunkResource Update(UpdateByocTrunkOptions options, ITwilioRe /// Client to make requests to Twilio /// Task that resolves to A single instance of ByocTrunk #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateByocTrunkOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateByocTrunkOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -492,7 +494,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateByocTrunkOptions(pathSid){ FriendlyName = friendlyName, VoiceUrl = voiceUrl, VoiceMethod = voiceMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceFallbackMethod = voiceFallbackMethod, StatusCallbackUrl = statusCallbackUrl, StatusCallbackMethod = statusCallbackMethod, CnamLookupEnabled = cnamLookupEnabled, ConnectionPolicySid = connectionPolicySid, FromDomainSid = fromDomainSid }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTargetResource.cs b/src/Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTargetResource.cs index 58f495222..7215145f5 100644 --- a/src/Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTargetResource.cs +++ b/src/Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTargetResource.cs @@ -68,10 +68,10 @@ public static ConnectionPolicyTargetResource Create(CreateConnectionPolicyTarget /// Create ConnectionPolicyTarget parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicyTarget - public static async System.Threading.Tasks.Task CreateAsync(CreateConnectionPolicyTargetOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateConnectionPolicyTargetOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -118,7 +118,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new CreateConnectionPolicyTargetOptions(pathConnectionPolicySid, target){ FriendlyName = friendlyName, Priority = priority, Weight = weight, Enabled = enabled }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -161,11 +161,12 @@ public static bool Delete(DeleteConnectionPolicyTargetOptions options, ITwilioRe /// Delete ConnectionPolicyTarget parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicyTarget - public static async System.Threading.Tasks.Task DeleteAsync(DeleteConnectionPolicyTargetOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteConnectionPolicyTargetOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -190,7 +191,7 @@ public static bool Delete(string pathConnectionPolicySid, string pathSid, ITwili public static async System.Threading.Tasks.Task DeleteAsync(string pathConnectionPolicySid, string pathSid, ITwilioRestClient client = null) { var options = new DeleteConnectionPolicyTargetOptions(pathConnectionPolicySid, pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -229,10 +230,10 @@ public static ConnectionPolicyTargetResource Fetch(FetchConnectionPolicyTargetOp /// Fetch ConnectionPolicyTarget parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicyTarget - public static async System.Threading.Tasks.Task FetchAsync(FetchConnectionPolicyTargetOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchConnectionPolicyTargetOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -259,7 +260,7 @@ public static ConnectionPolicyTargetResource Fetch( public static async System.Threading.Tasks.Task FetchAsync(string pathConnectionPolicySid, string pathSid, ITwilioRestClient client = null) { var options = new FetchConnectionPolicyTargetOptions(pathConnectionPolicySid, pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -296,10 +297,10 @@ public static ResourceSet Read(ReadConnectionPol /// Read ConnectionPolicyTarget parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicyTarget - public static async System.Threading.Tasks.Task> ReadAsync(ReadConnectionPolicyTargetOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadConnectionPolicyTargetOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("targets", response.Content); return new ResourceSet(page, options, client); @@ -335,7 +336,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicyTarget #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateConnectionPolicyTargetOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateConnectionPolicyTargetOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -479,7 +481,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new UpdateConnectionPolicyTargetOptions(pathConnectionPolicySid, pathSid){ FriendlyName = friendlyName, Target = target, Priority = priority, Weight = weight, Enabled = enabled }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Voice/V1/ConnectionPolicyResource.cs b/src/Twilio/Rest/Voice/V1/ConnectionPolicyResource.cs index 12d20ec61..82268922b 100644 --- a/src/Twilio/Rest/Voice/V1/ConnectionPolicyResource.cs +++ b/src/Twilio/Rest/Voice/V1/ConnectionPolicyResource.cs @@ -66,10 +66,10 @@ public static ConnectionPolicyResource Create(CreateConnectionPolicyOptions opti /// Create ConnectionPolicy parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicy - public static async System.Threading.Tasks.Task CreateAsync(CreateConnectionPolicyOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateConnectionPolicyOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -96,7 +96,7 @@ public static async System.Threading.Tasks.Task Create ITwilioRestClient client = null) { var options = new CreateConnectionPolicyOptions(){ FriendlyName = friendlyName }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -137,11 +137,12 @@ public static bool Delete(DeleteConnectionPolicyOptions options, ITwilioRestClie /// Delete ConnectionPolicy parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicy - public static async System.Threading.Tasks.Task DeleteAsync(DeleteConnectionPolicyOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteConnectionPolicyOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -161,10 +162,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The unique string that we created to identify the Connection Policy resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicy - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteConnectionPolicyOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -201,10 +202,10 @@ public static ConnectionPolicyResource Fetch(FetchConnectionPolicyOptions option /// Fetch ConnectionPolicy parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicy - public static async System.Threading.Tasks.Task FetchAsync(FetchConnectionPolicyOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchConnectionPolicyOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -225,10 +226,10 @@ public static ConnectionPolicyResource Fetch( /// The unique string that we created to identify the Connection Policy resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicy - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchConnectionPolicyOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -263,10 +264,10 @@ public static ResourceSet Read(ReadConnectionPolicyOpt /// Read ConnectionPolicy parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicy - public static async System.Threading.Tasks.Task> ReadAsync(ReadConnectionPolicyOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadConnectionPolicyOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("connection_policies", response.Content); return new ResourceSet(page, options, client); @@ -298,7 +299,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of ConnectionPolicy #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateConnectionPolicyOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateConnectionPolicyOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -420,7 +422,7 @@ public static async System.Threading.Tasks.Task Update ITwilioRestClient client = null) { var options = new UpdateConnectionPolicyOptions(pathSid){ FriendlyName = friendlyName }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Voice/V1/DialingPermissions/BulkCountryUpdateResource.cs b/src/Twilio/Rest/Voice/V1/DialingPermissions/BulkCountryUpdateResource.cs index 83907ca7f..b7ecef5d0 100644 --- a/src/Twilio/Rest/Voice/V1/DialingPermissions/BulkCountryUpdateResource.cs +++ b/src/Twilio/Rest/Voice/V1/DialingPermissions/BulkCountryUpdateResource.cs @@ -66,10 +66,10 @@ public static BulkCountryUpdateResource Create(CreateBulkCountryUpdateOptions op /// Create BulkCountryUpdate parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of BulkCountryUpdate - public static async System.Threading.Tasks.Task CreateAsync(CreateBulkCountryUpdateOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateBulkCountryUpdateOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -96,7 +96,7 @@ public static async System.Threading.Tasks.Task Creat ITwilioRestClient client = null) { var options = new CreateBulkCountryUpdateOptions(updateRequest){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Voice/V1/DialingPermissions/Country/HighriskSpecialPrefixResource.cs b/src/Twilio/Rest/Voice/V1/DialingPermissions/Country/HighriskSpecialPrefixResource.cs index 3b6e98d30..12b8d94e0 100644 --- a/src/Twilio/Rest/Voice/V1/DialingPermissions/Country/HighriskSpecialPrefixResource.cs +++ b/src/Twilio/Rest/Voice/V1/DialingPermissions/Country/HighriskSpecialPrefixResource.cs @@ -67,10 +67,10 @@ public static ResourceSet Read(ReadHighriskSpecia /// Read HighriskSpecialPrefix parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of HighriskSpecialPrefix - public static async System.Threading.Tasks.Task> ReadAsync(ReadHighriskSpecialPrefixOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadHighriskSpecialPrefixOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("content", response.Content); return new ResourceSet(page, options, client); @@ -106,7 +106,7 @@ public static async System.Threading.Tasks.Task Fetch Country parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Country - public static async System.Threading.Tasks.Task FetchAsync(FetchCountryOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCountryOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -91,10 +91,10 @@ public static CountryResource Fetch( /// The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the DialingPermissions Country resource to fetch /// Client to make requests to Twilio /// Task that resolves to A single instance of Country - public static async System.Threading.Tasks.Task FetchAsync(string pathIsoCode, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathIsoCode, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchCountryOptions(pathIsoCode){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -129,10 +129,10 @@ public static ResourceSet Read(ReadCountryOptions options, ITwi /// Read Country parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Country - public static async System.Threading.Tasks.Task> ReadAsync(ReadCountryOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadCountryOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("content", response.Content); return new ResourceSet(page, options, client); @@ -188,7 +188,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadCountryOptions(){ IsoCode = isoCode, Continent = continent, CountryCode = countryCode, LowRiskNumbersEnabled = lowRiskNumbersEnabled, HighRiskSpecialNumbersEnabled = highRiskSpecialNumbersEnabled, HighRiskTollfraudNumbersEnabled = highRiskTollfraudNumbersEnabled, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Voice/V1/DialingPermissions/SettingsResource.cs b/src/Twilio/Rest/Voice/V1/DialingPermissions/SettingsResource.cs index df8863b5c..b649cf480 100644 --- a/src/Twilio/Rest/Voice/V1/DialingPermissions/SettingsResource.cs +++ b/src/Twilio/Rest/Voice/V1/DialingPermissions/SettingsResource.cs @@ -65,10 +65,10 @@ public static SettingsResource Fetch(FetchSettingsOptions options, ITwilioRestCl /// Fetch Settings parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Settings - public static async System.Threading.Tasks.Task FetchAsync(FetchSettingsOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSettingsOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -86,10 +86,10 @@ public static SettingsResource Fetch( /// Retrieve voice dialing permissions inheritance for the sub-account /// Client to make requests to Twilio /// Task that resolves to A single instance of Settings - public static async System.Threading.Tasks.Task FetchAsync(ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchSettingsOptions(){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -125,11 +125,12 @@ public static SettingsResource Update(UpdateSettingsOptions options, ITwilioRest /// Client to make requests to Twilio /// Task that resolves to A single instance of Settings #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSettingsOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSettingsOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -156,7 +157,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateSettingsOptions(){ DialingPermissionsInheritance = dialingPermissionsInheritance }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Voice/V1/IpRecordResource.cs b/src/Twilio/Rest/Voice/V1/IpRecordResource.cs index f45a66699..f9e73fca2 100644 --- a/src/Twilio/Rest/Voice/V1/IpRecordResource.cs +++ b/src/Twilio/Rest/Voice/V1/IpRecordResource.cs @@ -66,10 +66,10 @@ public static IpRecordResource Create(CreateIpRecordOptions options, ITwilioRest /// Create IpRecord parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpRecord - public static async System.Threading.Tasks.Task CreateAsync(CreateIpRecordOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateIpRecordOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -104,7 +104,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateIpRecordOptions(ipAddress){ FriendlyName = friendlyName, CidrPrefixLength = cidrPrefixLength }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -145,11 +145,12 @@ public static bool Delete(DeleteIpRecordOptions options, ITwilioRestClient clien /// Delete IpRecord parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpRecord - public static async System.Threading.Tasks.Task DeleteAsync(DeleteIpRecordOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteIpRecordOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -169,10 +170,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The Twilio-provided string that uniquely identifies the IP Record resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of IpRecord - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteIpRecordOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -209,10 +210,10 @@ public static IpRecordResource Fetch(FetchIpRecordOptions options, ITwilioRestCl /// Fetch IpRecord parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpRecord - public static async System.Threading.Tasks.Task FetchAsync(FetchIpRecordOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchIpRecordOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -233,10 +234,10 @@ public static IpRecordResource Fetch( /// The Twilio-provided string that uniquely identifies the IP Record resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of IpRecord - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchIpRecordOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -271,10 +272,10 @@ public static ResourceSet Read(ReadIpRecordOptions options, IT /// Read IpRecord parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of IpRecord - public static async System.Threading.Tasks.Task> ReadAsync(ReadIpRecordOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadIpRecordOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("ip_records", response.Content); return new ResourceSet(page, options, client); @@ -306,7 +307,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadIpRecordOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -393,11 +394,12 @@ public static IpRecordResource Update(UpdateIpRecordOptions options, ITwilioRest /// Client to make requests to Twilio /// Task that resolves to A single instance of IpRecord #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateIpRecordOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateIpRecordOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -428,7 +430,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateIpRecordOptions(pathSid){ FriendlyName = friendlyName }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Voice/V1/SourceIpMappingResource.cs b/src/Twilio/Rest/Voice/V1/SourceIpMappingResource.cs index 32df8385f..12cdcf99a 100644 --- a/src/Twilio/Rest/Voice/V1/SourceIpMappingResource.cs +++ b/src/Twilio/Rest/Voice/V1/SourceIpMappingResource.cs @@ -66,10 +66,10 @@ public static SourceIpMappingResource Create(CreateSourceIpMappingOptions option /// Create SourceIpMapping parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SourceIpMapping - public static async System.Threading.Tasks.Task CreateAsync(CreateSourceIpMappingOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateSourceIpMappingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -100,7 +100,7 @@ public static async System.Threading.Tasks.Task CreateA ITwilioRestClient client = null) { var options = new CreateSourceIpMappingOptions(ipRecordSid, sipDomainSid){ }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -141,11 +141,12 @@ public static bool Delete(DeleteSourceIpMappingOptions options, ITwilioRestClien /// Delete SourceIpMapping parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SourceIpMapping - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSourceIpMappingOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSourceIpMappingOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -165,10 +166,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The Twilio-provided string that uniquely identifies the IP Record resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of SourceIpMapping - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteSourceIpMappingOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -205,10 +206,10 @@ public static SourceIpMappingResource Fetch(FetchSourceIpMappingOptions options, /// Fetch SourceIpMapping parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SourceIpMapping - public static async System.Threading.Tasks.Task FetchAsync(FetchSourceIpMappingOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSourceIpMappingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -229,10 +230,10 @@ public static SourceIpMappingResource Fetch( /// The Twilio-provided string that uniquely identifies the IP Record resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of SourceIpMapping - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchSourceIpMappingOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -267,10 +268,10 @@ public static ResourceSet Read(ReadSourceIpMappingOptio /// Read SourceIpMapping parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of SourceIpMapping - public static async System.Threading.Tasks.Task> ReadAsync(ReadSourceIpMappingOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSourceIpMappingOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("source_ip_mappings", response.Content); return new ResourceSet(page, options, client); @@ -302,7 +303,7 @@ public static async System.Threading.Tasks.Task Client to make requests to Twilio /// Task that resolves to A single instance of SourceIpMapping #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSourceIpMappingOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSourceIpMappingOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -424,7 +426,7 @@ public static async System.Threading.Tasks.Task UpdateA ITwilioRestClient client = null) { var options = new UpdateSourceIpMappingOptions(pathSid, sipDomainSid){ }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Wireless/V1/CommandResource.cs b/src/Twilio/Rest/Wireless/V1/CommandResource.cs index 70603c5ba..6c3ad1978 100644 --- a/src/Twilio/Rest/Wireless/V1/CommandResource.cs +++ b/src/Twilio/Rest/Wireless/V1/CommandResource.cs @@ -121,10 +121,10 @@ public static CommandResource Create(CreateCommandOptions options, ITwilioRestCl /// Create Command parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Command - public static async System.Threading.Tasks.Task CreateAsync(CreateCommandOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateCommandOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -175,7 +175,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateCommandOptions(command){ Sim = sim, CallbackMethod = callbackMethod, CallbackUrl = callbackUrl, CommandMode = commandMode, IncludeSid = includeSid, DeliveryReceiptRequested = deliveryReceiptRequested }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -216,11 +216,12 @@ public static bool Delete(DeleteCommandOptions options, ITwilioRestClient client /// Delete Command parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Command - public static async System.Threading.Tasks.Task DeleteAsync(DeleteCommandOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteCommandOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -240,10 +241,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID of the Command resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Command - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteCommandOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -280,10 +281,10 @@ public static CommandResource Fetch(FetchCommandOptions options, ITwilioRestClie /// Fetch Command parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Command - public static async System.Threading.Tasks.Task FetchAsync(FetchCommandOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchCommandOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -304,10 +305,10 @@ public static CommandResource Fetch( /// The SID of the Command resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Command - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchCommandOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -342,10 +343,10 @@ public static ResourceSet Read(ReadCommandOptions options, ITwi /// Read Command parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Command - public static async System.Threading.Tasks.Task> ReadAsync(ReadCommandOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadCommandOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("commands", response.Content); return new ResourceSet(page, options, client); @@ -393,7 +394,7 @@ public static async System.Threading.Tasks.Task> Re ITwilioRestClient client = null) { var options = new ReadCommandOptions(){ Sim = sim, Status = status, Direction = direction, Transport = transport, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Wireless/V1/RatePlanResource.cs b/src/Twilio/Rest/Wireless/V1/RatePlanResource.cs index 8ba8ac304..4022c66c9 100644 --- a/src/Twilio/Rest/Wireless/V1/RatePlanResource.cs +++ b/src/Twilio/Rest/Wireless/V1/RatePlanResource.cs @@ -66,10 +66,10 @@ public static RatePlanResource Create(CreateRatePlanOptions options, ITwilioRest /// Create RatePlan parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RatePlan - public static async System.Threading.Tasks.Task CreateAsync(CreateRatePlanOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateRatePlanOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildCreateRequest(options, client)); + var response = await client.RequestAsync(BuildCreateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -136,7 +136,7 @@ public static async System.Threading.Tasks.Task CreateAsync( ITwilioRestClient client = null) { var options = new CreateRatePlanOptions(){ UniqueName = uniqueName, FriendlyName = friendlyName, DataEnabled = dataEnabled, DataLimit = dataLimit, DataMetering = dataMetering, MessagingEnabled = messagingEnabled, VoiceEnabled = voiceEnabled, NationalRoamingEnabled = nationalRoamingEnabled, InternationalRoaming = internationalRoaming, NationalRoamingDataLimit = nationalRoamingDataLimit, InternationalRoamingDataLimit = internationalRoamingDataLimit }; - return await CreateAsync(options, client); + return await CreateAsync(options, client, cancellationToken); } #endif @@ -177,11 +177,12 @@ public static bool Delete(DeleteRatePlanOptions options, ITwilioRestClient clien /// Delete RatePlan parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RatePlan - public static async System.Threading.Tasks.Task DeleteAsync(DeleteRatePlanOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteRatePlanOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -201,10 +202,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID of the RatePlan resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of RatePlan - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteRatePlanOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -241,10 +242,10 @@ public static RatePlanResource Fetch(FetchRatePlanOptions options, ITwilioRestCl /// Fetch RatePlan parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RatePlan - public static async System.Threading.Tasks.Task FetchAsync(FetchRatePlanOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchRatePlanOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -265,10 +266,10 @@ public static RatePlanResource Fetch( /// The SID of the RatePlan resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of RatePlan - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchRatePlanOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -303,10 +304,10 @@ public static ResourceSet Read(ReadRatePlanOptions options, IT /// Read RatePlan parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of RatePlan - public static async System.Threading.Tasks.Task> ReadAsync(ReadRatePlanOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadRatePlanOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("rate_plans", response.Content); return new ResourceSet(page, options, client); @@ -338,7 +339,7 @@ public static async System.Threading.Tasks.Task> R ITwilioRestClient client = null) { var options = new ReadRatePlanOptions(){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -425,11 +426,12 @@ public static RatePlanResource Update(UpdateRatePlanOptions options, ITwilioRest /// Client to make requests to Twilio /// Task that resolves to A single instance of RatePlan #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateRatePlanOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateRatePlanOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -464,7 +466,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateRatePlanOptions(pathSid){ UniqueName = uniqueName, FriendlyName = friendlyName }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Wireless/V1/Sim/DataSessionResource.cs b/src/Twilio/Rest/Wireless/V1/Sim/DataSessionResource.cs index 613a0319e..ba250e815 100644 --- a/src/Twilio/Rest/Wireless/V1/Sim/DataSessionResource.cs +++ b/src/Twilio/Rest/Wireless/V1/Sim/DataSessionResource.cs @@ -67,10 +67,10 @@ public static ResourceSet Read(ReadDataSessionOptions optio /// Read DataSession parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of DataSession - public static async System.Threading.Tasks.Task> ReadAsync(ReadDataSessionOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadDataSessionOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("data_sessions", response.Content); return new ResourceSet(page, options, client); @@ -106,7 +106,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadDataSessionOptions(pathSimSid){ PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Wireless/V1/Sim/UsageRecordResource.cs b/src/Twilio/Rest/Wireless/V1/Sim/UsageRecordResource.cs index 8d0ca7093..0e7fe6cce 100644 --- a/src/Twilio/Rest/Wireless/V1/Sim/UsageRecordResource.cs +++ b/src/Twilio/Rest/Wireless/V1/Sim/UsageRecordResource.cs @@ -80,10 +80,10 @@ public static ResourceSet Read(ReadUsageRecordOptions optio /// Read UsageRecord parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of UsageRecord - public static async System.Threading.Tasks.Task> ReadAsync(ReadUsageRecordOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadUsageRecordOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("usage_records", response.Content); return new ResourceSet(page, options, client); @@ -131,7 +131,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadUsageRecordOptions(pathSimSid){ End = end, Start = start, Granularity = granularity, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Wireless/V1/SimResource.cs b/src/Twilio/Rest/Wireless/V1/SimResource.cs index 1206a8345..26cc0a850 100644 --- a/src/Twilio/Rest/Wireless/V1/SimResource.cs +++ b/src/Twilio/Rest/Wireless/V1/SimResource.cs @@ -102,11 +102,12 @@ public static bool Delete(DeleteSimOptions options, ITwilioRestClient client = n /// Delete Sim parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim - public static async System.Threading.Tasks.Task DeleteAsync(DeleteSimOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(DeleteSimOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildDeleteRequest(options, client)); + var response = await client.RequestAsync(BuildDeleteRequest(options, client), cancellationToken); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } #endif @@ -126,10 +127,10 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// The SID or the `unique_name` of the Sim resource to delete. /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new DeleteSimOptions(pathSid) ; - return await DeleteAsync(options, client); + return await DeleteAsync(options, client, cancellationToken); } #endif @@ -166,10 +167,10 @@ public static SimResource Fetch(FetchSimOptions options, ITwilioRestClient clien /// Fetch Sim parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim - public static async System.Threading.Tasks.Task FetchAsync(FetchSimOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchSimOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildFetchRequest(options, client)); + var response = await client.RequestAsync(BuildFetchRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -190,10 +191,10 @@ public static SimResource Fetch( /// The SID or the `unique_name` of the Sim resource to fetch. /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim - public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathSid, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { var options = new FetchSimOptions(pathSid){ }; - return await FetchAsync(options, client); + return await FetchAsync(options, client, cancellationToken); } #endif @@ -228,10 +229,10 @@ public static ResourceSet Read(ReadSimOptions options, ITwilioRestC /// Read Sim parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim - public static async System.Threading.Tasks.Task> ReadAsync(ReadSimOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadSimOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("sims", response.Content); return new ResourceSet(page, options, client); @@ -283,7 +284,7 @@ public static async System.Threading.Tasks.Task> ReadAs ITwilioRestClient client = null) { var options = new ReadSimOptions(){ Status = status, Iccid = iccid, RatePlan = ratePlan, EId = eId, SimRegistrationCode = simRegistrationCode, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif @@ -370,11 +371,12 @@ public static SimResource Update(UpdateSimOptions options, ITwilioRestClient cli /// Client to make requests to Twilio /// Task that resolves to A single instance of Sim #if !NET35 - public static async System.Threading.Tasks.Task UpdateAsync(UpdateSimOptions options, - ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task UpdateAsync(UpdateSimOptions options, + ITwilioRestClient client = null, + CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildUpdateRequest(options, client)); + var response = await client.RequestAsync(BuildUpdateRequest(options, client), cancellationToken); return FromJson(response.Content); } #endif @@ -473,7 +475,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( ITwilioRestClient client = null) { var options = new UpdateSimOptions(pathSid){ UniqueName = uniqueName, CallbackMethod = callbackMethod, CallbackUrl = callbackUrl, FriendlyName = friendlyName, RatePlan = ratePlan, Status = status, CommandsCallbackMethod = commandsCallbackMethod, CommandsCallbackUrl = commandsCallbackUrl, SmsFallbackMethod = smsFallbackMethod, SmsFallbackUrl = smsFallbackUrl, SmsMethod = smsMethod, SmsUrl = smsUrl, VoiceFallbackMethod = voiceFallbackMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceMethod = voiceMethod, VoiceUrl = voiceUrl, ResetStatus = resetStatus, AccountSid = accountSid }; - return await UpdateAsync(options, client); + return await UpdateAsync(options, client, cancellationToken); } #endif diff --git a/src/Twilio/Rest/Wireless/V1/UsageRecordResource.cs b/src/Twilio/Rest/Wireless/V1/UsageRecordResource.cs index 6c432adec..4572c3e92 100644 --- a/src/Twilio/Rest/Wireless/V1/UsageRecordResource.cs +++ b/src/Twilio/Rest/Wireless/V1/UsageRecordResource.cs @@ -78,10 +78,10 @@ public static ResourceSet Read(ReadUsageRecordOptions optio /// Read UsageRecord parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of UsageRecord - public static async System.Threading.Tasks.Task> ReadAsync(ReadUsageRecordOptions options, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadUsageRecordOptions options, ITwilioRestClient client = null, CancellationToken cancellationToken = default) { client = client ?? TwilioClient.GetRestClient(); - var response = await client.RequestAsync(BuildReadRequest(options, client)); + var response = await client.RequestAsync(BuildReadRequest(options, client), cancellationToken); var page = Page.FromJson("usage_records", response.Content); return new ResourceSet(page, options, client); @@ -125,7 +125,7 @@ public static async System.Threading.Tasks.Task ITwilioRestClient client = null) { var options = new ReadUsageRecordOptions(){ End = end, Start = start, Granularity = granularity, PageSize = pageSize, Limit = limit}; - return await ReadAsync(options, client); + return await ReadAsync(options, client, cancellationToken); } #endif