summaryrefslogtreecommitdiffstats
path: root/examples/devices/devices.cs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/devices/devices.cs')
-rw-r--r--examples/devices/devices.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/devices/devices.cs b/examples/devices/devices.cs
new file mode 100644
index 0000000..e813871
--- /dev/null
+++ b/examples/devices/devices.cs
@@ -0,0 +1,24 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Retrieve email statistics by device type.
+// GET /devices/stats
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.devices.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+