summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md48
1 files changed, 38 insertions, 10 deletions
diff --git a/README.md b/README.md
index d88a3fe..c23105b 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
**This library allows you to quickly and easily use the SendGrid Web API v3 via C# with .NET.**
-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).
+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).
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.
@@ -57,6 +57,7 @@ The following is the minimum needed code to send an email with the [/mail/send H
using System;
using SendGrid;
using SendGrid.Helpers.Mail;
+using System.Threading.Tasks;
namespace Example
{
@@ -64,16 +65,21 @@ namespace Example
{
private static void Main()
{
- String apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
+ Execute().Wait();
+ }
+
+ static async Task Execute()
+ {
+ string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGridAPIClient(apiKey);
Email from = new Email("test@example.com");
- String subject = "Hello World from the SendGrid CSharp Library!";
+ string subject = "Hello World from the SendGrid CSharp Library!";
Email to = new Email("test@example.com");
Content content = new Content("text/plain", "Hello, Email!");
Mail mail = new Mail(from, subject, to, content);
- dynamic response = sg.client.mail.send.post(requestBody: mail.Get());
+ dynamic response = await sg.client.mail.send.post(requestBody: mail.Get());
}
}
}
@@ -89,6 +95,7 @@ The following is the minimum needed code to send an email without the /mail/send
using System;
using SendGrid;
using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
+using System.Threading.Tasks;
namespace Example
{
@@ -96,6 +103,11 @@ namespace Example
{
private static void Main()
{
+ Execute().Wait();
+ }
+
+ static async Task Execute()
+ {
String apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGridAPIClient(apiKey);
@@ -121,7 +133,7 @@ namespace Example
]
}";
Object json = JsonConvert.DeserializeObject<Object>(data);
- dynamic response = sg.client.mail.send.post(requestBody: json.ToString());
+ dynamic response = await sg.client.mail.send.post(requestBody: json.ToString());
}
}
}
@@ -132,6 +144,7 @@ namespace Example
```csharp
using System;
using SendGrid;
+using System.Threading.Tasks;
namespace Example
{
@@ -139,10 +152,15 @@ namespace Example
{
private static void Main()
{
+ Execute().Wait();
+ }
+
+ static async Task Execute()
+ {
string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(apiKey);
- dynamic response = sg.client.suppression.bounces.get();
- }
+ dynamic response = await sg.client.suppression.bounces.get();
+ }
}
}
```
@@ -152,6 +170,7 @@ namespace Example
```csharp
using System;
using SendGrid;
+using System.Threading.Tasks;
namespace Example
{
@@ -159,9 +178,14 @@ namespace Example
{
private static void Main()
{
- string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
- dynamic sg = new SendGrid.SendGridAPIClient(apiKey);
- dynamic response = sg.client._("suppression/bounces").get();
+ Execute().Wait();
+ }
+
+ static async Task Execute()
+ {
+ string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey);
+ dynamic response = await sg.client._("suppression/bounces").get();
}
}
}
@@ -194,6 +218,10 @@ Quick links:
- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md#cla)
- [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md#improvements_to_the_codebase)
+# Troubleshooting
+
+Please see our [troubleshooting guide](https://github.com/sendgrid/sendgrid-csharp/blob/master/TROUBLESHOOTING.md) for common library issues.
+
# About
sendgrid-csharp is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).