diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2016-07-05 13:26:49 -0700 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2016-07-05 13:26:49 -0700 |
commit | 666738924462651e1bec97263cd7ae23eda1f276 (patch) | |
tree | 50d64bf4537885c0f336981bb9caf8a12e6b2b31 /SendGrid/UnitTest/UnitTest.cs | |
parent | 69adfeebe0d0468956bb3803687a8aa7bf2dda72 (diff) | |
download | sendgrid-csharp-666738924462651e1bec97263cd7ae23eda1f276.zip sendgrid-csharp-666738924462651e1bec97263cd7ae23eda1f276.tar.gz sendgrid-csharp-666738924462651e1bec97263cd7ae23eda1f276.tar.bz2 |
swagger/oai updates + accept header fix
Diffstat (limited to 'SendGrid/UnitTest/UnitTest.cs')
-rw-r--r-- | SendGrid/UnitTest/UnitTest.cs | 268 |
1 files changed, 236 insertions, 32 deletions
diff --git a/SendGrid/UnitTest/UnitTest.cs b/SendGrid/UnitTest/UnitTest.cs index b4f00da..1fd8c6d 100644 --- a/SendGrid/UnitTest/UnitTest.cs +++ b/SendGrid/UnitTest/UnitTest.cs @@ -3,7 +3,6 @@ using NUnit.Framework; using SendGrid.Helpers.Mail; using System.Collections.Generic; using System.Net; -using Newtonsoft.Json; namespace UnitTest { @@ -42,10 +41,7 @@ namespace UnitTest mail.AddContent(content); String ret = mail.Get(); - String final = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ret), - Formatting.None, - new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore }); - Assert.AreEqual(final, "{\"from\":{\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"email\":\"test@example.com\"}]}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"}]}"); + Assert.AreEqual(ret, "{\"from\":{\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"email\":\"test@example.com\"}]}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"}]}"); } // All paramaters available for sending an email @@ -235,12 +231,7 @@ namespace UnitTest mail.ReplyTo = email; String ret = mail.Get(); - - String final = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ret), - Formatting.None, - new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore }); - - Assert.AreEqual(final, "{\"from\":{\"name\":\"Example User\",\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"},{\"type\":\"text/calendar\",\"value\":\"Party Time!!\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"headers\":{\"X-Day\":\"Monday\",\"X-Month\":\"January\"},\"sections\":{\"%section1\":\"Substitution for Section 1 Tag\",\"%section2\":\"Substitution for Section 2 Tag\"},\"categories\":[\"customer\",\"vip\"],\"custom_args\":{\"campaign\":\"welcome\",\"sequence\":\"2\"},\"send_at\":1461775051,\"asm\":{\"group_id\":3,\"groups_to_display\":[1,4,5]},\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"test@example.com\"},\"bypass_list_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Some Footer Text\",\"html\":\"<bold>Some HTML Here</bold>\"},\"sandbox_mode\":{\"enable\":true},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://gotchya.example.com\"}},\"tracking_settings\":{\"click_tracking\":{\"enable\":true},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<bold>HTML to insert into the text/html portion of the message</bold>\",\"substitution_tag\":\"text to insert into the text/plain portion of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_medium\":\"some medium\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_campaign\":\"some campaign\"}},\"reply_to\":{\"email\":\"test@example.com\"}}"); + Assert.AreEqual(ret, "{\"from\":{\"name\":\"Example User\",\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"},{\"type\":\"text/calendar\",\"value\":\"Party Time!!\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"headers\":{\"X-Day\":\"Monday\",\"X-Month\":\"January\"},\"sections\":{\"%section1\":\"Substitution for Section 1 Tag\",\"%section2\":\"Substitution for Section 2 Tag\"},\"categories\":[\"customer\",\"vip\"],\"custom_args\":{\"campaign\":\"welcome\",\"sequence\":\"2\"},\"send_at\":1461775051,\"asm\":{\"group_id\":3,\"groups_to_display\":[1,4,5]},\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"test@example.com\"},\"bypass_list_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Some Footer Text\",\"html\":\"<bold>Some HTML Here</bold>\"},\"sandbox_mode\":{\"enable\":true},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://gotchya.example.com\"}},\"tracking_settings\":{\"click_tracking\":{\"enable\":true},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<bold>HTML to insert into the text/html portion of the message</bold>\",\"substitution_tag\":\"text to insert into the text/plain portion of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_medium\":\"some medium\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_campaign\":\"some campaign\"}},\"reply_to\":{\"email\":\"test@example.com\"}}"); } } @@ -382,6 +373,107 @@ namespace UnitTest } [Test] + public void test_alerts_post() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + string data = @"{ + 'email_to': 'example@example.com', + 'frequency': 'daily', + 'type': 'stats_notification' +}"; + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "201"); + dynamic response = sg.client.alerts.post(requestBody: data, requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.Created); + } + + [Test] + public void test_alerts_get() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "200"); + dynamic response = sg.client.alerts.get(requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); + } + + [Test] + public void test_alerts__alert_id__patch() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + string data = @"{ + 'email_to': 'example@example.com' +}"; + var alert_id = "test_url_param"; + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "200"); + dynamic response = sg.client.alerts._(alert_id).patch(requestBody: data, requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); + } + + [Test] + public void test_alerts__alert_id__get() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + var alert_id = "test_url_param"; + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "200"); + dynamic response = sg.client.alerts._(alert_id).get(requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); + } + + [Test] + public void test_alerts__alert_id__delete() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + var alert_id = "test_url_param"; + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "204"); + dynamic response = sg.client.alerts._(alert_id).delete(requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent); + } + + [Test] public void test_api_keys_post() { string _apiKey = "SendGrid API Key"; @@ -394,6 +486,7 @@ namespace UnitTest dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string data = @"{ 'name': 'My API Key', + 'sample': 'data', 'scopes': [ 'mail.send', 'alerts.create', @@ -418,10 +511,13 @@ namespace UnitTest host = "http://localhost:4010"; } dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + string queryParams = @"{ + 'limit': 1 +}"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); headers.Add("X-Mock", "200"); - dynamic response = sg.client.api_keys.get(requestHeaders: headers); + dynamic response = sg.client.api_keys.get(queryParams: queryParams, requestHeaders: headers); Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); } @@ -662,6 +758,32 @@ namespace UnitTest } [Test] + public void test_asm_groups__group_id__suppressions_search_post() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + string data = @"{ + 'recipient_emails': [ + 'exists1@example.com', + 'exists2@example.com', + 'doesnotexists@example.com' + ] +}"; + var group_id = "test_url_param"; + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "200"); + dynamic response = sg.client.asm.groups._(group_id).suppressions.search.post(requestBody: data, requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); + } + + [Test] public void test_asm_groups__group_id__suppressions__email__delete() { string _apiKey = "SendGrid API Key"; @@ -856,8 +978,8 @@ namespace UnitTest } dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'limit': 0, - 'offset': 0 + 'limit': 1, + 'offset': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -1334,7 +1456,7 @@ namespace UnitTest 'name': 'newlistname' }"; string queryParams = @"{ - 'list_id': 0 + 'list_id': 1 }"; var list_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1356,7 +1478,7 @@ namespace UnitTest } dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'list_id': 0 + 'list_id': 1 }"; var list_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1423,7 +1545,7 @@ namespace UnitTest } dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'list_id': 0, + 'list_id': 1, 'page': 1, 'page_size': 1 }"; @@ -1467,8 +1589,8 @@ namespace UnitTest } dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'list_id': 0, - 'recipient_id': 0 + 'list_id': 1, + 'recipient_id': 1 }"; var list_id = "test_url_param"; var recipient_id = "test_url_param"; @@ -1628,6 +1750,7 @@ namespace UnitTest } dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ + '%7Bfield_name%7D': 'test_string', '{field_name}': 'test_string' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -1818,7 +1941,7 @@ namespace UnitTest } dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'segment_id': 0 + 'segment_id': 1 }"; var segment_id = "test_url_param"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -2341,13 +2464,8 @@ namespace UnitTest 'send_at': 1409348513, 'subject': 'Hello, World!', 'substitutions': { - 'sub': { - '%name%': [ - 'John', - 'Jane', - 'Sam' - ] - } + 'id': 'substitutions', + 'type': 'object' }, 'to': [ { @@ -2960,8 +3078,8 @@ namespace UnitTest } dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'limit': 0, - 'offset': 0, + 'limit': 1, + 'offset': 1, 'username': 'test_string' }"; Dictionary<String, String> headers = new Dictionary<String, String>(); @@ -3231,7 +3349,7 @@ namespace UnitTest dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ 'date': 'test_string', - 'limit': 0, + 'limit': 1, 'offset': 1, 'sort_by_direction': 'asc', 'sort_by_metric': 'test_string' @@ -3343,8 +3461,8 @@ namespace UnitTest } dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); string queryParams = @"{ - 'end_time': 0, - 'start_time': 0 + 'end_time': 1, + 'start_time': 1 }"; Dictionary<String, String> headers = new Dictionary<String, String>(); headers.Clear(); @@ -4408,6 +4526,30 @@ namespace UnitTest } [Test] + public void test_user_webhooks_parse_settings_post() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + string data = @"{ + 'hostname': 'myhostname.com', + 'send_raw': false, + 'spam_check': true, + 'url': 'http://email.myhosthame.com' +}"; + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "201"); + dynamic response = sg.client.user.webhooks.parse.settings.post(requestBody: data, requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.Created); + } + + [Test] public void test_user_webhooks_parse_settings_get() { string _apiKey = "SendGrid API Key"; @@ -4426,6 +4568,68 @@ namespace UnitTest } [Test] + public void test_user_webhooks_parse_settings__hostname__patch() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + string data = @"{ + 'send_raw': true, + 'spam_check': false, + 'url': 'http://newdomain.com/parse' +}"; + var hostname = "test_url_param"; + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "200"); + dynamic response = sg.client.user.webhooks.parse.settings._(hostname).patch(requestBody: data, requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); + } + + [Test] + public void test_user_webhooks_parse_settings__hostname__get() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + var hostname = "test_url_param"; + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "200"); + dynamic response = sg.client.user.webhooks.parse.settings._(hostname).get(requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); + } + + [Test] + public void test_user_webhooks_parse_settings__hostname__delete() + { + string _apiKey = "SendGrid API Key"; + string host = ""; + if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) { + host = Environment.GetEnvironmentVariable("MOCK_HOST"); + } else { + host = "http://localhost:4010"; + } + dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host); + var hostname = "test_url_param"; + Dictionary<String, String> headers = new Dictionary<String, String>(); + headers.Clear(); + headers.Add("X-Mock", "204"); + dynamic response = sg.client.user.webhooks.parse.settings._(hostname).delete(requestHeaders: headers); + Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent); + } + + [Test] public void test_user_webhooks_parse_stats_get() { string _apiKey = "SendGrid API Key"; |