diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-10 14:36:11 -0800 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-10 14:36:11 -0800 |
commit | 82ed30026efa402952e5977c45398e490e1998f2 (patch) | |
tree | 9382f4d190fe318ee5fdebb74b91f6ceed4963f1 /SendGrid/Example/Program.cs | |
parent | d685ac8edd21a6063d9f1f7236e4e1e3f2d7ab94 (diff) | |
download | sendgrid-csharp-82ed30026efa402952e5977c45398e490e1998f2.zip sendgrid-csharp-82ed30026efa402952e5977c45398e490e1998f2.tar.gz sendgrid-csharp-82ed30026efa402952e5977c45398e490e1998f2.tar.bz2 |
GET implemented
Diffstat (limited to 'SendGrid/Example/Program.cs')
-rw-r--r-- | SendGrid/Example/Program.cs | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/SendGrid/Example/Program.cs b/SendGrid/Example/Program.cs index 4cdc71a..096eae3 100644 --- a/SendGrid/Example/Program.cs +++ b/SendGrid/Example/Program.cs @@ -15,11 +15,13 @@ namespace Example var to = "example@example.com";
var from = "example@example.com";
var fromName = "Jane Doe";
- SendEmail(to, from, fromName);
+ // SendEmail(to, from, fromName);
// Test viewing, creating, modifying and deleting API keys through our v3 Web API
- ApiKeys();
+ // ApiKeys();
+ UnsubscribeGroups();
}
-
+
+ /*
private static void SendAsync(SendGrid.SendGridMessage message)
{
// Create credentials, specifying your user Name and password.
@@ -103,5 +105,27 @@ namespace Example Console.WriteLine("API Key Deleted, press any key to end");
Console.ReadKey();
}
+ */
+
+ private static void UnsubscribeGroups()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ var client = new SendGrid.Client(apiKey);
+
+ // GET UNSUBSCRIBE GROUPS
+ HttpResponseMessage responseGet = client.UnsubscribeGroups.Get().Result;
+ Console.WriteLine(responseGet.StatusCode);
+ Console.WriteLine(responseGet.Content.ReadAsStringAsync().Result);
+ Console.WriteLine("These are your current Unsubscribe Groups. Press any key to continue.");
+ Console.ReadKey();
+
+ // GET A PARTICULAR UNSUBSCRIBE GROUP
+ int unsubscribeGroupID = 69;
+ HttpResponseMessage responseGetUnique = client.UnsubscribeGroups.Get(unsubscribeGroupID).Result;
+ Console.WriteLine(responseGetUnique.StatusCode);
+ Console.WriteLine(responseGetUnique.Content.ReadAsStringAsync().Result);
+ Console.WriteLine("These is an Unsubscribe Group with ID: " + unsubscribeGroupID.ToString() + ". Press any key to continue.");
+ Console.ReadKey();
+ }
}
}
|