Skip to content

Update serializer settings to include default values #273 #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions SendGrid/SendGrid/Helpers/Mail/Mail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Mail
private Dictionary<String, String> sections;
private List<String> categories;
private Dictionary<String, String> customArgs;
private long sendAt;
private long? sendAt;
private ASM asm;
private String batchId;
private String setIpPoolId;
Expand Down Expand Up @@ -183,7 +183,7 @@ public Dictionary<string, string> CustomArgs
}

[JsonProperty(PropertyName = "send_at")]
public long SendAt
public long? SendAt
{
get
{
Expand Down Expand Up @@ -347,18 +347,18 @@ public String Get()
{
return JsonConvert.SerializeObject(this,
Formatting.None,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, StringEscapeHandling = StringEscapeHandling.EscapeHtml });
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Include, StringEscapeHandling = StringEscapeHandling.EscapeHtml });
}
}


public class ClickTracking
{
private bool enable;
private bool enableText;
private bool? enable;
private bool? enableText;

[JsonProperty(PropertyName = "enable")]
public bool Enable
public bool? Enable
{
get
{
Expand All @@ -372,7 +372,7 @@ public bool Enable
}

[JsonProperty(PropertyName = "enable_text")]
public bool EnableText
public bool? EnableText
{
get
{
Expand All @@ -389,11 +389,11 @@ public bool EnableText

public class OpenTracking
{
private bool enable;
private bool? enable;
private String substitutionTag;

[JsonProperty(PropertyName = "enable")]
public bool Enable
public bool? Enable
{
get
{
Expand Down Expand Up @@ -424,13 +424,13 @@ public string SubstitutionTag

public class SubscriptionTracking
{
private bool enable;
private bool? enable;
private String text;
private String html;
private String substitutionTag;

[JsonProperty(PropertyName = "enable")]
public bool Enable
public bool? Enable
{
get
{
Expand Down Expand Up @@ -489,15 +489,15 @@ public string SubstitutionTag

public class Ganalytics
{
private bool enable;
private bool? enable;
private String utmSource;
private String utmMedium;
private String utmTerm;
private String utmContent;
private String utmCampaign;

[JsonProperty(PropertyName = "enable")]
public bool Enable
public bool? Enable
{
get
{
Expand Down Expand Up @@ -649,11 +649,11 @@ public Ganalytics Ganalytics

public class BCCSettings
{
private bool enable;
private bool? enable;
private String email;

[JsonProperty(PropertyName = "enable")]
public bool Enable
public bool? Enable
{
get
{
Expand Down Expand Up @@ -684,10 +684,10 @@ public string Email

public class BypassListManagement
{
private bool enable;
private bool? enable;

[JsonProperty(PropertyName = "enable")]
public bool Enable
public bool? Enable
{
get
{
Expand All @@ -704,12 +704,12 @@ public bool Enable

public class FooterSettings
{
private bool enable;
private bool? enable;
private String text;
private String html;

[JsonProperty(PropertyName = "enable")]
public bool Enable
public bool? Enable
{
get
{
Expand Down Expand Up @@ -754,10 +754,10 @@ public string Html

public class SandboxMode
{
private bool enable;
private bool? enable;

[JsonProperty(PropertyName = "enable")]
public bool Enable
public bool? Enable
{
get
{
Expand All @@ -774,12 +774,12 @@ public bool Enable

public class SpamCheck
{
private bool enable;
private int threshold;
private bool? enable;
private int? threshold;
private String postToUrl;

[JsonProperty(PropertyName = "enable")]
public bool Enable
public bool? Enable
{
get
{
Expand All @@ -793,7 +793,7 @@ public bool Enable
}

[JsonProperty(PropertyName = "threshold")]
public int Threshold
public int? Threshold
{
get
{
Expand Down Expand Up @@ -904,11 +904,11 @@ public SpamCheck SpamCheck

public class ASM
{
private int groupId;
private int? groupId;
private List<int> groupsToDisplay;

[JsonProperty(PropertyName = "group_id")]
public int GroupId
public int? GroupId
{
get
{
Expand Down Expand Up @@ -1118,7 +1118,7 @@ public class Personalization
private Dictionary<String, String> headers;
private Dictionary<String, String> substitutions;
private Dictionary<String, String> customArgs;
private long sendAt;
private long? sendAt;

[JsonProperty(PropertyName = "to")]
public List<Email> Tos
Expand Down Expand Up @@ -1219,7 +1219,7 @@ public Dictionary<string, string> CustomArgs
}

[JsonProperty(PropertyName = "send_at")]
public long SendAt
public long? SendAt
{
get
{
Expand Down
Loading