summaryrefslogtreecommitdiffstats
path: root/examples/clients/clients.cs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/clients/clients.cs')
-rw-r--r--examples/clients/clients.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/clients/clients.cs b/examples/clients/clients.cs
new file mode 100644
index 0000000..5ff7d56
--- /dev/null
+++ b/examples/clients/clients.cs
@@ -0,0 +1,37 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+using System.Net;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+##################################################
+# Retrieve email statistics by client type. #
+# GET /clients/stats #
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.clients.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result);
+Console.WriteLine(response.ResponseHeaders.ToString());
+
+##################################################
+# Retrieve stats by a specific client type. #
+# GET /clients/{client_type}/stats #
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'start_date': '2016-01-01'
+}";
+var client_type = "test_url_param";
+dynamic response = sg.client.clients._(client_type).stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result);
+Console.WriteLine(response.ResponseHeaders.ToString());
+