blob: e275267bd96dc871ee5d2f3945891f21ee4df914 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
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 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.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
Console.ReadLine();
##################################################
# 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.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
Console.ReadLine();
|