diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-13 15:17:05 -0700 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-13 15:17:05 -0700 |
commit | e307533a9dbf49b09192bf77d31c044828b74d08 (patch) | |
tree | ebe846b1603e323673969fe06e0cbbf505d788c8 | |
parent | e3c8d69925ae2f964c02fce30383b319930000a7 (diff) | |
download | sendgrid-csharp-e307533a9dbf49b09192bf77d31c044828b74d08.zip sendgrid-csharp-e307533a9dbf49b09192bf77d31c044828b74d08.tar.gz sendgrid-csharp-e307533a9dbf49b09192bf77d31c044828b74d08.tar.bz2 |
Version Bump v7.0.0: full v3 Web API support
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 2 | ||||
-rw-r--r-- | README.md | 59 | ||||
-rw-r--r-- | SendGrid/SendGrid/Helpers/Mail/README.md | 4 | ||||
-rw-r--r-- | USAGE.md | 8 | ||||
-rw-r--r-- | examples/mail/mail.cs | 144 |
6 files changed, 97 insertions, 122 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 257d958..d1795ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Change Log All notable changes to this project will be documented in this file. -## [7.0.0] - XXXX-XX-XX +## [7.0.0] - 2016-06-13 ### Added - Breaking change to support the v3 Web API - New HTTP client diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 87d5122..ee4c4ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,7 +86,7 @@ Next, update your Environment (user space) with your [SENDGRID_API_KEY](https:// - Check out the documentation for [Web API v3 endpoints](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html). - Review the corresponding [examples](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/examples). -- You can add your test code to our [Example project](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/SendGrid/Example/Example.cs). +- You can add your test code to our [Example Project](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/SendGrid/Example/Example.cs). <a name="understanding_the_codebase"></a> ## Understanding the Code Base @@ -1,18 +1,10 @@ -[](https://travis-ci.org/sendgrid/sendgrid-csharp) +[](https://travis-ci.org/sendgrid/sendgrid-csharp) **This library allows you to quickly and easily use the SendGrid Web API via C Sharp with .NET.** # Announcements -**NOTE: The `/mail/send/beta` endpoint is currently in beta! - -Since this is not a general release, we do not recommend POSTing production level traffic through this endpoint or integrating your production servers with this endpoint. - -When this endpoint is ready for general release, your code will require an update in order to use the official URI. - -By using this endpoint, you accept that you may encounter bugs and that the endpoint may be taken down for maintenance at any time. We cannot guarantee the continued availability of this beta endpoint. We hope that you like this new endpoint and we appreciate any [feedback](dx+mail-beta@sendgrid.com) that you can send our way.** - -**BREAKING CHANGE as of XXXX.XX.XX** +**BREAKING CHANGE as of 2016.06.14** Version `7.0.0` is a breaking change for the entire library. @@ -22,40 +14,23 @@ have the following resources to get you started quickly: - [SendGrid Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) - [Usage - Documentation](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/USAGE.md) + Documentation](https://github.com/sendgrid/sendgrid-csharp/tree/master/USAGE.md) - [Example - Code](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/Example) + Code](https://github.com/sendgrid/sendgrid-csharp/tree/master/Example) Thank you for your continued support! -All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/CHANGELOG.md). +All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-csharp/blob/master/CHANGELOG.md). # Installation -## Environment Variables +## Setup Environment Variables First, get your free SendGrid account [here](https://sendgrid.com/free?source=sendgrid-csharp). Next, update your Environment (user space) with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys). -## TRYING OUT THE V3 BETA MAIL SEND - -* Check out the v3beta branch from `https://github.com/sendgrid/sendgrid-csharp.git` using your favorite Git client. -* Open the [solution](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/SendGrid/SendGrid.sln) in Visual Studio (we have tested with the Community Edition). -* Update the to and from [emails](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/SendGrid/Example/Example.cs#L26). -* Build the Solution. -* Build the Example project and click `Start`. -* Check out the documentation for [Web API v3 /mail/send/beta endpoint](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html). - -## TRYING OUT THE V3 BETA WEB API - -* Check out the v3beta branch from `https://github.com/sendgrid/sendgrid-csharp.git` using your favorite Git client. -* Open the [solution](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/SendGrid/SendGrid.sln) in Visual Studio (we have tested with the Community Edition). -* Check out the documentation for [Web API v3 endpoints](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html). -* Review the corresponding [examples](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/examples). -* You can add your test code to our [Example project](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/SendGrid/Example/Example.cs). - -## Once we are out of v3 BETA, the following will apply +## Install Package 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. @@ -64,7 +39,7 @@ PM> Install-Package SendGrid ``` Once you have the SendGrid libraries properly referenced in your project, you can include calls to them in your code. -For a sample implementation, check the [Example](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/SendGrid/Example) folder. +For a sample implementation, check the [Example](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/Example) folder. Add the following namespaces to use the library: ```csharp @@ -101,7 +76,7 @@ namespace Example Content content = new Content("text/plain", "Textual content"); Mail mail = new Mail(from, subject, to, content); - dynamic response = sg.client.mail.send.beta.post(requestBody: mail.Get()); + dynamic response = sg.client.mail.send.post(requestBody: mail.Get()); } } } @@ -130,9 +105,9 @@ namespace Example # Usage - [SendGrid Docs](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) -- [Usage Docs](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/USAGE.md) -- [Example Code](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/SendGrid/Example) -- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/SendGrid/SendGrid/Helpers/Mail) +- [Usage Docs](https://github.com/sendgrid/sendgrid-csharp/tree/master/USAGE.md) +- [Example Code](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/Example) +- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/SendGrid/Helpers/Mail) ## Roadmap @@ -140,14 +115,14 @@ If you are intersted in the future direction of this project, please take a look ## How to Contribute -We encourage contribution to our library, please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/CONTRIBUTING.md) guide for details. +We encourage contribution to our library, please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md) guide for details. Quick links: -- [Feature Request](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/CONTRIBUTING.md#feature_request) -- [Bug Reports](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/CONTRIBUTING.md#submit_a_bug_report) -- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/CONTRIBUTING.md#cla) -- [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/CONTRIBUTING.md#improvements_to_the_codebase) +- [Feature Request](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md#feature_request) +- [Bug Reports](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md#submit_a_bug_report) +- [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) # About diff --git a/SendGrid/SendGrid/Helpers/Mail/README.md b/SendGrid/SendGrid/Helpers/Mail/README.md index 313f363..fa607b3 100644 --- a/SendGrid/SendGrid/Helpers/Mail/README.md +++ b/SendGrid/SendGrid/Helpers/Mail/README.md @@ -2,11 +2,11 @@ # Quick Start -Run the [example](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/examples) (make sure you have set your environment variable to include your SENDGRID_API_KEY). +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). Click on the Example project, then click the `Start` button in the menu. ## Usage -- See the [example](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/examples) for a complete working example. +- See the [example](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/Example/Example.cs) for a complete working example. - [Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/overview.html)
\ No newline at end of file @@ -2219,7 +2219,7 @@ Console.WriteLine(response.Headers.ToString()); Console.ReadLine(); ``` -## v3 Mail Send Beta +## v3 Mail Send This endpoint allows you to send email over SendGrids v3 Web API, the most recent version of our API. If you are looking for documentation about the v2 Mail Send endpoint, please see our [v2 API Reference](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). @@ -2230,9 +2230,9 @@ For an overview of the v3 Mail Send endpoint, please visit our [v3 API Reference For more detailed information about how to use the v3 Mail Send endpoint, please visit our [Classroom](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/index.html). -### POST /mail/send/beta +### POST /mail/send -This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/SendGrid/SendGrid/Helpers/Mail/README.md). +This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-csharp/blob/master/SendGrid/SendGrid/Helpers/Mail/README.md). ```csharp string data = @"{ @@ -2378,7 +2378,7 @@ string data = @"{ } } }"; -dynamic response = sg.client.mail.send.beta.post(requestBody: data); +dynamic response = sg.client.mail.send.post(requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/mail/mail.cs b/examples/mail/mail.cs index 0500958..7cad2be 100644 --- a/examples/mail/mail.cs +++ b/examples/mail/mail.cs @@ -27,154 +27,154 @@ Console.WriteLine(response.Headers.ToString()); Console.ReadLine(); //////////////////////////////////////////////////////// -// v3 Mail Send Beta -// POST /mail/send/beta -# This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-csharp/blob/v3beta/SendGrid/SendGrid/Helpers/Mail/README.md). +// v3 Mail Send +// POST /mail/send +# This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-csharp/blob/master/SendGrid/SendGrid/Helpers/Mail/README.md). string data = @"{ 'asm': { - 'group_id': 1, + 'group_id': 1, 'groups_to_display': [ - 1, - 2, + 1, + 2, 3 ] - }, + }, 'attachments': [ { - 'content': '[BASE64 encoded content block here]', - 'content_id': 'ii_139db99fdb5c3704', - 'disposition': 'inline', - 'filename': 'file1.jpg', - 'name': 'file1', + 'content': '[BASE64 encoded content block here]', + 'content_id': 'ii_139db99fdb5c3704', + 'disposition': 'inline', + 'filename': 'file1.jpg', + 'name': 'file1', 'type': 'jpg' } - ], - 'batch_id': '[YOUR BATCH ID GOES HERE]', + ], + 'batch_id': '[YOUR BATCH ID GOES HERE]', 'categories': [ - 'category1', + 'category1', 'category2' - ], + ], 'content': [ { - 'type': 'text/html', + 'type': 'text/html', 'value': '<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>' } - ], + ], 'custom_args': { - 'New Argument 1': 'New Value 1', - 'activationAttempt': '1', + 'New Argument 1': 'New Value 1', + 'activationAttempt': '1', 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]' - }, + }, 'from': { - 'email': 'sam.smith@example.com', + 'email': 'sam.smith@example.com', 'name': 'Sam Smith' - }, - 'headers': {}, - 'ip_pool_name': '[YOUR POOL NAME GOES HERE]', + }, + 'headers': {}, + 'ip_pool_name': '[YOUR POOL NAME GOES HERE]', 'mail_settings': { 'bcc': { - 'email': 'ben.doe@example.com', + 'email': 'ben.doe@example.com', 'enable': true - }, + }, 'bypass_list_management': { 'enable': true - }, + }, 'footer': { - 'enable': true, - 'html': '<p>Thanks</br>The SendGrid Team</p>', + 'enable': true, + 'html': '<p>Thanks</br>The SendGrid Team</p>', 'text': 'Thanks,/n The SendGrid Team' - }, + }, 'sandbox_mode': { 'enable': false - }, + }, 'spam_check': { - 'enable': true, - 'post_to_url': 'http://example.com/compliance', + 'enable': true, + 'post_to_url': 'http://example.com/compliance', 'threshold': 3 } - }, + }, 'personalizations': [ { 'bcc': [ { - 'email': 'sam.doe@example.com', + 'email': 'sam.doe@example.com', 'name': 'Sam Doe' } - ], + ], 'cc': [ { - 'email': 'jane.doe@example.com', + 'email': 'jane.doe@example.com', 'name': 'Jane Doe' } - ], + ], 'custom_args': { - 'New Argument 1': 'New Value 1', - 'activationAttempt': '1', + 'New Argument 1': 'New Value 1', + 'activationAttempt': '1', 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]' - }, + }, 'headers': { - 'X-Accept-Language': 'en', + 'X-Accept-Language': 'en', 'X-Mailer': 'MyApp' - }, - 'send_at': 1409348513, - 'subject': 'Hello, World!', + }, + 'send_at': 1409348513, + 'subject': 'Hello, World!', 'substitutions': { 'sub': { '%name%': [ - 'John', - 'Jane', + 'John', + 'Jane', 'Sam' ] } - }, + }, 'to': [ { - 'email': 'john.doe@example.com', + 'email': 'john.doe@example.com', 'name': 'John Doe' } ] } - ], + ], 'reply_to': { - 'email': 'sam.smith@example.com', + 'email': 'sam.smith@example.com', 'name': 'Sam Smith' - }, + }, 'sections': { 'section': { - ':sectionName1': 'section 1 text', + ':sectionName1': 'section 1 text', ':sectionName2': 'section 2 text' } - }, - 'send_at': 1409348513, - 'subject': 'Hello, World!', - 'template_id': '[YOUR TEMPLATE ID GOES HERE]', + }, + 'send_at': 1409348513, + 'subject': 'Hello, World!', + 'template_id': '[YOUR TEMPLATE ID GOES HERE]', 'tracking_settings': { 'click_tracking': { - 'enable': true, + 'enable': true, 'enable_text': true - }, + }, 'ganalytics': { - 'enable': true, - 'utm_campaign': '[NAME OF YOUR REFERRER SOURCE]', - 'utm_content': '[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]', - 'utm_medium': '[NAME OF YOUR MARKETING MEDIUM e.g. email]', - 'utm_name': '[NAME OF YOUR CAMPAIGN]', + 'enable': true, + 'utm_campaign': '[NAME OF YOUR REFERRER SOURCE]', + 'utm_content': '[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]', + 'utm_medium': '[NAME OF YOUR MARKETING MEDIUM e.g. email]', + 'utm_name': '[NAME OF YOUR CAMPAIGN]', 'utm_term': '[IDENTIFY PAID KEYWORDS HERE]' - }, + }, 'open_tracking': { - 'enable': true, + 'enable': true, 'substitution_tag': '%opentrack' - }, + }, 'subscription_tracking': { - 'enable': true, - 'html': 'If you would like to unsubscribe and stop receiving these emails <% clickhere %>.', - 'substitution_tag': '<%click here%>', + 'enable': true, + 'html': 'If you would like to unsubscribe and stop receiving these emails <% clickhere %>.', + 'substitution_tag': '<%click here%>', 'text': 'If you would like to unsubscribe and stop receiveing these emails <% click here %>.' } } }"; -dynamic response = sg.client.mail.send.beta.post(requestBody: data); +dynamic response = sg.client.mail.send.post(requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); |