diff options
Diffstat (limited to 'examples/geo/geo.cs')
-rw-r--r-- | examples/geo/geo.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/geo/geo.cs b/examples/geo/geo.cs new file mode 100644 index 0000000..7003650 --- /dev/null +++ b/examples/geo/geo.cs @@ -0,0 +1,25 @@ +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 country and state/province. # +# GET /geo/stats # + +string queryParams = @"{ + 'aggregated_by': 'day', + 'country': 'US', + 'end_date': '2016-04-01', + 'limit': 1, + 'offset': 1, + 'start_date': '2016-01-01' +}"; +dynamic response = sg.client.geo.stats.get(queryParams: queryParams); +Console.WriteLine(response.StatusCode); +Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result); +Console.WriteLine(response.ResponseHeaders.ToString()); + |