Skip to content

Commit 58bc301

Browse files
Stable v9.0.0 release
- Support for .NET Standard 1.3 - Removed dynamic dependencies - Updated Mail Helper
1 parent aef89aa commit 58bc301

File tree

34 files changed

+400
-360
lines changed

34 files changed

+400
-360
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [9.0.0] - 2017-02-14 ##
5+
### BREAKING CHANGE
6+
- Support for .NET Standard 1.3
7+
- Removed dynamic dependencies
8+
- Updated Mail Helper
9+
410
## [8.0.4] - 2016-08-24 ##
511
### Added
612
- Table of Contents in the README

CONTRIBUTING.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Hello! Thank you for choosing to help contribute to one of the SendGrid open sou
1111
- [Creating a Pull Request](#creating_a_pull_request)
1212

1313
<a name="roadmap"></a>
14-
We use [Milestones](https://github.com/sendgrid/sendgrid-csharp/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
14+
We use [GitHub Projects](https://github.com/sendgrid/sendgrid-csharp/projects) to help define current roadmaps, please feel free to grab an issue from our [GitHub Issues](https://github.com/sendgrid/sendgrid-csharp/issues). Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
1515

1616
<a name="cla"></a>
1717
## CLAs and CCLAs
@@ -64,23 +64,21 @@ We welcome direct contributions to the sendgrid-csharp code base. Thank you!
6464

6565
##### Prerequisites #####
6666

67-
- .NET 4.5.2
68-
- [SendGrid.CSharp.HTTP.Client](https://www.nuget.org/packages/SendGrid.CSharp.HTTP.Client/)
69-
- [Newtonsoft.Json](http://www.newtonsoft.com/json)
67+
- .NET 4.5.2+
7068

7169
##### Initial setup: #####
7270

7371
```bash
7472
git clone https://github.com/sendgrid/sendgrid-csharp.git
7573
```
7674

77-
- Open `sendgrid-csharp/SendGrid/SendGrid.sln`
75+
- Open `sendgrid-csharp/SendGrid.sln`
7876

7977
## Environment Variables
8078

8179
First, get your free SendGrid account [here](https://sendgrid.com/free?source=sendgrid-csharp).
8280

83-
Next, update your Environment (user space) with your [SENDGRID_APIKEY](https://app.sendgrid.com/settings/api_keys).
81+
Next, update your Environment with your [SENDGRID_APIKEY](https://app.sendgrid.com/settings/api_keys).
8482

8583
##### Execute: #####
8684

@@ -95,26 +93,30 @@ Next, update your Environment (user space) with your [SENDGRID_APIKEY](https://a
9593

9694
Examples that demonstrate usage.
9795

98-
**/Example/Example.cs**
96+
**/ExampleCoreProject/Example.cs**
9997

100-
A working example project for testing.
98+
A working .NET Core example project for testing.
10199

102-
**/SendGrid/SendGrid.cs**
100+
**/ExampleNet45Project/Example.cs**
103101

104-
The main interface to the SendGrid API is the class `SendGridAPIClient`.
102+
A working .NET 4.5.2 example project for testing.
105103

106-
**/UnitTest**
104+
**src/SendGrid/SendGridClient.cs**
107105

108-
Unit tests
106+
The main interface to the SendGrid API is the class `SendGridClient`.
107+
108+
**/tests/SendGrid.Tests/Integration.cs**
109+
110+
Integration tests
109111

110112
<a name="testing"></a>
111113
## Testing
112114

113115
All PRs require passing tests before the PR will be reviewed.
114116

115-
All test files are in the [`UnitTest`](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/SendGrid/UnitTest) directory.
117+
All test files are in the [`UnitTest`](https://github.com/sendgrid/sendgrid-csharp/blob/master/tests/SendGrid.Tests) directory.
116118

117-
For the purposes of contributing to this repo, please update the [`UnitTest.cs`](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/test/SendGrid/UnitTest/UnitTest.cs) file with unit tests as you modify the code.
119+
For the purposes of contributing to this repo, please update the [`Integration.cs`](https://github.com/sendgrid/sendgrid-csharp/blob/master/tests/SendGrid.Tests/Integration.cs) file with unit tests as you modify the code.
118120

119121
Downloaded [Prism](https://github.com/stoplightio/prism/releases) and rename the executable to be prism.exe and place the renamed executable in your PATH.
120122

@@ -123,7 +125,7 @@ When you run the tests for the first time, you will need to allow Prism.exe to r
123125
<a name="style_guidelines_and_naming_conventions"></a>
124126
## Style Guidelines & Naming Conventions
125127

126-
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning. In this case, we generally follow the [C# Naming Conventions](https://msdn.microsoft.com/library/ms229045(v=vs.100).aspx) and the suggestions provided by the Visual Studio IDE.
128+
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning. In this case, we generally follow the [C# Naming Conventions](https://msdn.microsoft.com/library/ms229045(v=vs.100).aspx), the suggestions provided by the Visual Studio IDE and StyleCop (see the [stylecop.json](https://github.com/sendgrid/sendgrid-csharp/blob/master/src/SendGrid/stylcop.json) and [SendGrid.ruleset](https://github.com/sendgrid/sendgrid-csharp/blob/master/src/SendGrid/SendGrid.ruleset) configuration files.
127129

128130
## Creating a Pull Request<a name="creating_a_pull_request"></a>
129131

ExampleCoreProject/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"type": "platform",
1010
"version": "1.0.1"
1111
},
12-
"SendGrid": "9.0.6-*"
12+
"SendGrid": "9.*"
1313
},
1414

1515
"frameworks": {

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ We appreciate your continued support, thank you!
3535

3636
## Setup Environment Variables
3737

38-
Update the development Environment (user space) with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys). For example, in Windows 10, please review [this thread](http://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10).
38+
Update the development Environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys). For example, in Windows 10, please review [this thread](http://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10).
3939

4040
## Install Package
4141

4242
To use SendGrid in your C# project, you can either <a href="https://github.com/sendgrid/sendgrid-csharp.git">download the SendGrid C# .NET libraries directly from our Github repository</a> or, if you have the NuGet package manager installed, you can grab them automatically.
4343

4444
```
45-
PM> Install-Package SendGrid -Pre
45+
PM> Install-Package SendGrid
4646
```
4747

4848
Once you have the SendGrid libraries properly referenced in your project, you can include calls to them in your code.
49-
For a sample implementation, check the [Example](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/Example) folder.
49+
For sample implementations, check the [.NET Core Example](https://github.com/sendgrid/sendgrid-csharp/tree/master/ExampleCoreProject) and the [.NET 4.5.2 Example](https://github.com/sendgrid/sendgrid-csharp/tree/master/ExampleNet45Project) folders.
5050

5151
## Dependencies
5252

53-
- [Newtonsoft.Json](http://www.newtonsoft.com/json)
53+
- Please see the [.nuspec file](https://github.com/sendgrid/sendgrid-csharp/tree/master/nuspec).
5454

5555
<a name="quick_start"></a>
5656
# Quick Start
@@ -127,7 +127,7 @@ namespace Example
127127
}
128128
```
129129

130-
You can find an example of all of the email features [here](https://github.com/sendgrid/sendgrid-csharp/blob/v9beta/tests/SendGrid.Tests/Integration.cs#L73).
130+
You can find an example of all of the email features [here](https://github.com/sendgrid/sendgrid-csharp/blob/master/tests/SendGrid.Tests/Integration.cs#L79).
131131

132132
## General v3 Web API Usage
133133

@@ -159,6 +159,13 @@ namespace Example
159159
}
160160
}
161161
```
162+
## Web Proxy
163+
164+
```csharp
165+
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");
166+
var proxy = new WebProxy("http://proxy:1337");
167+
var client = new SendGridClient(proxy, apiKey);
168+
```
162169

163170
<a name="usage"></a>
164171
# Usage

USAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using Newtonsoft.Json;
77
using SendGrid;
88
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
99
10-
string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
10+
string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");
1111
var client = new SendGridClient(apiKey);
1212
```
1313

examples/accesssettings/accesssettings.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
using System;
1+
using Newtonsoft.Json;
22
using SendGrid;
33
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
4-
using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
4+
using System;
5+
56

6-
string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
7-
Client client = new Client(apiKey);
7+
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");
8+
var client = new SendGridClient(apiKey);
89

910
////////////////////////////////////////////////////////
1011
// Retrieve all recent access attempts
@@ -13,7 +14,7 @@
1314
string queryParams = @"{
1415
'limit': 1
1516
}";
16-
Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/activity", queryParams: queryParams);
17+
var response = await client.RequestAsync(method: SendGridClient.Method.GET, urlPath: "access_settings/activity", queryParams: queryParams);
1718
Console.WriteLine(response.StatusCode);
1819
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
1920
Console.WriteLine(response.Headers.ToString());
@@ -38,7 +39,7 @@
3839
}";
3940
Object json = JsonConvert.DeserializeObject<Object>(data);
4041
data = json.ToString();
41-
Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "access_settings/whitelist", requestBody: data);
42+
var response = await client.RequestAsync(method: SendGridClient.Method.POST, urlPath: "access_settings/whitelist", requestBody: data);
4243
Console.WriteLine(response.StatusCode);
4344
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
4445
Console.WriteLine(response.Headers.ToString());
@@ -48,7 +49,7 @@
4849
// Retrieve a list of currently whitelisted IPs
4950
// GET /access_settings/whitelist
5051

51-
Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist");
52+
var response = await client.RequestAsync(method: SendGridClient.Method.GET, urlPath: "access_settings/whitelist");
5253
Console.WriteLine(response.StatusCode);
5354
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
5455
Console.WriteLine(response.Headers.ToString());
@@ -67,7 +68,7 @@
6768
}";
6869
Object json = JsonConvert.DeserializeObject<Object>(data);
6970
data = json.ToString();
70-
Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist", requestBody: data);
71+
var response = await client.RequestAsync(method: SendGridClient.Method.DELETE, urlPath: "access_settings/whitelist", requestBody: data);
7172
Console.WriteLine(response.StatusCode);
7273
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
7374
Console.WriteLine(response.Headers.ToString());
@@ -78,7 +79,7 @@
7879
// GET /access_settings/whitelist/{rule_id}
7980

8081
var rule_id = "test_url_param";
81-
Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist/" + rule_id);
82+
var response = await client.RequestAsync(method: SendGridClient.Method.GET, urlPath: "access_settings/whitelist/" + rule_id);
8283
Console.WriteLine(response.StatusCode);
8384
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
8485
Console.WriteLine(response.Headers.ToString());
@@ -89,7 +90,7 @@
8990
// DELETE /access_settings/whitelist/{rule_id}
9091

9192
var rule_id = "test_url_param";
92-
Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist/" + rule_id);
93+
var response = await client.RequestAsync(method: SendGridClient.Method.DELETE, urlPath: "access_settings/whitelist/" + rule_id);
9394
Console.WriteLine(response.StatusCode);
9495
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
9596
Console.WriteLine(response.Headers.ToString());

examples/alerts/alerts.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
using System;
1+
using Newtonsoft.Json;
22
using SendGrid;
33
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
4-
using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
4+
using System;
5+
56

6-
string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
7-
Client client = new Client(apiKey);
7+
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");
8+
var client = new SendGridClient(apiKey);
89

910
////////////////////////////////////////////////////////
1011
// Create a new Alert
@@ -17,7 +18,7 @@
1718
}";
1819
Object json = JsonConvert.DeserializeObject<Object>(data);
1920
data = json.ToString();
20-
Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "alerts", requestBody: data);
21+
var response = await client.RequestAsync(method: SendGridClient.Method.POST, urlPath: "alerts", requestBody: data);
2122
Console.WriteLine(response.StatusCode);
2223
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
2324
Console.WriteLine(response.Headers.ToString());
@@ -27,7 +28,7 @@
2728
// Retrieve all alerts
2829
// GET /alerts
2930

30-
Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "alerts");
31+
var response = await client.RequestAsync(method: SendGridClient.Method.GET, urlPath: "alerts");
3132
Console.WriteLine(response.StatusCode);
3233
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
3334
Console.WriteLine(response.Headers.ToString());
@@ -43,7 +44,7 @@
4344
Object json = JsonConvert.DeserializeObject<Object>(data);
4445
data = json.ToString();
4546
var alert_id = "test_url_param";
46-
Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "alerts/" + alert_id, requestBody: data);
47+
var response = await client.RequestAsync(method: SendGridClient.Method.PATCH, urlPath: "alerts/" + alert_id, requestBody: data);
4748
Console.WriteLine(response.StatusCode);
4849
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
4950
Console.WriteLine(response.Headers.ToString());
@@ -54,7 +55,7 @@
5455
// GET /alerts/{alert_id}
5556

5657
var alert_id = "test_url_param";
57-
Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "alerts/" + alert_id);
58+
var response = await client.RequestAsync(method: SendGridClient.Method.GET, urlPath: "alerts/" + alert_id);
5859
Console.WriteLine(response.StatusCode);
5960
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
6061
Console.WriteLine(response.Headers.ToString());
@@ -65,7 +66,7 @@
6566
// DELETE /alerts/{alert_id}
6667

6768
var alert_id = "test_url_param";
68-
Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "alerts/" + alert_id);
69+
var response = await client.RequestAsync(method: SendGridClient.Method.DELETE, urlPath: "alerts/" + alert_id);
6970
Console.WriteLine(response.StatusCode);
7071
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
7172
Console.WriteLine(response.Headers.ToString());

examples/apikeys/apikeys.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
using System;
1+
using Newtonsoft.Json;
22
using SendGrid;
33
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
4-
using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
4+
using System;
5+
56

6-
string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
7-
Client client = new Client(apiKey);
7+
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");
8+
var client = new SendGridClient(apiKey);
89

910
////////////////////////////////////////////////////////
1011
// Create API keys
@@ -21,7 +22,7 @@
2122
}";
2223
Object json = JsonConvert.DeserializeObject<Object>(data);
2324
data = json.ToString();
24-
Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "api_keys", requestBody: data);
25+
var response = await client.RequestAsync(method: SendGridClient.Method.POST, urlPath: "api_keys", requestBody: data);
2526
Console.WriteLine(response.StatusCode);
2627
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
2728
Console.WriteLine(response.Headers.ToString());
@@ -34,7 +35,7 @@
3435
string queryParams = @"{
3536
'limit': 1
3637
}";
37-
Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys", queryParams: queryParams);
38+
var response = await client.RequestAsync(method: SendGridClient.Method.GET, urlPath: "api_keys", queryParams: queryParams);
3839
Console.WriteLine(response.StatusCode);
3940
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
4041
Console.WriteLine(response.Headers.ToString());
@@ -54,7 +55,7 @@
5455
Object json = JsonConvert.DeserializeObject<Object>(data);
5556
data = json.ToString();
5657
var api_key_id = "test_url_param";
57-
Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "api_keys/" + api_key_id, requestBody: data);
58+
var response = await client.RequestAsync(method: SendGridClient.Method.PUT, urlPath: "api_keys/" + api_key_id, requestBody: data);
5859
Console.WriteLine(response.StatusCode);
5960
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
6061
Console.WriteLine(response.Headers.ToString());
@@ -70,7 +71,7 @@
7071
Object json = JsonConvert.DeserializeObject<Object>(data);
7172
data = json.ToString();
7273
var api_key_id = "test_url_param";
73-
Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "api_keys/" + api_key_id, requestBody: data);
74+
var response = await client.RequestAsync(method: SendGridClient.Method.PATCH, urlPath: "api_keys/" + api_key_id, requestBody: data);
7475
Console.WriteLine(response.StatusCode);
7576
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
7677
Console.WriteLine(response.Headers.ToString());
@@ -81,7 +82,7 @@
8182
// GET /api_keys/{api_key_id}
8283

8384
var api_key_id = "test_url_param";
84-
Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys/" + api_key_id);
85+
var response = await client.RequestAsync(method: SendGridClient.Method.GET, urlPath: "api_keys/" + api_key_id);
8586
Console.WriteLine(response.StatusCode);
8687
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
8788
Console.WriteLine(response.Headers.ToString());
@@ -92,7 +93,7 @@
9293
// DELETE /api_keys/{api_key_id}
9394

9495
var api_key_id = "test_url_param";
95-
Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "api_keys/" + api_key_id);
96+
var response = await client.RequestAsync(method: SendGridClient.Method.DELETE, urlPath: "api_keys/" + api_key_id);
9697
Console.WriteLine(response.StatusCode);
9798
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
9899
Console.WriteLine(response.Headers.ToString());

0 commit comments

Comments
 (0)