summaryrefslogtreecommitdiffstats
path: root/SendGrid/Example/Program.cs
diff options
context:
space:
mode:
authorElmer Thomas <elmer@thinkingserious.com>2015-11-16 21:16:10 -0800
committerElmer Thomas <elmer@thinkingserious.com>2015-11-16 21:16:10 -0800
commit0cfa8dee814a031b51b4b02e7d9389a17956f85b (patch)
tree3bc78aa90cc565619d7630f69a5837fa6f3b7671 /SendGrid/Example/Program.cs
parent5f02e69ac1bb329ccbc0014446d90d4a07a699fe (diff)
downloadsendgrid-csharp-0cfa8dee814a031b51b4b02e7d9389a17956f85b.zip
sendgrid-csharp-0cfa8dee814a031b51b4b02e7d9389a17956f85b.tar.gz
sendgrid-csharp-0cfa8dee814a031b51b4b02e7d9389a17956f85b.tar.bz2
Async all the way through + testing
via deckarep
Diffstat (limited to 'SendGrid/Example/Program.cs')
-rw-r--r--SendGrid/Example/Program.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/SendGrid/Example/Program.cs b/SendGrid/Example/Program.cs
index c0f4295..4cdc71a 100644
--- a/SendGrid/Example/Program.cs
+++ b/SendGrid/Example/Program.cs
@@ -70,14 +70,14 @@ namespace Example
var client = new SendGrid.Client(apiKey);
// GET API KEYS
- HttpResponseMessage responseGet = client.ApiKeys.Get();
+ HttpResponseMessage responseGet = client.ApiKeys.Get().Result;
Console.WriteLine(responseGet.StatusCode);
Console.WriteLine(responseGet.Content.ReadAsStringAsync().Result);
Console.WriteLine("These are your current API Keys. Press any key to continue.");
Console.ReadKey();
// POST API KEYS
- HttpResponseMessage responsePost = client.ApiKeys.Post("CSharpTestKey");
+ HttpResponseMessage responsePost = client.ApiKeys.Post("CSharpTestKey").Result;
var rawString = responsePost.Content.ReadAsStringAsync().Result;
dynamic jsonObject = JObject.Parse(rawString);
var apiKeyId = jsonObject.api_key_id.ToString();
@@ -87,7 +87,7 @@ namespace Example
Console.ReadKey();
// PATCH API KEYS
- HttpResponseMessage responsePatch = client.ApiKeys.Patch(apiKeyId, "CSharpTestKeyPatched");
+ HttpResponseMessage responsePatch = client.ApiKeys.Patch(apiKeyId, "CSharpTestKeyPatched").Result;
Console.WriteLine(responsePatch.StatusCode);
Console.WriteLine(responsePatch.Content.ReadAsStringAsync().Result);
Console.WriteLine("API Key patched. Press any key to continue.");
@@ -95,8 +95,9 @@ namespace Example
// DELETE API KEYS
Console.WriteLine("Deleting API Key, please wait.");
- client.ApiKeys.Delete(apiKeyId);
- HttpResponseMessage responseFinal = client.ApiKeys.Get();
+ HttpResponseMessage responseDelete = client.ApiKeys.Delete(apiKeyId).Result;
+ Console.WriteLine(responseDelete.StatusCode);
+ HttpResponseMessage responseFinal = client.ApiKeys.Get().Result;
Console.WriteLine(responseFinal.StatusCode);
Console.WriteLine(responseFinal.Content.ReadAsStringAsync().Result);
Console.WriteLine("API Key Deleted, press any key to end");