diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-15 14:23:48 -0700 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-15 14:23:48 -0700 |
commit | 6432c3c93b1dda85b2410f32b9c60574443d2b8f (patch) | |
tree | 1665bf875f0783caca27e323417bb96d909a5462 | |
parent | e9dfa87619976abcd9cb21c8bef4280af0ff820b (diff) | |
download | sendgrid-csharp-6432c3c93b1dda85b2410f32b9c60574443d2b8f.zip sendgrid-csharp-6432c3c93b1dda85b2410f32b9c60574443d2b8f.tar.gz sendgrid-csharp-6432c3c93b1dda85b2410f32b9c60574443d2b8f.tar.bz2 |
Updating usage docs and examples based on testing against deployed Nuget
25 files changed, 70 insertions, 93 deletions
@@ -46,6 +46,7 @@ Add the following namespaces to use the library: using System; using System.Web.Script.Serialization; using SendGrid; +using SendGrid.Helpers.Mail; // Include if you want to use the Mail Helper ``` ## Dependencies @@ -60,6 +61,7 @@ using SendGrid; ```csharp using System; using SendGrid; +using SendGrid.Helpers.Mail; namespace Example { @@ -68,7 +70,7 @@ namespace Example private static void Main() { String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGrid.SendGridAPIClient(apiKey); + dynamic sg = new SendGridAPIClient(apiKey); Email from = new Email("test@example.com"); String subject = "Hello World from the SendGrid CSharp Library"; @@ -86,7 +88,6 @@ namespace Example ```csharp using System; -using SendGrid; namespace Example { @@ -96,7 +97,7 @@ namespace Example { String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(apiKey); - dynamic response = sg.client.api_keys.get(queryParams: queryParams); + dynamic response = sg.client.api_keys.get(); } } } @@ -4,8 +4,7 @@ This documentation is based on our [OAI specification](https://github.com/sendgr ```csharp using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/accesssettings/accesssettings.cs b/examples/accesssettings/accesssettings.cs index 15fe8b0..09b822c 100644 --- a/examples/accesssettings/accesssettings.cs +++ b/examples/accesssettings/accesssettings.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/apikeys/apikeys.cs b/examples/apikeys/apikeys.cs index eff23ec..97a3add 100644 --- a/examples/apikeys/apikeys.cs +++ b/examples/apikeys/apikeys.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/asm/asm.cs b/examples/asm/asm.cs index 4f5bde7..00758ef 100644 --- a/examples/asm/asm.cs +++ b/examples/asm/asm.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/browsers/browsers.cs b/examples/browsers/browsers.cs index 43d52e5..4e34f82 100644 --- a/examples/browsers/browsers.cs +++ b/examples/browsers/browsers.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/campaigns/campaigns.cs b/examples/campaigns/campaigns.cs index 03bbadc..999566b 100644 --- a/examples/campaigns/campaigns.cs +++ b/examples/campaigns/campaigns.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/categories/categories.cs b/examples/categories/categories.cs index 82899ea..7e18c8e 100644 --- a/examples/categories/categories.cs +++ b/examples/categories/categories.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/clients/clients.cs b/examples/clients/clients.cs index ecefdcd..ac224b8 100644 --- a/examples/clients/clients.cs +++ b/examples/clients/clients.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/contactdb/contactdb.cs b/examples/contactdb/contactdb.cs index ea388d2..a149413 100644 --- a/examples/contactdb/contactdb.cs +++ b/examples/contactdb/contactdb.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/devices/devices.cs b/examples/devices/devices.cs index e813871..8bdc361 100644 --- a/examples/devices/devices.cs +++ b/examples/devices/devices.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/geo/geo.cs b/examples/geo/geo.cs index 25faa04..405b768 100644 --- a/examples/geo/geo.cs +++ b/examples/geo/geo.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/ips/ips.cs b/examples/ips/ips.cs index 640da91..26f5503 100644 --- a/examples/ips/ips.cs +++ b/examples/ips/ips.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/mail/mail.cs b/examples/mail/mail.cs index 7cad2be..b33872c 100644 --- a/examples/mail/mail.cs +++ b/examples/mail/mail.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); @@ -29,7 +28,7 @@ Console.ReadLine(); //////////////////////////////////////////////////////// // v3 Mail Send // POST /mail/send -# This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-csharp/blob/master/SendGrid/SendGrid/Helpers/Mail/README.md). +// This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-csharp/blob/master/SendGrid/SendGrid/Helpers/Mail/README.md). string data = @"{ 'asm': { diff --git a/examples/mailboxproviders/mailboxproviders.cs b/examples/mailboxproviders/mailboxproviders.cs index b307fc4..74bf7ed 100644 --- a/examples/mailboxproviders/mailboxproviders.cs +++ b/examples/mailboxproviders/mailboxproviders.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/mailsettings/mailsettings.cs b/examples/mailsettings/mailsettings.cs index 8f0c519..8f08b32 100644 --- a/examples/mailsettings/mailsettings.cs +++ b/examples/mailsettings/mailsettings.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/partnersettings/partnersettings.cs b/examples/partnersettings/partnersettings.cs index 5f253b3..50b445f 100644 --- a/examples/partnersettings/partnersettings.cs +++ b/examples/partnersettings/partnersettings.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/scopes/scopes.cs b/examples/scopes/scopes.cs index c5a5c68..53d8bd5 100644 --- a/examples/scopes/scopes.cs +++ b/examples/scopes/scopes.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/stats/stats.cs b/examples/stats/stats.cs index a363952..464ce3c 100644 --- a/examples/stats/stats.cs +++ b/examples/stats/stats.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/subusers/subusers.cs b/examples/subusers/subusers.cs index 208e13c..58935ae 100644 --- a/examples/subusers/subusers.cs +++ b/examples/subusers/subusers.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/suppression/suppression.cs b/examples/suppression/suppression.cs index 6cd819a..0e1d757 100644 --- a/examples/suppression/suppression.cs +++ b/examples/suppression/suppression.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/templates/templates.cs b/examples/templates/templates.cs index beea4d0..c3e7291 100644 --- a/examples/templates/templates.cs +++ b/examples/templates/templates.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/trackingsettings/trackingsettings.cs b/examples/trackingsettings/trackingsettings.cs index cba044d..73bb3b0 100644 --- a/examples/trackingsettings/trackingsettings.cs +++ b/examples/trackingsettings/trackingsettings.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); diff --git a/examples/user/user.cs b/examples/user/user.cs index c81acc6..7b06150 100644 --- a/examples/user/user.cs +++ b/examples/user/user.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); @@ -53,7 +52,7 @@ Console.ReadLine(); // PUT /user/password string data = @"{ - 'new_password': 'new_password', + 'new_password': 'new_password', 'old_password': 'old_password' }"; dynamic response = sg.client.user.password.put(requestBody: data); @@ -67,8 +66,8 @@ Console.ReadLine(); // PATCH /user/profile string data = @"{ - 'city': 'Orange', - 'first_name': 'Example', + 'city': 'Orange', + 'first_name': 'Example', 'last_name': 'User' }"; dynamic response = sg.client.user.profile.patch(requestBody: data); @@ -92,7 +91,7 @@ Console.ReadLine(); // POST /user/scheduled_sends string data = @"{ - 'batch_id': 'YOUR_BATCH_ID', + 'batch_id': 'YOUR_BATCH_ID', 'status': 'pause' }"; dynamic response = sg.client.user.scheduled_sends.post(requestBody: data); @@ -152,7 +151,7 @@ Console.ReadLine(); // PATCH /user/settings/enforced_tls string data = @"{ - 'require_tls': true, + 'require_tls': true, 'require_valid_cert': false }"; dynamic response = sg.client.user.settings.enforced_tls.patch(requestBody: data); @@ -199,18 +198,18 @@ Console.ReadLine(); // PATCH /user/webhooks/event/settings string data = @"{ - 'bounce': true, - 'click': true, - 'deferred': true, - 'delivered': true, - 'dropped': true, - 'enabled': true, - 'group_resubscribe': true, - 'group_unsubscribe': true, - 'open': true, - 'processed': true, - 'spam_report': true, - 'unsubscribe': true, + 'bounce': true, + 'click': true, + 'deferred': true, + 'delivered': true, + 'dropped': true, + 'enabled': true, + 'group_resubscribe': true, + 'group_unsubscribe': true, + 'open': true, + 'processed': true, + 'spam_report': true, + 'unsubscribe': true, 'url': 'url' }"; dynamic response = sg.client.user.webhooks._("event").settings.patch(requestBody: data); @@ -230,7 +229,7 @@ Console.WriteLine(response.Headers.ToString()); Console.ReadLine(); //////////////////////////////////////////////////////// -// Test Event Notification Settings +// Test Event Notification Settings // POST /user/webhooks/event/test string data = @"{ @@ -257,10 +256,10 @@ Console.ReadLine(); // GET /user/webhooks/parse/stats string queryParams = @"{ - 'aggregated_by': 'day', - 'end_date': '2016-04-01', - 'limit': 'test_string', - 'offset': 'test_string', + 'aggregated_by': 'day', + 'end_date': '2016-04-01', + 'limit': 'test_string', + 'offset': 'test_string', 'start_date': '2016-01-01' }"; dynamic response = sg.client.user.webhooks.parse.stats.get(queryParams: queryParams); diff --git a/examples/whitelabel/whitelabel.cs b/examples/whitelabel/whitelabel.cs index 80be1c1..9b4c0b1 100644 --- a/examples/whitelabel/whitelabel.cs +++ b/examples/whitelabel/whitelabel.cs @@ -1,6 +1,5 @@ using System; -using SendGrid.Helpers.Mail; -using System.Collections.Generic; +using SendGrid.Helpers.Mail; // If you are using the Mail Helper string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); @@ -10,15 +9,15 @@ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); // POST /whitelabel/domains string data = @"{ - 'automatic_security': false, - 'custom_spf': true, - 'default': true, - 'domain': 'example.com', + 'automatic_security': false, + 'custom_spf': true, + 'default': true, + 'domain': 'example.com', 'ips': [ - '192.168.1.1', + '192.168.1.1', '192.168.1.2' - ], - 'subdomain': 'news', + ], + 'subdomain': 'news', 'username': 'john@example.com' }"; dynamic response = sg.client.whitelabel.domains.post(requestBody: data); @@ -32,10 +31,10 @@ Console.ReadLine(); // GET /whitelabel/domains string queryParams = @"{ - 'domain': 'test_string', - 'exclude_subusers': 'true', - 'limit': 1, - 'offset': 1, + 'domain': 'test_string', + 'exclude_subusers': 'true', + 'limit': 1, + 'offset': 1, 'username': 'test_string' }"; dynamic response = sg.client.whitelabel.domains.get(queryParams: queryParams); @@ -79,7 +78,7 @@ Console.ReadLine(); // PATCH /whitelabel/domains/{domain_id} string data = @"{ - 'custom_spf': true, + 'custom_spf': true, 'default': false }"; var domain_id = "test_url_param"; @@ -167,8 +166,8 @@ Console.ReadLine(); // POST /whitelabel/ips string data = @"{ - 'domain': 'example.com', - 'ip': '192.168.1.1', + 'domain': 'example.com', + 'ip': '192.168.1.1', 'subdomain': 'email' }"; dynamic response = sg.client.whitelabel.ips.post(requestBody: data); @@ -182,8 +181,8 @@ Console.ReadLine(); // GET /whitelabel/ips string queryParams = @"{ - 'ip': 'test_string', - 'limit': 1, + 'ip': 'test_string', + 'limit': 1, 'offset': 1 }"; dynamic response = sg.client.whitelabel.ips.get(queryParams: queryParams); @@ -230,12 +229,12 @@ Console.ReadLine(); // POST /whitelabel/links string data = @"{ - 'default': true, - 'domain': 'example.com', + 'default': true, + 'domain': 'example.com', 'subdomain': 'mail' }"; string queryParams = @"{ - 'limit': 1, + 'limit': 1, 'offset': 1 }"; dynamic response = sg.client.whitelabel.links.post(requestBody: data, queryParams: queryParams); |