Issue Summary
The API won't allow disabling subscription tracking because the Enable parameter won't be sent when it's false, returning the error: "The subscription_tracking enable parameter is required."
Steps to Reproduce
Send an email with the following options:
trackingSettings := mail.NewTrackingSettings()
subscriptionTrackingSetting := mail.NewSubscriptionTrackingSetting()
subscriptionTrackingSetting.SetEnable(false)
trackingSettings.SetSubscriptionTracking(subscriptionTrackingSetting)
m.SetTrackingSettings(trackingSettings)
The following error will be returned:
&{400 {"errors":[{"message":"The subscription_tracking enable parameter is required.","field":"tracking_settings.subscription_tracking.enable","help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.tracking_settings.subscription_tracking.enable"}]} map[X-Frame-Options:[DENY] Server:[nginx] Date:[Fri, 01 Jul 2016 12:09:18 GMT] Content-Type:[application/json] Content-Length:[270] Connection:[keep-alive]]}
This happens because the Enabled field of the SubscriptionTrackingSetting struct has the JSON options json:"enable,omitempty" therefore false is not encoded. See http://stackoverflow.com/questions/37756236/json-golang-boolean-omitempty for more information.
Issue Summary
The API won't allow disabling subscription tracking because the Enable parameter won't be sent when it's false, returning the error: "The subscription_tracking enable parameter is required."
Steps to Reproduce
Send an email with the following options:
The following error will be returned:
&{400 {"errors":[{"message":"The subscription_tracking enable parameter is required.","field":"tracking_settings.subscription_tracking.enable","help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.tracking_settings.subscription_tracking.enable"}]} map[X-Frame-Options:[DENY] Server:[nginx] Date:[Fri, 01 Jul 2016 12:09:18 GMT] Content-Type:[application/json] Content-Length:[270] Connection:[keep-alive]]}
This happens because the Enabled field of the SubscriptionTrackingSetting struct has the JSON options
json:"enable,omitempty"therefore false is not encoded. See http://stackoverflow.com/questions/37756236/json-golang-boolean-omitempty for more information.