Skip to content

Commit 5c3f31e

Browse files
Merge pull request #283 from sendgrid/documentation-updates
README documentation updates
2 parents 4610abd + 35e4e93 commit 5c3f31e

File tree

2 files changed

+94
-30
lines changed

2 files changed

+94
-30
lines changed

README.md

Lines changed: 93 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
[![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-csharp.png?branch=master)](https://travis-ci.org/sendgrid/sendgrid-csharp)
22

3-
**This library allows you to quickly and easily use the SendGrid Web API via C Sharp with .NET.**
3+
**This library allows you to quickly and easily use the SendGrid Web API v3 via C# with .NET.**
44

5-
# Announcements
6-
7-
**BREAKING CHANGE as of 2016.06.14**
8-
9-
Version `7.X.X` is a breaking change for the entire library.
5+
Version 7.X.X of this library provides full support for all SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint).
106

11-
Version 7.X.X brings you full support for all Web API v3 endpoints. We
12-
have the following resources to get you started quickly:
7+
This library represents the beginning of a new path for SendGrid. We want this library to be community driven and SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-csharp/issues) and [pull requests](https://github.com/sendgrid/sendgrid-csharp/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests.
138

14-
- [SendGrid
15-
Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html)
16-
- [Usage
17-
Documentation](https://github.com/sendgrid/sendgrid-csharp/tree/master/USAGE.md)
18-
- [Example Code](https://github.com/sendgrid/sendgrid-csharp/tree/master/examples)
19-
- [Example
20-
Project](https://github.com/sendgrid/sendgrid-csharp/tree/master/Example)
21-
- [Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html)
9+
Please browse the rest of this README for further detail.
2210

23-
Thank you for your continued support!
24-
25-
All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-csharp/blob/master/CHANGELOG.md).
11+
We appreciate your continued support, thank you!
2612

2713
# Installation
2814

@@ -33,7 +19,7 @@ All updates to this library is documented in our [CHANGELOG](https://github.com/
3319

3420
## Setup Environment Variables
3521

36-
Update your Environment (user space) with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys).
22+
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).
3723

3824
## Install Package
3925

@@ -63,6 +49,10 @@ using SendGrid.Helpers.Mail; // Include if you want to use the Mail Helper
6349

6450
## Hello Email
6551

52+
The following is the minimum needed code to send an email with the [/mail/send Helper](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/SendGrid/Helpers/Mail) ([here](https://github.com/sendgrid/sendgrid-csharp/blob/master/SendGrid/Example/Example.cs#L45) is a full example):
53+
54+
### With Mail Helper Class
55+
6656
```csharp
6757
using System;
6858
using SendGrid;
@@ -78,9 +68,9 @@ namespace Example
7868
dynamic sg = new SendGridAPIClient(apiKey);
7969

8070
Email from = new Email("[email protected]");
81-
String subject = "Hello World from the SendGrid CSharp Library";
71+
String subject = "Hello World from the SendGrid CSharp Library!";
8272
Email to = new Email("[email protected]");
83-
Content content = new Content("text/plain", "Textual content");
73+
Content content = new Content("text/plain", "Hello, Email!");
8474
Mail mail = new Mail(from, subject, to, content);
8575

8676
dynamic response = sg.client.mail.send.post(requestBody: mail.Get());
@@ -89,10 +79,16 @@ namespace Example
8979
}
9080
```
9181

92-
## General v3 Web API Usage
82+
The `Mail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](https://github.com/sendgrid/sendgrid-csharp/blob/master/SendGrid/Example/Example.cs#L33) is an example of how to add to it.
83+
84+
### Without Mail Helper Class
85+
86+
The following is the minimum needed code to send an email without the /mail/send Helper ([here](https://github.com/sendgrid/sendgrid-csharp/blob/master/examples/mail/mail.cs#L29) is a full example):
9387

9488
```csharp
9589
using System;
90+
using SendGrid;
91+
using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
9692
9793
namespace Example
9894
{
@@ -101,8 +97,71 @@ namespace Example
10197
private static void Main()
10298
{
10399
String apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
100+
dynamic sg = new SendGridAPIClient(apiKey);
101+
102+
string data = @"{
103+
'personalizations': [
104+
{
105+
'to': [
106+
{
107+
'email': '[email protected]'
108+
}
109+
],
110+
'subject': 'Hello World from the SendGrid C# Library!'
111+
}
112+
],
113+
'from': {
114+
'email': '[email protected]'
115+
},
116+
'content': [
117+
{
118+
'type': 'text/plain',
119+
'value': 'Hello, Email!'
120+
}
121+
]
122+
}";
123+
Object json = JsonConvert.DeserializeObject<Object>(data);
124+
dynamic response = sg.client.mail.send.post(requestBody: json.ToString());
125+
}
126+
}
127+
}
128+
```
129+
130+
## General v3 Web API Usage (With Fluent Interface)
131+
132+
```csharp
133+
using System;
134+
using SendGrid;
135+
136+
namespace Example
137+
{
138+
internal class Example
139+
{
140+
private static void Main()
141+
{
142+
string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
104143
dynamic sg = new SendGrid.SendGridAPIClient(apiKey);
105-
dynamic response = sg.client.api_keys.get();
144+
dynamic response = sg.client.suppression.bounces.get();
145+
}
146+
}
147+
}
148+
```
149+
150+
## General v3 Web API Usage (Without Fluent Interface)
151+
152+
```csharp
153+
using System;
154+
using SendGrid;
155+
156+
namespace Example
157+
{
158+
internal class Example
159+
{
160+
private static void Main()
161+
{
162+
string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
163+
dynamic sg = new SendGrid.SendGridAPIClient(apiKey);
164+
dynamic response = sg.client._("suppression/bounces").get();
106165
}
107166
}
108167
}
@@ -111,17 +170,22 @@ namespace Example
111170
# Usage
112171

113172
- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html)
114-
- [Usage Docs](https://github.com/sendgrid/sendgrid-csharp/tree/master/USAGE.md)
173+
- [Library Usage Docs](https://github.com/sendgrid/sendgrid-csharp/tree/master/USAGE.md)
115174
- [Example Code](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/Example)
175+
- [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html)
116176
- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/SendGrid/Helpers/Mail)
117177

118-
## Roadmap
178+
# Announcements
179+
180+
All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-csharp/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-csharp/releases).
181+
182+
# Roadmap
119183

120-
If you are intersted in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/sendgrid-csharp/milestones). We would love to hear your feedback.
184+
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/sendgrid/sendgrid-csharp/issues) and [pull requests](https://github.com/sendgrid/sendgrid-csharp/pulls). We would love to hear your feedback.
121185

122-
## How to Contribute
186+
# How to Contribute
123187

124-
We encourage contribution to our library, please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md) guide for details.
188+
We encourage contribution to our library (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md) guide for details.
125189

126190
Quick links:
127191

SendGrid/SendGrid/Helpers/Mail/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Quick Start
44

5-
Run the [Example Project](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/SendGrid.sln) (make sure you have set your environment variable to include your SENDGRID_API_KEY).
5+
Run the [Example Project](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/SendGrid/Helpers/Mail) (make sure you have set your Environment variable to include your SENDGRID_API_KEY).
66

77
Click on the Example project, then click the `Start` button in the menu.
88

0 commit comments

Comments
 (0)