From bc68500f936121fdf651cefc4cf86d0116f84bbf Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 12 Apr 2020 14:49:45 -0400 Subject: [PATCH 1/8] SingleSendFilter.cs is no longer used --- Source/StrongGrid/Models/SingleSendFilter.cs | 28 -------------------- 1 file changed, 28 deletions(-) delete mode 100644 Source/StrongGrid/Models/SingleSendFilter.cs diff --git a/Source/StrongGrid/Models/SingleSendFilter.cs b/Source/StrongGrid/Models/SingleSendFilter.cs deleted file mode 100644 index df09681b..00000000 --- a/Source/StrongGrid/Models/SingleSendFilter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Newtonsoft.Json; - -namespace StrongGrid.Models -{ - /// - /// Single Send filter. - /// - public class SingleSendFilter - { - /// - /// Gets or sets the lists. - /// - /// - /// The lists. - /// - [JsonProperty("list_ids", NullValueHandling = NullValueHandling.Ignore)] - public string[] Lists { get; set; } - - /// - /// Gets or sets the segments. - /// - /// - /// The segments. - /// - [JsonProperty("segment_ids", NullValueHandling = NullValueHandling.Ignore)] - public string[] Segments { get; set; } - } -} From 5ff0d95f5e2c6141a824dd244d4395d3ed5cb852 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 12 Apr 2020 14:50:57 -0400 Subject: [PATCH 2/8] Replace the Filter property on the SingleSend model class with EmailConfig and SendTo --- Source/StrongGrid/Models/SingleSend.cs | 15 ++++++---- .../Models/SingleSendEmailConfig.cs | 9 ++++++ Source/StrongGrid/Models/SingleSendSendTo.cs | 28 +++++++++++++++++++ 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 Source/StrongGrid/Models/SingleSendEmailConfig.cs create mode 100644 Source/StrongGrid/Models/SingleSendSendTo.cs diff --git a/Source/StrongGrid/Models/SingleSend.cs b/Source/StrongGrid/Models/SingleSend.cs index 3abc9b76..e687bce4 100644 --- a/Source/StrongGrid/Models/SingleSend.cs +++ b/Source/StrongGrid/Models/SingleSend.cs @@ -80,8 +80,8 @@ public class SingleSend [JsonIgnore] public string[] Lists { - get { return Filter.Lists; } - set { Filter.Lists = value; } + get { return SendTo.Lists; } + set { SendTo.Lists = value; } } /// @@ -93,8 +93,8 @@ public string[] Lists [JsonIgnore] public string[] Segments { - get { return Filter.Segments; } - set { Filter.Segments = value; } + get { return SendTo.Segments; } + set { SendTo.Segments = value; } } /// @@ -142,7 +142,10 @@ public string[] Segments [JsonProperty("ip_pool", NullValueHandling = NullValueHandling.Ignore)] public string IpPool { get; set; } - [JsonProperty("filter", NullValueHandling = NullValueHandling.Ignore)] - private SingleSendFilter Filter { get; set; } + [JsonProperty("email_config", NullValueHandling = NullValueHandling.Ignore)] + private SingleSendEmailConfig EmailConfig { get; set; } + + [JsonProperty("send_to", NullValueHandling = NullValueHandling.Ignore)] + private SingleSendSendTo SendTo { get; set; } } } diff --git a/Source/StrongGrid/Models/SingleSendEmailConfig.cs b/Source/StrongGrid/Models/SingleSendEmailConfig.cs new file mode 100644 index 00000000..52942af1 --- /dev/null +++ b/Source/StrongGrid/Models/SingleSendEmailConfig.cs @@ -0,0 +1,9 @@ +namespace StrongGrid.Models +{ + /// + /// Single Send email config. + /// + public class SingleSendEmailConfig + { + } +} diff --git a/Source/StrongGrid/Models/SingleSendSendTo.cs b/Source/StrongGrid/Models/SingleSendSendTo.cs new file mode 100644 index 00000000..709c2bd7 --- /dev/null +++ b/Source/StrongGrid/Models/SingleSendSendTo.cs @@ -0,0 +1,28 @@ +using Newtonsoft.Json; + +namespace StrongGrid.Models +{ + /// + /// Single Send send to. + /// + public class SingleSendSendTo + { + /// + /// Gets or sets the lists. + /// + /// + /// The lists. + /// + [JsonProperty("list_ids", NullValueHandling = NullValueHandling.Ignore)] + public string[] Lists { get; set; } + + /// + /// Gets or sets the segments. + /// + /// + /// The segments. + /// + [JsonProperty("segment_ids", NullValueHandling = NullValueHandling.Ignore)] + public string[] Segments { get; set; } + } +} From 61d7f46d48cf689ab6f1b0e9c4e16fa63a62c157 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 12 Apr 2020 14:55:01 -0400 Subject: [PATCH 3/8] Remove the templateId parameter when creating/updating a SingleSend and replace it with subject, htmlContent, textContent, designId and editor type --- Source/StrongGrid/Resources/ISingleSends.cs | 24 ++++++++-- Source/StrongGrid/Resources/SingleSends.cs | 52 ++++++++++++++------- 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/Source/StrongGrid/Resources/ISingleSends.cs b/Source/StrongGrid/Resources/ISingleSends.cs index edae0b8b..4c6af267 100644 --- a/Source/StrongGrid/Resources/ISingleSends.cs +++ b/Source/StrongGrid/Resources/ISingleSends.cs @@ -20,12 +20,16 @@ public interface ISingleSends /// /// The name. /// The sender identifier. + /// The subject. + /// The HTML content. + /// The plain text content. + /// The design identifier. + /// The type of editor. /// The categories. /// The custom unsubscribe URL. /// The suppression group identifier. /// The list ids. /// The segment ids. - /// The template id. /// The ip pool. /// Cancellation token. /// @@ -34,12 +38,16 @@ public interface ISingleSends Task CreateAsync( string name, long senderId, + Parameter subject = default, + Parameter htmlContent = default, + Parameter textContent = default, + Parameter designId = default, + Parameter editor = default, Parameter> categories = default, Parameter customUnsubscribeUrl = default, Parameter suppressionGroupId = default, Parameter> listIds = default, Parameter> segmentIds = default, - Parameter templateId = default, Parameter ipPool = default, CancellationToken cancellationToken = default); @@ -49,12 +57,16 @@ Task CreateAsync( /// The id of the single send. /// The name. /// The sender identifier. + /// The subject. + /// The HTML content. + /// The plain text content. + /// The design identifier. + /// The type of editor. /// The categories. /// The custom unsubscribe URL. /// The suppression group identifier. /// The list ids. /// The segment ids. - /// The template id. /// The ip pool. /// Cancellation token. /// @@ -64,12 +76,16 @@ Task UpdateAsync( string singleSendId, Parameter name = default, Parameter senderId = default, + Parameter subject = default, + Parameter htmlContent = default, + Parameter textContent = default, + Parameter designId = default, + Parameter editor = default, Parameter> categories = default, Parameter customUnsubscribeUrl = default, Parameter suppressionGroupId = default, Parameter> listIds = default, Parameter> segmentIds = default, - Parameter templateId = default, Parameter ipPool = default, CancellationToken cancellationToken = default); diff --git a/Source/StrongGrid/Resources/SingleSends.cs b/Source/StrongGrid/Resources/SingleSends.cs index 9e872083..f064e819 100644 --- a/Source/StrongGrid/Resources/SingleSends.cs +++ b/Source/StrongGrid/Resources/SingleSends.cs @@ -19,7 +19,7 @@ namespace StrongGrid.Resources /// public class SingleSends : ISingleSends { - private const string _endpoint = "marketing/campaigns"; + private const string _endpoint = "marketing/singlesends"; private readonly Pathoschild.Http.Client.IClient _client; /// @@ -36,12 +36,16 @@ internal SingleSends(Pathoschild.Http.Client.IClient client) /// /// The name. /// The sender identifier. + /// The subject. + /// The HTML content. + /// The plain text content. + /// The design identifier. + /// The type of editor. /// The categories. /// The custom unsubscribe URL. /// The suppression group identifier. /// The list ids. /// The segment ids. - /// The template id. /// The ip pool. /// Cancellation token. /// @@ -50,16 +54,20 @@ internal SingleSends(Pathoschild.Http.Client.IClient client) public Task CreateAsync( string name, long senderId, + Parameter subject = default, + Parameter htmlContent = default, + Parameter textContent = default, + Parameter designId = default, + Parameter editor = default, Parameter> categories = default, Parameter customUnsubscribeUrl = default, Parameter suppressionGroupId = default, Parameter> listIds = default, Parameter> segmentIds = default, - Parameter templateId = default, Parameter ipPool = default, CancellationToken cancellationToken = default) { - var data = CreateJObject(name, senderId, SingleSendStatus.Draft, categories, customUnsubscribeUrl, suppressionGroupId, listIds, segmentIds, default, templateId, ipPool); + var data = CreateJObject(name, senderId, categories, customUnsubscribeUrl, suppressionGroupId, listIds, segmentIds, default, ipPool, subject, htmlContent, textContent, string.IsNullOrEmpty(textContent), designId, editor); return _client .PostAsync(_endpoint) .WithJsonBody(data) @@ -73,12 +81,16 @@ public Task CreateAsync( /// The id of the single send. /// The name. /// The sender identifier. + /// The subject. + /// The HTML content. + /// The plain text content. + /// The design identifier. + /// The type of editor. /// The categories. /// The custom unsubscribe URL. /// The suppression group identifier. /// The list ids. /// The segment ids. - /// The template id. /// The ip pool. /// Cancellation token. /// @@ -88,16 +100,20 @@ public Task UpdateAsync( string singleSendId, Parameter name = default, Parameter senderId = default, + Parameter subject = default, + Parameter htmlContent = default, + Parameter textContent = default, + Parameter designId = default, + Parameter editor = default, Parameter> categories = default, Parameter customUnsubscribeUrl = default, Parameter suppressionGroupId = default, Parameter> listIds = default, Parameter> segmentIds = default, - Parameter templateId = default, Parameter ipPool = default, CancellationToken cancellationToken = default) { - var data = CreateJObject(name, senderId, default, categories, customUnsubscribeUrl, suppressionGroupId, listIds, segmentIds, default, templateId, ipPool); + var data = CreateJObject(name, senderId, categories, customUnsubscribeUrl, suppressionGroupId, listIds, segmentIds, default, ipPool, subject, htmlContent, textContent, string.IsNullOrEmpty(textContent), designId, editor); return _client .PatchAsync($"{_endpoint}/{singleSendId}") .WithJsonBody(data) @@ -234,27 +250,31 @@ public Task UnscheduleAsync(string singleSendId, CancellationToken cancellationT .AsMessage(); } - private static JObject CreateJObject(string name, long senderId, Parameter status, Parameter> categories, Parameter customUnsubscribeUrl, Parameter suppressionGroupId, Parameter> listIds, Parameter> segmentIds, Parameter sendOn, Parameter templateId, Parameter ipPool) + private static JObject CreateJObject(string name, long senderId, Parameter> categories, Parameter customUnsubscribeUrl, Parameter suppressionGroupId, Parameter> listIds, Parameter> segmentIds, Parameter sendOn, Parameter ipPool, Parameter subject, Parameter htmlContent, Parameter textContent, Parameter generateTextContent, Parameter designId, Parameter editor) { var result = new JObject(); result.AddPropertyIfValue("name", name); result.AddPropertyIfValue("categories", categories); - result.AddPropertyIfValue("sender_id", senderId); - result.AddPropertyIfEnumValue("status", status); - result.AddPropertyIfValue("custom_unsubscribe_url", customUnsubscribeUrl); - result.AddPropertyIfValue("suppression_group_id", suppressionGroupId); result.AddPropertyIfValue("send_at", sendOn); - result.AddPropertyIfValue("template_id", templateId); - result.AddPropertyIfValue("ip_pool", ipPool); + result.AddPropertyIfValue("email_config/sender_id", senderId); + result.AddPropertyIfValue("email_config/custom_unsubscribe_url", customUnsubscribeUrl); + result.AddPropertyIfValue("email_config/suppression_group_id", suppressionGroupId); + result.AddPropertyIfValue("email_config/ip_pool", ipPool); + result.AddPropertyIfValue("email_config/subject", subject); + result.AddPropertyIfValue("email_config/html_content", htmlContent); + result.AddPropertyIfValue("email_config/plain_content", textContent); + result.AddPropertyIfValue("email_config/generate_plain_content", generateTextContent); + result.AddPropertyIfValue("email_config/design_id", designId); + result.AddPropertyIfEnumValue("email_config/editor", editor); if (listIds.HasValue && listIds.Value != null && listIds.Value.Any()) { - result.AddPropertyIfValue("filter/list_ids", listIds); + result.AddPropertyIfValue("send_to/list_ids", listIds); } if (segmentIds.HasValue && segmentIds.Value != null && segmentIds.Value.Any()) { - result.AddPropertyIfValue("filter/segment_ids", segmentIds); + result.AddPropertyIfValue("send_to/segment_ids", segmentIds); } return result; From cd3cdab3454e477c6f03909810a95ab9cb089833 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sun, 12 Apr 2020 14:58:21 -0400 Subject: [PATCH 4/8] Update SingleSend integration test --- .../Tests/SingleSendsAndSenderIdentities.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/StrongGrid.IntegrationTests/Tests/SingleSendsAndSenderIdentities.cs b/Source/StrongGrid.IntegrationTests/Tests/SingleSendsAndSenderIdentities.cs index a76c1a5e..6e733d53 100644 --- a/Source/StrongGrid.IntegrationTests/Tests/SingleSendsAndSenderIdentities.cs +++ b/Source/StrongGrid.IntegrationTests/Tests/SingleSendsAndSenderIdentities.cs @@ -80,7 +80,9 @@ public async Task RunAsync(IClient client, TextWriter log, CancellationToken can await log.WriteLineAsync("Unsubscribe group created").ConfigureAwait(false); } - var singleSend = await client.SingleSends.CreateAsync("StrongGrid Integration Testing: new single send", sender.Id, default, default, unsubscribeGroup.Id, new[] { list.Id }, default, default, default, cancellationToken).ConfigureAwait(false); + var subject = "This is a test"; + var htmlContent = "This is a test"; + var singleSend = await client.SingleSends.CreateAsync("StrongGrid Integration Testing: new single send", sender.Id, subject, htmlContent, default, default, EditorType.Code, default, default, unsubscribeGroup.Id, new[] { list.Id }, default, default, cancellationToken).ConfigureAwait(false); await log.WriteLineAsync($"Single Send '{singleSend.Name}' created. Id: {singleSend.Id}").ConfigureAwait(false); singleSend = await client.SingleSends.UpdateAsync(singleSend.Id, categories: new[] { "category1", "category2" }, cancellationToken: cancellationToken).ConfigureAwait(false); From 27cc3056c7f988e974ddd256319d2c35055a4d63 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sat, 9 May 2020 14:06:54 -0400 Subject: [PATCH 5/8] Remove unnecessary code --- Source/StrongGrid/Resources/SingleSends.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Source/StrongGrid/Resources/SingleSends.cs b/Source/StrongGrid/Resources/SingleSends.cs index f064e819..7ed06814 100644 --- a/Source/StrongGrid/Resources/SingleSends.cs +++ b/Source/StrongGrid/Resources/SingleSends.cs @@ -4,7 +4,6 @@ using StrongGrid.Utilities; using System; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -266,16 +265,8 @@ private static JObject CreateJObject(string name, long senderId, Parameter Date: Sat, 9 May 2020 14:41:21 -0400 Subject: [PATCH 6/8] SingleSend email config according to May 6 2020 documentation --- Source/StrongGrid/Models/SingleSend.cs | 169 +++++++++++++----- .../Models/SingleSendEmailConfig.cs | 84 ++++++++- Source/StrongGrid/Models/SingleSendSendTo.cs | 2 +- 3 files changed, 209 insertions(+), 46 deletions(-) diff --git a/Source/StrongGrid/Models/SingleSend.cs b/Source/StrongGrid/Models/SingleSend.cs index e687bce4..7b4f4ea7 100644 --- a/Source/StrongGrid/Models/SingleSend.cs +++ b/Source/StrongGrid/Models/SingleSend.cs @@ -36,102 +36,153 @@ public class SingleSend public string[] Categories { get; set; } /// - /// Gets or sets the sender identifier. + /// Gets or sets the status. /// /// - /// The sender identifier. + /// The status. /// - [JsonProperty("sender_id", NullValueHandling = NullValueHandling.Ignore)] - public long SenderId { get; set; } + [JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)] + public SingleSendStatus Status { get; set; } /// - /// Gets or sets the status. + /// Gets or sets the date and time when the single send will be sent. /// /// - /// The status. + /// The date and time when the single send will be sent. /// - [JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)] - public SingleSendStatus Status { get; set; } + [JsonProperty("send_at", NullValueHandling = NullValueHandling.Ignore)] + public DateTime? SendOn { get; set; } /// - /// Gets or sets the custom unsubscribe URL. + /// Gets or sets the template. /// /// - /// The custom unsubscribe URL. + /// The template identifier. /// - [JsonProperty("custom_unsubscribe_url", NullValueHandling = NullValueHandling.Ignore)] - public string CustomUnsubscribeUrl { get; set; } + [JsonProperty("template_id", NullValueHandling = NullValueHandling.Ignore)] + public string TemplateId { get; set; } /// - /// Gets or sets the suppression group identifier. + /// Gets or sets the date and time when the single send was modified. /// /// - /// The suppression group identifier. + /// The date and time when the single send was modified. /// - [JsonProperty("suppression_group_id", NullValueHandling = NullValueHandling.Ignore)] - public long? SuppressionGroupId { get; set; } + [JsonProperty("updated_at", NullValueHandling = NullValueHandling.Ignore)] + public DateTime? UpdatedOn { get; set; } /// - /// Gets or sets the lists. + /// Gets or sets the date and time when the single send was created. /// /// - /// The lists. + /// The date and time when the single send was created. + /// + [JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)] + public DateTime? CreatedOn { get; set; } + + /// + /// Gets or sets the subject. + /// + /// + /// The subject. /// [JsonIgnore] - public string[] Lists + public string Subject { - get { return SendTo.Lists; } - set { SendTo.Lists = value; } + get => EmailConfig.Subject; + set => EmailConfig.Subject = value; } /// - /// Gets or sets the segments. + /// Gets or sets the HTML content. /// /// - /// The segments. + /// The HTML content. /// [JsonIgnore] - public string[] Segments + public string HtmlContent { - get { return SendTo.Segments; } - set { SendTo.Segments = value; } + get => EmailConfig.HtmlContent; + set => EmailConfig.HtmlContent = value; } /// - /// Gets or sets the date and time when the single send will be sent. + /// Gets or sets the plain text content. /// /// - /// The date and time when the single send will be sent. + /// The plain text content. /// - [JsonProperty("send_at", NullValueHandling = NullValueHandling.Ignore)] - public DateTime? SendOn { get; set; } + [JsonIgnore] + public string TextContent + { + get => EmailConfig.TextContent; + set => EmailConfig.TextContent = value; + } /// - /// Gets or sets the template. + /// Gets or sets a value indicating whether the plain content should be generated. /// /// - /// The template identifier. + /// The generate_plain_content. /// - [JsonProperty("template_id", NullValueHandling = NullValueHandling.Ignore)] - public string TemplateId { get; set; } + [JsonIgnore] + public bool GeneratePlainContent + { + get => EmailConfig.GeneratePlainContent; + set => EmailConfig.GeneratePlainContent = value; + } /// - /// Gets or sets the date and time when the single send was modified. + /// Gets or sets the type of editor used in the UI. /// /// - /// The date and time when the single send was modified. + /// The type of editor. /// - [JsonProperty("updated_at", NullValueHandling = NullValueHandling.Ignore)] - public DateTime? UpdatedOn { get; set; } + [JsonIgnore] + public EditorType EditorType + { + get => EmailConfig.EditorType; + set => EmailConfig.EditorType = value; + } /// - /// Gets or sets the date and time when the single send was created. + /// Gets or sets the sender identifier. /// /// - /// The date and time when the single send was created. + /// The sender identifier. /// - [JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)] - public DateTime? CreatedOn { get; set; } + [JsonIgnore] + public long SenderId + { + get => EmailConfig.SenderId; + set => EmailConfig.SenderId = value; + } + + /// + /// Gets or sets the custom unsubscribe URL. + /// + /// + /// The custom unsubscribe URL. + /// + [JsonIgnore] + public string CustomUnsubscribeUrl + { + get => EmailConfig.CustomUnsubscribeUrl; + set => EmailConfig.CustomUnsubscribeUrl = value; + } + + /// + /// Gets or sets the suppression group identifier. + /// + /// + /// The suppression group identifier. + /// + [JsonIgnore] + public long? SuppressionGroupId + { + get => EmailConfig.SuppressionGroupId; + set => EmailConfig.SuppressionGroupId = value; + } /// /// Gets or sets the ip pool. @@ -139,8 +190,38 @@ public string[] Segments /// /// The ip pool. /// - [JsonProperty("ip_pool", NullValueHandling = NullValueHandling.Ignore)] - public string IpPool { get; set; } + [JsonIgnore] + public string IpPool + { + get => EmailConfig.IpPool; + set => EmailConfig.IpPool = value; + } + + /// + /// Gets or sets the lists. + /// + /// + /// The lists. + /// + [JsonIgnore] + public string[] Lists + { + get => SendTo.Lists; + set => SendTo.Lists = value; + } + + /// + /// Gets or sets the segments. + /// + /// + /// The segments. + /// + [JsonIgnore] + public string[] Segments + { + get => SendTo.Segments; + set => SendTo.Segments = value; + } [JsonProperty("email_config", NullValueHandling = NullValueHandling.Ignore)] private SingleSendEmailConfig EmailConfig { get; set; } diff --git a/Source/StrongGrid/Models/SingleSendEmailConfig.cs b/Source/StrongGrid/Models/SingleSendEmailConfig.cs index 52942af1..242a0485 100644 --- a/Source/StrongGrid/Models/SingleSendEmailConfig.cs +++ b/Source/StrongGrid/Models/SingleSendEmailConfig.cs @@ -1,9 +1,91 @@ +using Newtonsoft.Json; + namespace StrongGrid.Models { /// /// Single Send email config. /// - public class SingleSendEmailConfig + internal class SingleSendEmailConfig { + /// + /// Gets or sets the subject. + /// + /// + /// The subject. + /// + [JsonProperty("subject", NullValueHandling = NullValueHandling.Ignore)] + public string Subject { get; set; } + + /// + /// Gets or sets the HTML content. + /// + /// + /// The HTML content. + /// + [JsonProperty("html_content", NullValueHandling = NullValueHandling.Ignore)] + public string HtmlContent { get; set; } + + /// + /// Gets or sets the plain text content. + /// + /// + /// The plain text content. + /// + [JsonProperty("plain_content", NullValueHandling = NullValueHandling.Ignore)] + public string TextContent { get; set; } + + /// + /// Gets or sets a value indicating whether the plain content should be generated. + /// + /// + /// The generate_plain_content. + /// + [JsonProperty("generate_plain_content", NullValueHandling = NullValueHandling.Ignore)] + public bool GeneratePlainContent { get; set; } + + /// + /// Gets or sets the type of editor used in the UI. + /// + /// + /// The type of editor. + /// + [JsonProperty("editor", NullValueHandling = NullValueHandling.Ignore)] + public EditorType EditorType { get; set; } + + /// + /// Gets or sets the suppression group identifier. + /// + /// + /// The suppression group identifier. + /// + [JsonProperty("suppression_group_id", NullValueHandling = NullValueHandling.Ignore)] + public long? SuppressionGroupId { get; set; } + + /// + /// Gets or sets the custom unsubscribe URL. + /// + /// + /// The custom unsubscribe URL. + /// + [JsonProperty("custom_unsubscribe_url", NullValueHandling = NullValueHandling.Ignore)] + public string CustomUnsubscribeUrl { get; set; } + + /// + /// Gets or sets the sender identifier. + /// + /// + /// The sender identifier. + /// + [JsonProperty("sender_id", NullValueHandling = NullValueHandling.Ignore)] + public long SenderId { get; set; } + + /// + /// Gets or sets the ip pool. + /// + /// + /// The ip pool. + /// + [JsonProperty("ip_pool", NullValueHandling = NullValueHandling.Ignore)] + public string IpPool { get; set; } } } diff --git a/Source/StrongGrid/Models/SingleSendSendTo.cs b/Source/StrongGrid/Models/SingleSendSendTo.cs index 709c2bd7..4282d978 100644 --- a/Source/StrongGrid/Models/SingleSendSendTo.cs +++ b/Source/StrongGrid/Models/SingleSendSendTo.cs @@ -5,7 +5,7 @@ namespace StrongGrid.Models /// /// Single Send send to. /// - public class SingleSendSendTo + internal class SingleSendSendTo { /// /// Gets or sets the lists. From 09fb1ed0c4226d44f2393ceefcd5b075c5b985d6 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sat, 9 May 2020 15:04:02 -0400 Subject: [PATCH 7/8] Update XML comment in the GetErrorMessage extension method with observations --- Source/StrongGrid/Extensions/Internal.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Source/StrongGrid/Extensions/Internal.cs b/Source/StrongGrid/Extensions/Internal.cs index 88f0cc5a..95dd47a2 100644 --- a/Source/StrongGrid/Extensions/Internal.cs +++ b/Source/StrongGrid/Extensions/Internal.cs @@ -721,6 +721,29 @@ internal static async Task> AsPaginatedResponse(this Htt ] } + The documentation says that it should look like this: + { + "errors": [ + { + "message": , + "field": , + "error_id": + } + ] + } + + The documentation for "Add or Update a Contact" under the "New Marketing Campaigns" section says that it looks like this: + { + "errors": [ + { + "message": , + "field": , + "error_id": , + "parameter": + } + ] + } + I have also seen cases where the JSON string looks like this: { "error": "Name already exists" From 2da0b85bc2ad26293f15bea8759f5e6fb6342ae3 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sat, 9 May 2020 15:04:44 -0400 Subject: [PATCH 8/8] Remove TemplateId field from SingleSend --- Source/StrongGrid/Models/SingleSend.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Source/StrongGrid/Models/SingleSend.cs b/Source/StrongGrid/Models/SingleSend.cs index 7b4f4ea7..572f0bc6 100644 --- a/Source/StrongGrid/Models/SingleSend.cs +++ b/Source/StrongGrid/Models/SingleSend.cs @@ -53,15 +53,6 @@ public class SingleSend [JsonProperty("send_at", NullValueHandling = NullValueHandling.Ignore)] public DateTime? SendOn { get; set; } - /// - /// Gets or sets the template. - /// - /// - /// The template identifier. - /// - [JsonProperty("template_id", NullValueHandling = NullValueHandling.Ignore)] - public string TemplateId { get; set; } - /// /// Gets or sets the date and time when the single send was modified. ///