diff --git a/src/Twilio/Http/Request.cs b/src/Twilio/Http/Request.cs index d2b4d53b8..a80a79a92 100644 --- a/src/Twilio/Http/Request.cs +++ b/src/Twilio/Http/Request.cs @@ -56,6 +56,11 @@ public class Request /// public List> PostParams { get; private set; } + /// + /// Header params + /// + public List> HeaderParams { get; private set; } + /// /// Create a new Twilio request /// @@ -67,6 +72,7 @@ public Request(HttpMethod method, string url) Uri = new Uri(url); QueryParams = new List>(); PostParams = new List>(); + HeaderParams = new List>(); } /// @@ -79,6 +85,7 @@ public Request(HttpMethod method, string url) /// Query parameters /// Post data /// Twilio edge + /// Custom header data public Request( HttpMethod method, Domain domain, @@ -86,7 +93,8 @@ public Request( string region = null, List> queryParams = null, List> postParams = null, - string edge = null + string edge = null, + List> headerParams = null ) { Method = method; @@ -96,6 +104,7 @@ public Request( QueryParams = queryParams ?? new List>(); PostParams = postParams ?? new List>(); + HeaderParams = headerParams ?? new List>(); } /// @@ -209,6 +218,16 @@ public void AddPostParam(string name, string value) AddParam(PostParams, name, value); } + /// + /// Add a header parameter + /// + /// name of parameter + /// value of parameter + public void AddHeaderParam(string name, string value) + { + AddParam(HeaderParams, name, value); + } + private static void AddParam(ICollection> list, string name, string value) { list.Add(new KeyValuePair(name, value)); @@ -239,7 +258,11 @@ public override bool Equals(object obj) return Method.Equals(other.Method) && buildUri().Equals(other.buildUri()) && QueryParams.All(other.QueryParams.Contains) && - PostParams.All(other.PostParams.Contains); + other.QueryParams.All(QueryParams.Contains) && + PostParams.All(other.PostParams.Contains) && + other.PostParams.All(PostParams.Contains) && + HeaderParams.All(other.HeaderParams.Contains) && + other.HeaderParams.All(HeaderParams.Contains); } /// @@ -253,7 +276,8 @@ public override int GetHashCode() return (Method?.GetHashCode() ?? 0) ^ (buildUri()?.GetHashCode() ?? 0) ^ (QueryParams?.GetHashCode() ?? 0) ^ - (PostParams?.GetHashCode() ?? 0); + (PostParams?.GetHashCode() ?? 0) ^ + (HeaderParams?.GetHashCode() ?? 0); } } } diff --git a/src/Twilio/Http/SystemNetHttpClient.cs b/src/Twilio/Http/SystemNetHttpClient.cs index b6d253742..8efe288d4 100644 --- a/src/Twilio/Http/SystemNetHttpClient.cs +++ b/src/Twilio/Http/SystemNetHttpClient.cs @@ -94,6 +94,10 @@ private HttpRequestMessage BuildHttpRequest(Request request) var libraryVersion = "twilio-csharp/" + AssemblyInfomation.AssemblyInformationalVersion + PlatVersion; httpRequest.Headers.TryAddWithoutValidation("User-Agent", libraryVersion); + foreach (var header in request.HeaderParams) { + httpRequest.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + return httpRequest; } } diff --git a/src/Twilio/Rest/Chat/V2/Service/Channel/MemberOptions.cs b/src/Twilio/Rest/Chat/V2/Service/Channel/MemberOptions.cs index d54a3e7bd..a14791341 100644 --- a/src/Twilio/Rest/Chat/V2/Service/Channel/MemberOptions.cs +++ b/src/Twilio/Rest/Chat/V2/Service/Channel/MemberOptions.cs @@ -94,6 +94,10 @@ public class CreateMemberOptions : IOptions /// A valid JSON string that contains application-specific data /// public string Attributes { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MemberResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateMemberOptions @@ -151,6 +155,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -220,6 +238,10 @@ public class DeleteMemberOptions : IOptions /// The SID of the Member resource to delete /// public string PathSid { get; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MemberResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new DeleteMemberOptions @@ -242,6 +264,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -285,6 +321,10 @@ public class UpdateMemberOptions : IOptions /// A valid JSON string that contains application-specific data /// public string Attributes { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MemberResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateMemberOptions @@ -337,6 +377,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Chat/V2/Service/Channel/MemberResource.cs b/src/Twilio/Rest/Chat/V2/Service/Channel/MemberResource.cs index 20ced72e2..92d4b732f 100644 --- a/src/Twilio/Rest/Chat/V2/Service/Channel/MemberResource.cs +++ b/src/Twilio/Rest/Chat/V2/Service/Channel/MemberResource.cs @@ -115,7 +115,8 @@ private static Request BuildCreateRequest(CreateMemberOptions options, ITwilioRe HttpMethod.Post, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Members", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -161,6 +162,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Crea /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// A valid JSON string that contains application-specific data + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Member public static MemberResource Create(string pathServiceSid, @@ -172,9 +174,10 @@ public static MemberResource Create(string pathServiceSid, DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -192,6 +195,7 @@ public static MemberResource Create(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// A valid JSON string that contains application-specific data + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Member public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -203,9 +207,10 @@ public static async System.Threading.Tasks.Task CreateAsync(stri DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -356,7 +361,8 @@ private static Request BuildDeleteRequest(DeleteMemberOptions options, ITwilioRe HttpMethod.Delete, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Members/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -395,14 +401,16 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteMemberOp /// The SID of the Service to delete the resource from /// The SID of the channel the Member resource to delete belongs to /// The SID of the Member resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Member public static bool Delete(string pathServiceSid, string pathChannelSid, string pathSid, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteMemberOptions(pathServiceSid, pathChannelSid, pathSid); + var options = new DeleteMemberOptions(pathServiceSid, pathChannelSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Delete(options, client); } @@ -413,14 +421,16 @@ public static bool Delete(string pathServiceSid, /// The SID of the Service to delete the resource from /// The SID of the channel the Member resource to delete belongs to /// The SID of the Member resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Member public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathChannelSid, string pathSid, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteMemberOptions(pathServiceSid, pathChannelSid, pathSid); + var options = new DeleteMemberOptions(pathServiceSid, pathChannelSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await DeleteAsync(options, client); } #endif @@ -431,7 +441,8 @@ private static Request BuildUpdateRequest(UpdateMemberOptions options, ITwilioRe HttpMethod.Post, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Members/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -478,6 +489,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Upda /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// A valid JSON string that contains application-specific data + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Member public static MemberResource Update(string pathServiceSid, @@ -489,9 +501,10 @@ public static MemberResource Update(string pathServiceSid, DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMemberOptions(pathServiceSid, pathChannelSid, pathSid){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new UpdateMemberOptions(pathServiceSid, pathChannelSid, pathSid){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -510,6 +523,7 @@ public static MemberResource Update(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// A valid JSON string that contains application-specific data + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Member public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -521,9 +535,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(stri DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMemberOptions(pathServiceSid, pathChannelSid, pathSid){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new UpdateMemberOptions(pathServiceSid, pathChannelSid, pathSid){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Chat/V2/Service/Channel/MessageOptions.cs b/src/Twilio/Rest/Chat/V2/Service/Channel/MessageOptions.cs index f1821d505..65f595845 100644 --- a/src/Twilio/Rest/Chat/V2/Service/Channel/MessageOptions.cs +++ b/src/Twilio/Rest/Chat/V2/Service/Channel/MessageOptions.cs @@ -93,6 +93,10 @@ public class CreateMessageOptions : IOptions /// The Media Sid to be attached to the new Message /// public string MediaSid { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MessageResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateMessageOptions @@ -148,6 +152,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -216,6 +234,10 @@ public class DeleteMessageOptions : IOptions /// The SID of the Message resource to delete /// public string PathSid { get; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MessageResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new DeleteMessageOptions @@ -238,6 +260,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -281,6 +317,10 @@ public class UpdateMessageOptions : IOptions /// The Identity of the message's author /// public string From { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MessageResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateMessageOptions @@ -333,6 +373,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Chat/V2/Service/Channel/MessageResource.cs b/src/Twilio/Rest/Chat/V2/Service/Channel/MessageResource.cs index 4faba7af5..2a2fbf22c 100644 --- a/src/Twilio/Rest/Chat/V2/Service/Channel/MessageResource.cs +++ b/src/Twilio/Rest/Chat/V2/Service/Channel/MessageResource.cs @@ -128,7 +128,8 @@ private static Request BuildCreateRequest(CreateMessageOptions options, ITwilioR HttpMethod.Post, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Messages", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -173,6 +174,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Cre /// The Identity of the User who last updated the Message /// The message to send to the channel /// The Media Sid to be attached to the new Message + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Message public static MessageResource Create(string pathServiceSid, @@ -184,9 +186,10 @@ public static MessageResource Create(string pathServiceSid, string lastUpdatedBy = null, string body = null, string mediaSid = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMessageOptions(pathServiceSid, pathChannelSid){From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid}; + var options = new CreateMessageOptions(pathServiceSid, pathChannelSid){From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -203,6 +206,7 @@ public static MessageResource Create(string pathServiceSid, /// The Identity of the User who last updated the Message /// The message to send to the channel /// The Media Sid to be attached to the new Message + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Message public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -214,9 +218,10 @@ public static async System.Threading.Tasks.Task CreateAsync(str string lastUpdatedBy = null, string body = null, string mediaSid = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMessageOptions(pathServiceSid, pathChannelSid){From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid}; + var options = new CreateMessageOptions(pathServiceSid, pathChannelSid){From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -367,7 +372,8 @@ private static Request BuildDeleteRequest(DeleteMessageOptions options, ITwilioR HttpMethod.Delete, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Messages/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -406,14 +412,16 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteMessageO /// The SID of the Service to delete the resource from /// The SID of the Channel the message to delete belongs to /// The SID of the Message resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Message public static bool Delete(string pathServiceSid, string pathChannelSid, string pathSid, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteMessageOptions(pathServiceSid, pathChannelSid, pathSid); + var options = new DeleteMessageOptions(pathServiceSid, pathChannelSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Delete(options, client); } @@ -424,14 +432,16 @@ public static bool Delete(string pathServiceSid, /// The SID of the Service to delete the resource from /// The SID of the Channel the message to delete belongs to /// The SID of the Message resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Message public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathChannelSid, string pathSid, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteMessageOptions(pathServiceSid, pathChannelSid, pathSid); + var options = new DeleteMessageOptions(pathServiceSid, pathChannelSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await DeleteAsync(options, client); } #endif @@ -442,7 +452,8 @@ private static Request BuildUpdateRequest(UpdateMessageOptions options, ITwilioR HttpMethod.Post, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Messages/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -487,6 +498,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Upd /// The ISO 8601 date and time in GMT when the resource was updated /// The Identity of the User who last updated the Message, if applicable /// The Identity of the message's author + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Message public static MessageResource Update(string pathServiceSid, @@ -498,9 +510,10 @@ public static MessageResource Update(string pathServiceSid, DateTime? dateUpdated = null, string lastUpdatedBy = null, string from = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMessageOptions(pathServiceSid, pathChannelSid, pathSid){Body = body, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, From = from}; + var options = new UpdateMessageOptions(pathServiceSid, pathChannelSid, pathSid){Body = body, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, From = from, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -517,6 +530,7 @@ public static MessageResource Update(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was updated /// The Identity of the User who last updated the Message, if applicable /// The Identity of the message's author + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Message public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -528,9 +542,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(str DateTime? dateUpdated = null, string lastUpdatedBy = null, string from = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMessageOptions(pathServiceSid, pathChannelSid, pathSid){Body = body, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, From = from}; + var options = new UpdateMessageOptions(pathServiceSid, pathChannelSid, pathSid){Body = body, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, From = from, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Chat/V2/Service/ChannelOptions.cs b/src/Twilio/Rest/Chat/V2/Service/ChannelOptions.cs index e6eb0d7b7..aa2628154 100644 --- a/src/Twilio/Rest/Chat/V2/Service/ChannelOptions.cs +++ b/src/Twilio/Rest/Chat/V2/Service/ChannelOptions.cs @@ -60,6 +60,10 @@ public class DeleteChannelOptions : IOptions /// The SID of the Channel resource to delete /// public string PathSid { get; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ChannelResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new DeleteChannelOptions @@ -80,6 +84,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -119,6 +137,10 @@ public class CreateChannelOptions : IOptions /// The identity of the User that created the Channel /// public string CreatedBy { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ChannelResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateChannelOptions @@ -172,6 +194,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -255,6 +291,10 @@ public class UpdateChannelOptions : IOptions /// The identity of the User that created the Channel /// public string CreatedBy { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ChannelResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateChannelOptions @@ -305,6 +345,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Chat/V2/Service/ChannelResource.cs b/src/Twilio/Rest/Chat/V2/Service/ChannelResource.cs index 3291d6cbd..f7be55226 100644 --- a/src/Twilio/Rest/Chat/V2/Service/ChannelResource.cs +++ b/src/Twilio/Rest/Chat/V2/Service/ChannelResource.cs @@ -122,7 +122,8 @@ private static Request BuildDeleteRequest(DeleteChannelOptions options, ITwilioR HttpMethod.Delete, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -160,11 +161,15 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteChannelO /// /// The SID of the Service to delete the resource from /// The SID of the Channel resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Channel - public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClient client = null) + public static bool Delete(string pathServiceSid, + string pathSid, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, + ITwilioRestClient client = null) { - var options = new DeleteChannelOptions(pathServiceSid, pathSid); + var options = new DeleteChannelOptions(pathServiceSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Delete(options, client); } @@ -174,13 +179,15 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie /// /// The SID of the Service to delete the resource from /// The SID of the Channel resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Channel public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteChannelOptions(pathServiceSid, pathSid); + var options = new DeleteChannelOptions(pathServiceSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await DeleteAsync(options, client); } #endif @@ -191,7 +198,8 @@ private static Request BuildCreateRequest(CreateChannelOptions options, ITwilioR HttpMethod.Post, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Channels", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -235,6 +243,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Cre /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// The identity of the User that created the Channel + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Channel public static ChannelResource Create(string pathServiceSid, @@ -245,9 +254,10 @@ public static ChannelResource Create(string pathServiceSid, DateTime? dateCreated = null, DateTime? dateUpdated = null, string createdBy = null, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateChannelOptions(pathServiceSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, Type = type, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy}; + var options = new CreateChannelOptions(pathServiceSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, Type = type, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -263,6 +273,7 @@ public static ChannelResource Create(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// The identity of the User that created the Channel + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Channel public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -273,9 +284,10 @@ public static async System.Threading.Tasks.Task CreateAsync(str DateTime? dateCreated = null, DateTime? dateUpdated = null, string createdBy = null, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateChannelOptions(pathServiceSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, Type = type, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy}; + var options = new CreateChannelOptions(pathServiceSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, Type = type, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -422,7 +434,8 @@ private static Request BuildUpdateRequest(UpdateChannelOptions options, ITwilioR HttpMethod.Post, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -466,6 +479,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Upd /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// The identity of the User that created the Channel + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Channel public static ChannelResource Update(string pathServiceSid, @@ -476,9 +490,10 @@ public static ChannelResource Update(string pathServiceSid, DateTime? dateCreated = null, DateTime? dateUpdated = null, string createdBy = null, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateChannelOptions(pathServiceSid, pathSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy}; + var options = new UpdateChannelOptions(pathServiceSid, pathSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -494,6 +509,7 @@ public static ChannelResource Update(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// The identity of the User that created the Channel + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Channel public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -504,9 +520,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(str DateTime? dateCreated = null, DateTime? dateUpdated = null, string createdBy = null, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateChannelOptions(pathServiceSid, pathSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy}; + var options = new UpdateChannelOptions(pathServiceSid, pathSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Chat/V2/Service/UserOptions.cs b/src/Twilio/Rest/Chat/V2/Service/UserOptions.cs index 2e6618b25..d23e856c9 100644 --- a/src/Twilio/Rest/Chat/V2/Service/UserOptions.cs +++ b/src/Twilio/Rest/Chat/V2/Service/UserOptions.cs @@ -106,6 +106,10 @@ public class CreateUserOptions : IOptions /// A string to describe the new resource /// public string FriendlyName { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public UserResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateUserOptions @@ -146,6 +150,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -207,6 +225,10 @@ public class UpdateUserOptions : IOptions /// A string to describe the resource /// public string FriendlyName { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public UserResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateUserOptions @@ -242,6 +264,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Chat/V2/Service/UserResource.cs b/src/Twilio/Rest/Chat/V2/Service/UserResource.cs index f65f21c68..fc420c8db 100644 --- a/src/Twilio/Rest/Chat/V2/Service/UserResource.cs +++ b/src/Twilio/Rest/Chat/V2/Service/UserResource.cs @@ -178,7 +178,8 @@ private static Request BuildCreateRequest(CreateUserOptions options, ITwilioRest HttpMethod.Post, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Users", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -219,6 +220,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Create /// The SID of the Role assigned to this user /// A valid JSON string that contains application-specific data /// A string to describe the new resource + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of User public static UserResource Create(string pathServiceSid, @@ -226,9 +228,10 @@ public static UserResource Create(string pathServiceSid, string roleSid = null, string attributes = null, string friendlyName = null, + UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateUserOptions(pathServiceSid, identity){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName}; + var options = new CreateUserOptions(pathServiceSid, identity){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -241,6 +244,7 @@ public static UserResource Create(string pathServiceSid, /// The SID of the Role assigned to this user /// A valid JSON string that contains application-specific data /// A string to describe the new resource + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of User public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -248,9 +252,10 @@ public static async System.Threading.Tasks.Task CreateAsync(string string roleSid = null, string attributes = null, string friendlyName = null, + UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateUserOptions(pathServiceSid, identity){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName}; + var options = new CreateUserOptions(pathServiceSid, identity){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -393,7 +398,8 @@ private static Request BuildUpdateRequest(UpdateUserOptions options, ITwilioRest HttpMethod.Post, Rest.Domain.Chat, "/v2/Services/" + options.PathServiceSid + "/Users/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -434,6 +440,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Update /// The SID id of the Role assigned to this user /// A valid JSON string that contains application-specific data /// A string to describe the resource + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of User public static UserResource Update(string pathServiceSid, @@ -441,9 +448,10 @@ public static UserResource Update(string pathServiceSid, string roleSid = null, string attributes = null, string friendlyName = null, + UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateUserOptions(pathServiceSid, pathSid){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName}; + var options = new UpdateUserOptions(pathServiceSid, pathSid){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -456,6 +464,7 @@ public static UserResource Update(string pathServiceSid, /// The SID id of the Role assigned to this user /// A valid JSON string that contains application-specific data /// A string to describe the resource + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of User public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -463,9 +472,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(string string roleSid = null, string attributes = null, string friendlyName = null, + UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateUserOptions(pathServiceSid, pathSid){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName}; + var options = new UpdateUserOptions(pathServiceSid, pathSid){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Conversations/V1/Conversation/MessageOptions.cs b/src/Twilio/Rest/Conversations/V1/Conversation/MessageOptions.cs index d8214a539..53661692e 100644 --- a/src/Twilio/Rest/Conversations/V1/Conversation/MessageOptions.cs +++ b/src/Twilio/Rest/Conversations/V1/Conversation/MessageOptions.cs @@ -46,6 +46,10 @@ public class CreateMessageOptions : IOptions /// The Media Sid to be attached to the new Message. /// public string MediaSid { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MessageResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateMessageOptions @@ -94,6 +98,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -131,6 +149,10 @@ public class UpdateMessageOptions : IOptions /// A string metadata field you can use to store any data you wish. /// public string Attributes { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MessageResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateMessageOptions @@ -176,6 +198,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -193,6 +229,10 @@ public class DeleteMessageOptions : IOptions /// A 34 character string that uniquely identifies this resource. /// public string PathSid { get; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MessageResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new DeleteMessageOptions @@ -213,6 +253,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// diff --git a/src/Twilio/Rest/Conversations/V1/Conversation/MessageResource.cs b/src/Twilio/Rest/Conversations/V1/Conversation/MessageResource.cs index 7ac4cba11..121dadffc 100644 --- a/src/Twilio/Rest/Conversations/V1/Conversation/MessageResource.cs +++ b/src/Twilio/Rest/Conversations/V1/Conversation/MessageResource.cs @@ -42,7 +42,8 @@ private static Request BuildCreateRequest(CreateMessageOptions options, ITwilioR HttpMethod.Post, Rest.Domain.Conversations, "/v1/Conversations/" + options.PathConversationSid + "/Messages", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -85,6 +86,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Cre /// The date that this resource was last updated. /// A string metadata field you can use to store any data you wish. /// The Media Sid to be attached to the new Message. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Message public static MessageResource Create(string pathConversationSid, @@ -94,9 +96,10 @@ public static MessageResource Create(string pathConversationSid, DateTime? dateUpdated = null, string attributes = null, string mediaSid = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMessageOptions(pathConversationSid){Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MediaSid = mediaSid}; + var options = new CreateMessageOptions(pathConversationSid){Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MediaSid = mediaSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -111,6 +114,7 @@ public static MessageResource Create(string pathConversationSid, /// The date that this resource was last updated. /// A string metadata field you can use to store any data you wish. /// The Media Sid to be attached to the new Message. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Message public static async System.Threading.Tasks.Task CreateAsync(string pathConversationSid, @@ -120,9 +124,10 @@ public static async System.Threading.Tasks.Task CreateAsync(str DateTime? dateUpdated = null, string attributes = null, string mediaSid = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMessageOptions(pathConversationSid){Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MediaSid = mediaSid}; + var options = new CreateMessageOptions(pathConversationSid){Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MediaSid = mediaSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -133,7 +138,8 @@ private static Request BuildUpdateRequest(UpdateMessageOptions options, ITwilioR HttpMethod.Post, Rest.Domain.Conversations, "/v1/Conversations/" + options.PathConversationSid + "/Messages/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -176,6 +182,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Upd /// The date that this resource was created. /// The date that this resource was last updated. /// A string metadata field you can use to store any data you wish. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Message public static MessageResource Update(string pathConversationSid, @@ -185,9 +192,10 @@ public static MessageResource Update(string pathConversationSid, DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMessageOptions(pathConversationSid, pathSid){Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new UpdateMessageOptions(pathConversationSid, pathSid){Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -202,6 +210,7 @@ public static MessageResource Update(string pathConversationSid, /// The date that this resource was created. /// The date that this resource was last updated. /// A string metadata field you can use to store any data you wish. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Message public static async System.Threading.Tasks.Task UpdateAsync(string pathConversationSid, @@ -211,9 +220,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(str DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMessageOptions(pathConversationSid, pathSid){Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new UpdateMessageOptions(pathConversationSid, pathSid){Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif @@ -224,7 +234,8 @@ private static Request BuildDeleteRequest(DeleteMessageOptions options, ITwilioR HttpMethod.Delete, Rest.Domain.Conversations, "/v1/Conversations/" + options.PathConversationSid + "/Messages/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -262,11 +273,15 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteMessageO /// /// The unique id of the Conversation for this message. /// A 34 character string that uniquely identifies this resource. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Message - public static bool Delete(string pathConversationSid, string pathSid, ITwilioRestClient client = null) + public static bool Delete(string pathConversationSid, + string pathSid, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, + ITwilioRestClient client = null) { - var options = new DeleteMessageOptions(pathConversationSid, pathSid); + var options = new DeleteMessageOptions(pathConversationSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Delete(options, client); } @@ -276,13 +291,15 @@ public static bool Delete(string pathConversationSid, string pathSid, ITwilioRes /// /// The unique id of the Conversation for this message. /// A 34 character string that uniquely identifies this resource. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Message public static async System.Threading.Tasks.Task DeleteAsync(string pathConversationSid, string pathSid, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteMessageOptions(pathConversationSid, pathSid); + var options = new DeleteMessageOptions(pathConversationSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await DeleteAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Conversations/V1/Conversation/ParticipantOptions.cs b/src/Twilio/Rest/Conversations/V1/Conversation/ParticipantOptions.cs index ccde14095..f1e86d337 100644 --- a/src/Twilio/Rest/Conversations/V1/Conversation/ParticipantOptions.cs +++ b/src/Twilio/Rest/Conversations/V1/Conversation/ParticipantOptions.cs @@ -54,6 +54,10 @@ public class CreateParticipantOptions : IOptions /// The SID of the Role to assign to the participant /// public string RoleSid { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ParticipantResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateParticipantOptions @@ -112,6 +116,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -157,6 +175,10 @@ public class UpdateParticipantOptions : IOptions /// A unique string identifier for the conversation participant as Chat User. /// public string Identity { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ParticipantResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateParticipantOptions @@ -212,6 +234,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -229,6 +265,10 @@ public class DeleteParticipantOptions : IOptions /// A 34 character string that uniquely identifies this resource. /// public string PathSid { get; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ParticipantResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new DeleteParticipantOptions @@ -249,6 +289,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// diff --git a/src/Twilio/Rest/Conversations/V1/Conversation/ParticipantResource.cs b/src/Twilio/Rest/Conversations/V1/Conversation/ParticipantResource.cs index 24362105d..dd9872731 100644 --- a/src/Twilio/Rest/Conversations/V1/Conversation/ParticipantResource.cs +++ b/src/Twilio/Rest/Conversations/V1/Conversation/ParticipantResource.cs @@ -42,7 +42,8 @@ private static Request BuildCreateRequest(CreateParticipantOptions options, ITwi HttpMethod.Post, Rest.Domain.Conversations, "/v1/Conversations/" + options.PathConversationSid + "/Participants", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -89,6 +90,7 @@ public static async System.Threading.Tasks.Task CreateAsync /// The address of the Twilio phone number that is used in Group MMS. /// /// The SID of the Role to assign to the participant + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Participant public static ParticipantResource Create(string pathConversationSid, @@ -100,9 +102,10 @@ public static ParticipantResource Create(string pathConversationSid, string attributes = null, string messagingBindingProjectedAddress = null, string roleSid = null, + ParticipantResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateParticipantOptions(pathConversationSid){Identity = identity, MessagingBindingAddress = messagingBindingAddress, MessagingBindingProxyAddress = messagingBindingProxyAddress, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MessagingBindingProjectedAddress = messagingBindingProjectedAddress, RoleSid = roleSid}; + var options = new CreateParticipantOptions(pathConversationSid){Identity = identity, MessagingBindingAddress = messagingBindingAddress, MessagingBindingProxyAddress = messagingBindingProxyAddress, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MessagingBindingProjectedAddress = messagingBindingProjectedAddress, RoleSid = roleSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -121,6 +124,7 @@ public static ParticipantResource Create(string pathConversationSid, /// The address of the Twilio phone number that is used in Group MMS. /// /// The SID of the Role to assign to the participant + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Participant public static async System.Threading.Tasks.Task CreateAsync(string pathConversationSid, @@ -132,9 +136,10 @@ public static async System.Threading.Tasks.Task CreateAsync string attributes = null, string messagingBindingProjectedAddress = null, string roleSid = null, + ParticipantResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateParticipantOptions(pathConversationSid){Identity = identity, MessagingBindingAddress = messagingBindingAddress, MessagingBindingProxyAddress = messagingBindingProxyAddress, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MessagingBindingProjectedAddress = messagingBindingProjectedAddress, RoleSid = roleSid}; + var options = new CreateParticipantOptions(pathConversationSid){Identity = identity, MessagingBindingAddress = messagingBindingAddress, MessagingBindingProxyAddress = messagingBindingProxyAddress, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MessagingBindingProjectedAddress = messagingBindingProjectedAddress, RoleSid = roleSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -145,7 +150,8 @@ private static Request BuildUpdateRequest(UpdateParticipantOptions options, ITwi HttpMethod.Post, Rest.Domain.Conversations, "/v1/Conversations/" + options.PathConversationSid + "/Participants/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -192,6 +198,7 @@ public static async System.Threading.Tasks.Task UpdateAsync /// The address of the Twilio phone number that is used in Group MMS. /// /// A unique string identifier for the conversation participant as Chat User. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Participant public static ParticipantResource Update(string pathConversationSid, @@ -203,9 +210,10 @@ public static ParticipantResource Update(string pathConversationSid, string messagingBindingProxyAddress = null, string messagingBindingProjectedAddress = null, string identity = null, + ParticipantResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateParticipantOptions(pathConversationSid, pathSid){DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, RoleSid = roleSid, MessagingBindingProxyAddress = messagingBindingProxyAddress, MessagingBindingProjectedAddress = messagingBindingProjectedAddress, Identity = identity}; + var options = new UpdateParticipantOptions(pathConversationSid, pathSid){DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, RoleSid = roleSid, MessagingBindingProxyAddress = messagingBindingProxyAddress, MessagingBindingProjectedAddress = messagingBindingProjectedAddress, Identity = identity, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -224,6 +232,7 @@ public static ParticipantResource Update(string pathConversationSid, /// The address of the Twilio phone number that is used in Group MMS. /// /// A unique string identifier for the conversation participant as Chat User. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Participant public static async System.Threading.Tasks.Task UpdateAsync(string pathConversationSid, @@ -235,9 +244,10 @@ public static async System.Threading.Tasks.Task UpdateAsync string messagingBindingProxyAddress = null, string messagingBindingProjectedAddress = null, string identity = null, + ParticipantResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateParticipantOptions(pathConversationSid, pathSid){DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, RoleSid = roleSid, MessagingBindingProxyAddress = messagingBindingProxyAddress, MessagingBindingProjectedAddress = messagingBindingProjectedAddress, Identity = identity}; + var options = new UpdateParticipantOptions(pathConversationSid, pathSid){DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, RoleSid = roleSid, MessagingBindingProxyAddress = messagingBindingProxyAddress, MessagingBindingProjectedAddress = messagingBindingProjectedAddress, Identity = identity, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif @@ -248,7 +258,8 @@ private static Request BuildDeleteRequest(DeleteParticipantOptions options, ITwi HttpMethod.Delete, Rest.Domain.Conversations, "/v1/Conversations/" + options.PathConversationSid + "/Participants/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -286,11 +297,15 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteParticip /// /// The unique id of the Conversation for this participant. /// A 34 character string that uniquely identifies this resource. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Participant - public static bool Delete(string pathConversationSid, string pathSid, ITwilioRestClient client = null) + public static bool Delete(string pathConversationSid, + string pathSid, + ParticipantResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, + ITwilioRestClient client = null) { - var options = new DeleteParticipantOptions(pathConversationSid, pathSid); + var options = new DeleteParticipantOptions(pathConversationSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Delete(options, client); } @@ -300,13 +315,15 @@ public static bool Delete(string pathConversationSid, string pathSid, ITwilioRes /// /// The unique id of the Conversation for this participant. /// A 34 character string that uniquely identifies this resource. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Participant public static async System.Threading.Tasks.Task DeleteAsync(string pathConversationSid, string pathSid, + ParticipantResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteParticipantOptions(pathConversationSid, pathSid); + var options = new DeleteParticipantOptions(pathConversationSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await DeleteAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Conversations/V1/ConversationOptions.cs b/src/Twilio/Rest/Conversations/V1/ConversationOptions.cs index bf1b97ce1..354709d8d 100644 --- a/src/Twilio/Rest/Conversations/V1/ConversationOptions.cs +++ b/src/Twilio/Rest/Conversations/V1/ConversationOptions.cs @@ -50,6 +50,10 @@ public class CreateConversationOptions : IOptions /// ISO8601 duration when conversation will be switched to `closed` state. /// public string TimersClosed { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ConversationResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Generate the necessary parameters @@ -99,6 +103,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -144,6 +162,10 @@ public class UpdateConversationOptions : IOptions /// ISO8601 duration when conversation will be switched to `closed` state. /// public string TimersClosed { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ConversationResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateConversationOptions @@ -202,6 +224,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -215,6 +251,10 @@ public class DeleteConversationOptions : IOptions /// A 34 character string that uniquely identifies this resource. /// public string PathSid { get; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ConversationResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new DeleteConversationOptions @@ -233,6 +273,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// diff --git a/src/Twilio/Rest/Conversations/V1/ConversationResource.cs b/src/Twilio/Rest/Conversations/V1/ConversationResource.cs index a4086b06a..02bdc3f8a 100644 --- a/src/Twilio/Rest/Conversations/V1/ConversationResource.cs +++ b/src/Twilio/Rest/Conversations/V1/ConversationResource.cs @@ -56,7 +56,8 @@ private static Request BuildCreateRequest(CreateConversationOptions options, ITw HttpMethod.Post, Rest.Domain.Conversations, "/v1/Conversations", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -100,6 +101,7 @@ public static async System.Threading.Tasks.Task CreateAsyn /// Current state of this conversation. /// ISO8601 duration when conversation will be switched to `inactive` state. /// ISO8601 duration when conversation will be switched to `closed` state. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Conversation public static ConversationResource Create(string friendlyName = null, @@ -110,9 +112,10 @@ public static ConversationResource Create(string friendlyName = null, ConversationResource.StateEnum state = null, string timersInactive = null, string timersClosed = null, + ConversationResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateConversationOptions(){FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, MessagingServiceSid = messagingServiceSid, Attributes = attributes, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed}; + var options = new CreateConversationOptions(){FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, MessagingServiceSid = messagingServiceSid, Attributes = attributes, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -128,6 +131,7 @@ public static ConversationResource Create(string friendlyName = null, /// Current state of this conversation. /// ISO8601 duration when conversation will be switched to `inactive` state. /// ISO8601 duration when conversation will be switched to `closed` state. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Conversation public static async System.Threading.Tasks.Task CreateAsync(string friendlyName = null, @@ -138,9 +142,10 @@ public static async System.Threading.Tasks.Task CreateAsyn ConversationResource.StateEnum state = null, string timersInactive = null, string timersClosed = null, + ConversationResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateConversationOptions(){FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, MessagingServiceSid = messagingServiceSid, Attributes = attributes, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed}; + var options = new CreateConversationOptions(){FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, MessagingServiceSid = messagingServiceSid, Attributes = attributes, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -151,7 +156,8 @@ private static Request BuildUpdateRequest(UpdateConversationOptions options, ITw HttpMethod.Post, Rest.Domain.Conversations, "/v1/Conversations/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -196,6 +202,7 @@ public static async System.Threading.Tasks.Task UpdateAsyn /// Current state of this conversation. /// ISO8601 duration when conversation will be switched to `inactive` state. /// ISO8601 duration when conversation will be switched to `closed` state. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Conversation public static ConversationResource Update(string pathSid, @@ -207,9 +214,10 @@ public static ConversationResource Update(string pathSid, ConversationResource.StateEnum state = null, string timersInactive = null, string timersClosed = null, + ConversationResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateConversationOptions(pathSid){FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MessagingServiceSid = messagingServiceSid, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed}; + var options = new UpdateConversationOptions(pathSid){FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MessagingServiceSid = messagingServiceSid, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -226,6 +234,7 @@ public static ConversationResource Update(string pathSid, /// Current state of this conversation. /// ISO8601 duration when conversation will be switched to `inactive` state. /// ISO8601 duration when conversation will be switched to `closed` state. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Conversation public static async System.Threading.Tasks.Task UpdateAsync(string pathSid, @@ -237,9 +246,10 @@ public static async System.Threading.Tasks.Task UpdateAsyn ConversationResource.StateEnum state = null, string timersInactive = null, string timersClosed = null, + ConversationResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateConversationOptions(pathSid){FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MessagingServiceSid = messagingServiceSid, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed}; + var options = new UpdateConversationOptions(pathSid){FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MessagingServiceSid = messagingServiceSid, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif @@ -250,7 +260,8 @@ private static Request BuildDeleteRequest(DeleteConversationOptions options, ITw HttpMethod.Delete, Rest.Domain.Conversations, "/v1/Conversations/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -287,11 +298,14 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteConversa /// delete /// /// A 34 character string that uniquely identifies this resource. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Conversation - public static bool Delete(string pathSid, ITwilioRestClient client = null) + public static bool Delete(string pathSid, + ConversationResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, + ITwilioRestClient client = null) { - var options = new DeleteConversationOptions(pathSid); + var options = new DeleteConversationOptions(pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Delete(options, client); } @@ -300,11 +314,14 @@ public static bool Delete(string pathSid, ITwilioRestClient client = null) /// delete /// /// A 34 character string that uniquely identifies this resource. + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Conversation - public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathSid, + ConversationResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, + ITwilioRestClient client = null) { - var options = new DeleteConversationOptions(pathSid); + var options = new DeleteConversationOptions(pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await DeleteAsync(options, client); } #endif diff --git a/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberOptions.cs b/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberOptions.cs index 270520764..6ab7e8979 100644 --- a/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberOptions.cs +++ b/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberOptions.cs @@ -94,6 +94,10 @@ public class CreateMemberOptions : IOptions /// A valid JSON string that contains application-specific data /// public string Attributes { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MemberResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateMemberOptions @@ -151,6 +155,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -220,6 +238,10 @@ public class DeleteMemberOptions : IOptions /// The SID of the Member resource to delete /// public string PathSid { get; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MemberResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new DeleteMemberOptions @@ -242,6 +264,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -285,6 +321,10 @@ public class UpdateMemberOptions : IOptions /// A valid JSON string that contains application-specific data /// public string Attributes { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MemberResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateMemberOptions @@ -337,6 +377,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberResource.cs b/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberResource.cs index 69a95ca94..26a92489c 100644 --- a/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberResource.cs +++ b/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberResource.cs @@ -115,7 +115,8 @@ private static Request BuildCreateRequest(CreateMemberOptions options, ITwilioRe HttpMethod.Post, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Members", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -161,6 +162,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Crea /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// A valid JSON string that contains application-specific data + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Member public static MemberResource Create(string pathServiceSid, @@ -172,9 +174,10 @@ public static MemberResource Create(string pathServiceSid, DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -192,6 +195,7 @@ public static MemberResource Create(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// A valid JSON string that contains application-specific data + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Member public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -203,9 +207,10 @@ public static async System.Threading.Tasks.Task CreateAsync(stri DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new CreateMemberOptions(pathServiceSid, pathChannelSid, identity){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -356,7 +361,8 @@ private static Request BuildDeleteRequest(DeleteMemberOptions options, ITwilioRe HttpMethod.Delete, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Members/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -395,14 +401,16 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteMemberOp /// The SID of the Service to delete the resource from /// The SID of the channel the Member resource to delete belongs to /// The SID of the Member resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Member public static bool Delete(string pathServiceSid, string pathChannelSid, string pathSid, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteMemberOptions(pathServiceSid, pathChannelSid, pathSid); + var options = new DeleteMemberOptions(pathServiceSid, pathChannelSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Delete(options, client); } @@ -413,14 +421,16 @@ public static bool Delete(string pathServiceSid, /// The SID of the Service to delete the resource from /// The SID of the channel the Member resource to delete belongs to /// The SID of the Member resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Member public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathChannelSid, string pathSid, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteMemberOptions(pathServiceSid, pathChannelSid, pathSid); + var options = new DeleteMemberOptions(pathServiceSid, pathChannelSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await DeleteAsync(options, client); } #endif @@ -431,7 +441,8 @@ private static Request BuildUpdateRequest(UpdateMemberOptions options, ITwilioRe HttpMethod.Post, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Members/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -478,6 +489,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Upda /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// A valid JSON string that contains application-specific data + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Member public static MemberResource Update(string pathServiceSid, @@ -489,9 +501,10 @@ public static MemberResource Update(string pathServiceSid, DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMemberOptions(pathServiceSid, pathChannelSid, pathSid){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new UpdateMemberOptions(pathServiceSid, pathChannelSid, pathSid){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -510,6 +523,7 @@ public static MemberResource Update(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// A valid JSON string that contains application-specific data + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Member public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -521,9 +535,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(stri DateTime? dateCreated = null, DateTime? dateUpdated = null, string attributes = null, + MemberResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMemberOptions(pathServiceSid, pathChannelSid, pathSid){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes}; + var options = new UpdateMemberOptions(pathServiceSid, pathChannelSid, pathSid){RoleSid = roleSid, LastConsumedMessageIndex = lastConsumedMessageIndex, LastConsumptionTimestamp = lastConsumptionTimestamp, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageOptions.cs b/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageOptions.cs index 6b0cc0d67..3b6aad358 100644 --- a/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageOptions.cs +++ b/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageOptions.cs @@ -93,6 +93,10 @@ public class CreateMessageOptions : IOptions /// The Media Sid to be attached to the new Message /// public string MediaSid { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MessageResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateMessageOptions @@ -148,6 +152,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -216,6 +234,10 @@ public class DeleteMessageOptions : IOptions /// The SID of the Message resource to delete /// public string PathSid { get; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MessageResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new DeleteMessageOptions @@ -238,6 +260,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -281,6 +317,10 @@ public class UpdateMessageOptions : IOptions /// The Identity of the message's author /// public string From { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public MessageResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateMessageOptions @@ -333,6 +373,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageResource.cs b/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageResource.cs index c63d093b2..cec2295ce 100644 --- a/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageResource.cs +++ b/src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageResource.cs @@ -128,7 +128,8 @@ private static Request BuildCreateRequest(CreateMessageOptions options, ITwilioR HttpMethod.Post, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Messages", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -173,6 +174,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Cre /// The Identity of the User who last updated the Message /// The message to send to the channel /// The Media Sid to be attached to the new Message + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Message public static MessageResource Create(string pathServiceSid, @@ -184,9 +186,10 @@ public static MessageResource Create(string pathServiceSid, string lastUpdatedBy = null, string body = null, string mediaSid = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMessageOptions(pathServiceSid, pathChannelSid){From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid}; + var options = new CreateMessageOptions(pathServiceSid, pathChannelSid){From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -203,6 +206,7 @@ public static MessageResource Create(string pathServiceSid, /// The Identity of the User who last updated the Message /// The message to send to the channel /// The Media Sid to be attached to the new Message + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Message public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -214,9 +218,10 @@ public static async System.Threading.Tasks.Task CreateAsync(str string lastUpdatedBy = null, string body = null, string mediaSid = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateMessageOptions(pathServiceSid, pathChannelSid){From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid}; + var options = new CreateMessageOptions(pathServiceSid, pathChannelSid){From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -367,7 +372,8 @@ private static Request BuildDeleteRequest(DeleteMessageOptions options, ITwilioR HttpMethod.Delete, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Messages/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -406,14 +412,16 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteMessageO /// The SID of the Service to delete the resource from /// The SID of the Channel the message to delete belongs to /// The SID of the Message resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Message public static bool Delete(string pathServiceSid, string pathChannelSid, string pathSid, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteMessageOptions(pathServiceSid, pathChannelSid, pathSid); + var options = new DeleteMessageOptions(pathServiceSid, pathChannelSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Delete(options, client); } @@ -424,14 +432,16 @@ public static bool Delete(string pathServiceSid, /// The SID of the Service to delete the resource from /// The SID of the Channel the message to delete belongs to /// The SID of the Message resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Message public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathChannelSid, string pathSid, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteMessageOptions(pathServiceSid, pathChannelSid, pathSid); + var options = new DeleteMessageOptions(pathServiceSid, pathChannelSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await DeleteAsync(options, client); } #endif @@ -442,7 +452,8 @@ private static Request BuildUpdateRequest(UpdateMessageOptions options, ITwilioR HttpMethod.Post, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Messages/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -487,6 +498,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Upd /// The ISO 8601 date and time in GMT when the resource was updated /// The Identity of the User who last updated the Message, if applicable /// The Identity of the message's author + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Message public static MessageResource Update(string pathServiceSid, @@ -498,9 +510,10 @@ public static MessageResource Update(string pathServiceSid, DateTime? dateUpdated = null, string lastUpdatedBy = null, string from = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMessageOptions(pathServiceSid, pathChannelSid, pathSid){Body = body, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, From = from}; + var options = new UpdateMessageOptions(pathServiceSid, pathChannelSid, pathSid){Body = body, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, From = from, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -517,6 +530,7 @@ public static MessageResource Update(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was updated /// The Identity of the User who last updated the Message, if applicable /// The Identity of the message's author + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Message public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -528,9 +542,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(str DateTime? dateUpdated = null, string lastUpdatedBy = null, string from = null, + MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateMessageOptions(pathServiceSid, pathChannelSid, pathSid){Body = body, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, From = from}; + var options = new UpdateMessageOptions(pathServiceSid, pathChannelSid, pathSid){Body = body, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, From = from, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/IpMessaging/V2/Service/ChannelOptions.cs b/src/Twilio/Rest/IpMessaging/V2/Service/ChannelOptions.cs index 688e09dd5..3d4475031 100644 --- a/src/Twilio/Rest/IpMessaging/V2/Service/ChannelOptions.cs +++ b/src/Twilio/Rest/IpMessaging/V2/Service/ChannelOptions.cs @@ -60,6 +60,10 @@ public class DeleteChannelOptions : IOptions /// The SID of the Channel resource to delete /// public string PathSid { get; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ChannelResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new DeleteChannelOptions @@ -80,6 +84,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -119,6 +137,10 @@ public class CreateChannelOptions : IOptions /// The identity of the User that created the Channel /// public string CreatedBy { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ChannelResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateChannelOptions @@ -172,6 +194,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -255,6 +291,10 @@ public class UpdateChannelOptions : IOptions /// The identity of the User that created the Channel /// public string CreatedBy { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public ChannelResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateChannelOptions @@ -305,6 +345,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/IpMessaging/V2/Service/ChannelResource.cs b/src/Twilio/Rest/IpMessaging/V2/Service/ChannelResource.cs index 14ac5ba57..ed2a0574b 100644 --- a/src/Twilio/Rest/IpMessaging/V2/Service/ChannelResource.cs +++ b/src/Twilio/Rest/IpMessaging/V2/Service/ChannelResource.cs @@ -122,7 +122,8 @@ private static Request BuildDeleteRequest(DeleteChannelOptions options, ITwilioR HttpMethod.Delete, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -160,11 +161,15 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteChannelO /// /// The SID of the Service to delete the resource from /// The SID of the Channel resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Channel - public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClient client = null) + public static bool Delete(string pathServiceSid, + string pathSid, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, + ITwilioRestClient client = null) { - var options = new DeleteChannelOptions(pathServiceSid, pathSid); + var options = new DeleteChannelOptions(pathServiceSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Delete(options, client); } @@ -174,13 +179,15 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie /// /// The SID of the Service to delete the resource from /// The SID of the Channel resource to delete + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Channel public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new DeleteChannelOptions(pathServiceSid, pathSid); + var options = new DeleteChannelOptions(pathServiceSid, pathSid){XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await DeleteAsync(options, client); } #endif @@ -191,7 +198,8 @@ private static Request BuildCreateRequest(CreateChannelOptions options, ITwilioR HttpMethod.Post, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Channels", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -235,6 +243,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Cre /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// The identity of the User that created the Channel + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Channel public static ChannelResource Create(string pathServiceSid, @@ -245,9 +254,10 @@ public static ChannelResource Create(string pathServiceSid, DateTime? dateCreated = null, DateTime? dateUpdated = null, string createdBy = null, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateChannelOptions(pathServiceSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, Type = type, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy}; + var options = new CreateChannelOptions(pathServiceSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, Type = type, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -263,6 +273,7 @@ public static ChannelResource Create(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// The identity of the User that created the Channel + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Channel public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -273,9 +284,10 @@ public static async System.Threading.Tasks.Task CreateAsync(str DateTime? dateCreated = null, DateTime? dateUpdated = null, string createdBy = null, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateChannelOptions(pathServiceSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, Type = type, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy}; + var options = new CreateChannelOptions(pathServiceSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, Type = type, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -422,7 +434,8 @@ private static Request BuildUpdateRequest(UpdateChannelOptions options, ITwilioR HttpMethod.Post, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -466,6 +479,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Upd /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// The identity of the User that created the Channel + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of Channel public static ChannelResource Update(string pathServiceSid, @@ -476,9 +490,10 @@ public static ChannelResource Update(string pathServiceSid, DateTime? dateCreated = null, DateTime? dateUpdated = null, string createdBy = null, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateChannelOptions(pathServiceSid, pathSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy}; + var options = new UpdateChannelOptions(pathServiceSid, pathSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -494,6 +509,7 @@ public static ChannelResource Update(string pathServiceSid, /// The ISO 8601 date and time in GMT when the resource was created /// The ISO 8601 date and time in GMT when the resource was updated /// The identity of the User that created the Channel + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Channel public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -504,9 +520,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(str DateTime? dateCreated = null, DateTime? dateUpdated = null, string createdBy = null, + ChannelResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateChannelOptions(pathServiceSid, pathSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy}; + var options = new UpdateChannelOptions(pathServiceSid, pathSid){FriendlyName = friendlyName, UniqueName = uniqueName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/IpMessaging/V2/Service/UserOptions.cs b/src/Twilio/Rest/IpMessaging/V2/Service/UserOptions.cs index 5868caeb8..33c74a706 100644 --- a/src/Twilio/Rest/IpMessaging/V2/Service/UserOptions.cs +++ b/src/Twilio/Rest/IpMessaging/V2/Service/UserOptions.cs @@ -106,6 +106,10 @@ public class CreateUserOptions : IOptions /// A string to describe the new resource /// public string FriendlyName { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public UserResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new CreateUserOptions @@ -146,6 +150,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } /// @@ -207,6 +225,10 @@ public class UpdateUserOptions : IOptions /// A string to describe the resource /// public string FriendlyName { get; set; } + /// + /// The X-Twilio-Webhook-Enabled HTTP request header + /// + public UserResource.WebhookEnabledTypeEnum XTwilioWebhookEnabled { get; set; } /// /// Construct a new UpdateUserOptions @@ -242,6 +264,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XTwilioWebhookEnabled != null) + { + p.Add(new KeyValuePair("X-Twilio-Webhook-Enabled", XTwilioWebhookEnabled.ToString())); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/IpMessaging/V2/Service/UserResource.cs b/src/Twilio/Rest/IpMessaging/V2/Service/UserResource.cs index 641b73dc9..b2fc487cc 100644 --- a/src/Twilio/Rest/IpMessaging/V2/Service/UserResource.cs +++ b/src/Twilio/Rest/IpMessaging/V2/Service/UserResource.cs @@ -178,7 +178,8 @@ private static Request BuildCreateRequest(CreateUserOptions options, ITwilioRest HttpMethod.Post, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Users", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -219,6 +220,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Create /// The SID of the Role assigned to this user /// A valid JSON string that contains application-specific data /// A string to describe the new resource + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of User public static UserResource Create(string pathServiceSid, @@ -226,9 +228,10 @@ public static UserResource Create(string pathServiceSid, string roleSid = null, string attributes = null, string friendlyName = null, + UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateUserOptions(pathServiceSid, identity){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName}; + var options = new CreateUserOptions(pathServiceSid, identity){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Create(options, client); } @@ -241,6 +244,7 @@ public static UserResource Create(string pathServiceSid, /// The SID of the Role assigned to this user /// A valid JSON string that contains application-specific data /// A string to describe the new resource + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of User public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -248,9 +252,10 @@ public static async System.Threading.Tasks.Task CreateAsync(string string roleSid = null, string attributes = null, string friendlyName = null, + UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new CreateUserOptions(pathServiceSid, identity){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName}; + var options = new CreateUserOptions(pathServiceSid, identity){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await CreateAsync(options, client); } #endif @@ -393,7 +398,8 @@ private static Request BuildUpdateRequest(UpdateUserOptions options, ITwilioRest HttpMethod.Post, Rest.Domain.IpMessaging, "/v2/Services/" + options.PathServiceSid + "/Users/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -434,6 +440,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Update /// The SID id of the Role assigned to this user /// A valid JSON string that contains application-specific data /// A string to describe the resource + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// A single instance of User public static UserResource Update(string pathServiceSid, @@ -441,9 +448,10 @@ public static UserResource Update(string pathServiceSid, string roleSid = null, string attributes = null, string friendlyName = null, + UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateUserOptions(pathServiceSid, pathSid){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName}; + var options = new UpdateUserOptions(pathServiceSid, pathSid){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return Update(options, client); } @@ -456,6 +464,7 @@ public static UserResource Update(string pathServiceSid, /// The SID id of the Role assigned to this user /// A valid JSON string that contains application-specific data /// A string to describe the resource + /// The X-Twilio-Webhook-Enabled HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of User public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -463,9 +472,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(string string roleSid = null, string attributes = null, string friendlyName = null, + UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null, ITwilioRestClient client = null) { - var options = new UpdateUserOptions(pathServiceSid, pathSid){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName}; + var options = new UpdateUserOptions(pathServiceSid, pathSid){RoleSid = roleSid, Attributes = attributes, FriendlyName = friendlyName, XTwilioWebhookEnabled = xTwilioWebhookEnabled}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Preview/Sync/Service/DocumentOptions.cs b/src/Twilio/Rest/Preview/Sync/Service/DocumentOptions.cs index 9fb3f6ebb..9864db479 100644 --- a/src/Twilio/Rest/Preview/Sync/Service/DocumentOptions.cs +++ b/src/Twilio/Rest/Preview/Sync/Service/DocumentOptions.cs @@ -65,6 +65,10 @@ public class DeleteDocumentOptions : IOptions /// The sid /// public string PathSid { get; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new DeleteDocumentOptions @@ -85,6 +89,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } /// @@ -194,6 +212,10 @@ public class UpdateDocumentOptions : IOptions /// The data /// public object Data { get; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new UpdateDocumentOptions @@ -221,6 +243,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Preview/Sync/Service/DocumentResource.cs b/src/Twilio/Rest/Preview/Sync/Service/DocumentResource.cs index 4c0531f85..553cb97f4 100644 --- a/src/Twilio/Rest/Preview/Sync/Service/DocumentResource.cs +++ b/src/Twilio/Rest/Preview/Sync/Service/DocumentResource.cs @@ -98,7 +98,8 @@ private static Request BuildDeleteRequest(DeleteDocumentOptions options, ITwilio HttpMethod.Delete, Rest.Domain.Preview, "/Sync/Services/" + options.PathServiceSid + "/Documents/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -136,11 +137,15 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteDocument /// /// The service_sid /// The sid + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of Document - public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClient client = null) + public static bool Delete(string pathServiceSid, + string pathSid, + string ifMatch = null, + ITwilioRestClient client = null) { - var options = new DeleteDocumentOptions(pathServiceSid, pathSid); + var options = new DeleteDocumentOptions(pathServiceSid, pathSid){IfMatch = ifMatch}; return Delete(options, client); } @@ -150,13 +155,15 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie /// /// The service_sid /// The sid + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Document public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new DeleteDocumentOptions(pathServiceSid, pathSid); + var options = new DeleteDocumentOptions(pathServiceSid, pathSid){IfMatch = ifMatch}; return await DeleteAsync(options, client); } #endif @@ -374,7 +381,8 @@ private static Request BuildUpdateRequest(UpdateDocumentOptions options, ITwilio HttpMethod.Post, Rest.Domain.Preview, "/Sync/Services/" + options.PathServiceSid + "/Documents/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -413,14 +421,16 @@ public static async System.Threading.Tasks.Task UpdateAsync(Up /// The service_sid /// The sid /// The data + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of Document public static DocumentResource Update(string pathServiceSid, string pathSid, object data, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateDocumentOptions(pathServiceSid, pathSid, data); + var options = new UpdateDocumentOptions(pathServiceSid, pathSid, data){IfMatch = ifMatch}; return Update(options, client); } @@ -431,14 +441,16 @@ public static DocumentResource Update(string pathServiceSid, /// The service_sid /// The sid /// The data + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Document public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, string pathSid, object data, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateDocumentOptions(pathServiceSid, pathSid, data); + var options = new UpdateDocumentOptions(pathServiceSid, pathSid, data){IfMatch = ifMatch}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemOptions.cs b/src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemOptions.cs index 9978aefa4..4c7b98a45 100644 --- a/src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemOptions.cs +++ b/src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemOptions.cs @@ -75,6 +75,10 @@ public class DeleteSyncListItemOptions : IOptions /// The index /// public int? PathIndex { get; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new DeleteSyncListItemOptions @@ -97,6 +101,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } /// @@ -242,6 +260,10 @@ public class UpdateSyncListItemOptions : IOptions /// The data /// public object Data { get; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new UpdateSyncListItemOptions @@ -271,6 +293,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemResource.cs b/src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemResource.cs index aaad23c67..8ad38ca31 100644 --- a/src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemResource.cs +++ b/src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemResource.cs @@ -131,7 +131,8 @@ private static Request BuildDeleteRequest(DeleteSyncListItemOptions options, ITw HttpMethod.Delete, Rest.Domain.Preview, "/Sync/Services/" + options.PathServiceSid + "/Lists/" + options.PathListSid + "/Items/" + options.PathIndex + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -170,11 +171,16 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncList /// The service_sid /// The list_sid /// The index + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of SyncListItem - public static bool Delete(string pathServiceSid, string pathListSid, int? pathIndex, ITwilioRestClient client = null) + public static bool Delete(string pathServiceSid, + string pathListSid, + int? pathIndex, + string ifMatch = null, + ITwilioRestClient client = null) { - var options = new DeleteSyncListItemOptions(pathServiceSid, pathListSid, pathIndex); + var options = new DeleteSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){IfMatch = ifMatch}; return Delete(options, client); } @@ -185,14 +191,16 @@ public static bool Delete(string pathServiceSid, string pathListSid, int? pathIn /// The service_sid /// The list_sid /// The index + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListItem 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); + var options = new DeleteSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){IfMatch = ifMatch}; return await DeleteAsync(options, client); } #endif @@ -427,7 +435,8 @@ private static Request BuildUpdateRequest(UpdateSyncListItemOptions options, ITw HttpMethod.Post, Rest.Domain.Preview, "/Sync/Services/" + options.PathServiceSid + "/Lists/" + options.PathListSid + "/Items/" + options.PathIndex + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -467,15 +476,17 @@ public static async System.Threading.Tasks.Task UpdateAsyn /// The list_sid /// The index /// The data + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of SyncListItem public static SyncListItemResource Update(string pathServiceSid, string pathListSid, int? pathIndex, object data, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateSyncListItemOptions(pathServiceSid, pathListSid, pathIndex, data); + var options = new UpdateSyncListItemOptions(pathServiceSid, pathListSid, pathIndex, data){IfMatch = ifMatch}; return Update(options, client); } @@ -487,15 +498,17 @@ public static SyncListItemResource Update(string pathServiceSid, /// The list_sid /// The index /// The data + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListItem public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, string pathListSid, int? pathIndex, object data, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateSyncListItemOptions(pathServiceSid, pathListSid, pathIndex, data); + var options = new UpdateSyncListItemOptions(pathServiceSid, pathListSid, pathIndex, data){IfMatch = ifMatch}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemOptions.cs b/src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemOptions.cs index 429d0ae32..16b9e659c 100644 --- a/src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemOptions.cs +++ b/src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemOptions.cs @@ -75,6 +75,10 @@ public class DeleteSyncMapItemOptions : IOptions /// The key /// public string PathKey { get; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new DeleteSyncMapItemOptions @@ -97,6 +101,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } /// @@ -253,6 +271,10 @@ public class UpdateSyncMapItemOptions : IOptions /// The data /// public object Data { get; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new UpdateSyncMapItemOptions @@ -282,6 +304,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemResource.cs b/src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemResource.cs index 6e8111ef2..0a7181e48 100644 --- a/src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemResource.cs +++ b/src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemResource.cs @@ -131,7 +131,8 @@ private static Request BuildDeleteRequest(DeleteSyncMapItemOptions options, ITwi HttpMethod.Delete, Rest.Domain.Preview, "/Sync/Services/" + options.PathServiceSid + "/Maps/" + options.PathMapSid + "/Items/" + options.PathKey + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -170,11 +171,16 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncMapI /// The service_sid /// The map_sid /// The key + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of SyncMapItem - public static bool Delete(string pathServiceSid, string pathMapSid, string pathKey, ITwilioRestClient client = null) + public static bool Delete(string pathServiceSid, + string pathMapSid, + string pathKey, + string ifMatch = null, + ITwilioRestClient client = null) { - var options = new DeleteSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey); + var options = new DeleteSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){IfMatch = ifMatch}; return Delete(options, client); } @@ -185,14 +191,16 @@ public static bool Delete(string pathServiceSid, string pathMapSid, string pathK /// The service_sid /// The map_sid /// The key + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapItem 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); + var options = new DeleteSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){IfMatch = ifMatch}; return await DeleteAsync(options, client); } #endif @@ -430,7 +438,8 @@ private static Request BuildUpdateRequest(UpdateSyncMapItemOptions options, ITwi HttpMethod.Post, Rest.Domain.Preview, "/Sync/Services/" + options.PathServiceSid + "/Maps/" + options.PathMapSid + "/Items/" + options.PathKey + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -470,15 +479,17 @@ public static async System.Threading.Tasks.Task UpdateAsync /// The map_sid /// The key /// The data + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of SyncMapItem public static SyncMapItemResource Update(string pathServiceSid, string pathMapSid, string pathKey, object data, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey, data); + var options = new UpdateSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey, data){IfMatch = ifMatch}; return Update(options, client); } @@ -490,15 +501,17 @@ public static SyncMapItemResource Update(string pathServiceSid, /// The map_sid /// The key /// The data + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapItem public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, string pathMapSid, string pathKey, object data, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey, data); + var options = new UpdateSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey, data){IfMatch = ifMatch}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Preview/TrustedComms/BrandsInformationOptions.cs b/src/Twilio/Rest/Preview/TrustedComms/BrandsInformationOptions.cs index 18ac58307..3119eb921 100644 --- a/src/Twilio/Rest/Preview/TrustedComms/BrandsInformationOptions.cs +++ b/src/Twilio/Rest/Preview/TrustedComms/BrandsInformationOptions.cs @@ -19,6 +19,11 @@ namespace Twilio.Rest.Preview.TrustedComms /// public class FetchBrandsInformationOptions : IOptions { + /// + /// Standard `If-None-Match` HTTP header + /// + public string IfNoneMatch { get; set; } + /// /// Generate the necessary parameters /// @@ -27,6 +32,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfNoneMatch != null) + { + p.Add(new KeyValuePair("If-None-Match", IfNoneMatch)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Preview/TrustedComms/BrandsInformationResource.cs b/src/Twilio/Rest/Preview/TrustedComms/BrandsInformationResource.cs index aa9a260a4..d91e88005 100644 --- a/src/Twilio/Rest/Preview/TrustedComms/BrandsInformationResource.cs +++ b/src/Twilio/Rest/Preview/TrustedComms/BrandsInformationResource.cs @@ -29,7 +29,8 @@ private static Request BuildFetchRequest(FetchBrandsInformationOptions options, HttpMethod.Get, Rest.Domain.Preview, "/TrustedComms/BrandsInformation", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -65,11 +66,12 @@ public static async System.Threading.Tasks.Task Fetch /// /// Retrieve the newest available BrandInformation /// + /// Standard `If-None-Match` HTTP header /// Client to make requests to Twilio /// A single instance of BrandsInformation - public static BrandsInformationResource Fetch(ITwilioRestClient client = null) + public static BrandsInformationResource Fetch(string ifNoneMatch = null, ITwilioRestClient client = null) { - var options = new FetchBrandsInformationOptions(); + var options = new FetchBrandsInformationOptions(){IfNoneMatch = ifNoneMatch}; return Fetch(options, client); } @@ -77,11 +79,13 @@ public static BrandsInformationResource Fetch(ITwilioRestClient client = null) /// /// Retrieve the newest available BrandInformation /// + /// Standard `If-None-Match` HTTP header /// Client to make requests to Twilio /// Task that resolves to A single instance of BrandsInformation - public static async System.Threading.Tasks.Task FetchAsync(ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string ifNoneMatch = null, + ITwilioRestClient client = null) { - var options = new FetchBrandsInformationOptions(); + var options = new FetchBrandsInformationOptions(){IfNoneMatch = ifNoneMatch}; return await FetchAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Preview/TrustedComms/CpsOptions.cs b/src/Twilio/Rest/Preview/TrustedComms/CpsOptions.cs index efcf053c1..9fd0bb76a 100644 --- a/src/Twilio/Rest/Preview/TrustedComms/CpsOptions.cs +++ b/src/Twilio/Rest/Preview/TrustedComms/CpsOptions.cs @@ -19,6 +19,11 @@ namespace Twilio.Rest.Preview.TrustedComms /// public class FetchCpsOptions : IOptions { + /// + /// Phone number to retrieve CPS. + /// + public string XXcnamSensitivePhoneNumber { get; set; } + /// /// Generate the necessary parameters /// @@ -27,6 +32,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XXcnamSensitivePhoneNumber != null) + { + p.Add(new KeyValuePair("X-Xcnam-Sensitive-Phone-Number", XXcnamSensitivePhoneNumber)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Preview/TrustedComms/CpsResource.cs b/src/Twilio/Rest/Preview/TrustedComms/CpsResource.cs index 19a21cbbe..452310764 100644 --- a/src/Twilio/Rest/Preview/TrustedComms/CpsResource.cs +++ b/src/Twilio/Rest/Preview/TrustedComms/CpsResource.cs @@ -29,7 +29,8 @@ private static Request BuildFetchRequest(FetchCpsOptions options, ITwilioRestCli HttpMethod.Get, Rest.Domain.Preview, "/TrustedComms/CPS", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -65,11 +66,12 @@ public static async System.Threading.Tasks.Task FetchAsync(FetchCps /// /// Fetch a specific Call Placement Service (CPS) given a phone number via `X-XCNAM-Sensitive-Phone-Number` header. /// + /// Phone number to retrieve CPS. /// Client to make requests to Twilio /// A single instance of Cps - public static CpsResource Fetch(ITwilioRestClient client = null) + public static CpsResource Fetch(string xXcnamSensitivePhoneNumber = null, ITwilioRestClient client = null) { - var options = new FetchCpsOptions(); + var options = new FetchCpsOptions(){XXcnamSensitivePhoneNumber = xXcnamSensitivePhoneNumber}; return Fetch(options, client); } @@ -77,11 +79,13 @@ public static CpsResource Fetch(ITwilioRestClient client = null) /// /// Fetch a specific Call Placement Service (CPS) given a phone number via `X-XCNAM-Sensitive-Phone-Number` header. /// + /// Phone number to retrieve CPS. /// Client to make requests to Twilio /// Task that resolves to A single instance of Cps - public static async System.Threading.Tasks.Task FetchAsync(ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string xXcnamSensitivePhoneNumber = null, + ITwilioRestClient client = null) { - var options = new FetchCpsOptions(); + var options = new FetchCpsOptions(){XXcnamSensitivePhoneNumber = xXcnamSensitivePhoneNumber}; return await FetchAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Preview/TrustedComms/CurrentCallOptions.cs b/src/Twilio/Rest/Preview/TrustedComms/CurrentCallOptions.cs index f4cba60b9..5e3a62d98 100644 --- a/src/Twilio/Rest/Preview/TrustedComms/CurrentCallOptions.cs +++ b/src/Twilio/Rest/Preview/TrustedComms/CurrentCallOptions.cs @@ -20,6 +20,15 @@ namespace Twilio.Rest.Preview.TrustedComms /// public class FetchCurrentCallOptions : IOptions { + /// + /// The originating Phone Number + /// + public string XXcnamSensitivePhoneNumberFrom { get; set; } + /// + /// The terminating Phone Number + /// + public string XXcnamSensitivePhoneNumberTo { get; set; } + /// /// Generate the necessary parameters /// @@ -28,6 +37,25 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (XXcnamSensitivePhoneNumberFrom != null) + { + p.Add(new KeyValuePair("X-Xcnam-Sensitive-Phone-Number-From", XXcnamSensitivePhoneNumberFrom)); + } + + if (XXcnamSensitivePhoneNumberTo != null) + { + p.Add(new KeyValuePair("X-Xcnam-Sensitive-Phone-Number-To", XXcnamSensitivePhoneNumberTo)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Preview/TrustedComms/CurrentCallResource.cs b/src/Twilio/Rest/Preview/TrustedComms/CurrentCallResource.cs index ada8a39e5..5e10ab9c1 100644 --- a/src/Twilio/Rest/Preview/TrustedComms/CurrentCallResource.cs +++ b/src/Twilio/Rest/Preview/TrustedComms/CurrentCallResource.cs @@ -29,7 +29,8 @@ private static Request BuildFetchRequest(FetchCurrentCallOptions options, ITwili HttpMethod.Get, Rest.Domain.Preview, "/TrustedComms/CurrentCall", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -68,11 +69,15 @@ public static async System.Threading.Tasks.Task FetchAsync( /// Retrieve a current call given the originating and terminating number via `X-XCNAM-Sensitive-Phone-Number-From` and /// `X-XCNAM-Sensitive-Phone-Number-To` headers. /// + /// The originating Phone Number + /// The terminating Phone Number /// Client to make requests to Twilio /// A single instance of CurrentCall - public static CurrentCallResource Fetch(ITwilioRestClient client = null) + public static CurrentCallResource Fetch(string xXcnamSensitivePhoneNumberFrom = null, + string xXcnamSensitivePhoneNumberTo = null, + ITwilioRestClient client = null) { - var options = new FetchCurrentCallOptions(); + var options = new FetchCurrentCallOptions(){XXcnamSensitivePhoneNumberFrom = xXcnamSensitivePhoneNumberFrom, XXcnamSensitivePhoneNumberTo = xXcnamSensitivePhoneNumberTo}; return Fetch(options, client); } @@ -81,11 +86,15 @@ public static CurrentCallResource Fetch(ITwilioRestClient client = null) /// Retrieve a current call given the originating and terminating number via `X-XCNAM-Sensitive-Phone-Number-From` and /// `X-XCNAM-Sensitive-Phone-Number-To` headers. /// + /// The originating Phone Number + /// The terminating Phone Number /// Client to make requests to Twilio /// Task that resolves to A single instance of CurrentCall - public static async System.Threading.Tasks.Task FetchAsync(ITwilioRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string xXcnamSensitivePhoneNumberFrom = null, + string xXcnamSensitivePhoneNumberTo = null, + ITwilioRestClient client = null) { - var options = new FetchCurrentCallOptions(); + var options = new FetchCurrentCallOptions(){XXcnamSensitivePhoneNumberFrom = xXcnamSensitivePhoneNumberFrom, XXcnamSensitivePhoneNumberTo = xXcnamSensitivePhoneNumberTo}; return await FetchAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/DocumentOptions.cs b/src/Twilio/Rest/Sync/V1/Service/DocumentOptions.cs index 5ea99231d..f1bfad223 100644 --- a/src/Twilio/Rest/Sync/V1/Service/DocumentOptions.cs +++ b/src/Twilio/Rest/Sync/V1/Service/DocumentOptions.cs @@ -63,6 +63,10 @@ public class DeleteDocumentOptions : IOptions /// The SID of the Document resource to delete /// public string PathSid { get; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new DeleteDocumentOptions @@ -83,6 +87,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } /// @@ -202,6 +220,10 @@ public class UpdateDocumentOptions : IOptions /// How long, in seconds, before the Document resource expires and is deleted /// public int? Ttl { get; set; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new UpdateDocumentOptions @@ -232,6 +254,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Sync/V1/Service/DocumentResource.cs b/src/Twilio/Rest/Sync/V1/Service/DocumentResource.cs index 723e3fc9c..5bec2f803 100644 --- a/src/Twilio/Rest/Sync/V1/Service/DocumentResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/DocumentResource.cs @@ -97,7 +97,8 @@ private static Request BuildDeleteRequest(DeleteDocumentOptions options, ITwilio HttpMethod.Delete, Rest.Domain.Sync, "/v1/Services/" + options.PathServiceSid + "/Documents/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -135,11 +136,15 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteDocument /// /// The SID of the Sync Service with the Document resource to delete /// The SID of the Document resource to delete + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of Document - public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClient client = null) + public static bool Delete(string pathServiceSid, + string pathSid, + string ifMatch = null, + ITwilioRestClient client = null) { - var options = new DeleteDocumentOptions(pathServiceSid, pathSid); + var options = new DeleteDocumentOptions(pathServiceSid, pathSid){IfMatch = ifMatch}; return Delete(options, client); } @@ -149,13 +154,15 @@ public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClie /// /// The SID of the Sync Service with the Document resource to delete /// The SID of the Document resource to delete + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Document public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathSid, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new DeleteDocumentOptions(pathServiceSid, pathSid); + var options = new DeleteDocumentOptions(pathServiceSid, pathSid){IfMatch = ifMatch}; return await DeleteAsync(options, client); } #endif @@ -379,7 +386,8 @@ private static Request BuildUpdateRequest(UpdateDocumentOptions options, ITwilio HttpMethod.Post, Rest.Domain.Sync, "/v1/Services/" + options.PathServiceSid + "/Documents/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -420,15 +428,17 @@ public static async System.Threading.Tasks.Task UpdateAsync(Up /// A JSON string that represents an arbitrary, schema-less object that the Sync Document stores /// /// How long, in seconds, before the Document resource expires and is deleted + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of Document public static DocumentResource Update(string pathServiceSid, string pathSid, object data = null, int? ttl = null, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateDocumentOptions(pathServiceSid, pathSid){Data = data, Ttl = ttl}; + var options = new UpdateDocumentOptions(pathServiceSid, pathSid){Data = data, Ttl = ttl, IfMatch = ifMatch}; return Update(options, client); } @@ -441,15 +451,17 @@ public static DocumentResource Update(string pathServiceSid, /// A JSON string that represents an arbitrary, schema-less object that the Sync Document stores /// /// How long, in seconds, before the Document resource expires and is deleted + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Document public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, string pathSid, object data = null, int? ttl = null, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateDocumentOptions(pathServiceSid, pathSid){Data = data, Ttl = ttl}; + var options = new UpdateDocumentOptions(pathServiceSid, pathSid){Data = data, Ttl = ttl, IfMatch = ifMatch}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemOptions.cs b/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemOptions.cs index d81f3ec67..62340b040 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemOptions.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemOptions.cs @@ -73,6 +73,10 @@ public class DeleteSyncListItemOptions : IOptions /// The index of the Sync List Item resource to delete /// public int? PathIndex { get; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new DeleteSyncListItemOptions @@ -95,6 +99,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } /// @@ -277,6 +295,10 @@ public class UpdateSyncListItemOptions : IOptions /// How long, in seconds, before the List Item's parent Sync List expires /// public int? CollectionTtl { get; set; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new UpdateSyncListItemOptions @@ -319,6 +341,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemResource.cs index bd1b7bff8..ce0a306a6 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemResource.cs @@ -130,7 +130,8 @@ private static Request BuildDeleteRequest(DeleteSyncListItemOptions options, ITw HttpMethod.Delete, Rest.Domain.Sync, "/v1/Services/" + options.PathServiceSid + "/Lists/" + options.PathListSid + "/Items/" + options.PathIndex + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -169,11 +170,16 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncList /// The SID of the Sync Service with the Sync List Item resource to delete /// The SID of the Sync List with the Sync List Item resource to delete /// The index of the Sync List Item resource to delete + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of SyncListItem - public static bool Delete(string pathServiceSid, string pathListSid, int? pathIndex, ITwilioRestClient client = null) + public static bool Delete(string pathServiceSid, + string pathListSid, + int? pathIndex, + string ifMatch = null, + ITwilioRestClient client = null) { - var options = new DeleteSyncListItemOptions(pathServiceSid, pathListSid, pathIndex); + var options = new DeleteSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){IfMatch = ifMatch}; return Delete(options, client); } @@ -184,14 +190,16 @@ public static bool Delete(string pathServiceSid, string pathListSid, int? pathIn /// The SID of the Sync Service with the Sync List Item resource to delete /// The SID of the Sync List with the Sync List Item resource to delete /// The index of the Sync List Item resource to delete + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListItem 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); + var options = new DeleteSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){IfMatch = ifMatch}; return await DeleteAsync(options, client); } #endif @@ -440,7 +448,8 @@ private static Request BuildUpdateRequest(UpdateSyncListItemOptions options, ITw HttpMethod.Post, Rest.Domain.Sync, "/v1/Services/" + options.PathServiceSid + "/Lists/" + options.PathListSid + "/Items/" + options.PathIndex + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -484,6 +493,7 @@ public static async System.Threading.Tasks.Task UpdateAsyn /// An alias for item_ttl /// How long, in seconds, before the List Item expires /// How long, in seconds, before the List Item's parent Sync List expires + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of SyncListItem public static SyncListItemResource Update(string pathServiceSid, @@ -493,9 +503,10 @@ public static SyncListItemResource Update(string pathServiceSid, int? ttl = null, int? itemTtl = null, int? collectionTtl = null, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl}; + var options = new UpdateSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl, IfMatch = ifMatch}; return Update(options, client); } @@ -511,6 +522,7 @@ public static SyncListItemResource Update(string pathServiceSid, /// An alias for item_ttl /// How long, in seconds, before the List Item expires /// How long, in seconds, before the List Item's parent Sync List expires + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncListItem public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -520,9 +532,10 @@ public static async System.Threading.Tasks.Task UpdateAsyn int? ttl = null, int? itemTtl = null, int? collectionTtl = null, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl}; + var options = new UpdateSyncListItemOptions(pathServiceSid, pathListSid, pathIndex){Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl, IfMatch = ifMatch}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemOptions.cs b/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemOptions.cs index b7c65fa32..c4537e45e 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemOptions.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemOptions.cs @@ -73,6 +73,10 @@ public class DeleteSyncMapItemOptions : IOptions /// The key value of the Sync Map Item resource to delete /// public string PathKey { get; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new DeleteSyncMapItemOptions @@ -95,6 +99,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } /// @@ -287,6 +305,10 @@ public class UpdateSyncMapItemOptions : IOptions /// How long, in seconds, before the Map Item's parent Sync Map expires and is deleted /// public int? CollectionTtl { get; set; } + /// + /// The If-Match HTTP request header + /// + public string IfMatch { get; set; } /// /// Construct a new UpdateSyncMapItemOptions @@ -329,6 +351,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (IfMatch != null) + { + p.Add(new KeyValuePair("If-Match", IfMatch)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemResource.cs b/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemResource.cs index 80c2d587d..294b73fbc 100644 --- a/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemResource.cs +++ b/src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemResource.cs @@ -130,7 +130,8 @@ private static Request BuildDeleteRequest(DeleteSyncMapItemOptions options, ITwi HttpMethod.Delete, Rest.Domain.Sync, "/v1/Services/" + options.PathServiceSid + "/Maps/" + options.PathMapSid + "/Items/" + options.PathKey + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -169,11 +170,16 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteSyncMapI /// The SID of the Sync Service with the Sync Map Item resource to delete /// The SID of the Sync Map with the Sync Map Item resource to delete /// The key value of the Sync Map Item resource to delete + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of SyncMapItem - public static bool Delete(string pathServiceSid, string pathMapSid, string pathKey, ITwilioRestClient client = null) + public static bool Delete(string pathServiceSid, + string pathMapSid, + string pathKey, + string ifMatch = null, + ITwilioRestClient client = null) { - var options = new DeleteSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey); + var options = new DeleteSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){IfMatch = ifMatch}; return Delete(options, client); } @@ -184,14 +190,16 @@ public static bool Delete(string pathServiceSid, string pathMapSid, string pathK /// The SID of the Sync Service with the Sync Map Item resource to delete /// The SID of the Sync Map with the Sync Map Item resource to delete /// The key value of the Sync Map Item resource to delete + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapItem 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); + var options = new DeleteSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){IfMatch = ifMatch}; return await DeleteAsync(options, client); } #endif @@ -443,7 +451,8 @@ private static Request BuildUpdateRequest(UpdateSyncMapItemOptions options, ITwi HttpMethod.Post, Rest.Domain.Sync, "/v1/Services/" + options.PathServiceSid + "/Maps/" + options.PathMapSid + "/Items/" + options.PathKey + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -487,6 +496,7 @@ public static async System.Threading.Tasks.Task UpdateAsync /// How long, in seconds, before the Map Item expires /// How long, in seconds, before the Map Item's parent Sync Map expires and is deleted /// + /// The If-Match HTTP request header /// Client to make requests to Twilio /// A single instance of SyncMapItem public static SyncMapItemResource Update(string pathServiceSid, @@ -496,9 +506,10 @@ public static SyncMapItemResource Update(string pathServiceSid, int? ttl = null, int? itemTtl = null, int? collectionTtl = null, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl}; + var options = new UpdateSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl, IfMatch = ifMatch}; return Update(options, client); } @@ -514,6 +525,7 @@ public static SyncMapItemResource Update(string pathServiceSid, /// How long, in seconds, before the Map Item expires /// How long, in seconds, before the Map Item's parent Sync Map expires and is deleted /// + /// The If-Match HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of SyncMapItem public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -523,9 +535,10 @@ public static async System.Threading.Tasks.Task UpdateAsync int? ttl = null, int? itemTtl = null, int? collectionTtl = null, + string ifMatch = null, ITwilioRestClient client = null) { - var options = new UpdateSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl}; + var options = new UpdateSyncMapItemOptions(pathServiceSid, pathMapSid, pathKey){Data = data, Ttl = ttl, ItemTtl = itemTtl, CollectionTtl = collectionTtl, IfMatch = ifMatch}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeOptions.cs b/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeOptions.cs index fa2ffd4f5..053a970af 100644 --- a/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeOptions.cs +++ b/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeOptions.cs @@ -43,6 +43,10 @@ public class CreateChallengeOptions : IOptions /// Hidden details provided to contextualize the Challenge /// public string HiddenDetails { get; set; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new CreateChallengeOptions @@ -85,6 +89,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } /// @@ -107,6 +125,10 @@ public class FetchChallengeOptions : IOptions /// A string that uniquely identifies this Challenge. /// public string PathSid { get; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new FetchChallengeOptions @@ -129,6 +151,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } /// @@ -155,6 +191,10 @@ public class ReadChallengeOptions : ReadOptions /// The Status of theChallenges to fetch /// public ChallengeResource.ChallengeStatusesEnum Status { get; set; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new ReadChallengeOptions @@ -190,6 +230,20 @@ public override List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } /// @@ -216,6 +270,10 @@ public class UpdateChallengeOptions : IOptions /// Optional payload to verify the Challenge /// public string AuthPayload { get; set; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new UpdateChallengeOptions @@ -243,6 +301,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeResource.cs b/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeResource.cs index 59f0b9b4d..8bae18f58 100644 --- a/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeResource.cs @@ -71,7 +71,8 @@ private static Request BuildCreateRequest(CreateChallengeOptions options, ITwili HttpMethod.Post, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Challenges", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -113,6 +114,7 @@ public static async System.Threading.Tasks.Task CreateAsync(C /// The future date in which this Challenge will expire /// Public details provided to contextualize the Challenge /// Hidden details provided to contextualize the Challenge + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// A single instance of Challenge public static ChallengeResource Create(string pathServiceSid, @@ -121,9 +123,10 @@ public static ChallengeResource Create(string pathServiceSid, DateTime? expirationDate = null, string details = null, string hiddenDetails = null, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new CreateChallengeOptions(pathServiceSid, pathIdentity, factorSid){ExpirationDate = expirationDate, Details = details, HiddenDetails = hiddenDetails}; + var options = new CreateChallengeOptions(pathServiceSid, pathIdentity, factorSid){ExpirationDate = expirationDate, Details = details, HiddenDetails = hiddenDetails, TwilioSandboxMode = twilioSandboxMode}; return Create(options, client); } @@ -137,6 +140,7 @@ public static ChallengeResource Create(string pathServiceSid, /// The future date in which this Challenge will expire /// Public details provided to contextualize the Challenge /// Hidden details provided to contextualize the Challenge + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Challenge public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -145,9 +149,10 @@ public static async System.Threading.Tasks.Task CreateAsync(s DateTime? expirationDate = null, string details = null, string hiddenDetails = null, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new CreateChallengeOptions(pathServiceSid, pathIdentity, factorSid){ExpirationDate = expirationDate, Details = details, HiddenDetails = hiddenDetails}; + var options = new CreateChallengeOptions(pathServiceSid, pathIdentity, factorSid){ExpirationDate = expirationDate, Details = details, HiddenDetails = hiddenDetails, TwilioSandboxMode = twilioSandboxMode}; return await CreateAsync(options, client); } #endif @@ -158,7 +163,8 @@ private static Request BuildFetchRequest(FetchChallengeOptions options, ITwilioR HttpMethod.Get, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Challenges/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -197,14 +203,16 @@ public static async System.Threading.Tasks.Task FetchAsync(Fe /// Service Sid. /// Unique external identifier of the Entity /// A string that uniquely identifies this Challenge. + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// A single instance of Challenge public static ChallengeResource Fetch(string pathServiceSid, string pathIdentity, string pathSid, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new FetchChallengeOptions(pathServiceSid, pathIdentity, pathSid); + var options = new FetchChallengeOptions(pathServiceSid, pathIdentity, pathSid){TwilioSandboxMode = twilioSandboxMode}; return Fetch(options, client); } @@ -215,14 +223,16 @@ public static ChallengeResource Fetch(string pathServiceSid, /// Service Sid. /// Unique external identifier of the Entity /// A string that uniquely identifies this Challenge. + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Challenge public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathIdentity, string pathSid, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new FetchChallengeOptions(pathServiceSid, pathIdentity, pathSid); + var options = new FetchChallengeOptions(pathServiceSid, pathIdentity, pathSid){TwilioSandboxMode = twilioSandboxMode}; return await FetchAsync(options, client); } #endif @@ -233,7 +243,8 @@ private static Request BuildReadRequest(ReadChallengeOptions options, ITwilioRes HttpMethod.Get, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Challenges", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -277,6 +288,7 @@ public static async System.Threading.Tasks.Task> /// Unique external identifier of the Entity /// Factor Sid. /// The Status of theChallenges to fetch + /// The Twilio-Sandbox-Mode HTTP request header /// Page size /// Record limit /// Client to make requests to Twilio @@ -285,11 +297,12 @@ public static ResourceSet Read(string pathServiceSid, string pathIdentity, string factorSid = null, ChallengeResource.ChallengeStatusesEnum status = null, + string twilioSandboxMode = null, int? pageSize = null, long? limit = null, ITwilioRestClient client = null) { - var options = new ReadChallengeOptions(pathServiceSid, pathIdentity){FactorSid = factorSid, Status = status, PageSize = pageSize, Limit = limit}; + var options = new ReadChallengeOptions(pathServiceSid, pathIdentity){FactorSid = factorSid, Status = status, TwilioSandboxMode = twilioSandboxMode, PageSize = pageSize, Limit = limit}; return Read(options, client); } @@ -301,6 +314,7 @@ public static ResourceSet Read(string pathServiceSid, /// Unique external identifier of the Entity /// Factor Sid. /// The Status of theChallenges to fetch + /// The Twilio-Sandbox-Mode HTTP request header /// Page size /// Record limit /// Client to make requests to Twilio @@ -309,11 +323,12 @@ public static async System.Threading.Tasks.Task> string pathIdentity, string factorSid = null, ChallengeResource.ChallengeStatusesEnum status = null, + string twilioSandboxMode = null, int? pageSize = null, long? limit = null, ITwilioRestClient client = null) { - var options = new ReadChallengeOptions(pathServiceSid, pathIdentity){FactorSid = factorSid, Status = status, PageSize = pageSize, Limit = limit}; + var options = new ReadChallengeOptions(pathServiceSid, pathIdentity){FactorSid = factorSid, Status = status, TwilioSandboxMode = twilioSandboxMode, PageSize = pageSize, Limit = limit}; return await ReadAsync(options, client); } #endif @@ -377,7 +392,8 @@ private static Request BuildUpdateRequest(UpdateChallengeOptions options, ITwili HttpMethod.Post, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Challenges/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -417,15 +433,17 @@ public static async System.Threading.Tasks.Task UpdateAsync(U /// Unique external identifier of the Entity /// A string that uniquely identifies this Challenge. /// Optional payload to verify the Challenge + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// A single instance of Challenge public static ChallengeResource Update(string pathServiceSid, string pathIdentity, string pathSid, string authPayload = null, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new UpdateChallengeOptions(pathServiceSid, pathIdentity, pathSid){AuthPayload = authPayload}; + var options = new UpdateChallengeOptions(pathServiceSid, pathIdentity, pathSid){AuthPayload = authPayload, TwilioSandboxMode = twilioSandboxMode}; return Update(options, client); } @@ -437,15 +455,17 @@ public static ChallengeResource Update(string pathServiceSid, /// Unique external identifier of the Entity /// A string that uniquely identifies this Challenge. /// Optional payload to verify the Challenge + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Challenge public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, string pathIdentity, string pathSid, string authPayload = null, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new UpdateChallengeOptions(pathServiceSid, pathIdentity, pathSid){AuthPayload = authPayload}; + var options = new UpdateChallengeOptions(pathServiceSid, pathIdentity, pathSid){AuthPayload = authPayload, TwilioSandboxMode = twilioSandboxMode}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/Entity/FactorOptions.cs b/src/Twilio/Rest/Verify/V2/Service/Entity/FactorOptions.cs index 9732c4900..131a46650 100644 --- a/src/Twilio/Rest/Verify/V2/Service/Entity/FactorOptions.cs +++ b/src/Twilio/Rest/Verify/V2/Service/Entity/FactorOptions.cs @@ -43,6 +43,14 @@ public class CreateFactorOptions : IOptions /// The config for this Factor as a json string /// public string Config { get; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } + /// + /// The Authorization HTTP request header + /// + public string Authorization { get; set; } /// /// Construct a new CreateFactorOptions @@ -96,6 +104,25 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + if (Authorization != null) + { + p.Add(new KeyValuePair("Authorization", Authorization)); + } + + return p; + } } /// @@ -118,6 +145,10 @@ public class DeleteFactorOptions : IOptions /// A string that uniquely identifies this Factor. /// public string PathSid { get; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new DeleteFactorOptions @@ -140,6 +171,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } /// @@ -162,6 +207,10 @@ public class FetchFactorOptions : IOptions /// A string that uniquely identifies this Factor. /// public string PathSid { get; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new FetchFactorOptions @@ -184,6 +233,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } /// @@ -202,6 +265,10 @@ public class ReadFactorOptions : ReadOptions /// Unique external identifier of the Entity /// public string PathIdentity { get; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new ReadFactorOptions @@ -227,6 +294,20 @@ public override List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } /// @@ -261,6 +342,10 @@ public class UpdateFactorOptions : IOptions /// The config for this Factor as a json string /// public string Config { get; set; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new UpdateFactorOptions @@ -298,6 +383,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Verify/V2/Service/Entity/FactorResource.cs b/src/Twilio/Rest/Verify/V2/Service/Entity/FactorResource.cs index 2b8eb2e4a..20a606752 100644 --- a/src/Twilio/Rest/Verify/V2/Service/Entity/FactorResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/Entity/FactorResource.cs @@ -55,7 +55,8 @@ private static Request BuildCreateRequest(CreateFactorOptions options, ITwilioRe HttpMethod.Post, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Factors", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -97,6 +98,8 @@ public static async System.Threading.Tasks.Task CreateAsync(Crea /// The friendly name of this Factor /// The Type of this Factor /// The config for this Factor as a json string + /// The Twilio-Sandbox-Mode HTTP request header + /// The Authorization HTTP request header /// Client to make requests to Twilio /// A single instance of Factor public static FactorResource Create(string pathServiceSid, @@ -105,9 +108,11 @@ public static FactorResource Create(string pathServiceSid, string friendlyName, FactorResource.FactorTypesEnum factorType, string config, + string twilioSandboxMode = null, + string authorization = null, ITwilioRestClient client = null) { - var options = new CreateFactorOptions(pathServiceSid, pathIdentity, binding, friendlyName, factorType, config); + var options = new CreateFactorOptions(pathServiceSid, pathIdentity, binding, friendlyName, factorType, config){TwilioSandboxMode = twilioSandboxMode, Authorization = authorization}; return Create(options, client); } @@ -121,6 +126,8 @@ public static FactorResource Create(string pathServiceSid, /// The friendly name of this Factor /// The Type of this Factor /// The config for this Factor as a json string + /// The Twilio-Sandbox-Mode HTTP request header + /// The Authorization HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Factor public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, @@ -129,9 +136,11 @@ public static async System.Threading.Tasks.Task CreateAsync(stri string friendlyName, FactorResource.FactorTypesEnum factorType, string config, + string twilioSandboxMode = null, + string authorization = null, ITwilioRestClient client = null) { - var options = new CreateFactorOptions(pathServiceSid, pathIdentity, binding, friendlyName, factorType, config); + var options = new CreateFactorOptions(pathServiceSid, pathIdentity, binding, friendlyName, factorType, config){TwilioSandboxMode = twilioSandboxMode, Authorization = authorization}; return await CreateAsync(options, client); } #endif @@ -142,7 +151,8 @@ private static Request BuildDeleteRequest(DeleteFactorOptions options, ITwilioRe HttpMethod.Delete, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Factors/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -181,14 +191,16 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteFactorOp /// Service Sid. /// Unique external identifier of the Entity /// A string that uniquely identifies this Factor. + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// A single instance of Factor public static bool Delete(string pathServiceSid, string pathIdentity, string pathSid, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new DeleteFactorOptions(pathServiceSid, pathIdentity, pathSid); + var options = new DeleteFactorOptions(pathServiceSid, pathIdentity, pathSid){TwilioSandboxMode = twilioSandboxMode}; return Delete(options, client); } @@ -199,14 +211,16 @@ public static bool Delete(string pathServiceSid, /// Service Sid. /// Unique external identifier of the Entity /// A string that uniquely identifies this Factor. + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Factor public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathIdentity, string pathSid, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new DeleteFactorOptions(pathServiceSid, pathIdentity, pathSid); + var options = new DeleteFactorOptions(pathServiceSid, pathIdentity, pathSid){TwilioSandboxMode = twilioSandboxMode}; return await DeleteAsync(options, client); } #endif @@ -217,7 +231,8 @@ private static Request BuildFetchRequest(FetchFactorOptions options, ITwilioRest HttpMethod.Get, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Factors/" + options.PathSid + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -256,14 +271,16 @@ public static async System.Threading.Tasks.Task FetchAsync(Fetch /// Service Sid. /// Unique external identifier of the Entity /// A string that uniquely identifies this Factor. + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// A single instance of Factor public static FactorResource Fetch(string pathServiceSid, string pathIdentity, string pathSid, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new FetchFactorOptions(pathServiceSid, pathIdentity, pathSid); + var options = new FetchFactorOptions(pathServiceSid, pathIdentity, pathSid){TwilioSandboxMode = twilioSandboxMode}; return Fetch(options, client); } @@ -274,14 +291,16 @@ public static FactorResource Fetch(string pathServiceSid, /// Service Sid. /// Unique external identifier of the Entity /// A string that uniquely identifies this Factor. + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Factor public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathIdentity, string pathSid, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new FetchFactorOptions(pathServiceSid, pathIdentity, pathSid); + var options = new FetchFactorOptions(pathServiceSid, pathIdentity, pathSid){TwilioSandboxMode = twilioSandboxMode}; return await FetchAsync(options, client); } #endif @@ -292,7 +311,8 @@ private static Request BuildReadRequest(ReadFactorOptions options, ITwilioRestCl HttpMethod.Get, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Factors", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -334,17 +354,19 @@ public static async System.Threading.Tasks.Task> Rea /// /// Service Sid. /// Unique external identifier of the Entity + /// The Twilio-Sandbox-Mode HTTP request header /// Page size /// Record limit /// Client to make requests to Twilio /// A single instance of Factor public static ResourceSet Read(string pathServiceSid, string pathIdentity, + string twilioSandboxMode = null, int? pageSize = null, long? limit = null, ITwilioRestClient client = null) { - var options = new ReadFactorOptions(pathServiceSid, pathIdentity){PageSize = pageSize, Limit = limit}; + var options = new ReadFactorOptions(pathServiceSid, pathIdentity){TwilioSandboxMode = twilioSandboxMode, PageSize = pageSize, Limit = limit}; return Read(options, client); } @@ -354,17 +376,19 @@ public static ResourceSet Read(string pathServiceSid, /// /// Service Sid. /// Unique external identifier of the Entity + /// The Twilio-Sandbox-Mode HTTP request header /// Page size /// Record limit /// Client to make requests to Twilio /// Task that resolves to A single instance of Factor public static async System.Threading.Tasks.Task> ReadAsync(string pathServiceSid, string pathIdentity, + string twilioSandboxMode = null, int? pageSize = null, long? limit = null, ITwilioRestClient client = null) { - var options = new ReadFactorOptions(pathServiceSid, pathIdentity){PageSize = pageSize, Limit = limit}; + var options = new ReadFactorOptions(pathServiceSid, pathIdentity){TwilioSandboxMode = twilioSandboxMode, PageSize = pageSize, Limit = limit}; return await ReadAsync(options, client); } #endif @@ -428,7 +452,8 @@ private static Request BuildUpdateRequest(UpdateFactorOptions options, ITwilioRe HttpMethod.Post, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Factors/" + options.PathSid + "", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -470,6 +495,7 @@ public static async System.Threading.Tasks.Task UpdateAsync(Upda /// Optional payload to verify the Factor for the first time /// The friendly name of this Factor /// The config for this Factor as a json string + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// A single instance of Factor public static FactorResource Update(string pathServiceSid, @@ -478,9 +504,10 @@ public static FactorResource Update(string pathServiceSid, string authPayload = null, string friendlyName = null, string config = null, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new UpdateFactorOptions(pathServiceSid, pathIdentity, pathSid){AuthPayload = authPayload, FriendlyName = friendlyName, Config = config}; + var options = new UpdateFactorOptions(pathServiceSid, pathIdentity, pathSid){AuthPayload = authPayload, FriendlyName = friendlyName, Config = config, TwilioSandboxMode = twilioSandboxMode}; return Update(options, client); } @@ -494,6 +521,7 @@ public static FactorResource Update(string pathServiceSid, /// Optional payload to verify the Factor for the first time /// The friendly name of this Factor /// The config for this Factor as a json string + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Factor public static async System.Threading.Tasks.Task UpdateAsync(string pathServiceSid, @@ -502,9 +530,10 @@ public static async System.Threading.Tasks.Task UpdateAsync(stri string authPayload = null, string friendlyName = null, string config = null, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new UpdateFactorOptions(pathServiceSid, pathIdentity, pathSid){AuthPayload = authPayload, FriendlyName = friendlyName, Config = config}; + var options = new UpdateFactorOptions(pathServiceSid, pathIdentity, pathSid){AuthPayload = authPayload, FriendlyName = friendlyName, Config = config, TwilioSandboxMode = twilioSandboxMode}; return await UpdateAsync(options, client); } #endif diff --git a/src/Twilio/Rest/Verify/V2/Service/EntityOptions.cs b/src/Twilio/Rest/Verify/V2/Service/EntityOptions.cs index dc32cc8dd..ea1dd8b65 100644 --- a/src/Twilio/Rest/Verify/V2/Service/EntityOptions.cs +++ b/src/Twilio/Rest/Verify/V2/Service/EntityOptions.cs @@ -27,6 +27,10 @@ public class CreateEntityOptions : IOptions /// Unique external identifier of the Entity /// public string Identity { get; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new CreateEntityOptions @@ -52,6 +56,20 @@ public List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } /// @@ -70,6 +88,10 @@ public class DeleteEntityOptions : IOptions /// Unique external identifier of the Entity /// public string PathIdentity { get; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new DeleteEntityOptions @@ -90,6 +112,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } /// @@ -108,6 +144,10 @@ public class FetchEntityOptions : IOptions /// Unique external identifier of the Entity /// public string PathIdentity { get; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new FetchEntityOptions @@ -128,6 +168,20 @@ public List> GetParams() var p = new List>(); return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } /// @@ -142,6 +196,10 @@ public class ReadEntityOptions : ReadOptions /// Service Sid. /// public string PathServiceSid { get; } + /// + /// The Twilio-Sandbox-Mode HTTP request header + /// + public string TwilioSandboxMode { get; set; } /// /// Construct a new ReadEntityOptions @@ -165,6 +223,20 @@ public override List> GetParams() return p; } + + /// + /// Generate the necessary header parameters + /// + public List> GetHeaderParams() + { + var p = new List>(); + if (TwilioSandboxMode != null) + { + p.Add(new KeyValuePair("Twilio-Sandbox-Mode", TwilioSandboxMode)); + } + + return p; + } } } \ No newline at end of file diff --git a/src/Twilio/Rest/Verify/V2/Service/EntityResource.cs b/src/Twilio/Rest/Verify/V2/Service/EntityResource.cs index 2a5e9a445..487181c44 100644 --- a/src/Twilio/Rest/Verify/V2/Service/EntityResource.cs +++ b/src/Twilio/Rest/Verify/V2/Service/EntityResource.cs @@ -29,7 +29,8 @@ private static Request BuildCreateRequest(CreateEntityOptions options, ITwilioRe HttpMethod.Post, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities", - postParams: options.GetParams() + postParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -67,11 +68,15 @@ public static async System.Threading.Tasks.Task CreateAsync(Crea /// /// Service Sid. /// Unique external identifier of the Entity + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// A single instance of Entity - public static EntityResource Create(string pathServiceSid, string identity, ITwilioRestClient client = null) + public static EntityResource Create(string pathServiceSid, + string identity, + string twilioSandboxMode = null, + ITwilioRestClient client = null) { - var options = new CreateEntityOptions(pathServiceSid, identity); + var options = new CreateEntityOptions(pathServiceSid, identity){TwilioSandboxMode = twilioSandboxMode}; return Create(options, client); } @@ -81,13 +86,15 @@ public static EntityResource Create(string pathServiceSid, string identity, ITwi /// /// Service Sid. /// Unique external identifier of the Entity + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Entity public static async System.Threading.Tasks.Task CreateAsync(string pathServiceSid, string identity, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new CreateEntityOptions(pathServiceSid, identity); + var options = new CreateEntityOptions(pathServiceSid, identity){TwilioSandboxMode = twilioSandboxMode}; return await CreateAsync(options, client); } #endif @@ -98,7 +105,8 @@ private static Request BuildDeleteRequest(DeleteEntityOptions options, ITwilioRe HttpMethod.Delete, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -136,11 +144,15 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteEntityOp /// /// Service Sid. /// Unique external identifier of the Entity + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// A single instance of Entity - public static bool Delete(string pathServiceSid, string pathIdentity, ITwilioRestClient client = null) + public static bool Delete(string pathServiceSid, + string pathIdentity, + string twilioSandboxMode = null, + ITwilioRestClient client = null) { - var options = new DeleteEntityOptions(pathServiceSid, pathIdentity); + var options = new DeleteEntityOptions(pathServiceSid, pathIdentity){TwilioSandboxMode = twilioSandboxMode}; return Delete(options, client); } @@ -150,13 +162,15 @@ public static bool Delete(string pathServiceSid, string pathIdentity, ITwilioRes /// /// Service Sid. /// Unique external identifier of the Entity + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Entity public static async System.Threading.Tasks.Task DeleteAsync(string pathServiceSid, string pathIdentity, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new DeleteEntityOptions(pathServiceSid, pathIdentity); + var options = new DeleteEntityOptions(pathServiceSid, pathIdentity){TwilioSandboxMode = twilioSandboxMode}; return await DeleteAsync(options, client); } #endif @@ -167,7 +181,8 @@ private static Request BuildFetchRequest(FetchEntityOptions options, ITwilioRest HttpMethod.Get, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -205,11 +220,15 @@ public static async System.Threading.Tasks.Task FetchAsync(Fetch /// /// Service Sid. /// Unique external identifier of the Entity + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// A single instance of Entity - public static EntityResource Fetch(string pathServiceSid, string pathIdentity, ITwilioRestClient client = null) + public static EntityResource Fetch(string pathServiceSid, + string pathIdentity, + string twilioSandboxMode = null, + ITwilioRestClient client = null) { - var options = new FetchEntityOptions(pathServiceSid, pathIdentity); + var options = new FetchEntityOptions(pathServiceSid, pathIdentity){TwilioSandboxMode = twilioSandboxMode}; return Fetch(options, client); } @@ -219,13 +238,15 @@ public static EntityResource Fetch(string pathServiceSid, string pathIdentity, I /// /// Service Sid. /// Unique external identifier of the Entity + /// The Twilio-Sandbox-Mode HTTP request header /// Client to make requests to Twilio /// Task that resolves to A single instance of Entity public static async System.Threading.Tasks.Task FetchAsync(string pathServiceSid, string pathIdentity, + string twilioSandboxMode = null, ITwilioRestClient client = null) { - var options = new FetchEntityOptions(pathServiceSid, pathIdentity); + var options = new FetchEntityOptions(pathServiceSid, pathIdentity){TwilioSandboxMode = twilioSandboxMode}; return await FetchAsync(options, client); } #endif @@ -236,7 +257,8 @@ private static Request BuildReadRequest(ReadEntityOptions options, ITwilioRestCl HttpMethod.Get, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/Entities", - queryParams: options.GetParams() + queryParams: options.GetParams(), + headerParams: options.GetHeaderParams() ); } @@ -277,16 +299,18 @@ public static async System.Threading.Tasks.Task> Rea /// Retrieve a list of all Entities for a Service. /// /// Service Sid. + /// The Twilio-Sandbox-Mode HTTP request header /// Page size /// Record limit /// Client to make requests to Twilio /// A single instance of Entity public static ResourceSet Read(string pathServiceSid, + string twilioSandboxMode = null, int? pageSize = null, long? limit = null, ITwilioRestClient client = null) { - var options = new ReadEntityOptions(pathServiceSid){PageSize = pageSize, Limit = limit}; + var options = new ReadEntityOptions(pathServiceSid){TwilioSandboxMode = twilioSandboxMode, PageSize = pageSize, Limit = limit}; return Read(options, client); } @@ -295,16 +319,18 @@ public static ResourceSet Read(string pathServiceSid, /// Retrieve a list of all Entities for a Service. /// /// Service Sid. + /// The Twilio-Sandbox-Mode HTTP request header /// Page size /// Record limit /// Client to make requests to Twilio /// Task that resolves to A single instance of Entity public static async System.Threading.Tasks.Task> ReadAsync(string pathServiceSid, + string twilioSandboxMode = null, int? pageSize = null, long? limit = null, ITwilioRestClient client = null) { - var options = new ReadEntityOptions(pathServiceSid){PageSize = pageSize, Limit = limit}; + var options = new ReadEntityOptions(pathServiceSid){TwilioSandboxMode = twilioSandboxMode, PageSize = pageSize, Limit = limit}; return await ReadAsync(options, client); } #endif diff --git a/test/Twilio.Test/Rest/Chat/V2/Service/Channel/MemberResourceTest.cs b/test/Twilio.Test/Rest/Chat/V2/Service/Channel/MemberResourceTest.cs index 6adc44884..05868944d 100644 --- a/test/Twilio.Test/Rest/Chat/V2/Service/Channel/MemberResourceTest.cs +++ b/test/Twilio.Test/Rest/Chat/V2/Service/Channel/MemberResourceTest.cs @@ -67,11 +67,12 @@ public void TestCreateRequest() "" ); request.AddPostParam("Identity", Serialize("identity")); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MemberResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MemberResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + MemberResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -89,7 +90,7 @@ public void TestCreateResponse() "{\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"jing\",\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"last_consumed_message_index\": null,\"last_consumption_timestamp\": null,\"date_created\": \"2016-03-24T21:05:50Z\",\"date_updated\": \"2016-03-24T21:05:50Z\",\"attributes\": \"{}\",\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MemberResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = MemberResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -154,11 +155,12 @@ public void TestDeleteRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MemberResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MemberResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MemberResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -176,7 +178,7 @@ public void TestDeleteResponse() "null" )); - var response = MemberResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MemberResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -190,11 +192,12 @@ public void TestUpdateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MemberResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MemberResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MemberResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -212,7 +215,7 @@ public void TestUpdateRoleSidResponse() "{\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"jing\",\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"last_consumed_message_index\": 20,\"last_consumption_timestamp\": \"2016-03-24T21:05:52Z\",\"date_created\": \"2016-03-24T21:05:50Z\",\"date_updated\": \"2016-03-24T21:05:51Z\",\"attributes\": \"{}\",\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MemberResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MemberResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Chat/V2/Service/Channel/MessageResourceTest.cs b/test/Twilio.Test/Rest/Chat/V2/Service/Channel/MessageResourceTest.cs index 34e954b8e..298d7e579 100644 --- a/test/Twilio.Test/Rest/Chat/V2/Service/Channel/MessageResourceTest.cs +++ b/test/Twilio.Test/Rest/Chat/V2/Service/Channel/MessageResourceTest.cs @@ -81,11 +81,12 @@ public void TestCreateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MessageResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -103,7 +104,7 @@ public void TestCreateResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"to\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": null,\"date_created\": \"2016-03-24T20:37:57Z\",\"date_updated\": \"2016-03-24T20:37:57Z\",\"last_updated_by\": \"system\",\"was_edited\": false,\"from\": \"system\",\"body\": \"Hello\",\"index\": 0,\"type\": \"text\",\"media\": null,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -118,7 +119,7 @@ public void TestCreateWithAllResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"to\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"last_updated_by\": \"username\",\"was_edited\": true,\"from\": \"system\",\"attributes\": \"{\\\"test\\\": \\\"test\\\"}\",\"body\": \"Hello\",\"index\": 0,\"type\": \"text\",\"media\": null,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -133,7 +134,7 @@ public void TestCreateMediaResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"to\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": null,\"date_created\": \"2016-03-24T20:37:57Z\",\"date_updated\": \"2016-03-24T20:37:57Z\",\"last_updated_by\": \"system\",\"was_edited\": false,\"from\": \"system\",\"body\": \"Hello\",\"index\": 0,\"type\": \"text\",\"media\": {\"sid\": \"MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"size\": 99999999999999,\"content_type\": \"application/pdf\",\"filename\": \"hello.pdf\"},\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -198,11 +199,12 @@ public void TestDeleteRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MessageResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MessageResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MessageResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -220,7 +222,7 @@ public void TestDeleteResponse() "null" )); - var response = MessageResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -234,11 +236,12 @@ public void TestUpdateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MessageResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MessageResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MessageResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -256,7 +259,7 @@ public void TestUpdateResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"to\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{ \\\"foo\\\": \\\"bar\\\" }\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"last_updated_by\": \"username\",\"was_edited\": true,\"from\": \"fromUser\",\"body\": \"Hello\",\"index\": 0,\"type\": \"text\",\"media\": null,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MessageResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Chat/V2/Service/ChannelResourceTest.cs b/test/Twilio.Test/Rest/Chat/V2/Service/ChannelResourceTest.cs index 861b64173..dff472774 100644 --- a/test/Twilio.Test/Rest/Chat/V2/Service/ChannelResourceTest.cs +++ b/test/Twilio.Test/Rest/Chat/V2/Service/ChannelResourceTest.cs @@ -66,11 +66,12 @@ public void TestDeleteRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ChannelResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChannelResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ChannelResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -88,7 +89,7 @@ public void TestDeleteResponse() "null" )); - var response = ChannelResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ChannelResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -102,11 +103,12 @@ public void TestCreateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ChannelResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChannelResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ChannelResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -124,7 +126,7 @@ public void TestCreateResponse() "{\"sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"friendly_name\",\"unique_name\": \"unique_name\",\"attributes\": \"{ \\\"foo\\\": \\\"bar\\\" }\",\"type\": \"public\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"created_by\": \"username\",\"members_count\": 0,\"messages_count\": 0,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"members\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members\",\"messages\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages\",\"invites\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites\",\"webhooks\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks\",\"last_message\": null}}" )); - var response = ChannelResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ChannelResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -189,11 +191,12 @@ public void TestUpdateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ChannelResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChannelResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ChannelResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -211,7 +214,7 @@ public void TestUpdateResponse() "{\"sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"friendly_name\",\"unique_name\": \"unique_name\",\"attributes\": \"{ \\\"foo\\\": \\\"bar\\\" }\",\"type\": \"public\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"created_by\": \"username\",\"members_count\": 0,\"messages_count\": 0,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"members\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members\",\"messages\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages\",\"invites\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites\",\"webhooks\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks\",\"last_message\": null}}" )); - var response = ChannelResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ChannelResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Chat/V2/Service/UserResourceTest.cs b/test/Twilio.Test/Rest/Chat/V2/Service/UserResourceTest.cs index 4476e833d..8380a2127 100644 --- a/test/Twilio.Test/Rest/Chat/V2/Service/UserResourceTest.cs +++ b/test/Twilio.Test/Rest/Chat/V2/Service/UserResourceTest.cs @@ -103,11 +103,12 @@ public void TestCreateRequest() "" ); request.AddPostParam("Identity", Serialize("identity")); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(UserResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - UserResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + UserResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", xTwilioWebhookEnabled: Serialize(UserResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -125,7 +126,7 @@ public void TestCreateResponse() "{\"sid\": \"USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"jing\",\"attributes\": null,\"is_online\": true,\"is_notifiable\": null,\"friendly_name\": null,\"joined_channels_count\": 0,\"date_created\": \"2016-03-24T21:05:19Z\",\"date_updated\": \"2016-03-24T21:05:19Z\",\"links\": {\"user_channels\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels\",\"user_bindings\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings\"},\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = UserResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = UserResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", xTwilioWebhookEnabled: Serialize(UserResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -190,11 +191,12 @@ public void TestUpdateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(UserResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - UserResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + UserResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(UserResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -212,7 +214,7 @@ public void TestUpdateResponse() "{\"sid\": \"USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"jing\",\"attributes\": null,\"is_online\": true,\"is_notifiable\": null,\"friendly_name\": null,\"joined_channels_count\": 0,\"date_created\": \"2016-03-24T21:05:19Z\",\"date_updated\": \"2016-03-24T21:05:19Z\",\"links\": {\"user_channels\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels\",\"user_bindings\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings\"},\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = UserResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = UserResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(UserResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Conversations/V1/Conversation/MessageResourceTest.cs b/test/Twilio.Test/Rest/Conversations/V1/Conversation/MessageResourceTest.cs index 8e181d128..1c0826814 100644 --- a/test/Twilio.Test/Rest/Conversations/V1/Conversation/MessageResourceTest.cs +++ b/test/Twilio.Test/Rest/Conversations/V1/Conversation/MessageResourceTest.cs @@ -30,11 +30,12 @@ public void TestCreateRequest() "/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MessageResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MessageResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MessageResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -52,7 +53,7 @@ public void TestCreateResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"body\": \"Hello\",\"media\": null,\"author\": \"message author\",\"participant_sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{ \\\"importance\\\": \\\"high\\\" }\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"index\": 0,\"delivery\": {\"total\": 2,\"sent\": \"all\",\"delivered\": \"some\",\"read\": \"some\",\"failed\": \"none\",\"undelivered\": \"none\"},\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"delivery_receipts\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Receipts\"}}" )); - var response = MessageResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -67,7 +68,7 @@ public void TestCreateWithMediaResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"body\": null,\"media\": [{\"sid\": \"MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"size\": 42056,\"content_type\": \"image/jpeg\",\"filename\": \"car.jpg\"}],\"author\": \"message author\",\"participant_sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{ \\\"importance\\\": \\\"high\\\" }\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"index\": 0,\"delivery\": {\"total\": 2,\"sent\": \"all\",\"delivered\": \"some\",\"read\": \"some\",\"failed\": \"none\",\"undelivered\": \"none\"},\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"delivery_receipts\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Receipts\"}}" )); - var response = MessageResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -82,7 +83,7 @@ public void TestCreateNoAttributesResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"body\": \"Hello\",\"media\": null,\"author\": \"message author\",\"participant_sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{}\",\"date_created\": \"2020-07-01T22:18:37Z\",\"date_updated\": \"2020-07-01T22:18:37Z\",\"index\": 0,\"delivery\": {\"total\": 2,\"sent\": \"all\",\"delivered\": \"some\",\"read\": \"some\",\"failed\": \"none\",\"undelivered\": \"none\"},\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"delivery_receipts\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Receipts\"}}" )); - var response = MessageResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -96,11 +97,12 @@ public void TestUpdateRequest() "/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MessageResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MessageResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MessageResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -118,7 +120,7 @@ public void TestUpdateResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"body\": \"Hello\",\"media\": null,\"author\": \"message author\",\"participant_sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{ \\\"importance\\\": \\\"high\\\" }\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"index\": 0,\"delivery\": {\"total\": 2,\"sent\": \"all\",\"delivered\": \"some\",\"read\": \"some\",\"failed\": \"none\",\"undelivered\": \"none\"},\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"delivery_receipts\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Receipts\"}}" )); - var response = MessageResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -132,11 +134,12 @@ public void TestDeleteRequest() "/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MessageResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MessageResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MessageResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -154,7 +157,7 @@ public void TestDeleteResponse() "null" )); - var response = MessageResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } diff --git a/test/Twilio.Test/Rest/Conversations/V1/Conversation/ParticipantResourceTest.cs b/test/Twilio.Test/Rest/Conversations/V1/Conversation/ParticipantResourceTest.cs index ec319da36..cc02c67cc 100644 --- a/test/Twilio.Test/Rest/Conversations/V1/Conversation/ParticipantResourceTest.cs +++ b/test/Twilio.Test/Rest/Conversations/V1/Conversation/ParticipantResourceTest.cs @@ -30,11 +30,12 @@ public void TestCreateRequest() "/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ParticipantResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -52,7 +53,7 @@ public void TestCreateSmsResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"null\",\"attributes\": \"{ \\\"role\\\": \\\"driver\\\" }\",\"messaging_binding\": {\"type\": \"sms\",\"address\": \"+15558675310\",\"proxy_address\": \"+15017122661\"},\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -67,7 +68,7 @@ public void TestCreateChatResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"IDENTITY\",\"attributes\": \"{ \\\"role\\\": \\\"driver\\\" }\",\"messaging_binding\": null,\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -82,7 +83,7 @@ public void TestCreateGmmsResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"IDENTITY\",\"attributes\": \"{ \\\"role\\\": \\\"driver\\\" }\",\"messaging_binding\": {\"type\": \"sms\",\"projected_address\": \"+15017122661\"},\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -97,7 +98,7 @@ public void TestCreateGmmsChatNoAttributesResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"IDENTITY\",\"attributes\": \"{}\",\"messaging_binding\": {\"type\": \"sms\",\"projected_address\": \"+15017122661\"},\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2020-07-01T22:18:37Z\",\"date_updated\": \"2020-07-01T22:18:37Z\",\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -112,7 +113,7 @@ public void TestCreateGmmsSmsNoAttributesResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"null\",\"attributes\": \"{}\",\"messaging_binding\": {\"type\": \"sms\",\"address\": \"+15017122661\"},\"role_sid\": \"null\",\"date_created\": \"2020-07-01T22:18:37Z\",\"date_updated\": \"2020-07-01T22:18:37Z\",\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ParticipantResource.Create("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -126,11 +127,12 @@ public void TestUpdateRequest() "/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ParticipantResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ParticipantResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ParticipantResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -148,7 +150,7 @@ public void TestUpdateResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"null\",\"attributes\": \"{ \\\"role\\\": \\\"driver\\\" }\",\"messaging_binding\": {\"type\": \"sms\",\"address\": \"+15558675310\",\"proxy_address\": \"+15017122661\"},\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ParticipantResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ParticipantResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -163,7 +165,7 @@ public void TestUpdateGmmsResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversation_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"id\",\"attributes\": \"{ \\\"role\\\": \\\"driver\\\" }\",\"messaging_binding\": {\"type\": \"sms\",\"projected_address\": \"+15017122661\"},\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ParticipantResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ParticipantResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -177,11 +179,12 @@ public void TestDeleteRequest() "/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ParticipantResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ParticipantResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ParticipantResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -199,7 +202,7 @@ public void TestDeleteResponse() "null" )); - var response = ParticipantResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ParticipantResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ParticipantResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } diff --git a/test/Twilio.Test/Rest/Conversations/V1/ConversationResourceTest.cs b/test/Twilio.Test/Rest/Conversations/V1/ConversationResourceTest.cs index b0a2cabb8..e4da21ca7 100644 --- a/test/Twilio.Test/Rest/Conversations/V1/ConversationResourceTest.cs +++ b/test/Twilio.Test/Rest/Conversations/V1/ConversationResourceTest.cs @@ -30,11 +30,12 @@ public void TestCreateRequest() "/v1/Conversations", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ConversationResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ConversationResource.Create(client: twilioRestClient); + ConversationResource.Create(xTwilioWebhookEnabled: Serialize(ConversationResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -52,7 +53,7 @@ public void TestCreateResponse() "{\"sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"chat_service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"messaging_service_sid\": \"MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"friendly_name\",\"attributes\": \"{ \\\"topic\\\": \\\"feedback\\\" }\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"state\": \"inactive\",\"timers\": {\"date_inactive\": \"2015-12-16T22:19:38Z\",\"date_closed\": \"2015-12-16T22:28:38Z\"},\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"participants\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants\",\"messages\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages\",\"webhooks\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks\"}}" )); - var response = ConversationResource.Create(client: twilioRestClient); + var response = ConversationResource.Create(xTwilioWebhookEnabled: Serialize(ConversationResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -67,7 +68,7 @@ public void TestCreateNoTimersNoAttributesResponse() "{\"sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"chat_service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"messaging_service_sid\": \"MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"friendly_name\",\"attributes\": \"{}\",\"date_created\": \"2020-07-01T22:18:37Z\",\"date_updated\": \"2020-07-01T22:18:37Z\",\"state\": \"active\",\"timers\": {},\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"participants\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants\",\"messages\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages\",\"webhooks\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks\"}}" )); - var response = ConversationResource.Create(client: twilioRestClient); + var response = ConversationResource.Create(xTwilioWebhookEnabled: Serialize(ConversationResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -81,11 +82,12 @@ public void TestUpdateRequest() "/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ConversationResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ConversationResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ConversationResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ConversationResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -103,7 +105,7 @@ public void TestUpdateResponse() "{\"sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"chat_service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"messaging_service_sid\": \"MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\",\"friendly_name\": \"friendly_name\",\"attributes\": \"{ \\\"topic\\\": \\\"feedback\\\" }\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"state\": \"inactive\",\"timers\": {\"date_inactive\": \"2015-12-16T22:19:38Z\",\"date_closed\": \"2015-12-16T22:28:38Z\"},\"url\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"participants\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants\",\"messages\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages\",\"webhooks\": \"https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks\"}}" )); - var response = ConversationResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ConversationResource.Update("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ConversationResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -117,11 +119,12 @@ public void TestDeleteRequest() "/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ConversationResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ConversationResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ConversationResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ConversationResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -139,7 +142,7 @@ public void TestDeleteResponse() "null" )); - var response = ConversationResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ConversationResource.Delete("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ConversationResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } diff --git a/test/Twilio.Test/Rest/IpMessaging/V2/Service/Channel/MemberResourceTest.cs b/test/Twilio.Test/Rest/IpMessaging/V2/Service/Channel/MemberResourceTest.cs index 258ee4fae..7518519f4 100644 --- a/test/Twilio.Test/Rest/IpMessaging/V2/Service/Channel/MemberResourceTest.cs +++ b/test/Twilio.Test/Rest/IpMessaging/V2/Service/Channel/MemberResourceTest.cs @@ -67,11 +67,12 @@ public void TestCreateRequest() "" ); request.AddPostParam("Identity", Serialize("identity")); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MemberResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MemberResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + MemberResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -89,7 +90,7 @@ public void TestCreateResponse() "{\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"jing\",\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"last_consumed_message_index\": null,\"last_consumption_timestamp\": null,\"date_created\": \"2016-03-24T21:05:50Z\",\"date_updated\": \"2016-03-24T21:05:50Z\",\"attributes\": \"{}\",\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MemberResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = MemberResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -154,11 +155,12 @@ public void TestDeleteRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MemberResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MemberResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MemberResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -176,7 +178,7 @@ public void TestDeleteResponse() "null" )); - var response = MemberResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MemberResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -190,11 +192,12 @@ public void TestUpdateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MemberResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MemberResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MemberResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -212,7 +215,7 @@ public void TestUpdateRoleSidResponse() "{\"sid\": \"MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"jing\",\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"last_consumed_message_index\": 20,\"last_consumption_timestamp\": \"2016-03-24T21:05:52Z\",\"date_created\": \"2016-03-24T21:05:50Z\",\"date_updated\": \"2016-03-24T21:05:51Z\",\"attributes\": \"{}\",\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MemberResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MemberResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MemberResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/IpMessaging/V2/Service/Channel/MessageResourceTest.cs b/test/Twilio.Test/Rest/IpMessaging/V2/Service/Channel/MessageResourceTest.cs index bb9de95da..ddbbb2105 100644 --- a/test/Twilio.Test/Rest/IpMessaging/V2/Service/Channel/MessageResourceTest.cs +++ b/test/Twilio.Test/Rest/IpMessaging/V2/Service/Channel/MessageResourceTest.cs @@ -81,11 +81,12 @@ public void TestCreateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MessageResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -103,7 +104,7 @@ public void TestCreateResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"to\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": null,\"date_created\": \"2016-03-24T20:37:57Z\",\"date_updated\": \"2016-03-24T20:37:57Z\",\"last_updated_by\": \"system\",\"was_edited\": false,\"from\": \"system\",\"body\": \"Hello\",\"index\": 0,\"type\": \"text\",\"media\": null,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -118,7 +119,7 @@ public void TestCreateWithAllResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"to\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"last_updated_by\": \"username\",\"was_edited\": true,\"from\": \"system\",\"attributes\": \"{\\\"test\\\": \\\"test\\\"}\",\"body\": \"Hello\",\"index\": 0,\"type\": \"text\",\"media\": null,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -133,7 +134,7 @@ public void TestCreateMediaResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"to\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": null,\"date_created\": \"2016-03-24T20:37:57Z\",\"date_updated\": \"2016-03-24T20:37:57Z\",\"last_updated_by\": \"system\",\"was_edited\": false,\"from\": \"system\",\"body\": \"Hello\",\"index\": 0,\"type\": \"text\",\"media\": {\"sid\": \"MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"size\": 99999999999999,\"content_type\": \"application/pdf\",\"filename\": \"hello.pdf\"},\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -198,11 +199,12 @@ public void TestDeleteRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MessageResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MessageResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MessageResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -220,7 +222,7 @@ public void TestDeleteResponse() "null" )); - var response = MessageResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -234,11 +236,12 @@ public void TestUpdateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(MessageResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - MessageResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + MessageResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -256,7 +259,7 @@ public void TestUpdateResponse() "{\"sid\": \"IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"to\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channel_sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{ \\\"foo\\\": \\\"bar\\\" }\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"last_updated_by\": \"username\",\"was_edited\": true,\"from\": \"fromUser\",\"body\": \"Hello\",\"index\": 0,\"type\": \"text\",\"media\": null,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = MessageResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = MessageResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(MessageResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/IpMessaging/V2/Service/ChannelResourceTest.cs b/test/Twilio.Test/Rest/IpMessaging/V2/Service/ChannelResourceTest.cs index 3e60efa39..70cf26246 100644 --- a/test/Twilio.Test/Rest/IpMessaging/V2/Service/ChannelResourceTest.cs +++ b/test/Twilio.Test/Rest/IpMessaging/V2/Service/ChannelResourceTest.cs @@ -66,11 +66,12 @@ public void TestDeleteRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ChannelResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChannelResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ChannelResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -88,7 +89,7 @@ public void TestDeleteResponse() "null" )); - var response = ChannelResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ChannelResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -102,11 +103,12 @@ public void TestCreateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ChannelResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChannelResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ChannelResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -124,7 +126,7 @@ public void TestCreateResponse() "{\"sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"friendly_name\",\"unique_name\": \"unique_name\",\"attributes\": \"{ \\\"foo\\\": \\\"bar\\\" }\",\"type\": \"public\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"created_by\": \"username\",\"members_count\": 0,\"messages_count\": 0,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"members\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members\",\"messages\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages\",\"invites\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites\",\"webhooks\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks\",\"last_message\": null}}" )); - var response = ChannelResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ChannelResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -189,11 +191,12 @@ public void TestUpdateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(ChannelResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChannelResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ChannelResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -211,7 +214,7 @@ public void TestUpdateResponse() "{\"sid\": \"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"friendly_name\",\"unique_name\": \"unique_name\",\"attributes\": \"{ \\\"foo\\\": \\\"bar\\\" }\",\"type\": \"public\",\"date_created\": \"2015-12-16T22:18:37Z\",\"date_updated\": \"2015-12-16T22:18:38Z\",\"created_by\": \"username\",\"members_count\": 0,\"messages_count\": 0,\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"members\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members\",\"messages\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages\",\"invites\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites\",\"webhooks\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks\",\"last_message\": null}}" )); - var response = ChannelResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ChannelResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(ChannelResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/IpMessaging/V2/Service/UserResourceTest.cs b/test/Twilio.Test/Rest/IpMessaging/V2/Service/UserResourceTest.cs index bf0291552..dac5ca703 100644 --- a/test/Twilio.Test/Rest/IpMessaging/V2/Service/UserResourceTest.cs +++ b/test/Twilio.Test/Rest/IpMessaging/V2/Service/UserResourceTest.cs @@ -103,11 +103,12 @@ public void TestCreateRequest() "" ); request.AddPostParam("Identity", Serialize("identity")); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(UserResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - UserResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + UserResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", xTwilioWebhookEnabled: Serialize(UserResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -125,7 +126,7 @@ public void TestCreateResponse() "{\"sid\": \"USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"jing\",\"attributes\": null,\"is_online\": true,\"is_notifiable\": null,\"friendly_name\": null,\"joined_channels_count\": 0,\"date_created\": \"2016-03-24T21:05:19Z\",\"date_updated\": \"2016-03-24T21:05:19Z\",\"links\": {\"user_channels\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels\",\"user_bindings\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings\"},\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = UserResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = UserResource.Create("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", xTwilioWebhookEnabled: Serialize(UserResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } @@ -190,11 +191,12 @@ public void TestUpdateRequest() "/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("X-Twilio-Webhook-Enabled", Serialize(UserResource.WebhookEnabledTypeEnum.True)); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - UserResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + UserResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(UserResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -212,7 +214,7 @@ public void TestUpdateResponse() "{\"sid\": \"USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"role_sid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"jing\",\"attributes\": null,\"is_online\": true,\"is_notifiable\": null,\"friendly_name\": null,\"joined_channels_count\": 0,\"date_created\": \"2016-03-24T21:05:19Z\",\"date_updated\": \"2016-03-24T21:05:19Z\",\"links\": {\"user_channels\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels\",\"user_bindings\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings\"},\"url\": \"https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = UserResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = UserResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", xTwilioWebhookEnabled: Serialize(UserResource.WebhookEnabledTypeEnum.True), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Preview/Sync/Service/DocumentResourceTest.cs b/test/Twilio.Test/Rest/Preview/Sync/Service/DocumentResourceTest.cs index f1e1b20d5..cd5c59620 100644 --- a/test/Twilio.Test/Rest/Preview/Sync/Service/DocumentResourceTest.cs +++ b/test/Twilio.Test/Rest/Preview/Sync/Service/DocumentResourceTest.cs @@ -66,11 +66,12 @@ public void TestDeleteRequest() "/Sync/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents/ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - DocumentResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + DocumentResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -88,7 +89,7 @@ public void TestDeleteResponse() "null" )); - var response = DocumentResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = DocumentResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } @@ -190,11 +191,12 @@ public void TestUpdateRequest() "" ); request.AddPostParam("Data", Serialize("{}")); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - DocumentResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "{}", client: twilioRestClient); + DocumentResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "{}", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -212,7 +214,7 @@ public void TestUpdateResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"created_by\": \"created_by\",\"data\": {},\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"revision\": \"revision\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\",\"url\": \"https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents/ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"permissions\": \"https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents/ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Permissions\"}}" )); - var response = DocumentResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "{}", client: twilioRestClient); + var response = DocumentResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "{}", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Preview/Sync/Service/SyncList/SyncListItemResourceTest.cs b/test/Twilio.Test/Rest/Preview/Sync/Service/SyncList/SyncListItemResourceTest.cs index 36f46ea64..aca2cd7b6 100644 --- a/test/Twilio.Test/Rest/Preview/Sync/Service/SyncList/SyncListItemResourceTest.cs +++ b/test/Twilio.Test/Rest/Preview/Sync/Service/SyncList/SyncListItemResourceTest.cs @@ -66,11 +66,12 @@ public void TestDeleteRequest() "/Sync/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/1", "" ); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - SyncListItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, client: twilioRestClient); + SyncListItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -88,7 +89,7 @@ public void TestDeleteResponse() "null" )); - var response = SyncListItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, client: twilioRestClient); + var response = SyncListItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } @@ -191,11 +192,12 @@ public void TestUpdateRequest() "" ); request.AddPostParam("Data", Serialize("{}")); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - SyncListItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, "{}", client: twilioRestClient); + SyncListItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, "{}", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -213,7 +215,7 @@ public void TestUpdateResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"created_by\": \"created_by\",\"data\": {},\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"index\": 100,\"list_sid\": \"ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"revision\": \"revision\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/100\"}" )); - var response = SyncListItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, "{}", client: twilioRestClient); + var response = SyncListItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, "{}", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Preview/Sync/Service/SyncMap/SyncMapItemResourceTest.cs b/test/Twilio.Test/Rest/Preview/Sync/Service/SyncMap/SyncMapItemResourceTest.cs index 9ddb6d10a..7622e5699 100644 --- a/test/Twilio.Test/Rest/Preview/Sync/Service/SyncMap/SyncMapItemResourceTest.cs +++ b/test/Twilio.Test/Rest/Preview/Sync/Service/SyncMap/SyncMapItemResourceTest.cs @@ -66,11 +66,12 @@ public void TestDeleteRequest() "/Sync/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/key", "" ); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - SyncMapItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", client: twilioRestClient); + SyncMapItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -88,7 +89,7 @@ public void TestDeleteResponse() "null" )); - var response = SyncMapItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", client: twilioRestClient); + var response = SyncMapItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } @@ -192,11 +193,12 @@ public void TestUpdateRequest() "" ); request.AddPostParam("Data", Serialize("{}")); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - SyncMapItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", "{}", client: twilioRestClient); + SyncMapItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", "{}", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -214,7 +216,7 @@ public void TestUpdateResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"created_by\": \"created_by\",\"data\": {},\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"key\": \"key\",\"map_sid\": \"MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"revision\": \"revision\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps/MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/key\"}" )); - var response = SyncMapItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", "{}", client: twilioRestClient); + var response = SyncMapItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", "{}", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Preview/TrustedComms/BrandsInformationResourceTest.cs b/test/Twilio.Test/Rest/Preview/TrustedComms/BrandsInformationResourceTest.cs index 374399f8d..9ef4ae385 100644 --- a/test/Twilio.Test/Rest/Preview/TrustedComms/BrandsInformationResourceTest.cs +++ b/test/Twilio.Test/Rest/Preview/TrustedComms/BrandsInformationResourceTest.cs @@ -30,11 +30,12 @@ public void TestFetchRequest() "/TrustedComms/BrandsInformation", "" ); + request.AddHeaderParam("If-None-Match", Serialize("if_none_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - BrandsInformationResource.Fetch(client: twilioRestClient); + BrandsInformationResource.Fetch(ifNoneMatch: Serialize("if_none_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -52,7 +53,7 @@ public void TestFetchResultsWithEtagResponse() "{\"update_time\": \"2020-05-19T19:47:51Z\",\"file_link\": \"https://www.twilio.com\",\"file_link_ttl_in_seconds\": \"900\",\"url\": \"https://preview.twilio.com/TrustedComms/BrandsInformation\"}" )); - var response = BrandsInformationResource.Fetch(client: twilioRestClient); + var response = BrandsInformationResource.Fetch(ifNoneMatch: Serialize("if_none_match"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Preview/TrustedComms/CpsResourceTest.cs b/test/Twilio.Test/Rest/Preview/TrustedComms/CpsResourceTest.cs index 302928599..63e61a9c1 100644 --- a/test/Twilio.Test/Rest/Preview/TrustedComms/CpsResourceTest.cs +++ b/test/Twilio.Test/Rest/Preview/TrustedComms/CpsResourceTest.cs @@ -30,11 +30,12 @@ public void TestFetchRequest() "/TrustedComms/CPS", "" ); + request.AddHeaderParam("X-Xcnam-Sensitive-Phone-Number", Serialize("x_xcnam_sensitive_phone_number")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - CpsResource.Fetch(client: twilioRestClient); + CpsResource.Fetch(xXcnamSensitivePhoneNumber: Serialize("x_xcnam_sensitive_phone_number"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -52,7 +53,7 @@ public void TestFetchResponse() "{\"cps_url\": \"https://preview.twilio.com/TrustedComms/CurrentCall\",\"phone_number\": \"+1500123\",\"url\": \"https://preview.twilio.com/TrustedComms/CPS\"}" )); - var response = CpsResource.Fetch(client: twilioRestClient); + var response = CpsResource.Fetch(xXcnamSensitivePhoneNumber: Serialize("x_xcnam_sensitive_phone_number"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Preview/TrustedComms/CurrentCallResourceTest.cs b/test/Twilio.Test/Rest/Preview/TrustedComms/CurrentCallResourceTest.cs index 5e4f8eee7..634355cb9 100644 --- a/test/Twilio.Test/Rest/Preview/TrustedComms/CurrentCallResourceTest.cs +++ b/test/Twilio.Test/Rest/Preview/TrustedComms/CurrentCallResourceTest.cs @@ -30,11 +30,13 @@ public void TestFetchRequest() "/TrustedComms/CurrentCall", "" ); + request.AddHeaderParam("X-Xcnam-Sensitive-Phone-Number-From", Serialize("x_xcnam_sensitive_phone_number_from")); + request.AddHeaderParam("X-Xcnam-Sensitive-Phone-Number-To", Serialize("x_xcnam_sensitive_phone_number_to")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - CurrentCallResource.Fetch(client: twilioRestClient); + CurrentCallResource.Fetch(xXcnamSensitivePhoneNumberFrom: Serialize("x_xcnam_sensitive_phone_number_from"), xXcnamSensitivePhoneNumberTo: Serialize("x_xcnam_sensitive_phone_number_to"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -52,7 +54,7 @@ public void TestReadFoundResponse() "{\"bg_color\": \"#fff\",\"caller\": \"Owl Bank\",\"created_at\": \"2019-05-01T20:00:00Z\",\"font_color\": \"#f22f46\",\"from\": \"+1500123\",\"logo\": \"https://www.twilio.com/marketing/bundles/company/img/logos/red/twilio-logo-red.png\",\"manager\": \"Twilio\",\"reason\": \"Hello Jhon, your bank appointment has been confirmed.\",\"shield_img\": \"https://www.twilio.com/marketing/bundles/company/img/badges/red/twilio-badge-red.png\",\"sid\": \"CQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"ringing\",\"to\": \"+1500456\",\"url\": \"https://preview.twilio.com/TrustedComms/CurrentCall\",\"use_case\": \"conversational\"}" )); - var response = CurrentCallResource.Fetch(client: twilioRestClient); + var response = CurrentCallResource.Fetch(xXcnamSensitivePhoneNumberFrom: Serialize("x_xcnam_sensitive_phone_number_from"), xXcnamSensitivePhoneNumberTo: Serialize("x_xcnam_sensitive_phone_number_to"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Sync/V1/Service/DocumentResourceTest.cs b/test/Twilio.Test/Rest/Sync/V1/Service/DocumentResourceTest.cs index 98e3dbde9..e71dc08b4 100644 --- a/test/Twilio.Test/Rest/Sync/V1/Service/DocumentResourceTest.cs +++ b/test/Twilio.Test/Rest/Sync/V1/Service/DocumentResourceTest.cs @@ -66,11 +66,12 @@ public void TestDeleteRequest() "/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents/ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - DocumentResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + DocumentResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -88,7 +89,7 @@ public void TestDeleteResponse() "null" )); - var response = DocumentResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = DocumentResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } @@ -189,11 +190,12 @@ public void TestUpdateRequest() "/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents/ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - DocumentResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + DocumentResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -211,7 +213,7 @@ public void TestUpdateResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"created_by\": \"created_by\",\"data\": {},\"date_expires\": \"2015-07-30T21:00:00Z\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"revision\": \"revision\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\",\"url\": \"https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents/ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"permissions\": \"https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents/ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Permissions\"}}" )); - var response = DocumentResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = DocumentResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Sync/V1/Service/SyncList/SyncListItemResourceTest.cs b/test/Twilio.Test/Rest/Sync/V1/Service/SyncList/SyncListItemResourceTest.cs index ce946defe..a3a9ea3ca 100644 --- a/test/Twilio.Test/Rest/Sync/V1/Service/SyncList/SyncListItemResourceTest.cs +++ b/test/Twilio.Test/Rest/Sync/V1/Service/SyncList/SyncListItemResourceTest.cs @@ -66,11 +66,12 @@ public void TestDeleteRequest() "/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/1", "" ); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - SyncListItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, client: twilioRestClient); + SyncListItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -88,7 +89,7 @@ public void TestDeleteResponse() "null" )); - var response = SyncListItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, client: twilioRestClient); + var response = SyncListItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } @@ -190,11 +191,12 @@ public void TestUpdateRequest() "/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/1", "" ); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - SyncListItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, client: twilioRestClient); + SyncListItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -212,7 +214,7 @@ public void TestUpdateResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"created_by\": \"created_by\",\"data\": {},\"date_expires\": \"2015-07-30T21:00:00Z\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"index\": 100,\"list_sid\": \"ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"revision\": \"revision\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/100\"}" )); - var response = SyncListItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, client: twilioRestClient); + var response = SyncListItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Sync/V1/Service/SyncMap/SyncMapItemResourceTest.cs b/test/Twilio.Test/Rest/Sync/V1/Service/SyncMap/SyncMapItemResourceTest.cs index 5814b0498..16f411849 100644 --- a/test/Twilio.Test/Rest/Sync/V1/Service/SyncMap/SyncMapItemResourceTest.cs +++ b/test/Twilio.Test/Rest/Sync/V1/Service/SyncMap/SyncMapItemResourceTest.cs @@ -66,11 +66,12 @@ public void TestDeleteRequest() "/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/key", "" ); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - SyncMapItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", client: twilioRestClient); + SyncMapItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -88,7 +89,7 @@ public void TestDeleteResponse() "null" )); - var response = SyncMapItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", client: twilioRestClient); + var response = SyncMapItemResource.Delete("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } @@ -191,11 +192,12 @@ public void TestUpdateRequest() "/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/key", "" ); + request.AddHeaderParam("If-Match", Serialize("if_match")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - SyncMapItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", client: twilioRestClient); + SyncMapItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -213,7 +215,7 @@ public void TestUpdateResponse() "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"created_by\": \"created_by\",\"data\": {},\"date_expires\": \"2015-07-30T21:00:00Z\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"key\": \"key\",\"map_sid\": \"MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"revision\": \"revision\",\"service_sid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps/MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/key\"}" )); - var response = SyncMapItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", client: twilioRestClient); + var response = SyncMapItemResource.Update("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", ifMatch: Serialize("if_match"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Verify/V2/Service/Entity/ChallengeResourceTest.cs b/test/Twilio.Test/Rest/Verify/V2/Service/Entity/ChallengeResourceTest.cs index c0e821a4c..2e13f275f 100644 --- a/test/Twilio.Test/Rest/Verify/V2/Service/Entity/ChallengeResourceTest.cs +++ b/test/Twilio.Test/Rest/Verify/V2/Service/Entity/ChallengeResourceTest.cs @@ -31,11 +31,12 @@ public void TestCreateRequest() "" ); request.AddPostParam("FactorSid", Serialize("YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChallengeResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ChallengeResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -53,7 +54,7 @@ public void TestCreateResponse() "{\"sid\": \"YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"entity_sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"factor_sid\": \"YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"date_responded\": \"2015-07-30T20:00:00Z\",\"expiration_date\": \"2015-07-30T20:00:00Z\",\"status\": \"pending\",\"responded_reason\": \"none\",\"details\": \"{\\\"message\\\": \\\"Hi! Mr. John Doe, would you like to sign up?\\\", \\\"date\\\":\\\"2020-07-01T12:13:14Z\\\", \\\"fields\\\": [{\\\"label\\\": \\\"Action\\\", \\\"value\\\": \\\"Sign up in portal\\\"}]}\",\"hidden_details\": \"{\\\"ip\\\": \\\"172.168.1.234\\\"}\",\"factor_type\": \"push\",\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ChallengeResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ChallengeResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -67,11 +68,12 @@ public void TestFetchRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Challenges/YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChallengeResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ChallengeResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -89,7 +91,7 @@ public void TestFetchSidResponse() "{\"sid\": \"YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"entity_sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"factor_sid\": \"YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"date_responded\": \"2015-07-30T20:00:00Z\",\"expiration_date\": \"2015-07-30T20:00:00Z\",\"status\": \"pending\",\"responded_reason\": \"none\",\"details\": \"{\\\"message\\\": \\\"Hi! Mr. John Doe, would you like to sign up?\\\", \\\"fields\\\": [{\\\"label\\\": \\\"Action\\\", \\\"value\\\": \\\"Sign up in portal\\\"}]}\",\"hidden_details\": \"{\\\"ip\\\": \\\"172.168.1.234\\\"}\",\"factor_type\": \"push\",\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ChallengeResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ChallengeResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -103,11 +105,12 @@ public void TestReadRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Challenges", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChallengeResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + ChallengeResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -125,7 +128,7 @@ public void TestReadEmptyResponse() "{\"challenges\": [],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"challenges\"}}" )); - var response = ChallengeResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = ChallengeResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -140,7 +143,7 @@ public void TestReadFullResponse() "{\"challenges\": [{\"sid\": \"YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"entity_sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"factor_sid\": \"YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"date_responded\": \"2015-07-30T20:00:00Z\",\"expiration_date\": \"2015-07-30T20:00:00Z\",\"status\": \"pending\",\"responded_reason\": \"none\",\"details\": \"{\\\"message\\\": \\\"Hi! Mr. John Doe, would you like to sign up?\\\", \\\"fields\\\": [{\\\"label\\\": \\\"Action\\\", \\\"value\\\": \\\"Sign up in portal\\\"}]}\",\"hidden_details\": \"{\\\"ip\\\": \\\"172.168.1.234\\\"}\",\"factor_type\": \"push\",\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"challenges\"}}" )); - var response = ChallengeResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = ChallengeResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -154,11 +157,12 @@ public void TestUpdateRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Challenges/YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - ChallengeResource.Update("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + ChallengeResource.Update("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -176,7 +180,7 @@ public void TestVerifySidResponse() "{\"sid\": \"YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"entity_sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"factor_sid\": \"YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"date_responded\": \"2015-07-30T20:00:00Z\",\"expiration_date\": \"2015-07-30T20:00:00Z\",\"status\": \"approved\",\"responded_reason\": \"none\",\"details\": \"{\\\"message\\\": \\\"Hi! Mr. John Doe, would you like to sign up?\\\", \\\"fields\\\": [{\\\"label\\\": \\\"Action\\\", \\\"value\\\": \\\"Sign up in portal\\\"}]}\",\"hidden_details\": \"{\\\"ip\\\": \\\"172.168.1.234\\\"}\",\"factor_type\": \"push\",\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = ChallengeResource.Update("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = ChallengeResource.Update("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Verify/V2/Service/Entity/FactorResourceTest.cs b/test/Twilio.Test/Rest/Verify/V2/Service/Entity/FactorResourceTest.cs index cf8806725..11f9f89c7 100644 --- a/test/Twilio.Test/Rest/Verify/V2/Service/Entity/FactorResourceTest.cs +++ b/test/Twilio.Test/Rest/Verify/V2/Service/Entity/FactorResourceTest.cs @@ -34,11 +34,13 @@ public void TestCreateRequest() request.AddPostParam("FriendlyName", Serialize("friendly_name")); request.AddPostParam("FactorType", Serialize(FactorResource.FactorTypesEnum.Push)); request.AddPostParam("Config", Serialize("config")); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); + request.AddHeaderParam("Authorization", Serialize("authorization")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - FactorResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "binding", "friendly_name", FactorResource.FactorTypesEnum.Push, "config", client: twilioRestClient); + FactorResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "binding", "friendly_name", FactorResource.FactorTypesEnum.Push, "config", twilioSandboxMode: Serialize("twilio_sandbox_mode"), authorization: Serialize("authorization"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -56,7 +58,7 @@ public void TestCreateResponse() "{\"sid\": \"YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"entity_sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"friendly_name\": \"friendly_name\",\"status\": \"unverified\",\"factor_type\": \"push\",\"config\": {\"sdk_version\": \"1.0\",\"app_id\": \"com.authy.authy\",\"notification_platform\": \"fcm\",\"notification_token\": \"test_token\"},\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = FactorResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "binding", "friendly_name", FactorResource.FactorTypesEnum.Push, "config", client: twilioRestClient); + var response = FactorResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "binding", "friendly_name", FactorResource.FactorTypesEnum.Push, "config", twilioSandboxMode: Serialize("twilio_sandbox_mode"), authorization: Serialize("authorization"), client: twilioRestClient); Assert.NotNull(response); } @@ -70,11 +72,12 @@ public void TestDeleteRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Factors/YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - FactorResource.Delete("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + FactorResource.Delete("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -92,7 +95,7 @@ public void TestDeleteResponse() "null" )); - var response = FactorResource.Delete("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = FactorResource.Delete("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -106,11 +109,12 @@ public void TestFetchRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Factors/YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - FactorResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + FactorResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -128,7 +132,7 @@ public void TestFetchResponse() "{\"sid\": \"YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"entity_sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"friendly_name\": \"friendly_name\",\"status\": \"unverified\",\"factor_type\": \"push\",\"config\": {\"sdk_version\": \"1.0\",\"app_id\": \"com.authy.authy\",\"notification_platform\": \"fcm\",\"notification_token\": \"test_token\"},\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = FactorResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = FactorResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -142,11 +146,12 @@ public void TestReadRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Factors", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - FactorResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + FactorResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -164,7 +169,7 @@ public void TestReadEmptyResponse() "{\"factors\": [],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"factors\"}}" )); - var response = FactorResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = FactorResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -179,7 +184,7 @@ public void TestReadFullResponse() "{\"factors\": [{\"sid\": \"YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"entity_sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"friendly_name\": \"friendly_name\",\"status\": \"unverified\",\"factor_type\": \"push\",\"config\": {\"sdk_version\": \"1.0\",\"app_id\": \"com.authy.authy\",\"notification_platform\": \"fcm\",\"notification_token\": \"test_token\"},\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"factors\"}}" )); - var response = FactorResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = FactorResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -193,11 +198,12 @@ public void TestUpdateRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity/Factors/YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - FactorResource.Update("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + FactorResource.Update("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -215,7 +221,7 @@ public void TestVerifyResponse() "{\"sid\": \"YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"entity_sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"friendly_name\": \"friendly_name\",\"status\": \"verified\",\"factor_type\": \"push\",\"config\": {\"sdk_version\": \"1.0\",\"app_id\": \"com.authy.authy\",\"notification_platform\": \"fcm\",\"notification_token\": \"test_token\"},\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); - var response = FactorResource.Update("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = FactorResource.Update("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } } diff --git a/test/Twilio.Test/Rest/Verify/V2/Service/EntityResourceTest.cs b/test/Twilio.Test/Rest/Verify/V2/Service/EntityResourceTest.cs index 407ba0dac..2e065e9c6 100644 --- a/test/Twilio.Test/Rest/Verify/V2/Service/EntityResourceTest.cs +++ b/test/Twilio.Test/Rest/Verify/V2/Service/EntityResourceTest.cs @@ -31,11 +31,12 @@ public void TestCreateRequest() "" ); request.AddPostParam("Identity", Serialize("identity")); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - EntityResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + EntityResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -53,7 +54,7 @@ public void TestCreateResponse() "{\"sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f\",\"links\": {\"factors\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors\",\"challenges\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges\"}}" )); - var response = EntityResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = EntityResource.Create("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -67,11 +68,12 @@ public void TestDeleteRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - EntityResource.Delete("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + EntityResource.Delete("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -89,7 +91,7 @@ public void TestDeleteResponse() "null" )); - var response = EntityResource.Delete("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = EntityResource.Delete("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -103,11 +105,12 @@ public void TestFetchRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - EntityResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + EntityResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -125,7 +128,7 @@ public void TestFetchResponse() "{\"sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f\",\"links\": {\"factors\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors\",\"challenges\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges\"}}" )); - var response = EntityResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", client: twilioRestClient); + var response = EntityResource.Fetch("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -139,11 +142,12 @@ public void TestReadRequest() "/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities", "" ); + request.AddHeaderParam("Twilio-Sandbox-Mode", Serialize("twilio_sandbox_mode")); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { - EntityResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + EntityResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} @@ -161,7 +165,7 @@ public void TestReadEmptyResponse() "{\"entities\": [],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"entities\"}}" )); - var response = EntityResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = EntityResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } @@ -176,7 +180,7 @@ public void TestReadFullResponse() "{\"entities\": [{\"sid\": \"YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"identity\": \"ff483d1ff591898a9942916050d2ca3f\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f\",\"links\": {\"factors\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors\",\"challenges\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges\"}}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"entities\"}}" )); - var response = EntityResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); + var response = EntityResource.Read("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", twilioSandboxMode: Serialize("twilio_sandbox_mode"), client: twilioRestClient); Assert.NotNull(response); } }