diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 36 |
1 files changed, 28 insertions, 8 deletions
@@ -64,16 +64,21 @@ namespace Example { private static void Main() { - String apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); + Execute.Wait(); + } + + static async Task Execute() + { + string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); dynamic sg = new SendGridAPIClient(apiKey); Email from = new Email("test@example.com"); - String subject = "Hello World from the SendGrid CSharp Library!"; + string subject = "Hello World from the SendGrid CSharp Library!"; Email to = new Email("test@example.com"); Content content = new Content("text/plain", "Hello, Email!"); Mail mail = new Mail(from, subject, to, content); - dynamic response = sg.client.mail.send.post(requestBody: mail.Get()); + dynamic response = await sg.client.mail.send.post(requestBody: mail.Get()); } } } @@ -96,6 +101,11 @@ namespace Example { private static void Main() { + Execute.Wait(); + } + + static async Task Execute() + { String apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); dynamic sg = new SendGridAPIClient(apiKey); @@ -121,7 +131,7 @@ namespace Example ] }"; Object json = JsonConvert.DeserializeObject<Object>(data); - dynamic response = sg.client.mail.send.post(requestBody: json.ToString()); + dynamic response = await sg.client.mail.send.post(requestBody: json.ToString()); } } } @@ -139,10 +149,15 @@ namespace Example { private static void Main() { + Execute.Wait(); + } + + static async Task Execute() + { string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(apiKey); - dynamic response = sg.client.suppression.bounces.get(); - } + dynamic response = await sg.client.suppression.bounces.get(); + } } } ``` @@ -159,10 +174,15 @@ namespace Example { private static void Main() { + Execute.Wait(); + } + + static async Task Execute() + { string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(apiKey); - dynamic response = sg.client._("suppression/bounces").get(); - } + dynamic response = await sg.client._("suppression/bounces").get(); + } } } ``` |