diff options
Diffstat (limited to 'examples/devices/devices.cs')
-rw-r--r-- | examples/devices/devices.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/devices/devices.cs b/examples/devices/devices.cs index 679cde8..47f46d3 100644 --- a/examples/devices/devices.cs +++ b/examples/devices/devices.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve email statistics by device type. @@ -16,7 +17,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.devices.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "devices/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); |