summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElmer Thomas <elmer@thinkingserious.com>2016-06-14 10:22:39 -0700
committerElmer Thomas <elmer@thinkingserious.com>2016-06-14 10:22:39 -0700
commit1e2111f09142552d7dde4e18f116835dec91ed86 (patch)
tree1de111c549454450ce5a45aa129726132db217b5
parent5ee89f857c09d79e507483bd807727bb6c4d7057 (diff)
parent2e52cfb07decb924a961b5c75ece1b9e79ab973c (diff)
downloadsendgrid-csharp-7.0.1.zip
sendgrid-csharp-7.0.1.tar.gz
sendgrid-csharp-7.0.1.tar.bz2
Merge branch 'v3release'v7.0.1v7.0.0
-rw-r--r--.github/ISSUE_TEMPLATE17
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml3
-rw-r--r--CHANGELOG.md23
-rw-r--r--CONTRIBUTING.md179
-rw-r--r--LICENSE.txt (renamed from MIT.LICENSE)42
-rw-r--r--README.md400
-rw-r--r--SendGrid/Example/Example.cs329
-rw-r--r--SendGrid/Example/Example.csproj21
-rw-r--r--SendGrid/Example/Program.cs263
-rw-r--r--SendGrid/Example/Properties/AssemblyInfo.cs14
-rw-r--r--SendGrid/Example/WEBAPI.cs544
-rw-r--r--SendGrid/Example/app.config20
-rw-r--r--SendGrid/Example/packages.config3
-rw-r--r--SendGrid/SendGrid.sln39
-rw-r--r--SendGrid/SendGrid/App.config2
-rw-r--r--SendGrid/SendGrid/Client.cs117
-rw-r--r--SendGrid/SendGrid/Helpers/Mail/Mail.cs1291
-rw-r--r--SendGrid/SendGrid/Helpers/Mail/README.md12
-rw-r--r--SendGrid/SendGrid/Properties/AssemblyInfo.cs16
-rw-r--r--SendGrid/SendGrid/Resources/APIKeys.cs67
-rw-r--r--SendGrid/SendGrid/Resources/GlobalStats.cs48
-rw-r--r--SendGrid/SendGrid/Resources/GlobalSuppressions.cs57
-rw-r--r--SendGrid/SendGrid/Resources/Suppressions.cs60
-rw-r--r--SendGrid/SendGrid/Resources/UnsubscribeGroups.cs70
-rw-r--r--SendGrid/SendGrid/SendGrid.csproj16
-rw-r--r--SendGrid/SendGrid/packages.config1
-rw-r--r--SendGrid/SendGridMail/Exceptions/InvalidApiRequestException.cs19
-rw-r--r--SendGrid/SendGridMail/ISendGrid.cs302
-rw-r--r--SendGrid/SendGridMail/Mail.csproj154
-rw-r--r--SendGrid/SendGridMail/Properties/AssemblyInfo.cs62
-rw-r--r--SendGrid/SendGridMail/SendGrid.cs550
-rw-r--r--SendGrid/SendGridMail/SendGridMail.pfxbin1709 -> 0 bytes
-rw-r--r--SendGrid/SendGridMail/StreamedFileBody.cs39
-rw-r--r--SendGrid/SendGridMail/Transport/ErrorChecker.cs57
-rw-r--r--SendGrid/SendGridMail/Transport/ITransport.cs18
-rw-r--r--SendGrid/SendGridMail/Transport/Web.cs186
-rw-r--r--SendGrid/SendGridMail/Web/IWebApi.cs45
-rw-r--r--SendGrid/SendGridMail/app.config3
-rw-r--r--SendGrid/SendGridMail/nuget/Sendgrid.2.1.1.nuspec24
-rw-r--r--SendGrid/SendGridMail/nuget/lib/SendGridMail.dllbin25600 -> 0 bytes
-rw-r--r--SendGrid/SendGridMail/packages.config4
-rw-r--r--SendGrid/SendGridMail/sendgrid-csharp.snkbin596 -> 0 bytes
-rw-r--r--SendGrid/Tests/Properties/AssemblyInfo.cs39
-rw-r--r--SendGrid/Tests/TestSendgrid.cs418
-rw-r--r--SendGrid/Tests/Tests.csproj123
-rw-r--r--SendGrid/Tests/Transport/TestErrorChecker.cs34
-rw-r--r--SendGrid/Tests/Transport/TestWebApi.cs97
-rw-r--r--SendGrid/Tests/app.config26
-rw-r--r--SendGrid/Tests/packages.config8
-rw-r--r--SendGrid/Tests/sendgrid-csharp.snkbin596 -> 0 bytes
-rw-r--r--SendGrid/UnitTest/Properties/AssemblyInfo.cs14
-rw-r--r--SendGrid/UnitTest/UnitTest.cs5093
-rw-r--r--SendGrid/UnitTest/UnitTests.csproj11
-rw-r--r--SendGrid/UnitTest/packages.config1
-rw-r--r--USAGE.md5317
-rw-r--r--examples/accesssettings/accesssettings.cs92
-rw-r--r--examples/apikeys/apikeys.cs89
-rw-r--r--examples/asm/asm.cs172
-rw-r--r--examples/browsers/browsers.cs25
-rw-r--r--examples/campaigns/campaigns.cs168
-rw-r--r--examples/categories/categories.cs59
-rw-r--r--examples/clients/clients.cs38
-rw-r--r--examples/contactdb/contactdb.cs454
-rw-r--r--examples/devices/devices.cs24
-rw-r--r--examples/geo/geo.cs25
-rw-r--r--examples/ips/ips.cs175
-rw-r--r--examples/mail/mail.cs182
-rw-r--r--examples/mailboxproviders/mailboxproviders.cs25
-rw-r--r--examples/mailsettings/mailsettings.cs242
-rw-r--r--examples/partnersettings/partnersettings.cs46
-rw-r--r--examples/scopes/scopes.cs17
-rw-r--r--examples/stats/stats.cs24
-rw-r--r--examples/subusers/subusers.cs218
-rw-r--r--examples/suppression/suppression.cs244
-rw-r--r--examples/templates/templates.cs140
-rw-r--r--examples/trackingsettings/trackingsettings.cs123
-rw-r--r--examples/user/user.cs271
-rw-r--r--examples/whitelabel/whitelabel.cs359
79 files changed, 15464 insertions, 4049 deletions
diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE
new file mode 100644
index 0000000..87c0676
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE
@@ -0,0 +1,17 @@
+#### Issue Summary
+
+A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples.
+
+
+#### Steps to Reproduce
+
+1. This is the first step
+2. This is the second step
+3. Further steps, etc.
+
+Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?
+
+#### Technical details:
+
+* sendgrid-csharp Version: master (latest commit: [commit number])
+* .NET Version: 4.5.2 \ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 17ba00d..bf1bcac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,4 +19,5 @@ SendGrid/packages/
SendGrid/TestResult.xml
SendGrid/SendGrid.sln.VisualState.xml
*.pfx
-*.PublicKey \ No newline at end of file
+*.PublicKey
+SendGrid/.vs/config/applicationhost.config \ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 44bc924..c7e643b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,8 +7,7 @@ install:
- nuget restore SendGrid/SendGrid.sln
- nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory testrunner
script:
-- xbuild /p:Configuration=BuildNet45 SendGrid/SendGrid.sln
-- mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe SendGrid/Tests/bin/BuildNet45/Tests.dll
+- xbuild /p:Configuration=Release /p:DebugSymbols=False /p:TargetFrameworkVersion="v4.5" SendGrid/SendGrid.sln
- mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe SendGrid/UnitTest/bin/Release/UnitTest.dll
notifications:
hipchat:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd42d96..d1795ae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,37 +1,43 @@
# Change Log
All notable changes to this project will be documented in this file.
+## [7.0.0] - 2016-06-13
+### Added
+- Breaking change to support the v3 Web API
+- New HTTP client
+- v3 Mail Send helper
+
## [6.3.4] - 2015-12-15
-###Added
+### Added
- Implemented the global stats /asm/stats endpoint [GET]
## [6.3.3] - 2015-12-14
-###Added
+### Added
- Implemented the global suppressions /asm/suppressions/global endpoint [GET, POST, DELETE]
## [6.3.2] - 2015-12-11
-###Added
+### Added
- Implemented the suppressions /asm/groups/:group_id/suppressions endpoint [GET, POST, DELETE]
## [6.3.1] - 2015-12-10
-###Added
+### Added
- Implemented the unsubscribe groups /asm/groups endpoint [GET, POST, DELETE]
## [6.3.0] - 2015-11-24
-###Added
+### Added
- Send emails using API Key
## [6.2.0] - 2015-11-18
-###Added
+### Added
- Added support for using the Web API v3 endpoints
- Implemented the api_keys endpoint [GET, POST, PATCH, DELETE]
## [6.1.0] - 2015-4-27
-###Added
+### Added
- Added support for sending via API keys in addition to credentials. Pass an API Key string to the Web transport constructor
## [6.0.1] - 2015-4-24
-###Fixed
+### Fixed
- Fixed the endpoint URL. (⌒_⌒;)
## [6.0.0] - 2015-4-22
@@ -56,7 +62,6 @@ Deliver method. All other changes are backwards compatible.
### Fixed
- Invalid Protocol Exception in Mono due to the way the endpoint URL was
being assigned (thanks @mdymel, @rbarinov)
-
- Connections were not being reused. This was causing degraded
performance with multiple threads open. Performance should be much
better. (with help from @gatesvp)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..ee4c4ac
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,179 @@
+Hello! Thank you for choosing to help contribute to one of the SendGrid open source libraries. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
+
+- [CLAs and CCLAs](#cla)
+- [Roadmap & Milestones](#roadmap)
+- [Feature Request](#feature_request)
+- [Submit a Bug Report](#submit_a_bug_report)
+- [Improvements to the Codebase](#improvements_to_the_codebase)
+- [Understanding the Code Base](#understanding_the_codebase)
+- [Testing](#testing)
+- [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions)
+- [Creating a Pull Request](#creating_a_pull_request)
+
+<a name="roadmap"></a>
+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.
+
+<a name="cla"></a>
+## CLAs and CCLAs
+
+Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) or a SendGrid Company Contributor Licensing Agreement (CCLA) be filled out by every contributor to a SendGrid open source project.
+
+Our goal with the CLA and CCLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA and CCLA encourage broad participation by our open source community and help us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
+
+SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA (or CCLA). Copies of the CLA and CCLA are available [here](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view).
+
+You may submit your completed [CLA or CCLA](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view) to SendGrid at [dx@sendgrid.com](mailto:dx@sendgrid.com). SendGrid will then confirm you are ready to begin making contributions.
+
+There are a few ways to contribute, which we'll enumerate below:
+
+<a name="feature_request"></a>
+## Feature Request
+
+If you'd like to make a feature request, please read this section.
+
+The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
+
+- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
+- Please be respectful and considerate of others when commenting on issues
+
+<a name="submit_a_bug_report"></a>
+## Submit a Bug Report
+
+Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
+
+A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
+
+Before you decide to create a new issue, please try the following:
+
+1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
+2. Update to the latest version of this code and check if issue has already been fixed
+3. Copy and fill in the Bug Report Template we have provided below
+
+### Please use our Bug Report Template
+
+In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/sendgrid-csharp/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
+
+<a name="improvements_to_the_codebase"></a>
+## Improvements to the Codebase
+
+We welcome direct contributions to the sendgrid-csharp code base. Thank you!
+
+### Development Environment ###
+
+#### Install and Run Locally ####
+
+##### Prerequisites #####
+
+- .NET 4.5.2
+- [SendGrid.CSharp.HTTP.Client](https://www.nuget.org/packages/SendGrid.CSharp.HTTP.Client/)
+- [Newtonsoft.Json](http://www.newtonsoft.com/json)
+
+##### Initial setup: #####
+
+```bash
+git clone https://github.com/sendgrid/sendgrid-csharp.git
+```
+
+Open `sendgrid-csharp/SendGrid/SendGrid.sln`
+
+## 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).
+
+##### Execute: #####
+
+- 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).
+
+<a name="understanding_the_codebase"></a>
+## Understanding the Code Base
+
+**/examples**
+
+Examples that demonstrate usage.
+
+**/Example/Example.cs**
+
+A working example project for testing.
+
+**/SendGrid/SendGrid.cs**
+
+The main interface to the SendGrid API is the class `SendGridAPIClient`.
+
+**/UnitTest**
+
+Unit tests
+
+<a name="testing"></a>
+## Testing
+
+All PRs require passing tests before the PR will be reviewed.
+
+All test files are in the [`UnitTest`](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/SendGrid/UnitTest) directory.
+
+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.
+
+<!--- describe how to run the tests --->
+
+<a name="style_guidelines_and_naming_conventions"></a>
+## Style Guidelines & Naming Conventions
+
+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.
+
+## Creating a Pull Request<a name="creating_a_pull_request"></a>
+
+1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
+ and configure the remotes:
+
+ ```bash
+ # Clone your fork of the repo into the current directory
+ git clone https://github.com/sendgrid/sendgrid-csharp
+ # Navigate to the newly cloned directory
+ cd sendgrid-python
+ # Assign the original repo to a remote called "upstream"
+ git remote add upstream https://github.com/sendgrid/sendgrid-csharp
+ ```
+
+2. If you cloned a while ago, get the latest changes from upstream:
+
+ ```bash
+ git checkout <dev-branch>
+ git pull upstream <dev-branch>
+ ```
+
+3. Create a new topic branch (off the main project development branch) to
+ contain your feature, change, or fix:
+
+ ```bash
+ git checkout -b <topic-branch-name>
+ ```
+
+4. Commit your changes in logical chunks. Please adhere to these [git commit
+ message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
+ or your code is unlikely be merged into the main project. Use Git's
+ [interactive rebase](https://help.github.com/articles/interactive-rebase)
+ feature to tidy up your commits before making them public.
+
+4a. Create tests.
+
+4b. Create or update the example code that demonstrates the functionality of this change to the code.
+
+5. Locally merge (or rebase) the upstream development branch into your topic branch:
+
+ ```bash
+ git pull [--rebase] upstream master
+ ```
+
+6. Push your topic branch up to your fork:
+
+ ```bash
+ git push origin <topic-branch-name>
+ ```
+
+7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
+ with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
+
+If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo. \ No newline at end of file
diff --git a/MIT.LICENSE b/LICENSE.txt
index 585f8b3..7f9d537 100644
--- a/MIT.LICENSE
+++ b/LICENSE.txt
@@ -1,21 +1,21 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 SendGrid
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+The MIT License (MIT)
+
+Copyright (c) 2012-2016 SendGrid, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index db53ba0..638008b 100644
--- a/README.md
+++ b/README.md
@@ -1,366 +1,134 @@
-# Special Announcement
+[![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-csharp.png?branch=master)](https://travis-ci.org/sendgrid/sendgrid-csharp)
-We have released a [v3 beta branch](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta) for this library that supports our new v3 Mail Send endpoint which is in open beta. The v3/mail/send/beta endpoint is not a production endpoint, so you should not integrate with it for your production email sending. However, when we make this an officially released feature it will be available at v3/mail//send.
+**This library allows you to quickly and easily use the SendGrid Web API via C Sharp with .NET.**
-Please try it out and let us know what you think about the endpoint and the library in the [issues area of this repo](https://github.com/sendgrid/sendgrid-csharp/issues), all of your feedback will be taken into account to influence the endpoint and this library.
+# Announcements
-Beginning with v3/mail/send/beta, the new version of our library will only support v3 endpoints.. Once this endpoint is out of beta, we will update the endpoint, removing the “/beta” from the URI. At this point, the v3 beta branch will be merged to master and will be our official library going forward. This means that we will no longer formally support the v2 mail.send.json endpoint in any of our libraries.
+**BREAKING CHANGE as of 2016.06.14**
-So long as you are not automatically pulling new versions of the library into your production code base, your integration will not break regardless of which endpoint you’re using. By the way, don't pull new versions into your production code base, because breaking changes break things.
+Version `7.0.0` is a breaking change for the entire library.
-The /api/mail.send.json endpoint, known as v2 mail send, is NOT going away. It will continue to work as it always has, happily sending your emails along as if nothing happened.
+Version 7.0.0 brings you full support for all Web API v3 endpoints. We
+have the following resources to get you started quickly:
-[![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-csharp.png?branch=master)](https://travis-ci.org/sendgrid/sendgrid-csharp)
+- [SendGrid
+ Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html)
+- [Usage
+ Documentation](https://github.com/sendgrid/sendgrid-csharp/tree/master/USAGE.md)
+- [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/master/CHANGELOG.md).
-See the [changelog](https://github.com/sendgrid/sendgrid-csharp/blob/master/CHANGELOG.md) for updates.
+# Installation
-#Requirements
+## Setup Environment Variables
-As of 4.0.0, this library requires .NET 4.5 and above. [Fork with .NET 4.0 support](https://www.nuget.org/packages/SendGrid.Net40/)
+First, get your free SendGrid account [here](https://sendgrid.com/free?source=sendgrid-csharp).
-#Installation
+Next, update your Environment (user space) with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys).
+
+## 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.
```
-PM> Install-Package SendGrid
+PM> Install-Package SendGrid
```
-Once you have the SendGrid libraries properly referenced in your project, you can include calls to them in your code.
+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/master/SendGrid/Example) folder.
Add the following namespaces to use the library:
```csharp
using System;
-using System.Net;
-using System.Net.Mail;
+using System.Web.Script.Serialization;
using SendGrid;
```
-#How to: Create an email
-
-Use the static **new SendGridMessage** constructor to create an email message that is of type **SendGridMessage**. Once the message is created, you can use **SendGridMessage** properties and methods to set values including the email sender, the email recipient, and the subject and body of the email.
-
-The following example demonstrates how to create an email object and populate it:
-
-```csharp
-// Create the email object first, then add the properties.
-var myMessage = new SendGridMessage();
-
-// Add the message properties.
-myMessage.From = new MailAddress("john@example.com");
-
-// Add multiple addresses to the To field.
-List<String> recipients = new List<String>
-{
- @"Jeff Smith <jeff@example.com>",
- @"Anna Lidman <anna@example.com>",
- @"Peter Saddow <peter@example.com>"
-};
-
-myMessage.AddTo(recipients);
-
-myMessage.Subject = "Testing the SendGrid Library";
-
-//Add the HTML and Text bodies
-myMessage.Html = "<p>Hello World!</p>";
-myMessage.Text = "Hello World plain text!";
-```
-
-#How to: Send an Email
-
-After creating an email message, you can send it using the Web API provided by SendGrid.
-
-Sending email requires that you supply your SendGrid account credentials (username and password) OR a SendGrid API Key. API Key is the preferred method. API Keys are in beta. To configure API keys, visit https://sendgrid.com/beta/settings/api_keys
-
-To send an email message, use the **DeliverAsync** method on the **Web** transport class, which calls the SendGrid Web API. The following example shows how to send a message.
-
-```csharp
-// Create the email object first, then add the properties.
-SendGridMessage myMessage = new SendGridMessage();
-myMessage.AddTo("anna@example.com");
-myMessage.From = new MailAddress("john@example.com", "John Smith");
-myMessage.Subject = "Testing the SendGrid Library";
-myMessage.Text = "Hello World!";
-
-// Create a Web transport, using API Key
-var transportWeb = new Web("This string is a SendGrid API key");
-
-// Send the email.
-transportWeb.DeliverAsync(myMessage);
-// NOTE: If your developing a Console Application, use the following so that the API call has time to complete
-// transportWeb.DeliverAsync(myMessage).Wait();
-```
-
-#How to: Add an Attachment
+## Dependencies
-Attachments can be added to a message by calling the **AddAttachment** method and specifying the name and path of the file you want to attach, or by passing a stream. You can include multiple attachments by calling this method once for each file you wish to attach. The following example demonstrates adding an attachment to a message:
+- The SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-csharp))
+- [SendGrid.CSharp.HTTP.Client](https://github.com/sendgrid/csharp-http-client)
-```csharp
-SendGridMessage myMessage = new SendGridMessage();
-myMessage.AddTo("anna@example.com");
-myMessage.From = new MailAddress("john@example.com", "John Smith");
-myMessage.Subject = "Testing the SendGrid Library";
-myMessage.Text = "Hello World!";
+# Quick Start
-myMessage.AddAttachment(@"C:\file1.txt");
-```
-
-You can also add attachments from the data's **Stream**. It can be done by calling the same method as above, **AddAttachment**, but by passing in the Stream of the data, and the filename you want it to show as in the message.
+## Hello Email
```csharp
-SendGridMessage myMessage = new SendGridMessage();
-myMessage.AddTo("anna@example.com");
-myMessage.From = new MailAddress("john@example.com", "John Smith");
-myMessage.Subject = "Testing the SendGrid Library";
-myMessage.Text = "Hello World!";
+using System;
+using SendGrid;
-using (var attachmentFileStream = new FileStream(@"C:\file.txt", FileMode.Open))
+namespace Example
{
- message.AddAttachment(attachmentFileStream, "My Cool File.txt");
+ internal class Example
+ {
+ private static void Main()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey);
+
+ Email from = new Email("test@example.com");
+ String subject = "Hello World from the SendGrid CSharp Library";
+ Email to = new Email("test@example.com");
+ Content content = new Content("text/plain", "Textual content");
+ Mail mail = new Mail(from, subject, to, content);
+
+ dynamic response = sg.client.mail.send.post(requestBody: mail.Get());
+ }
+ }
}
```
-#How to: Use filters to enable footers, tracking, analytics and templates
-
-SendGrid provides additional email functionality through the use of filters. These are settings that can be added to an email message to enable specific functionality such as click tracking, Google analytics, subscription tracking, and so on. For a full list of filters, see [Filter Settings](https://sendgrid.com/docs/API_Reference/SMTP_API/apps.html).
-
-Filters can be applied to **SendGrid** email messages using methods implemented as part of the **SendGrid** class. Before you can enable filters on an email message, you must first initialize the list of available filters by calling the **InitializeFilters** method.
-
-The following examples demonstrate the footer and click tracking filters:
-
-##Footer
-```csharp
-// Create the email object first, then add the properties.
-SendGridMessage myMessage = new SendGridMessage();
-myMessage.AddTo("anna@example.com");
-myMessage.From = new MailAddress("john@example.com", "John Smith");
-myMessage.Subject = "Testing the SendGrid Library";
-myMessage.Text = "Hello World!";
-
-// Add a footer to the message.
-myMessage.EnableFooter("PLAIN TEXT FOOTER", "<p><em>HTML FOOTER</em></p>");
-```
-
-##Click tracking
-```csharp
-// Create the email object first, then add the properties.
-SendGridMessage myMessage = new SendGridMessage();
-myMessage.AddTo("anna@example.com");
-myMessage.From = new MailAddress("john@example.com", "John Smith");
-myMessage.Subject = "Testing the SendGrid Library";
-myMessage.Html = "<p><a href=\"http://www.example.com\">Hello World Link!</a></p>";
-myMessage.Text = "Hello World!";
-
-// true indicates that links in plain text portions of the email
-// should also be overwritten for link tracking purposes.
-myMessage.EnableClickTracking(true);
-```
-
-##Template
-```csharp
-// Create the email object first, then add the properties.
-SendGridMessage myMessage = new SendGridMessage();
-myMessage.AddTo("anna@example.com");
-myMessage.From = new MailAddress("john@example.com", "John Smith");
-myMessage.Subject = "Testing the SendGrid Library";
-myMessage.Text = "Hello World!";
-
-// Enable template engine, you must send the template id
- myMessage.EnableTemplateEngine("template id");
-```
-
-#How to: Use the [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html)
-
-Note: We have just begun to implement support for these endpoints and therefore only the following endpoints are currently supported. This functionality is located in the "SendGrid" project.
-
-## API Keys ##
-
-Please refer to [our documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/index.html) for further details.
-
-List all API Keys belonging to the authenticated user [GET]
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responseGet = client.ApiKeys.Get().Result;
-```
-
-Generate a new API Key for the authenticated user [POST]
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-var apiKeyName = "CSharpTestKey";
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responsePost = client.ApiKeys.Post(apiKeyName).Result;
-```
-
-Update the name of an existing API Key [PATCH]
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-var apiKeyName = "CSharpTestKey";
-var apiKeyId = "<API Key ID>";
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responsePatch = client.ApiKeys.Patch(apiKeyId, apiKeyName).Result;
-```
-
-Revoke an existing API Key [DELETE]
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-var apiKeyId = "<API Key ID>";
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responseDelete = client.ApiKeys.Delete(apiKeyId).Result;
-```
-
-## Unsubscribe Groups ##
-
-Please refer to [our documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html) for further details.
-
-Retrieve all suppression groups associated with the user. [GET]
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responseGet = client.ApiKeys.Get().Result;
-```
-
-Get information on a single suppression group. [GET]
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responseGet = client.UnsubscribeGroups.Get().Result;
-```
-
-Create a new suppression group. [POST]
-
-There is a limit of 25 groups per user.
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-var unsubscribeGroupName = "CSharpTestUnsubscribeGroup";
-var unsubscribeGroupDescription = "CSharp test Unsubscribe Group description.";
-var unsubscribeGroupIsDefault = false;
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responsePost = client.UnsubscribeGroups.Post(unsubscribeGroupName, unsubscribeGroupDescription, unsubscribeGroupIsDefault ).Result;
-```
-
-Delete a suppression group. [DELETE]
-
-You can only delete groups that have not been attached to sent mail in the last 60 days. If a recipient uses the “one-click unsubscribe” option on an email associated with a deleted group, that recipient will be added to the global suppression list.
+## General v3 Web API Usage
```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-var unsubscribeGroupId = "<UNSUBSCRIBE GROUP ID>";
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responseDelete = client.UnsubscribeGroups.Delete(unsubscribeGroupId).Result;
-```
-
-## Suppressions ##
-
-Please refer to [our documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/suppressions.html) for further details.
-
-Get suppressed addresses for a given group. [GET]
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-// Leave off .Result for an asyncronous call
-int groupId = <Group ID>;
-HttpResponseMessage responseGet = client.Suppressions.Get(groupId).Result;
-```
-
-Add recipient addresses to the suppressions list for a given group. [POST]
-
-If the group has been deleted, this request will add the address to the global suppression.
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-string[] emails = { "example@example.com", "example2@example.com" };
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responsePost = client.Suppressions.Post(groupID, emails).Result;
-```
-
-Delete a recipient email from the suppressions list for a group. [DELETE]
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-var groupId = "<UNSUBSCRIBE GROUP ID>";
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responseDelete1 = client.Suppressions.Delete(groupId, "example@example.com").Result;
-```
-
-## Global Suppressions ##
-
-Please refer to [our documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/global_suppressions.html) for further details.
-
-Check if a recipient address is in the global suppressions group. [GET]
+using System;
+using SendGrid;
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-// Leave off .Result for an asyncronous call
-string email = "example@example.com";
-HttpResponseMessage responseGet = client.GlobalSuppressions.Get(email).Result;
+namespace Example
+{
+ internal class Example
+ {
+ private static void Main()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey);
+ dynamic response = sg.client.api_keys.get(queryParams: queryParams);
+ }
+ }
+}
```
-Add recipient addresses to the global suppression group. [POST]
+# Usage
-If the group has been deleted, this request will add the address to the global suppression.
+- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html)
+- [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)
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-string[] emails = { "example@example.com", "example2@example.com" };
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responsePost = client.GlobalSuppressions.Post(emails).Result;
-```
+## Roadmap
-Delete a recipient email from the global suppressions group. [DELETE]
+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.
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-string email = "example@example.com";
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responseDelete1 = client.GlobalSuppressions.Delete(email).Result;
-```
-
-## Global Stats ##
+## How to Contribute
-Please refer to [our documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Stats/global.html) for further details.
+We encourage contribution to our library, please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md) guide for details.
-Global Stats provide all of your user’s email statistics for a given date range. [GET]
-
-```csharp
-String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
-var client = new SendGrid.Client(apiKey);
-var startDate = "2015-11-01"; // required
-var endDate = "2015-12-01";
-var aggregatedBy = "day"; // "week" or "month" are also options
-// Leave off .Result for an asyncronous call
-HttpResponseMessage responseGet = client.GlobalStats.Get(startDate, endDate, aggregatedBy).Result;
-```
+Quick links:
-#How to: Testing
+- [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)
-* Load the solution (We have tested using the Visual Studio Community Edition)
-* In the Test Explorer, click "Run All". Tests for the Mail Send v2 endpoint are in the "Tests" project, while the tests for the v3 endpoints are in the "UnitTests" project. Selecting "Run All" from the Test Explorer will run the tests in both projects.
+# About
-You can also test the code by building and running our "Example" project. It will run through the examples using an interactive console. You will need your API key to run the examples against your account.
+sendgrid-csharp is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
-[SendGrid Documentation](http://www.sendgrid.com/docs)
+sendgrid-csharp is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-csharp are trademarks of SendGrid, Inc.
-This readme adapted from [How to Send Email Using SendGrid with Windows Azure](http://www.windowsazure.com/en-us/develop/net/how-to-guides/sendgrid-email-service/)
+![SendGrid Logo]
+(https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)
diff --git a/SendGrid/Example/Example.cs b/SendGrid/Example/Example.cs
new file mode 100644
index 0000000..5155e9d
--- /dev/null
+++ b/SendGrid/Example/Example.cs
@@ -0,0 +1,329 @@
+using System;
+using System.Collections.Generic;
+using System.Web.Script.Serialization;
+using SendGrid.Helpers.Mail;
+
+namespace Example
+{
+ internal class Example
+ {
+ private static void Main()
+ {
+ // v3 Mail Helper
+ HelloEmail(); // this will actually send an email
+ KitchenSink(); // this will only send an email if you set SandBox Mode to false
+
+ // v3 Web API
+ ApiKeys();
+
+ }
+
+ private static void HelloEmail()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+
+ Email from = new Email("test@example.com");
+ String subject = "Hello World from the SendGrid CSharp Library";
+ Email to = new Email("test@example.com");
+ Content content = new Content("text/plain", "Textual content");
+ Mail mail = new Mail(from, subject, to, content);
+ Email email = new Email("test2@example.com");
+ mail.Personalization[0].AddTo(email);
+
+ String ret = mail.Get();
+
+ string requestBody = ret;
+ dynamic response = sg.client.mail.send.beta.post(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.WriteLine(ret);
+ Console.ReadLine();
+
+ }
+
+ private static void KitchenSink()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+
+ Mail mail = new Mail();
+
+ Email email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ mail.From = email;
+
+ mail.Subject = "Hello World from the SendGrid CSharp Library";
+
+ Personalization personalization = new Personalization();
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test1@example.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test2@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test3@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test4@example.com";
+ personalization.AddBcc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test5@example.com";
+ personalization.AddBcc(email);
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Example User");
+ personalization.AddSubstitution("%city%", "Denver");
+ personalization.AddCustomArgs("marketing", "false");
+ personalization.AddCustomArgs("transactional", "true");
+ personalization.SendAt = 1461775051;
+ mail.AddPersonalization(personalization);
+
+ personalization = new Personalization();
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test1@example.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test2@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test3@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test4@example.com";
+ personalization.AddBcc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test5@example.com";
+ personalization.AddBcc(email);
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Example User");
+ personalization.AddSubstitution("%city%", "Denver");
+ personalization.AddCustomArgs("marketing", "false");
+ personalization.AddCustomArgs("transactional", "true");
+ personalization.SendAt = 1461775051;
+ mail.AddPersonalization(personalization);
+
+ Content content = new Content();
+ content.Type = "text/plain";
+ content.Value = "Textual content";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/html";
+ content.Value = "<html><body>HTML content</body></html>";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/calendar";
+ content.Value = "Party Time!!";
+ mail.AddContent(content);
+
+ Attachment attachment = new Attachment();
+ attachment.Content = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12";
+ attachment.Type = "application/pdf";
+ attachment.Filename = "balance_001.pdf";
+ attachment.Disposition = "attachment";
+ attachment.ContentId = "Balance Sheet";
+ mail.AddAttachment(attachment);
+
+ attachment = new Attachment();
+ attachment.Content = "BwdW";
+ attachment.Type = "image/png";
+ attachment.Filename = "banner.png";
+ attachment.Disposition = "inline";
+ attachment.ContentId = "Banner";
+ mail.AddAttachment(attachment);
+
+ mail.TemplateId = "13b8f94f-bcae-4ec6-b752-70d6cb59f932";
+
+ mail.AddHeader("X-Day", "Monday");
+ mail.AddHeader("X-Month", "January");
+
+ mail.AddSection("%section1", "Substitution for Section 1 Tag");
+ mail.AddSection("%section2", "Substitution for Section 2 Tag");
+
+ mail.AddCategory("customer");
+ mail.AddCategory("vip");
+
+ mail.AddCustomArgs("campaign", "welcome");
+ mail.AddCustomArgs("sequence", "2");
+
+ ASM asm = new ASM();
+ asm.GroupId = 3;
+ List<int> groups_to_display = new List<int>()
+ {
+ 1, 4, 5
+ };
+ asm.GroupsToDisplay = groups_to_display;
+ mail.Asm = asm;
+
+ mail.SendAt = 1461775051;
+
+ mail.SetIpPoolId = "23";
+
+ // This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)
+ // mail.BatchId = "some_batch_id";
+
+ MailSettings mailSettings = new MailSettings();
+ BCCSettings bccSettings = new BCCSettings();
+ bccSettings.Enable = true;
+ bccSettings.Email = "test@example.com";
+ mailSettings.BccSettings = bccSettings;
+ BypassListManagement bypassListManagement = new BypassListManagement();
+ bypassListManagement.Enable = true;
+ mailSettings.BypassListManagement = bypassListManagement;
+ FooterSettings footerSettings = new FooterSettings();
+ footerSettings.Enable = true;
+ footerSettings.Text = "Some Footer Text";
+ footerSettings.Html = "<bold>Some HTML Here</bold>";
+ mailSettings.FooterSettings = footerSettings;
+ SandboxMode sandboxMode = new SandboxMode();
+ sandboxMode.Enable = true;
+ mailSettings.SandboxMode = sandboxMode;
+ SpamCheck spamCheck = new SpamCheck();
+ spamCheck.Enable = true;
+ spamCheck.Threshold = 1;
+ spamCheck.PostToUrl = "https://gotchya.example.com";
+ mailSettings.SpamCheck = spamCheck;
+ mail.MailSettings = mailSettings;
+
+ TrackingSettings trackingSettings = new TrackingSettings();
+ ClickTracking clickTracking = new ClickTracking();
+ clickTracking.Enable = true;
+ clickTracking.EnableText = false;
+ trackingSettings.ClickTracking = clickTracking;
+ OpenTracking openTracking = new OpenTracking();
+ openTracking.Enable = true;
+ openTracking.SubstitutionTag = "Optional tag to replace with the open image in the body of the message";
+ trackingSettings.OpenTracking = openTracking;
+ SubscriptionTracking subscriptionTracking = new SubscriptionTracking();
+ subscriptionTracking.Enable = true;
+ subscriptionTracking.Text = "text to insert into the text/plain portion of the message";
+ subscriptionTracking.Html = "<bold>HTML to insert into the text/html portion of the message</bold>";
+ subscriptionTracking.SubstitutionTag = "text to insert into the text/plain portion of the message";
+ trackingSettings.SubscriptionTracking = subscriptionTracking;
+ Ganalytics ganalytics = new Ganalytics();
+ ganalytics.Enable = true;
+ ganalytics.UtmCampaign = "some campaign";
+ ganalytics.UtmContent = "some content";
+ ganalytics.UtmMedium = "some medium";
+ ganalytics.UtmSource = "some source";
+ ganalytics.UtmTerm = "some term";
+ trackingSettings.Ganalytics = ganalytics;
+ mail.TrackingSettings = trackingSettings;
+
+ email = new Email();
+ email.Address = "test@example.com";
+ mail.ReplyTo = email;
+
+ String ret = mail.Get();
+
+ string requestBody = ret;
+ dynamic response = sg.client.mail.send.beta.post(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.WriteLine(ret);
+ Console.ReadLine();
+ }
+
+ private static void ApiKeys()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+
+ string queryParams = @"{
+ 'limit': 100
+ }";
+ dynamic response = sg.client.api_keys.get(queryParams: queryParams);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to POST.");
+ Console.ReadLine();
+
+ // POST
+ string requestBody = @"{
+ 'name': 'My API Key 5',
+ 'scopes': [
+ 'mail.send',
+ 'alerts.create',
+ 'alerts.read'
+ ]
+ }";
+ response = sg.client.api_keys.post(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+ JavaScriptSerializer jss = new JavaScriptSerializer();
+ var ds_response = jss.Deserialize<Dictionary<string, dynamic>>(response.Body.ReadAsStringAsync().Result);
+ string api_key_id = ds_response["api_key_id"];
+
+ Console.WriteLine("\n\nPress any key to continue to GET single.");
+ Console.ReadLine();
+
+ // GET Single
+ response = sg.client.api_keys._(api_key_id).get();
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to PATCH.");
+ Console.ReadLine();
+
+ // PATCH
+ requestBody = @"{
+ 'name': 'A New Hope'
+ }";
+ response = sg.client.api_keys._(api_key_id).patch(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to PUT.");
+ Console.ReadLine();
+
+ // PUT
+ requestBody = @"{
+ 'name': 'A New Hope',
+ 'scopes': [
+ ' user.profile.read',
+ ' user.profile.update'
+ ]
+ }";
+ response = sg.client.api_keys._(api_key_id).put(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to DELETE.");
+ Console.ReadLine();
+
+ // DELETE
+ response = sg.client.api_keys._(api_key_id).delete();
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.WriteLine("\n\nPress any key to exit.");
+ Console.ReadLine();
+
+ }
+ }
+}
diff --git a/SendGrid/Example/Example.csproj b/SendGrid/Example/Example.csproj
index 786d6fb..98044fa 100644
--- a/SendGrid/Example/Example.csproj
+++ b/SendGrid/Example/Example.csproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition="'$(Platform)' == '' ">x86</Platform>
@@ -8,7 +8,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Example</RootNamespace>
<AssemblyName>Example</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -46,8 +46,12 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="SendGrid.CSharp.HTTP.Client, Version=2.0.0.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
+ <HintPath>..\packages\SendGrid.CSharp.HTTP.Client.2.0.1\lib\SendGrid.CSharp.HTTP.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SendGrid.SmtpApi, Version=1.3.1.0, Culture=neutral, PublicKeyToken=2ae73662c35d80e4, processorArchitecture=MSIL">
@@ -61,9 +65,8 @@
<Reference Include="System.Web.Extensions" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Program.cs" />
+ <Compile Include="Example.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="WebApi.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config">
@@ -75,10 +78,6 @@
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\SendGridMail\Mail.csproj">
- <Project>{3c687bef-ff50-44ad-8315-2d4237281af8}</Project>
- <Name>Mail</Name>
- </ProjectReference>
<ProjectReference Include="..\SendGrid\SendGrid.csproj">
<Project>{1c318867-440b-4eb9-99e3-c0cc2c556962}</Project>
<Name>SendGrid</Name>
@@ -87,7 +86,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
diff --git a/SendGrid/Example/Program.cs b/SendGrid/Example/Program.cs
deleted file mode 100644
index 447bd04..0000000
--- a/SendGrid/Example/Program.cs
+++ /dev/null
@@ -1,263 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Net.Mail;
-using Newtonsoft.Json.Linq;
-
-namespace Example
-{
- internal class Program
- {
- private static void Main()
- {
- // Test sending email
- var to = "example@example.com";
- var from = "example@example.com";
- var fromName = "Jane Doe";
- SendEmail(to, from, fromName);
- // Test viewing, creating, modifying and deleting API keys through our v3 Web API
- ApiKeys();
- UnsubscribeGroups();
- Suppressions();
- GlobalSuppressions();
- GlobalStats();
- }
-
- private static void SendAsync(SendGrid.SendGridMessage message)
- {
- string apikey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
- // Create a Web transport for sending email.
- var transportWeb = new SendGrid.Web(apikey);
-
- // Send the email.
- try
- {
- transportWeb.DeliverAsync(message).Wait();
- Console.WriteLine("Email sent to " + message.To.GetValue(0));
- Console.WriteLine("\n\nPress any key to continue.");
- Console.ReadKey();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- Console.WriteLine("\n\nPress any key to continue.");
- Console.ReadKey();
- }
- }
-
- private static void SendEmail(string to, string from, string fromName)
- {
- // Create the email object first, then add the properties.
- var myMessage = new SendGrid.SendGridMessage();
- myMessage.AddTo(to);
- myMessage.From = new MailAddress(from, fromName);
- myMessage.Subject = "Testing the SendGrid Library";
- myMessage.Text = "Hello World! %tag%";
-
- var subs = new List<String> { "私は%type%ラーメンが大好き" };
- myMessage.AddSubstitution("%tag%", subs);
- myMessage.AddSection("%type%", "とんこつ");
-
- SendAsync(myMessage);
- }
-
- private static void ApiKeys()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // GET API KEYS
- HttpResponseMessage responseGet = client.ApiKeys.Get().Result;
- Console.WriteLine(responseGet.StatusCode);
- Console.WriteLine(responseGet.Content.ReadAsStringAsync().Result);
- Console.WriteLine("These are your current API Keys.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // POST API KEYS
- HttpResponseMessage responsePost = client.ApiKeys.Post("CSharpTestKey").Result;
- var rawString = responsePost.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- var apiKeyId = jsonObject.api_key_id.ToString();
- Console.WriteLine(responsePost.StatusCode);
- Console.WriteLine(responsePost.Content.ReadAsStringAsync().Result);
- Console.WriteLine("API Key created.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // PATCH API KEYS
- HttpResponseMessage responsePatch = client.ApiKeys.Patch(apiKeyId, "CSharpTestKeyPatched").Result;
- Console.WriteLine(responsePatch.StatusCode);
- Console.WriteLine(responsePatch.Content.ReadAsStringAsync().Result);
- Console.WriteLine("API Key patched.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // DELETE API KEYS
- Console.WriteLine("Deleting API Key, please wait.");
- HttpResponseMessage responseDelete = client.ApiKeys.Delete(apiKeyId).Result;
- Console.WriteLine(responseDelete.StatusCode);
- HttpResponseMessage responseFinal = client.ApiKeys.Get().Result;
- Console.WriteLine(responseFinal.StatusCode);
- Console.WriteLine(responseFinal.Content.ReadAsStringAsync().Result);
- Console.WriteLine("API Key Deleted.\n\nPress any key to end.");
- Console.ReadKey();
- }
-
- private static void UnsubscribeGroups()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // GET UNSUBSCRIBE GROUPS
- HttpResponseMessage responseGet = client.UnsubscribeGroups.Get().Result;
- Console.WriteLine(responseGet.StatusCode);
- Console.WriteLine(responseGet.Content.ReadAsStringAsync().Result);
- Console.WriteLine("These are your current Unsubscribe Groups. Press any key to continue.");
- Console.ReadKey();
-
- // GET A PARTICULAR UNSUBSCRIBE GROUP
- int unsubscribeGroupID = 69;
- HttpResponseMessage responseGetUnique = client.UnsubscribeGroups.Get(unsubscribeGroupID).Result;
- Console.WriteLine(responseGetUnique.StatusCode);
- Console.WriteLine(responseGetUnique.Content.ReadAsStringAsync().Result);
- Console.WriteLine("This is an Unsubscribe Group with ID: " + unsubscribeGroupID.ToString() + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- // POST UNSUBSCRIBE GROUP
- HttpResponseMessage responsePost = client.UnsubscribeGroups.Post("C Sharp Unsubscribes", "Testing the C Sharp Library", false).Result;
- var rawString = responsePost.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- var unsubscribeGroupId = jsonObject.id.ToString();
- Console.WriteLine(responsePost.StatusCode);
- Console.WriteLine(responsePost.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Unsubscribe Group created.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // DELETE UNSUBSCRIBE GROUP
- Console.WriteLine("Deleting Unsubscribe Group, please wait.");
- HttpResponseMessage responseDelete = client.UnsubscribeGroups.Delete(unsubscribeGroupId).Result;
- Console.WriteLine(responseDelete.StatusCode);
- HttpResponseMessage responseFinal = client.UnsubscribeGroups.Get().Result;
- Console.WriteLine(responseFinal.StatusCode);
- Console.WriteLine(responseFinal.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Unsubscribe Group Deleted.\n\nPress any key to end.");
- Console.ReadKey();
- }
-
- private static void Suppressions()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // GET SUPPRESSED ADDRESSES FOR A GIVEN GROUP
- int groupID = 69;
- HttpResponseMessage responseGetUnique = client.Suppressions.Get(groupID).Result;
- Console.WriteLine(responseGetUnique.StatusCode);
- Console.WriteLine(responseGetUnique.Content.ReadAsStringAsync().Result);
- Console.WriteLine("These are the suppressed emails with group ID: " + groupID.ToString() + ". Press any key to continue.");
- Console.ReadKey();
-
- // ADD EMAILS TO A SUPPRESSION GROUP
- string[] emails = { "example@example.com", "example2@example.com" };
- HttpResponseMessage responsePost = client.Suppressions.Post(groupID, emails).Result;
- var rawString = responsePost.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- Console.WriteLine(responsePost.StatusCode);
- Console.WriteLine(responsePost.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Emails added to Suppression Group:" + groupID.ToString() + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- // DELETE EMAILS FROM A SUPPRESSION GROUP
- Console.WriteLine("Deleting emails from Suppression Group, please wait.");
- HttpResponseMessage responseDelete1 = client.Suppressions.Delete(groupID, "example@example.com").Result;
- Console.WriteLine(responseDelete1.StatusCode);
- HttpResponseMessage responseDelete2 = client.Suppressions.Delete(groupID, "example2@example.com").Result;
- Console.WriteLine(responseDelete2.StatusCode);
- HttpResponseMessage responseFinal = client.Suppressions.Get(groupID).Result;
- Console.WriteLine(responseFinal.StatusCode);
- Console.WriteLine(responseFinal.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Emails removed from Suppression Group" + groupID.ToString() + "Deleted.\n\nPress any key to end.");
- Console.ReadKey();
- }
-
- private static void GlobalSuppressions()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // CHECK IF EMAIL IS ON THE GLOBAL SUPPRESSION LIST
- var email = "elmer.thomas+test_global@gmail.com";
- HttpResponseMessage responseGetUnique = client.GlobalSuppressions.Get(email).Result;
- Console.WriteLine(responseGetUnique.StatusCode);
- Console.WriteLine(responseGetUnique.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Determines if the given email is listed on the Global Suppressions list. Press any key to continue.");
- Console.ReadKey();
-
- // ADD EMAILS TO THE GLOBAL SUPPRESSION LIST
- string[] emails = { "example@example.com", "example2@example.com" };
- HttpResponseMessage responsePost = client.GlobalSuppressions.Post(emails).Result;
- var rawString = responsePost.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- Console.WriteLine(responsePost.StatusCode);
- Console.WriteLine(responsePost.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Emails added to Global Suppression Group.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // DELETE EMAILS FROM THE GLOBAL SUPPRESSION GROUP
- Console.WriteLine("Deleting emails from Global Suppression Group, please wait.");
- HttpResponseMessage responseDelete1 = client.GlobalSuppressions.Delete("example@example.com").Result;
- Console.WriteLine(responseDelete1.StatusCode);
- HttpResponseMessage responseDelete2 = client.GlobalSuppressions.Delete("example2@example.com").Result;
- Console.WriteLine(responseDelete2.StatusCode);
- HttpResponseMessage responseFinal = client.GlobalSuppressions.Get("example@example.com").Result;
- Console.WriteLine(responseFinal.StatusCode);
- Console.WriteLine(responseFinal.Content.ReadAsStringAsync().Result);
- HttpResponseMessage responseFinal2 = client.GlobalSuppressions.Get("example2@example.com").Result;
- Console.WriteLine(responseFinal2.StatusCode);
- Console.WriteLine(responseFinal2.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Emails removed from Global Suppression Group.\n\nPress any key to end.");
- Console.ReadKey();
- }
-
- private static void GlobalStats()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // Global Stats provide all of your user’s email statistics for a given date range.
- var startDate = "2015-11-01";
- HttpResponseMessage response = client.GlobalStats.Get(startDate).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and no end date.\n\nPress any key to continue.");
- Console.ReadKey();
-
- var endDate = "2015-12-01";
- response = client.GlobalStats.Get(startDate, endDate).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and end date " + endDate + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- var aggregatedBy = "day";
- response = client.GlobalStats.Get(startDate, endDate, aggregatedBy).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and end date " + endDate + " and aggregated by " + aggregatedBy + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- aggregatedBy = "week";
- response = client.GlobalStats.Get(startDate, endDate, aggregatedBy).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and end date " + endDate + " and aggregated by " + aggregatedBy + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- aggregatedBy = "month";
- response = client.GlobalStats.Get(startDate, endDate, aggregatedBy).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and end date " + endDate + " and aggregated by " + aggregatedBy + ".\n\nPress any key to continue.");
- Console.ReadKey();
- }
-
- }
-}
diff --git a/SendGrid/Example/Properties/AssemblyInfo.cs b/SendGrid/Example/Properties/AssemblyInfo.cs
index 87d5e71..8c0cc2a 100644
--- a/SendGrid/Example/Properties/AssemblyInfo.cs
+++ b/SendGrid/Example/Properties/AssemblyInfo.cs
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -27,13 +27,13 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.0")]
-[assembly: AssemblyFileVersion("1.2.0")] \ No newline at end of file
+[assembly: AssemblyVersion("7.0.0")]
+[assembly: AssemblyFileVersion("7.0.0")] \ No newline at end of file
diff --git a/SendGrid/Example/WEBAPI.cs b/SendGrid/Example/WEBAPI.cs
deleted file mode 100644
index 1238df0..0000000
--- a/SendGrid/Example/WEBAPI.cs
+++ /dev/null
@@ -1,544 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Net.Mail;
-using SendGrid;
-
-namespace Example
-{
- internal class Webapi
- {
- private readonly String _from;
- private readonly String _password;
- private readonly IEnumerable<String> _to;
- private readonly String _username;
-
- public Webapi(String username, String password, String from, IEnumerable<String> recipients)
- {
- _username = username;
- _password = password;
- _from = from;
- _to = recipients;
- }
-
- /// <summary>
- /// Send a simple HTML based email
- /// </summary>
- public void SimpleHTMLEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Html = "<html><p>Hello</p><p>World</p></html>";
-
- //set the message subject
- message.Subject = "Hello World HTML Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Send a simple Plain Text email
- /// </summary>
- public void SimplePlaintextEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Text = "Hello World Plain Text";
-
- //set the message subject
- message.Subject = "Hello World Plain Text Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Enable The Gravatar Filter.
- /// Currently the filter generates a 1x1 pixel gravatar image.
- /// http://docs.sendgrid.com/documentation/apps/gravatar/
- /// </summary>
- public void EnableGravatarEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Html = "<p style='color:red';>Hello World Gravatar Email</p>";
-
- //set the message subject
- message.Subject = "Hello World Gravatar Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable gravatar
- message.EnableGravatar();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Enable the Open Tracking to track when emails are opened.
- /// http://docs.sendgrid.com/documentation/apps/open-tracking/
- /// </summary>
- public void EnableOpenTrackingEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Html = "<p style='color:red';>Hello World Plain Text</p>";
-
- //set the message subject
- message.Subject = "Hello World Open Tracking Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable gravatar
- message.EnableOpenTracking();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Point the urls to Sendgrid Servers so that the clicks can be logged before
- /// being directed to the appropriate link
- /// http://docs.sendgrid.com/documentation/apps/click-tracking/
- /// </summary>
- public void EnableClickTrackingEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World HTML </p> <a href='http://microsoft.com'>Checkout Microsoft!!</a>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- message.Text = "hello world http://microsoft.com";
-
- //set the message subject
- message.Subject = "Hello World Click Tracking Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable clicktracking
- message.EnableClickTracking();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// The Spam Checker filter, is useful when your web application allows your end users
- /// to create content that is then emailed through your SendGridMessage account.
- /// http://docs.sendgrid.com/documentation/apps/spam-checker-filter/
- /// </summary>
- public void EnableSpamCheckEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>VIAGRA!!!!!! Viagra!!! CHECKOUT THIS VIAGRA!!!! MALE ENHANCEMENT!!! </p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- //set the message subject
- message.Subject = "WIN A MILLION DOLLARS TODAY! WORK FROM HOME! A NIGERIAN PRINCE WANTS YOU!";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable spamcheck
- message.EnableSpamCheck();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Add automatic unsubscribe links to the bottom of emails.
- /// http://docs.sendgrid.com/documentation/apps/subscription-tracking/
- /// </summary>
- public void EnableUnsubscribeEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Html = "This is the HTML body";
-
- message.Text = "This is the plain text body";
-
- //set the message subject
- message.Subject = "Hello World Unsubscribe Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable spamcheck
- //or optionally, you can specify 'replace' instead of the text and html in order to
- //place the link wherever you want.
- message.EnableUnsubscribe("Please click the following link to unsubscribe: <% %>",
- "Please click <% here %> to unsubscribe");
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// The Footer App will insert a custom footer at the bottom of the text and HTML bodies.
- /// http://docs.sendgrid.com/documentation/apps/footer/
- /// </summary>
- public void EnableFooterEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World</p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- message.Text = "Hello World plain text";
-
- //set the message subject
- message.Subject = "Hello World Footer Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //Enable Footer
- message.EnableFooter("PLAIN TEXT FOOTER", "<p color='blue'>HTML FOOTER TEXT</p>");
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// The Footer App will insert a custom footer at the bottom of the text and HTML bodies.
- /// http://docs.sendgrid.com/documentation/apps/google-analytics/
- /// </summary>
- public void EnableGoogleAnalytics()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World</p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
- message.Html += "Checkout my page at <a href=\"http://microsoft.com\">Microsoft</a>";
-
- message.Text = "Hello World plain text";
-
- //set the message subject
- message.Subject = "Hello World Footer Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable Google Analytics
- message.EnableGoogleAnalytics("SendGridTest", "EMAIL", "Sendgrid", "ad-one", "My SG Campaign");
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// This feature wraps an HTML template around your email content.
- /// This can be useful for sending out newsletters and/or other HTML formatted messages.
- /// http://docs.sendgrid.com/documentation/apps/email-templates/
- /// </summary>
- public void EnableTemplateEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World</p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- message.Text = "Hello World plain text";
-
- //set the message subject
- message.Subject = "Hello World Template Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable template
- message.EnableTemplate("<p>My Email Template <% body %> is awesome!</p>");
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// This feature wraps an HTML template around your email content.
- /// This can be useful for sending out newsletters and/or other HTML formatted messages.
- /// hhttp://docs.sendgrid.com/documentation/apps/email-templates/
- /// </summary>
- public void EnableBypassListManagementEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World</p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- message.Text = "Hello World plain text";
-
- //set the message subject
- message.Subject = "Hello World Bypass List Management Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable bypass list management
- message.EnableBypassListManagement();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
-
- /// <summary>
- /// This feature allows you to create a message template, and specify different replacement
- /// strings for each specific recipient
- /// </summary>
- public void AddSubstitutionValues()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Text = "Hi %name%! Pleased to meet you!";
-
- //set the message subject
- message.Subject = "Testing Substitution Values";
-
- //This replacement key must exist in the message body
- var replacementKey = "%name%";
-
- //There should be one value for each recipient in the To list
- var substitutionValues = new List<String> {"Mr Foo", "Mrs Raz"};
-
- message.AddSubstitution(replacementKey, substitutionValues);
-
- //create an instance of the SMTP transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable bypass list management
- message.EnableBypassListManagement();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// This feature adds key value identifiers to be sent back as arguments over the event api for
- /// various events
- /// </summary>
- public void AddUniqueIdentifiers()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Text = "Hello World";
-
- //set the message subject
- message.Subject = "Testing Unique Identifiers";
-
- var identifiers = new Dictionary<String, String>();
- identifiers["customer"] = "someone";
- identifiers["location"] = "somewhere";
-
- message.AddUniqueArgs(identifiers);
-
- //create an instance of the SMTP transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable bypass list management
- message.EnableBypassListManagement();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// This feature tags the message with a specific tracking category, which will have aggregated stats
- /// viewable from your SendGridMessage account page.
- /// </summary>
- public void SetCategory()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Text = "Hello World";
-
- //set the message subject
- message.Subject = "Testing Categories";
-
- var category = "vipCustomers";
-
- message.SetCategory(category);
-
- //create an instance of the SMTP transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable bypass list management
- message.EnableBypassListManagement();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/Example/app.config b/SendGrid/Example/app.config
index ea6ea7f..8382638 100644
--- a/SendGrid/Example/app.config
+++ b/SendGrid/Example/app.config
@@ -1,25 +1,25 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
- <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
- <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0"/>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
- <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
- <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0"/>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
- <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
- <bindingRedirect oldVersion="0.0.0.0-2.2.18.0" newVersion="2.2.18.0"/>
+ <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-2.2.18.0" newVersion="2.2.18.0" />
</dependentAssembly>
<dependentAssembly>
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
- <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0"/>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
diff --git a/SendGrid/Example/packages.config b/SendGrid/Example/packages.config
index 8aa9f7b..a0de518 100644
--- a/SendGrid/Example/packages.config
+++ b/SendGrid/Example/packages.config
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
+ <package id="SendGrid.CSharp.HTTP.Client" version="2.0.1" targetFramework="net452" />
<package id="SendGrid.SmtpApi" version="1.3.1" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/SendGrid/SendGrid.sln b/SendGrid/SendGrid.sln
index 476f639..c80cffb 100644
--- a/SendGrid/SendGrid.sln
+++ b/SendGrid/SendGrid.sln
@@ -3,12 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{0319E73A-7039-4858-B047-1EDF88BB6BD1}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example", "Example\Example.csproj", "{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}"
- ProjectSection(ProjectDependencies) = postProject
- {3C687BEF-FF50-44AD-8315-2D4237281AF8} = {3C687BEF-FF50-44AD-8315-2D4237281AF8}
- EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{DAC6CBA4-41D4-490D-B9BE-A8E3AB2E8A96}"
ProjectSection(SolutionItems) = preProject
@@ -16,8 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{DAC6CB
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mail", "SendGridMail\Mail.csproj", "{3C687BEF-FF50-44AD-8315-2D4237281AF8}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendGrid", "SendGrid\SendGrid.csproj", "{1C318867-440B-4EB9-99E3-C0CC2C556962}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTest\UnitTests.csproj", "{8A66032B-0D1C-4F24-B0E3-A250F31D09D8}"
@@ -35,22 +28,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.BuildNet45|Any CPU.ActiveCfg = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.BuildNet45|Any CPU.Build.0 = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.BuildNet45|Mixed Platforms.ActiveCfg = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.BuildNet45|Mixed Platforms.Build.0 = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.BuildNet45|x86.ActiveCfg = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.BuildNet45|x86.Build.0 = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Debug|Any CPU.ActiveCfg = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Debug|Any CPU.Build.0 = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Debug|Mixed Platforms.ActiveCfg = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Debug|Mixed Platforms.Build.0 = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Debug|x86.ActiveCfg = Debug|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Release|Any CPU.Build.0 = Release|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Release|Mixed Platforms.ActiveCfg = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Release|Mixed Platforms.Build.0 = BuildNet45|Any CPU
- {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Release|x86.ActiveCfg = Release|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|Any CPU.ActiveCfg = BuildNet45|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|Mixed Platforms.ActiveCfg = Release|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|x86.ActiveCfg = BuildNet45|Any CPU
@@ -60,22 +37,6 @@ Global
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|x86.ActiveCfg = Release|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.BuildNet45|Any CPU.ActiveCfg = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.BuildNet45|Any CPU.Build.0 = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.BuildNet45|Mixed Platforms.ActiveCfg = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.BuildNet45|Mixed Platforms.Build.0 = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.BuildNet45|x86.ActiveCfg = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.BuildNet45|x86.Build.0 = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Debug|Any CPU.ActiveCfg = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Debug|Any CPU.Build.0 = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Debug|Mixed Platforms.ActiveCfg = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Debug|Mixed Platforms.Build.0 = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Debug|x86.ActiveCfg = Debug|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Release|Any CPU.Build.0 = Release|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Release|Mixed Platforms.ActiveCfg = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Release|Mixed Platforms.Build.0 = BuildNet45|Any CPU
- {3C687BEF-FF50-44AD-8315-2D4237281AF8}.Release|x86.ActiveCfg = Release|Any CPU
{1C318867-440B-4EB9-99E3-C0CC2C556962}.BuildNet45|Any CPU.ActiveCfg = Release|Any CPU
{1C318867-440B-4EB9-99E3-C0CC2C556962}.BuildNet45|Any CPU.Build.0 = Release|Any CPU
{1C318867-440B-4EB9-99E3-C0CC2C556962}.BuildNet45|Mixed Platforms.ActiveCfg = Release|Any CPU
diff --git a/SendGrid/SendGrid/App.config b/SendGrid/SendGrid/App.config
index 03260cb..faf56dd 100644
--- a/SendGrid/SendGrid/App.config
+++ b/SendGrid/SendGrid/App.config
@@ -11,4 +11,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
-</configuration> \ No newline at end of file
+</configuration>
diff --git a/SendGrid/SendGrid/Client.cs b/SendGrid/SendGrid/Client.cs
index 6e86be1..388cc3f 100644
--- a/SendGrid/SendGrid/Client.cs
+++ b/SendGrid/SendGrid/Client.cs
@@ -1,26 +1,16 @@
using System;
-using System.Net.Http;
-using System.Net.Http.Headers;
using System.Reflection;
-using System.Threading.Tasks;
-using System.Text;
-using SendGrid.Resources;
-using System.Net;
-using Newtonsoft.Json.Linq;
+using System.Collections.Generic;
+using SendGrid.CSharp.HTTP.Client;
namespace SendGrid
{
- public class Client
+ public class SendGridAPIClient
{
private string _apiKey;
- public APIKeys ApiKeys;
- public UnsubscribeGroups UnsubscribeGroups;
- public Suppressions Suppressions;
- public GlobalSuppressions GlobalSuppressions;
- public GlobalStats GlobalStats;
public string Version;
+ public dynamic client;
private Uri _baseUri;
- private const string MediaType = "application/json";
private enum Methods
{
GET, POST, PATCH, DELETE
@@ -31,103 +21,16 @@ namespace SendGrid
/// </summary>
/// <param name="apiKey">Your SendGrid API Key</param>
/// <param name="baseUri">Base SendGrid API Uri</param>
- public Client(string apiKey, string baseUri = "https://api.sendgrid.com/")
+ public SendGridAPIClient(string apiKey, String baseUri = "https://api.sendgrid.com", String version = "v3")
{
_baseUri = new Uri(baseUri);
_apiKey = apiKey;
Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
- ApiKeys = new APIKeys(this);
- UnsubscribeGroups = new UnsubscribeGroups(this);
- Suppressions = new Suppressions(this);
- GlobalSuppressions = new GlobalSuppressions(this);
- GlobalStats = new GlobalStats(this);
- }
-
- /// <summary>
- /// Create a client that connects to the SendGrid Web API
- /// </summary>
- /// <param name="method">HTTP verb, case-insensitive</param>
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- /// <param name="data">An JObject representing the resource's data</param>
- /// <returns>An asyncronous task</returns>
- private async Task<HttpResponseMessage> RequestAsync(Methods method, string endpoint, JObject data)
- {
- using (var client = new HttpClient())
- {
- try
- {
- client.BaseAddress = _baseUri;
- client.DefaultRequestHeaders.Accept.Clear();
- client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaType));
- client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _apiKey);
- client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "sendgrid/" + Version + ";csharp");
-
- switch (method)
- {
- case Methods.GET:
- return await client.GetAsync(endpoint);
- case Methods.POST:
- return await client.PostAsJsonAsync(endpoint, data);
- case Methods.PATCH:
- endpoint = _baseUri + endpoint;
- StringContent content = new StringContent(data.ToString(), Encoding.UTF8, MediaType);
- HttpRequestMessage request = new HttpRequestMessage
- {
- Method = new HttpMethod("PATCH"),
- RequestUri = new Uri(endpoint),
- Content = content
- };
- return await client.SendAsync(request);
- case Methods.DELETE:
- return await client.DeleteAsync(endpoint);
- default:
- HttpResponseMessage response = new HttpResponseMessage();
- response.StatusCode = HttpStatusCode.MethodNotAllowed;
- var message = "{\"errors\":[{\"message\":\"Bad method call, supported methods are GET, POST, PATCH and DELETE\"}]}";
- response.Content = new StringContent(message);
- return response;
- }
- }
- catch (Exception ex)
- {
- HttpResponseMessage response = new HttpResponseMessage();
- string message;
- message = (ex is HttpRequestException) ? ".NET HttpRequestException" : ".NET Exception";
- message = message + ", raw message: \n\n";
- response.Content = new StringContent(message + ex.Message);
- return response;
- }
- }
- }
-
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- /// <returns>The resulting message from the API call</returns>
- public async Task<HttpResponseMessage> Get(string endpoint)
- {
- return await RequestAsync(Methods.GET, endpoint, null);
- }
-
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- /// <param name="data">An JObject representing the resource's data</param>
- /// <returns>The resulting message from the API call</returns>
- public async Task<HttpResponseMessage> Post(string endpoint, JObject data)
- {
- return await RequestAsync(Methods.POST, endpoint, data);
- }
-
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- /// <returns>The resulting message from the API call</returns>
- public async Task<HttpResponseMessage> Delete(string endpoint)
- {
- return await RequestAsync(Methods.DELETE, endpoint, null);
- }
-
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- /// <param name="data">An JObject representing the resource's data</param>
- /// <returns>The resulting message from the API call</returns>
- public async Task<HttpResponseMessage> Patch(string endpoint, JObject data)
- {
- return await RequestAsync(Methods.PATCH, endpoint, data);
+ Dictionary<String, String> requestHeaders = new Dictionary<String, String>();
+ requestHeaders.Add("Authorization", "Bearer " + apiKey);
+ requestHeaders.Add("Content-Type", "application/json");
+ requestHeaders.Add("User-Agent", "sendgrid/" + Version + " csharp");
+ client = new Client(host: baseUri, requestHeaders: requestHeaders, version: version);
}
}
}
diff --git a/SendGrid/SendGrid/Helpers/Mail/Mail.cs b/SendGrid/SendGrid/Helpers/Mail/Mail.cs
new file mode 100644
index 0000000..52dbb9a
--- /dev/null
+++ b/SendGrid/SendGrid/Helpers/Mail/Mail.cs
@@ -0,0 +1,1291 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+
+namespace SendGrid.Helpers.Mail
+{
+ /// <summary>
+ /// Class Mail builds an object that sends an email through SendGrid.
+ /// </summary>
+ public class Mail
+ {
+ private Email from;
+ private String subject;
+ private List<Personalization> personalizations;
+ private List<Content> contents;
+ private List<Attachment> attachments;
+ private String templateId;
+ private Dictionary<String, String> headers;
+ private Dictionary<String, String> sections;
+ private List<String> categories;
+ private Dictionary<String, String> customArgs;
+ private long sendAt;
+ private ASM asm;
+ private String batchId;
+ private String setIpPoolId;
+ private MailSettings mailSettings;
+ private TrackingSettings trackingSettings;
+ private Email replyTo;
+
+ public Mail()
+ {
+ return;
+ }
+
+ public Mail(Email from, String subject, Email to, Content content)
+ {
+ this.From = from;
+ Personalization personalization = new Personalization();
+ personalization.AddTo(to);
+ this.AddPersonalization(personalization);
+ this.Subject = "Hello World from the SendGrid CSharp Library";
+ this.AddContent(content);
+ }
+
+ [JsonProperty(PropertyName = "from")]
+ public Email From
+ {
+ get
+ {
+ return from;
+ }
+
+ set
+ {
+ from = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "subject")]
+ public string Subject
+ {
+ get
+ {
+ return subject;
+ }
+
+ set
+ {
+ subject = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "personalizations")]
+ public List<Personalization> Personalization
+ {
+ get
+ {
+ return personalizations;
+ }
+
+ set
+ {
+ personalizations = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "content")]
+ public List<Content> Contents
+ {
+ get
+ {
+ return contents;
+ }
+
+ set
+ {
+ contents = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "attachments")]
+ public List<Attachment> Attachments
+ {
+ get
+ {
+ return attachments;
+ }
+
+ set
+ {
+ attachments = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "template_id")]
+ public string TemplateId
+ {
+ get
+ {
+ return templateId;
+ }
+
+ set
+ {
+ templateId = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "headers")]
+ public Dictionary<string, string> Headers
+ {
+ get
+ {
+ return headers;
+ }
+
+ set
+ {
+ headers = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "sections")]
+ public Dictionary<string, string> Sections
+ {
+ get
+ {
+ return sections;
+ }
+
+ set
+ {
+ sections = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "categories")]
+ public List<string> Categories
+ {
+ get
+ {
+ return categories;
+ }
+
+ set
+ {
+ categories = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "custom_args")]
+ public Dictionary<string, string> CustomArgs
+ {
+ get
+ {
+ return customArgs;
+ }
+
+ set
+ {
+ customArgs = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "send_at")]
+ public long SendAt
+ {
+ get
+ {
+ return sendAt;
+ }
+
+ set
+ {
+ sendAt = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "asm")]
+ public ASM Asm
+ {
+ get
+ {
+ return asm;
+ }
+
+ set
+ {
+ asm = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "batch_id")]
+ public string BatchId
+ {
+ get
+ {
+ return batchId;
+ }
+
+ set
+ {
+ batchId = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "ip_pool_name")]
+ public string SetIpPoolId
+ {
+ get
+ {
+ return setIpPoolId;
+ }
+
+ set
+ {
+ setIpPoolId = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "mail_settings")]
+ public MailSettings MailSettings
+ {
+ get
+ {
+ return mailSettings;
+ }
+
+ set
+ {
+ mailSettings = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "tracking_settings")]
+ public TrackingSettings TrackingSettings
+ {
+ get
+ {
+ return trackingSettings;
+ }
+
+ set
+ {
+ trackingSettings = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "reply_to")]
+ public Email ReplyTo
+ {
+ get
+ {
+ return replyTo;
+ }
+
+ set
+ {
+ replyTo = value;
+ }
+ }
+
+ public void AddPersonalization(Personalization personalization)
+ {
+ if (Personalization == null)
+ {
+ Personalization = new List<Personalization>();
+ }
+ Personalization.Add(personalization);
+ }
+
+ public void AddContent(Content content)
+ {
+ if (Contents == null)
+ {
+ Contents = new List<Content>();
+ }
+ Contents.Add(content);
+ }
+
+ public void AddAttachment(Attachment attachment)
+ {
+ if (Attachments == null)
+ {
+ Attachments = new List<Attachment>();
+ }
+ Attachments.Add(attachment);
+ }
+
+ public void AddHeader(String key, String value)
+ {
+ if (headers == null)
+ {
+ headers = new Dictionary<String, String>();
+ }
+ headers.Add(key, value);
+ }
+
+ public void AddSection(String key, String value)
+ {
+ if (sections == null)
+ {
+ sections = new Dictionary<String, String>();
+ }
+ sections.Add(key, value);
+ }
+
+ public void AddCategory(String category)
+ {
+ if (Categories == null)
+ {
+ Categories = new List<String>();
+ }
+ Categories.Add(category);
+ }
+
+ public void AddCustomArgs(String key, String value)
+ {
+ if (customArgs == null)
+ {
+ customArgs = new Dictionary<String, String>();
+ }
+ customArgs.Add(key, value);
+ }
+
+ public String Get()
+ {
+ return JsonConvert.SerializeObject(this,
+ Formatting.None,
+ new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore });
+ }
+ }
+
+
+ public class ClickTracking
+ {
+ private bool enable;
+ private bool enableText;
+
+ [JsonProperty(PropertyName = "enable")]
+ public bool Enable
+ {
+ get
+ {
+ return enable;
+ }
+
+ set
+ {
+ enable = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "enable_text")]
+ public bool EnableText
+ {
+ get
+ {
+ return enableText;
+ }
+
+ set
+ {
+ enableText = value;
+ }
+ }
+ }
+
+
+ public class OpenTracking
+ {
+ private bool enable;
+ private String substitutionTag;
+
+ [JsonProperty(PropertyName = "enable")]
+ public bool Enable
+ {
+ get
+ {
+ return enable;
+ }
+
+ set
+ {
+ enable = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "substitution_tag")]
+ public string SubstitutionTag
+ {
+ get
+ {
+ return substitutionTag;
+ }
+
+ set
+ {
+ substitutionTag = value;
+ }
+ }
+ }
+
+
+ public class SubscriptionTracking
+ {
+ private bool enable;
+ private String text;
+ private String html;
+ private String substitutionTag;
+
+ [JsonProperty(PropertyName = "enable")]
+ public bool Enable
+ {
+ get
+ {
+ return enable;
+ }
+
+ set
+ {
+ enable = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "text")]
+ public string Text
+ {
+ get
+ {
+ return text;
+ }
+
+ set
+ {
+ text = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "html")]
+ public string Html
+ {
+ get
+ {
+ return html;
+ }
+
+ set
+ {
+ html = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "substitution_tag")]
+ public string SubstitutionTag
+ {
+ get
+ {
+ return substitutionTag;
+ }
+
+ set
+ {
+ substitutionTag = value;
+ }
+ }
+ }
+
+
+ public class Ganalytics
+ {
+ private bool enable;
+ private String utmSource;
+ private String utmMedium;
+ private String utmTerm;
+ private String utmContent;
+ private String utmCampaign;
+
+ [JsonProperty(PropertyName = "enable")]
+ public bool Enable
+ {
+ get
+ {
+ return enable;
+ }
+
+ set
+ {
+ enable = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "utm_source")]
+ public string UtmSource
+ {
+ get
+ {
+ return utmSource;
+ }
+
+ set
+ {
+ utmSource = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "utm_medium")]
+ public string UtmMedium
+ {
+ get
+ {
+ return utmMedium;
+ }
+
+ set
+ {
+ utmMedium = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "utm_term")]
+ public string UtmTerm
+ {
+ get
+ {
+ return utmTerm;
+ }
+
+ set
+ {
+ utmTerm = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "utm_content")]
+ public string UtmContent
+ {
+ get
+ {
+ return utmContent;
+ }
+
+ set
+ {
+ utmContent = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "utm_campaign")]
+ public string UtmCampaign
+ {
+ get
+ {
+ return utmCampaign;
+ }
+
+ set
+ {
+ utmCampaign = value;
+ }
+ }
+ }
+
+
+ public class TrackingSettings
+ {
+ private ClickTracking clickTracking;
+ private OpenTracking openTracking;
+ private SubscriptionTracking subscriptionTracking;
+ private Ganalytics ganalytics;
+
+ [JsonProperty(PropertyName = "click_tracking")]
+ public ClickTracking ClickTracking
+ {
+ get
+ {
+ return clickTracking;
+ }
+
+ set
+ {
+ clickTracking = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "open_tracking")]
+ public OpenTracking OpenTracking
+ {
+ get
+ {
+ return openTracking;
+ }
+
+ set
+ {
+ openTracking = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "subscription_tracking")]
+ public SubscriptionTracking SubscriptionTracking
+ {
+ get
+ {
+ return subscriptionTracking;
+ }
+
+ set
+ {
+ subscriptionTracking = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "ganalytics")]
+ public Ganalytics Ganalytics
+ {
+ get
+ {
+ return ganalytics;
+ }
+
+ set
+ {
+ ganalytics = value;
+ }
+ }
+ }
+
+
+ public class BCCSettings
+ {
+ private bool enable;
+ private String email;
+
+ [JsonProperty(PropertyName = "enable")]
+ public bool Enable
+ {
+ get
+ {
+ return enable;
+ }
+
+ set
+ {
+ enable = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "email")]
+ public string Email
+ {
+ get
+ {
+ return email;
+ }
+
+ set
+ {
+ email = value;
+ }
+ }
+ }
+
+
+ public class BypassListManagement
+ {
+ private bool enable;
+
+ [JsonProperty(PropertyName = "enable")]
+ public bool Enable
+ {
+ get
+ {
+ return enable;
+ }
+
+ set
+ {
+ enable = value;
+ }
+ }
+ }
+
+
+ public class FooterSettings
+ {
+ private bool enable;
+ private String text;
+ private String html;
+
+ [JsonProperty(PropertyName = "enable")]
+ public bool Enable
+ {
+ get
+ {
+ return enable;
+ }
+
+ set
+ {
+ enable = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "text")]
+ public string Text
+ {
+ get
+ {
+ return text;
+ }
+
+ set
+ {
+ text = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "html")]
+ public string Html
+ {
+ get
+ {
+ return html;
+ }
+
+ set
+ {
+ html = value;
+ }
+ }
+ }
+
+
+ public class SandboxMode
+ {
+ private bool enable;
+
+ [JsonProperty(PropertyName = "enable")]
+ public bool Enable
+ {
+ get
+ {
+ return enable;
+ }
+
+ set
+ {
+ enable = value;
+ }
+ }
+ }
+
+
+ public class SpamCheck
+ {
+ private bool enable;
+ private int threshold;
+ private String postToUrl;
+
+ [JsonProperty(PropertyName = "enable")]
+ public bool Enable
+ {
+ get
+ {
+ return enable;
+ }
+
+ set
+ {
+ enable = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "threshold")]
+ public int Threshold
+ {
+ get
+ {
+ return threshold;
+ }
+
+ set
+ {
+ threshold = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "post_to_url")]
+ public string PostToUrl
+ {
+ get
+ {
+ return postToUrl;
+ }
+
+ set
+ {
+ postToUrl = value;
+ }
+ }
+ }
+
+
+ public class MailSettings
+ {
+ private BCCSettings bccSettings;
+ private BypassListManagement bypassListManagement;
+ private FooterSettings footerSettings;
+ private SandboxMode sandboxMode;
+ private SpamCheck spamCheck;
+
+ [JsonProperty(PropertyName = "bcc")]
+ public BCCSettings BccSettings
+ {
+ get
+ {
+ return bccSettings;
+ }
+
+ set
+ {
+ bccSettings = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "bypass_list_management")]
+ public BypassListManagement BypassListManagement
+ {
+ get
+ {
+ return bypassListManagement;
+ }
+
+ set
+ {
+ bypassListManagement = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "footer")]
+ public FooterSettings FooterSettings
+ {
+ get
+ {
+ return footerSettings;
+ }
+
+ set
+ {
+ footerSettings = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "sandbox_mode")]
+ public SandboxMode SandboxMode
+ {
+ get
+ {
+ return sandboxMode;
+ }
+
+ set
+ {
+ sandboxMode = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "spam_check")]
+ public SpamCheck SpamCheck
+ {
+ get
+ {
+ return spamCheck;
+ }
+
+ set
+ {
+ spamCheck = value;
+ }
+ }
+ }
+
+
+ public class ASM
+ {
+ private int groupId;
+ private List<int> groupsToDisplay;
+
+ [JsonProperty(PropertyName = "group_id")]
+ public int GroupId
+ {
+ get
+ {
+ return groupId;
+ }
+
+ set
+ {
+ groupId = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "groups_to_display")]
+ public List<int> GroupsToDisplay
+ {
+ get
+ {
+ return groupsToDisplay;
+ }
+
+ set
+ {
+ groupsToDisplay = value;
+ }
+ }
+ }
+
+
+ public class Attachment
+ {
+ private String content;
+ private String type;
+ private String filename;
+ private String disposition;
+ private String contentId;
+
+ [JsonProperty(PropertyName = "content")]
+ public string Content
+ {
+ get
+ {
+ return content;
+ }
+
+ set
+ {
+ content = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "type")]
+ public string Type
+ {
+ get
+ {
+ return type;
+ }
+
+ set
+ {
+ type = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "filename")]
+ public string Filename
+ {
+ get
+ {
+ return filename;
+ }
+
+ set
+ {
+ filename = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "disposition")]
+ public string Disposition
+ {
+ get
+ {
+ return disposition;
+ }
+
+ set
+ {
+ disposition = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "content_id")]
+ public string ContentId
+ {
+ get
+ {
+ return contentId;
+ }
+
+ set
+ {
+ contentId = value;
+ }
+ }
+ }
+
+
+ public class Content
+ {
+ private String type;
+ private String value;
+
+ public Content()
+ {
+ return;
+ }
+
+ public Content(String type, String value)
+ {
+ this.Type = type;
+ this.Value = value;
+ }
+
+ [JsonProperty(PropertyName = "type")]
+ public string Type
+ {
+ get
+ {
+ return type;
+ }
+
+ set
+ {
+ type = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "value")]
+ public string Value
+ {
+ get
+ {
+ return value;
+ }
+
+ set
+ {
+ this.value = value;
+ }
+ }
+ }
+
+
+ public class Email
+ {
+ private String name;
+ private String address;
+
+ public Email()
+ {
+ return;
+ }
+
+ public Email(String email, String name = null)
+ {
+ this.Address = email;
+ this.Name = name;
+ }
+
+ [JsonProperty(PropertyName = "name")]
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "email")]
+ public string Address
+ {
+ get
+ {
+ return address;
+ }
+
+ set
+ {
+ address = value;
+ }
+ }
+ }
+
+
+ public class Personalization
+ {
+ private List<Email> tos;
+ private List<Email> ccs;
+ private List<Email> bccs;
+ private String subject;
+ private Dictionary<String, String> headers;
+ private Dictionary<String, String> substitutions;
+ private Dictionary<String, String> customArgs;
+ private long sendAt;
+
+ [JsonProperty(PropertyName = "to")]
+ public List<Email> Tos
+ {
+ get
+ {
+ return tos;
+ }
+
+ set
+ {
+ tos = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "cc")]
+ public List<Email> Ccs
+ {
+ get
+ {
+ return ccs;
+ }
+
+ set
+ {
+ ccs = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "bcc")]
+ public List<Email> Bccs
+ {
+ get
+ {
+ return bccs;
+ }
+
+ set
+ {
+ bccs = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "subject")]
+ public string Subject
+ {
+ get
+ {
+ return subject;
+ }
+
+ set
+ {
+ subject = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "headers")]
+ public Dictionary<string, string> Headers
+ {
+ get
+ {
+ return headers;
+ }
+
+ set
+ {
+ headers = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "substitutions")]
+ public Dictionary<string, string> Substitutions
+ {
+ get
+ {
+ return substitutions;
+ }
+
+ set
+ {
+ substitutions = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "custom_args")]
+ public Dictionary<string, string> CustomArgs
+ {
+ get
+ {
+ return customArgs;
+ }
+
+ set
+ {
+ customArgs = value;
+ }
+ }
+
+ [JsonProperty(PropertyName = "send_at")]
+ public long SendAt
+ {
+ get
+ {
+ return sendAt;
+ }
+
+ set
+ {
+ sendAt = value;
+ }
+ }
+
+ public void AddTo(Email email)
+ {
+ if (tos == null)
+ {
+ tos = new List<Email>();
+
+ }
+ tos.Add(email);
+ }
+
+ public void AddCc(Email email)
+ {
+ if (ccs == null)
+ {
+ ccs = new List<Email>();
+ }
+ ccs.Add(email);
+ }
+
+ public void AddBcc(Email email)
+ {
+ if (bccs == null)
+ {
+ bccs = new List<Email>();
+ }
+ bccs.Add(email);
+ }
+
+ public void AddHeader(String key, String value)
+ {
+ if (headers == null)
+ {
+ headers = new Dictionary<String, String>();
+ }
+ headers.Add(key, value);
+ }
+
+ public void AddSubstitution(String key, String value)
+ {
+ if (substitutions == null)
+ {
+ substitutions = new Dictionary<String, String>();
+ }
+ substitutions.Add(key, value);
+ }
+
+ public void AddCustomArgs(String key, String value)
+ {
+ if (customArgs == null)
+ {
+ customArgs = new Dictionary<String, String>();
+ }
+ customArgs.Add(key, value);
+ }
+ }
+}
+
diff --git a/SendGrid/SendGrid/Helpers/Mail/README.md b/SendGrid/SendGrid/Helpers/Mail/README.md
new file mode 100644
index 0000000..fa607b3
--- /dev/null
+++ b/SendGrid/SendGrid/Helpers/Mail/README.md
@@ -0,0 +1,12 @@
+**This helper allows you to quickly and easily build a Mail object for sending email through SendGrid.**
+
+# Quick Start
+
+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/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
diff --git a/SendGrid/SendGrid/Properties/AssemblyInfo.cs b/SendGrid/SendGrid/Properties/AssemblyInfo.cs
index 9bf8337..0c09d3f 100644
--- a/SendGrid/SendGrid/Properties/AssemblyInfo.cs
+++ b/SendGrid/SendGrid/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SendGrid")]
@@ -10,12 +10,12 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SendGrid")]
[assembly: AssemblyProduct("SendGrid")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -25,12 +25,12 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("6.3.4")]
-[assembly: AssemblyFileVersion("6.3.4ss")]
+[assembly: AssemblyVersion("7.0.0")]
+[assembly: AssemblyFileVersion("7.0.0")]
diff --git a/SendGrid/SendGrid/Resources/APIKeys.cs b/SendGrid/SendGrid/Resources/APIKeys.cs
deleted file mode 100644
index 37bd4a7..0000000
--- a/SendGrid/SendGrid/Resources/APIKeys.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System.Net.Http;
-using System.Threading.Tasks;
-using Newtonsoft.Json.Linq;
-
-namespace SendGrid.Resources
-{
- public class APIKeys
- {
- private string _endpoint;
- private Client _client;
-
- /// <summary>
- /// Constructs the SendGrid APIKeys object.
- /// See https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/index.html
- /// </summary>
- /// <param name="client">SendGrid Web API v3 client</param>
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- public APIKeys(Client client, string endpoint = "v3/api_keys")
- {
- _endpoint = endpoint;
- _client = client;
- }
-
- /// <summary>
- /// Get a list of active API Keys
- /// </summary>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/index.html</returns>
- public async Task<HttpResponseMessage> Get()
- {
- return await _client.Get(_endpoint);
- }
-
- /// <summary>
- /// Create a new API key
- /// </summary>
- /// <param name="apiKeyName">Name of the new API Key</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/index.html</returns>
- public async Task<HttpResponseMessage> Post(string apiKeyName)
- {
- var data = new JObject {{"name", apiKeyName}};
- return await _client.Post(_endpoint, data);
- }
-
- /// <summary>
- /// Delete a API key
- /// </summary>
- /// <param name="apiKeyId">ID of the API Key to delete</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/index.html</returns>
- public async Task<HttpResponseMessage> Delete(string apiKeyId)
- {
- return await _client.Delete(_endpoint + "/" + apiKeyId);
- }
-
- /// <summary>
- /// Patch a API key
- /// </summary>
- /// <param name="apiKeyId">ID of the API Key to rename</param>
- /// <param name="apiKeyName">New API Key name</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/index.html</returns>
- public async Task<HttpResponseMessage> Patch(string apiKeyId, string apiKeyName)
- {
- var data = new JObject { { "name", apiKeyName } };
- return await _client.Patch(_endpoint + "/" + apiKeyId, data);
- }
-
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Resources/GlobalStats.cs b/SendGrid/SendGrid/Resources/GlobalStats.cs
deleted file mode 100644
index 73f0b33..0000000
--- a/SendGrid/SendGrid/Resources/GlobalStats.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using System.Net.Http;
-using System.Threading.Tasks;
-using System.Web;
-
-namespace SendGrid.Resources
-{
- public class GlobalStats
- {
- private string _endpoint;
- private Client _client;
-
- /// <summary>
- /// Constructs the SendGrid GlobalStats object.
- /// See https://sendgrid.com/docs/API_Reference/Web_API_v3/Stats/global.html
- /// </summary>
- /// <param name="client">SendGrid Web API v3 client</param>
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- public GlobalStats(Client client, string endpoint = "v3/stats")
- {
- _endpoint = endpoint;
- _client = client;
- }
-
- /// <summary>
- /// https://sendgrid.com/docs/API_Reference/Web_API_v3/Stats/global.html
- /// </summary>
- /// <param name="startDate">The starting date of the statistics to retrieve, formatted as YYYY-MM-DD.</param>
- /// <param name="endDate">The end date of the statistics to retrieve, formatted as YYYY-MM-DD. Defaults to today.</param>
- /// <param name="aggregatedBy">How to group the statistics, must be day|week|month</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Stats/global.html</returns>
- public async Task<HttpResponseMessage> Get(string startDate, string endDate = null, string aggregatedBy = null)
- {
- var query = HttpUtility.ParseQueryString(string.Empty);
- query["start_date"] = startDate;
- if (endDate != null)
- {
- query["end_date"] = endDate;
- }
- if (aggregatedBy != null)
- {
- query["aggregated_by"] = aggregatedBy;
- }
- return await _client.Get(_endpoint + "?" + query);
- }
-
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Resources/GlobalSuppressions.cs b/SendGrid/SendGrid/Resources/GlobalSuppressions.cs
deleted file mode 100644
index 36fcd18..0000000
--- a/SendGrid/SendGrid/Resources/GlobalSuppressions.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System.Net.Http;
-using System.Threading.Tasks;
-using Newtonsoft.Json.Linq;
-
-namespace SendGrid.Resources
-{
- public class GlobalSuppressions
- {
- private string _endpoint;
- private Client _client;
-
- /// <summary>
- /// Constructs the SendGrid Global Suppressions object.
- /// See https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/global_suppressions.html
- /// </summary>
- /// <param name="client">SendGrid Web API v3 client</param>
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- public GlobalSuppressions(Client client, string endpoint = "v3/asm/suppressions/global")
- {
- _endpoint = endpoint;
- _client = client;
- }
-
- /// <summary>
- /// Check if a recipient address is in the global suppressions group.
- /// </summary>
- /// <param name="email">email address to check</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/global_suppressions.html</returns>
- public async Task<HttpResponseMessage> Get(string email)
- {
- return await _client.Get(_endpoint + "/" + email);
- }
-
- /// <summary>
- /// Add recipient addresses to the global suppression group.
- /// </summary>
- /// <param name="recipient_emails">Array of email addresses to add to the suppression group</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/global_suppressions.html</returns>
- public async Task<HttpResponseMessage> Post(string[] emails)
- {
- JArray receipient_emails = new JArray();
- foreach (string email in emails) { receipient_emails.Add(email); }
- var data = new JObject(new JProperty("recipient_emails", receipient_emails));
- return await _client.Post(_endpoint, data);
- }
-
- /// <summary>
- /// Delete a recipient email from the global suppressions group.
- /// </summary>
- /// <param name="email">email address to be removed from the global suppressions group</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/global_suppressions.html</returns>
- public async Task<HttpResponseMessage> Delete(string email)
- {
- return await _client.Delete(_endpoint + "/" + email);
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Resources/Suppressions.cs b/SendGrid/SendGrid/Resources/Suppressions.cs
deleted file mode 100644
index 91bb38d..0000000
--- a/SendGrid/SendGrid/Resources/Suppressions.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System.Net.Http;
-using System.Threading.Tasks;
-using Newtonsoft.Json.Linq;
-
-namespace SendGrid.Resources
-{
- public class Suppressions
- {
- private string _endpoint;
- private Client _client;
-
- /// <summary>
- /// Constructs the SendGrid Suppressions object.
- /// See https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/suppressions.html
- /// </summary>
- /// <param name="client">SendGrid Web API v3 client</param>
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- public Suppressions(Client client, string endpoint = "v3/asm/groups")
- {
- _endpoint = endpoint;
- _client = client;
- }
-
- /// <summary>
- /// Get suppressed addresses for a given group.
- /// </summary>
- /// <param name="groupId">ID of the suppression group</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/suppressions.html</returns>
- public async Task<HttpResponseMessage> Get(int groupId)
- {
- return await _client.Get(_endpoint + "/" + groupId.ToString() + "/suppressions");
- }
-
- /// <summary>
- /// Add recipient addresses to the suppressions list for a given group.
- ///
- /// If the group has been deleted, this request will add the address to the global suppression.
- /// </summary>
- /// <param name="groupId">ID of the suppression group</param>
- /// <param name="recipient_emails">Array of email addresses to add to the suppression group</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/suppressions.html</returns>
- public async Task<HttpResponseMessage> Post(int groupId, string[] emails)
- {
- JArray receipient_emails = new JArray();
- foreach (string email in emails) { receipient_emails.Add(email); }
- var data = new JObject(new JProperty("recipient_emails", receipient_emails));
- return await _client.Post(_endpoint + "/" + groupId.ToString() + "/suppressions", data);
- }
-
- /// <summary>
- /// Delete a suppression group.
- /// </summary>
- /// <param name="groupId">ID of the suppression group to delete</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/suppressions.html</returns>
- public async Task<HttpResponseMessage> Delete(int groupId, string email)
- {
- return await _client.Delete(_endpoint + "/" + groupId.ToString() + "/suppressions/" + email);
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Resources/UnsubscribeGroups.cs b/SendGrid/SendGrid/Resources/UnsubscribeGroups.cs
deleted file mode 100644
index db8e4d2..0000000
--- a/SendGrid/SendGrid/Resources/UnsubscribeGroups.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System.Net.Http;
-using System.Threading.Tasks;
-using Newtonsoft.Json.Linq;
-
-namespace SendGrid.Resources
-{
- public class UnsubscribeGroups
- {
- private string _endpoint;
- private Client _client;
-
- /// <summary>
- /// Constructs the SendGrid UnsubscribeGroups object.
- /// See https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html
- /// </summary>
- /// <param name="client">SendGrid Web API v3 client</param>
- /// <param name="endpoint">Resource endpoint, do not prepend slash</param>
- public UnsubscribeGroups(Client client, string endpoint = "v3/asm/groups")
- {
- _endpoint = endpoint;
- _client = client;
- }
-
- /// <summary>
- /// Retrieve all suppression groups associated with the user.
- /// </summary>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html</returns>
- public async Task<HttpResponseMessage> Get()
- {
- return await _client.Get(_endpoint);
- }
-
- /// <summary>
- /// Get information on a single suppression group.
- /// </summary>
- /// <param name="unsubscribeGroupId">ID of the suppression group to delete</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html</returns>
- public async Task<HttpResponseMessage> Get(int unsubscribeGroupId)
- {
- return await _client.Get(_endpoint + "/" + unsubscribeGroupId);
- }
-
- /// <summary>
- /// Create a new suppression group.
- /// </summary>
- /// <param name="unsubscribeGroupName">The name of the new suppression group</param>
- /// <param name="unsubscribeGroupDescription">A description of the suppression group</param>
- /// <param name="unsubscribeGroupIsDefault">Default value is false</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html</returns>
- public async Task<HttpResponseMessage> Post(string unsubscribeGroupName,
- string unsubscribeGroupDescription,
- bool unsubscribeGroupIsDefault)
- {
- var data = new JObject {{"name", unsubscribeGroupName},
- {"description", unsubscribeGroupDescription},
- {"is_default", unsubscribeGroupIsDefault}};
- return await _client.Post(_endpoint, data);
- }
-
- /// <summary>
- /// Delete a suppression group.
- /// </summary>
- /// <param name="unsubscribeGroupId">ID of the suppression group to delete</param>
- /// <returns>https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html</returns>
- public async Task<HttpResponseMessage> Delete(string unsubscribeGroupId)
- {
- return await _client.Delete(_endpoint + "/" + unsubscribeGroupId);
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGrid/SendGrid.csproj b/SendGrid/SendGrid/SendGrid.csproj
index 2f5bcf6..e40d161 100644
--- a/SendGrid/SendGrid/SendGrid.csproj
+++ b/SendGrid/SendGrid/SendGrid.csproj
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SendGrid</RootNamespace>
<AssemblyName>SendGrid</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
@@ -26,7 +26,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
+ <DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
@@ -47,6 +47,10 @@
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
+ <Reference Include="SendGrid.CSharp.HTTP.Client, Version=2.0.0.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
+ <HintPath>..\packages\SendGrid.CSharp.HTTP.Client.2.0.1\lib\SendGrid.CSharp.HTTP.Client.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -64,12 +68,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Client.cs" />
+ <Compile Include="Helpers\Mail\Mail.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Resources\GlobalSuppressions.cs" />
- <Compile Include="Resources\GlobalStats.cs" />
- <Compile Include="Resources\Suppressions.cs" />
- <Compile Include="Resources\UnsubscribeGroups.cs" />
- <Compile Include="Resources\APIKeys.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
@@ -78,7 +78,7 @@
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
diff --git a/SendGrid/SendGrid/packages.config b/SendGrid/SendGrid/packages.config
index b24a212..6073925 100644
--- a/SendGrid/SendGrid/packages.config
+++ b/SendGrid/SendGrid/packages.config
@@ -2,4 +2,5 @@
<packages>
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
+ <package id="SendGrid.CSharp.HTTP.Client" version="2.0.1" targetFramework="net452" />
</packages> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/Exceptions/InvalidApiRequestException.cs b/SendGrid/SendGridMail/Exceptions/InvalidApiRequestException.cs
deleted file mode 100644
index 7fd51ea..0000000
--- a/SendGrid/SendGridMail/Exceptions/InvalidApiRequestException.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Net;
-
-namespace Exceptions
-{
- public class InvalidApiRequestException : Exception
- {
- public InvalidApiRequestException(HttpStatusCode httpStatusCode, string[] errors, string httpResponsePhrase)
- : base(httpResponsePhrase + " Check `Errors` for a list of errors returned by the API.")
- {
- ResponseStatusCode = httpStatusCode;
- Errors = errors;
- }
-
- public String[] Errors { get; set; }
-
- public HttpStatusCode ResponseStatusCode { get; private set; }
- }
-}
diff --git a/SendGrid/SendGridMail/ISendGrid.cs b/SendGrid/SendGridMail/ISendGrid.cs
deleted file mode 100644
index 38a931a..0000000
--- a/SendGrid/SendGridMail/ISendGrid.cs
+++ /dev/null
@@ -1,302 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net.Mail;
-using SendGrid.SmtpApi;
-
-namespace SendGrid
-{
- /// <summary>
- /// Represents the basic set of functions that will be called by the user
- /// includes basic message data manipulation and filter settings
- /// </summary>
- public interface ISendGrid
- {
- #region Properties
-
- MailAddress From { get; set; }
- MailAddress[] To { get; set; }
- MailAddress[] Cc { get; set; }
- MailAddress[] Bcc { get; set; }
- MailAddress[] ReplyTo { get; set; }
- Dictionary<String, MemoryStream> StreamedAttachments { get; set; }
- String[] Attachments { get; set; }
- String Subject { get; set; }
- Dictionary<String, String> Headers { get; set; }
- IHeader Header { get; set; }
- String Html { get; set; }
- String Text { get; set; }
-
- #endregion
-
- #region Interface for ITransport
-
- /// <summary>
- /// Used by the Transport object to create a MIME for SMTP
- /// </summary>
- /// <returns>MIME to be sent</returns>
- MailMessage CreateMimeMessage();
-
- #endregion
-
- #region Methods for setting data
-
- /// <summary>
- /// Add to the 'To' address.
- /// </summary>
- /// <param name="address">single string eg. 'you@company.com'</param>
- void AddTo(String address);
-
- /// <summary>
- /// Add to the 'To' address.
- /// </summary>
- /// <param name="addresses">list of email addresses as strings</param>
- void AddTo(IEnumerable<String> addresses);
-
- /// <summary>
- /// Add to the 'To' address.
- /// </summary>
- /// <param name="addresssInfo">
- /// the dictionary keys are the email addresses, which points to a dictionary of
- /// key substitutionValues pairs mapping to other address codes, such as { foo@bar.com => { 'DisplayName' => 'Mr Foo' }
- /// }
- /// </param>
- void AddTo(IDictionary<String, IDictionary<String, String>> addresssInfo);
-
- /// <summary>
- /// Defines a mapping between a replacement string in the text of the message to a section of
- /// substitution values to be used
- /// </summary>
- /// <param name="replacementTag">the string in the email that you'll replace eg. '-itemsOrdered-'</param>
- /// <param name="sectionValue">
- /// The content that will be substituted in for the replacementTag
- /// </param>
- void AddSection(String replacementTag, String sectionValue);
-
- /// <summary>
- /// Defines a mapping between a replacement string in the text of the message to a list of
- /// substitution values to be used, one per each recipient, in the same order as the recipients were added.
- /// </summary>
- /// <param name="replacementTag">the string in the email that you'll replace eg. '-name-'</param>
- /// <param name="substitutionValues">
- /// a list of values that will be substituted in for the replacementTag, one for each
- /// recipient
- /// </param>
- void AddSubstitution(String replacementTag, List<String> substitutionValues);
-
- /// <summary>
- /// This adds parameters and values that will be bassed back through SendGrid's
- /// Event API if an event notification is triggered by this email.
- /// </summary>
- /// <param name="identifiers">parameter substitutionValues pairs to be passed back on event notification</param>
- void AddUniqueArgs(IDictionary<String, String> identifiers);
-
- /// <summary>
- /// This sets the suppression group id for this email.
- /// </summary>
- /// <param name="id">the id of the suppression group</param>
- void SetAsmGroupId(int id);
-
- /// <summary>
- /// This sets the category for this email. Statistics are stored on a per category
- /// basis, so this can be useful for tracking on a per group basis.
- /// </summary>
- /// <param name="category">categories applied to the message</param>
- void SetCategory(String category);
-
- /// <summary>
- /// This sets the categories for this email. Statistics are stored on a per category
- /// basis, so this can be useful for tracking on a per group basis.
- /// </summary>
- /// <param name="categories">categories applied to the message</param>
- void SetCategories(IEnumerable<String> categories);
-
- /// <summary>
- /// This sets the IP Pool for this email.
- /// </summary>
- /// <param name="pool">The name of the pool with which to send the message.</param>
- void SetIpPool(String pool);
-
- /// <summary>
- /// Define a send_at timestamp to schedule this send for the future.
- /// </summary>
- /// <param name="sendTime">The time at which to send the email</param>
- void SetSendAt(DateTime sendTime);
-
- /// <summary>
- /// Define a send_each_at timestamp to schedule individual send times per message
- /// </summary>
- /// <param name="sendTimes">The times at which to send the emails</param>
- void SetSendEachAt(IEnumerable<DateTime> sendTimes);
-
- /// <summary>
- /// Add an attachment to the message.
- /// </summary>
- /// <param name="filePath">a fully qualified file path as a string</param>
- void AddAttachment(String filePath);
-
- /// <summary>
- /// Add a stream as an attachment to the message
- /// </summary>
- /// <param name="stream">Stream of file to be attached</param>
- /// <param name="name">Name of file to be attached</param>
- void AddAttachment(Stream stream, String name);
-
- void EmbedStreamImage(Stream stream, String name);
-
- /// <summary>
- /// GetRecipients returns a list of all the recepients by retrieving the to, cc, and bcc lists.
- /// </summary>
- /// <returns></returns>
- IEnumerable<String> GetRecipients();
-
- /// <summary>
- /// Add custom headers to the message
- /// </summary>
- /// <param name="headers">key substitutionValues pairs</param>
- void AddHeaders(IDictionary<String, String> headers);
-
- /// <summary>
- /// Gets the list of embedded images
- /// </summary>
- /// <returns></returns>
- IDictionary<string, string> GetEmbeddedImages();
-
- #endregion
-
- #region SMTP API Functions
-
- /// <summary>
- /// Disable the gravatar app
- /// </summary>
- void DisableGravatar();
-
- /// <summary>
- /// Disable the open tracking app
- /// </summary>
- void DisableOpenTracking();
-
- /// <summary>
- /// Disable the click tracking app
- /// </summary>
- void DisableClickTracking();
-
- /// <summary>
- /// Disable the spam check
- /// </summary>
- void DisableSpamCheck();
-
- /// <summary>
- /// Disable the unsubscribe app
- /// </summary>
- void DisableUnsubscribe();
-
- /// <summary>
- /// Disable the footer app
- /// </summary>
- void DisableFooter();
-
- /// <summary>
- /// Disable the Google Analytics app
- /// </summary>
- void DisableGoogleAnalytics();
-
- /// <summary>
- /// Disable the templates app
- /// </summary>
- void DisableTemplate();
-
- /// <summary>
- /// Disable Bcc app
- /// </summary>
- void DisableBcc();
-
- /// <summary>
- /// Disable the Bypass List Management app
- /// </summary>
- void DisableBypassListManagement();
-
- /// <summary>
- /// Inserts the gravatar image of the sender to the bottom of the message
- /// </summary>
- void EnableGravatar();
-
- /// <summary>
- /// Adds an invisible image to the end of the email which can track e-mail opens.
- /// </summary>
- void EnableOpenTracking();
-
- /// <summary>
- /// Causes all links to be overwritten, shortened, and pointed to SendGrid's servers so clicks will be tracked.
- /// </summary>
- /// <param name="includePlainText">true if links found in plain text portions of the message are to be overwritten</param>
- void EnableClickTracking(bool includePlainText = false);
-
- /// <summary>
- /// Provides notification when emails are deteched that exceed a predefined spam threshold.
- /// </summary>
- /// <param name="score">
- /// Emails with a SpamAssassin score over this substitutionValues will be considered spam and not be
- /// delivered.
- /// </param>
- /// <param name="url">SendGridMessage will send an HTTP POST request to this url when a message is detected as spam</param>
- void EnableSpamCheck(int score = 5, String url = null);
-
- /// <summary>
- /// Allow's SendGridMessage to manage unsubscribes and ensure these users don't get future emails from the sender
- /// </summary>
- /// <param name="text">String for the plain text email body showing what you want the message to look like.</param>
- /// <param name="html">String for the HTML email body showing what you want the message to look like.</param>
- void EnableUnsubscribe(String text, String html);
-
- /// <summary>
- /// Allow's SendGridMessage to manage unsubscribes and ensure these users don't get future emails from the sender
- /// </summary>
- /// <param name="replace">Tag in the message body to be replaced with the unsubscribe link and message</param>
- void EnableUnsubscribe(String replace);
-
- /// <summary>
- /// Attaches a message at the footer of the email
- /// </summary>
- /// <param name="text">Message for the plain text body of the email</param>
- /// <param name="html">Message for the HTML body of the email</param>
- void EnableFooter(String text = null, String html = null);
-
- /// <summary>
- /// Re-writes links to integrate with Google Analytics
- /// </summary>
- /// <param name="source">Name of the referrer source (e.g. Google, SomeDomain.com, NewsletterA)</param>
- /// <param name="medium">Name of the marketing medium (e.g. Email)</param>
- /// <param name="term">Identify paid keywords</param>
- /// <param name="content">Use to differentiate ads</param>
- /// <param name="campaign">Name of the campaign</param>
- void EnableGoogleAnalytics(String source, String medium, String term, String content = null, String campaign = null);
-
- /// <summary>
- /// Wraps an HTML template around your email content.
- /// </summary>
- /// <param name="html">HTML that your emails will be wrapped in, containing a body replacementTag.</param>
- void EnableTemplate(String html = null);
-
- /// <summary>
- /// Enable a Template Engine template via the template ID
- /// </summary>
- /// <param name="template_id">The ID of the Template Engine template to use.</param>
- void EnableTemplateEngine(String templateId);
-
- /// <summary>
- /// Automatically sends a blind carbon copy to an address for every e-mail sent, without
- /// adding that address to the header.
- /// </summary>
- /// <param name="email">A single email recipient</param>
- void EnableBcc(String email = null);
-
- /// <summary>
- /// Enabing this app will bypass the normal unsubscribe / bounce / spam report checks
- /// and queue the e-mail for delivery.
- /// </summary>
- void EnableBypassListManagement();
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGridMail/Mail.csproj b/SendGrid/SendGridMail/Mail.csproj
deleted file mode 100644
index 85ee4a3..0000000
--- a/SendGrid/SendGridMail/Mail.csproj
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
- <SignAssembly>false</SignAssembly>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <DebugType>pdbonly</DebugType>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>TRACE, DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <RestorePackages>true</RestorePackages>
- <Prefer32Bit>false</Prefer32Bit>
- <BuildPackage>false</BuildPackage>
- <SignAssembly>false</SignAssembly>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)' == 'BuildNet45'">
- <SignAssembly>false</SignAssembly>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <DebugType>pdbonly</DebugType>
- <OutputPath>bin\BuildNet45\</OutputPath>
- <DefineConstants>TRACE, BUILD</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <RestorePackages>true</RestorePackages>
- <Prefer32Bit>false</Prefer32Bit>
- <BuildPackage>false</BuildPackage>
- <SignAssembly>false</SignAssembly>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)' == 'Release'">
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <DebugType>pdbonly</DebugType>
- <Optimize>True</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup>
- <ProjectGuid>{3C687BEF-FF50-44AD-8315-2D4237281AF8}</ProjectGuid>
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- <RestorePackages>true</RestorePackages>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <TargetFrameworkProfile />
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup>
- <OutputType>Library</OutputType>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyName>SendGridMail</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- <SignAssembly>true</SignAssembly>
- <DefineConstants>TRACE, RELEASE</DefineConstants>
- <DebugType>
- </DebugType>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'BuildNet45|AnyCPU' ">
- <Optimize>false</Optimize>
- <SignAssembly>false</SignAssembly>
- <DebugType>
- </DebugType>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <SignAssembly>false</SignAssembly>
- <Optimize>false</Optimize>
- <DebugType>
- </DebugType>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="SendGrid.SmtpApi, Version=1.3.1.0, Culture=neutral, PublicKeyToken=2ae73662c35d80e4, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\SendGrid.SmtpApi.1.3.1\lib\net40\SendGrid.SmtpApi.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Net" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Exceptions\InvalidApiRequestException.cs" />
- <Compile Include="ISendGrid.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="SendGrid.cs" />
- <Compile Include="Transport\ErrorChecker.cs" />
- <Compile Include="Transport\ITransport.cs" />
- <Compile Include="Transport\Web.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- <None Include="sendgrid-csharp.snk" />
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include=".NETFramework,Version=v4.0">
- <Visible>False</Visible>
- <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
- <Visible>False</Visible>
- <ProductName>Windows Installer 4.5</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <ItemGroup />
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/Properties/AssemblyInfo.cs b/SendGrid/SendGridMail/Properties/AssemblyInfo.cs
deleted file mode 100644
index 540b5e9..0000000
--- a/SendGrid/SendGridMail/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("SendGridMail")]
-[assembly: AssemblyDescription("A client library for interfacing with the SendGridMessage API")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("SendGridMessage")]
-[assembly: AssemblyProduct("SendGridMail")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("193fa200-8430-4206-aacd-2d2bb2dfa6cf")]
-
-#if (BUILD)
-[assembly: InternalsVisibleTo("Tests," + "" +
- "PublicKey=0024000004800000940000000602000000240000525341310004000001000100812ec26a66c8e0" +
- "8c790704ac4b46bcc9da9f4bca4da0ec7c06ce6dcd73baeb2c5525f36a237b253e80e16febb4c0" +
- "52f50734d5e1cf3bf478d9c88f0f69df53b47306419182983bc35c33c3bafb5e90b9bd7aa7b9a9" +
- "da09abe3667d50db891012e077e4b9aefe9799a58222fa67127c230219755d7670073c7463d90c" +
- "f9e79dba")]
-#elif (DEBUG)
-[assembly: InternalsVisibleTo("Tests," + "" +
- "PublicKey=0024000004800000940000000602000000240000525341310004000001000100812ec26a66c8e0" +
- "8c790704ac4b46bcc9da9f4bca4da0ec7c06ce6dcd73baeb2c5525f36a237b253e80e16febb4c0" +
- "52f50734d5e1cf3bf478d9c88f0f69df53b47306419182983bc35c33c3bafb5e90b9bd7aa7b9a9" +
- "da09abe3667d50db891012e077e4b9aefe9799a58222fa67127c230219755d7670073c7463d90c" +
- "f9e79dba")]
-#else
-[assembly: InternalsVisibleTo("Tests," + "" +
- "PublicKey=0024000004800000940000000602000000240000525341310004000001000100812ec26a66c8e0" +
- "8c790704ac4b46bcc9da9f4bca4da0ec7c06ce6dcd73baeb2c5525f36a237b253e80e16febb4c0" +
- "52f50734d5e1cf3bf478d9c88f0f69df53b47306419182983bc35c33c3bafb5e90b9bd7aa7b9a9" +
- "da09abe3667d50db891012e077e4b9aefe9799a58222fa67127c230219755d7670073c7463d90c" +
- "f9e79dba")]
-#endif
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-
-[assembly: AssemblyVersion("6.3.4")]
-[assembly: AssemblyFileVersion("6.3.4")] \ No newline at end of file
diff --git a/SendGrid/SendGridMail/SendGrid.cs b/SendGrid/SendGridMail/SendGrid.cs
deleted file mode 100644
index 1581f40..0000000
--- a/SendGrid/SendGridMail/SendGrid.cs
+++ /dev/null
@@ -1,550 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Net.Mail;
-using System.Net.Mime;
-using System.Text.RegularExpressions;
-using SendGrid.SmtpApi;
-
-namespace SendGrid
-{
- public class SendGridMessage : ISendGrid
- {
- #region constants/vars
-
- //apps list and settings
- private static readonly Dictionary<String, String> Filters = InitializeFilters();
- private readonly MailMessage _message;
- private static readonly Regex TemplateTest = new Regex(@"<%\s*body\s*%>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
- private static readonly Regex TextUnsubscribeTest = new Regex(@"<%\s*%>", RegexOptions.Compiled);
- private static readonly Regex HtmlUnsubscribeTest = new Regex(@"<%\s*([^\s%]+\s?)+\s*%>", RegexOptions.Compiled);
- private const string SinkHost = "sink.sendgrid.net";
-
- #endregion
-
- #region Initialization and Constructors
-
- /// <summary>
- /// Creates an instance of SendGrid's custom message object
- /// </summary>
- /// <returns></returns>
- public SendGridMessage() : this(new Header())
- {
-
- }
-
- public SendGridMessage(IHeader header)
- {
- _message = new MailMessage();
- Header = header;
- Headers = new Dictionary<string, string>();
- }
-
- public SendGridMessage(MailAddress from, MailAddress[] to,
- String subject, String html, String text, IHeader header = null) : this()
- {
- From = from;
- To = to;
-
- _message.Subject = subject;
-
- Text = text;
- Html = html;
- }
-
- private static Dictionary<string, string> InitializeFilters()
- {
- return
- new Dictionary<string, string>
- {
- {"Gravatar", "gravatar"},
- {"OpenTracking", "opentrack"},
- {"ClickTracking", "clicktrack"},
- {"SpamCheck", "spamcheck"},
- {"Unsubscribe", "subscriptiontrack"},
- {"Footer", "footer"},
- {"GoogleAnalytics", "ganalytics"},
- {"Template", "template"},
- {"Templates","templates"},
- {"Bcc", "bcc"},
- {"BypassListManagement", "bypass_list_management"}
- };
- }
-
- #endregion
-
- #region Properties
-
- public MailAddress From
- {
- get { return _message.From; }
- set { if (value != null) _message.From = value; }
- }
-
- public MailAddress[] ReplyTo
- {
- get { return _message.ReplyToList.ToArray(); }
- set
- {
- _message.ReplyToList.Clear();
- foreach (var replyTo in value)
- {
- _message.ReplyToList.Add(replyTo);
- }
- }
- }
-
- public MailAddress[] To
- {
- get
- {
- if (_sendToSink)
- {
- return _message.To
- .Select(ma => new MailAddress(string.Format("{0}_at_{1}@{2}", ma.User, ma.Host, SinkHost), ma.DisplayName))
- .ToArray();
- }
- return _message.To.ToArray();
- }
- set
- {
- _message.To.Clear();
- foreach (var mailAddress in value)
- {
- _message.To.Add(mailAddress);
- }
- }
- }
-
- public MailAddress[] Cc
- {
- get { return _message.CC.ToArray(); }
- set
- {
- _message.CC.Clear();
- foreach (var mailAddress in value)
- {
- _message.CC.Add(mailAddress);
- }
- }
- }
-
- public MailAddress[] Bcc
- {
- get { return _message.Bcc.ToArray(); }
- set
- {
- _message.Bcc.Clear();
- foreach (var mailAddress in value)
- {
- _message.Bcc.Add(mailAddress);
- }
- }
- }
-
- public String Subject
- {
- get { return _message.Subject; }
- set { if (value != null) _message.Subject = value; }
- }
-
- public Dictionary<String, String> Headers { get; set; }
- public IHeader Header { get; set; }
- public String Html { get; set; }
- public String Text { get; set; }
-
- #endregion
-
- #region Methods for setting data
-
- private List<String> _attachments = new List<String>();
- private Dictionary<String, MemoryStream> _streamedAttachments = new Dictionary<string, MemoryStream>();
- private Dictionary<String, String> _contentImages = new Dictionary<string, string>();
- private bool _sendToSink;
-
- public void AddTo(String address)
- {
- var mailAddress = new MailAddress(address);
- _message.To.Add(mailAddress);
- }
-
- public void AddTo(IEnumerable<String> addresses)
- {
- if (addresses == null) return;
-
- foreach (var address in addresses.Where(address => address != null))
- AddTo(address);
- }
-
- public void AddTo(IDictionary<String, IDictionary<String, String>> addresssInfo)
- {
- foreach (var mailAddress in from address in addresssInfo.Keys let table = addresssInfo[address] select new MailAddress(address, table.ContainsKey("DisplayName") ? table["DisplayName"] : null))
- {
- _message.To.Add(mailAddress);
- }
- }
-
- public void AddCc(string address)
- {
- var mailAddress = new MailAddress(address);
- _message.CC.Add(mailAddress);
- }
-
- public void AddCc(MailAddress address)
- {
- _message.CC.Add(address);
- }
-
- public void AddBcc(string address)
- {
- var mailAddress = new MailAddress(address);
- _message.Bcc.Add(mailAddress);
- }
-
- public void AddBcc(MailAddress address)
- {
- _message.Bcc.Add(address);
- }
-
- public Dictionary<String, MemoryStream> StreamedAttachments
- {
- get { return _streamedAttachments; }
- set { _streamedAttachments = value; }
- }
-
- public String[] Attachments
- {
- get { return _attachments.ToArray(); }
- set { _attachments = value.ToList(); }
- }
-
- public void EmbedImage(String filename, String cid) {
- _contentImages[filename] = cid;
- }
-
- public IDictionary<string, string> GetEmbeddedImages() {
- return new Dictionary<string, string>(_contentImages);
- }
-
- public void AddSubstitution(String replacementTag, List<String> substitutionValues)
- {
- //let the system complain if they do something bad, since the function returns null
- Header.AddSubstitution(replacementTag, substitutionValues);
- }
-
- public void AddSection(String replacementTag, String sectionValue)
- {
- Header.AddSection(replacementTag, sectionValue);
- }
-
- public void AddUniqueArgs(IDictionary<String, String> identifiers)
- {
- Header.AddUniqueArgs(identifiers);
- }
-
- public void SetAsmGroupId(int id)
- {
- Header.SetAsmGroupId(id);
- }
-
- public void SetIpPool(string pool)
- {
- Header.SetIpPool(pool);
- }
-
- public void SetSendAt(DateTime sendTime)
- {
- Header.SetSendAt(sendTime);
- }
-
- public void SetSendEachAt(IEnumerable<DateTime> sendTimes)
- {
- Header.SetSendEachAt(sendTimes);
- }
-
- public void SetCategory(String category)
- {
- Header.SetCategory(category);
- }
-
- public void SetCategories(IEnumerable<string> categories)
- {
- Header.SetCategories(categories);
- }
-
- public void AddAttachment(Stream stream, String name)
- {
- var ms = new MemoryStream();
- stream.CopyTo(ms);
- ms.Seek(0, SeekOrigin.Begin);
- StreamedAttachments[name] = ms;
- }
-
- public void EmbedStreamImage(Stream stream, String name)
- {
- var ms = new MemoryStream();
- stream.CopyTo(ms);
- ms.Seek(0, SeekOrigin.Begin);
- StreamedAttachments[name] = ms;
-
- _contentImages[name] = name;
- }
-
- public void AddAttachment(String filePath)
- {
- _attachments.Add(filePath);
- }
-
- public IEnumerable<String> GetRecipients()
- {
- var tos = _message.To.ToList();
- var ccs = _message.CC.ToList();
- var bccs = _message.Bcc.ToList();
-
- var rcpts = tos.Union(ccs.Union(bccs)).Select(address => address.Address);
- return rcpts;
- }
-
- public void AddHeaders(IDictionary<string, string> headers)
- {
- headers.Keys.ToList().ForEach(key => Headers[key] = headers[key]);
- }
-
- public void SendToSink(bool value = true)
- {
- _sendToSink = value;
- }
-
- #endregion
-
- #region SMTP API Functions
-
- public void DisableGravatar()
- {
- Header.DisableFilter(Filters["Gravatar"]);
- }
-
- public void DisableOpenTracking()
- {
- Header.DisableFilter(Filters["OpenTracking"]);
- }
-
- public void DisableClickTracking()
- {
- Header.DisableFilter(Filters["ClickTracking"]);
- }
-
- public void DisableSpamCheck()
- {
- Header.DisableFilter(Filters["SpamCheck"]);
- }
-
- public void DisableUnsubscribe()
- {
- Header.DisableFilter(Filters["Unsubscribe"]);
- }
-
- public void DisableFooter()
- {
- Header.DisableFilter(Filters["Footer"]);
- }
-
- public void DisableGoogleAnalytics()
- {
- Header.DisableFilter(Filters["GoogleAnalytics"]);
- }
-
- public void DisableTemplate()
- {
- Header.DisableFilter(Filters["Template"]);
- }
-
- public void DisableBcc()
- {
- Header.DisableFilter(Filters["Bcc"]);
- }
-
- public void DisableBypassListManagement()
- {
- Header.DisableFilter(Filters["BypassListManagement"]);
- }
-
- public void EnableGravatar()
- {
- Header.EnableFilter(Filters["Gravatar"]);
- }
-
- public void EnableOpenTracking()
- {
- Header.EnableFilter(Filters["OpenTracking"]);
- }
-
- public void EnableClickTracking(bool includePlainText = false)
- {
- var filter = Filters["ClickTracking"];
-
- Header.EnableFilter(filter);
- if (includePlainText)
- {
- Header.AddFilterSetting(filter, new List<string> {"enable_text"}, "1");
- }
- }
-
- public void EnableSpamCheck(int score = 5, string url = null)
- {
- var filter = Filters["SpamCheck"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"maxscore"}, score.ToString(CultureInfo.InvariantCulture));
- Header.AddFilterSetting(filter, new List<string> {"url"}, url);
- }
-
- public void EnableUnsubscribe(string text, string html)
- {
- var filter = Filters["Unsubscribe"];
-
- if (!TextUnsubscribeTest.IsMatch(text))
- {
- throw new Exception("Missing substitution replacementTag in text");
- }
-
- if (!HtmlUnsubscribeTest.IsMatch(html))
- {
- throw new Exception("Missing substitution replacementTag in html");
- }
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"text/plain"}, text);
- Header.AddFilterSetting(filter, new List<string> {"text/html"}, html);
- }
-
- public void EnableUnsubscribe(string replace)
- {
- var filter = Filters["Unsubscribe"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"replace"}, replace);
- }
-
- public void EnableFooter(string text = null, string html = null)
- {
- var filter = Filters["Footer"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"text/plain"}, text);
- Header.AddFilterSetting(filter, new List<string> {"text/html"}, html);
- }
-
- public void EnableGoogleAnalytics(string source, string medium, string term, string content = null,
- string campaign = null)
- {
- var filter = Filters["GoogleAnalytics"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"utm_source"}, source);
- Header.AddFilterSetting(filter, new List<string> {"utm_medium"}, medium);
- Header.AddFilterSetting(filter, new List<string> {"utm_term"}, term);
- Header.AddFilterSetting(filter, new List<string> {"utm_content"}, content);
- Header.AddFilterSetting(filter, new List<string> {"utm_campaign"}, campaign);
- }
-
- public void EnableTemplate(string html)
- {
- var filter = Filters["Template"];
-
- if (!TemplateTest.IsMatch(html))
- {
- throw new Exception("Missing <% body %> tag in template HTML");
- }
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"text/html"}, html);
- }
-
- public void EnableTemplateEngine(string templateId)
- {
- var filter = Filters["Templates"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> { "template_id" }, templateId);
- }
-
- public void EnableBcc(string email)
- {
- var filter = Filters["Bcc"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"email"}, email);
- }
-
- public void EnableBypassListManagement()
- {
- Header.EnableFilter(Filters["BypassListManagement"]);
- }
-
- #endregion
-
- public MailMessage CreateMimeMessage()
- {
- var smtpapi = Header.JsonString();
-
- if (!String.IsNullOrEmpty(smtpapi))
- _message.Headers.Add("X-Smtpapi", smtpapi);
-
- Headers.Keys.ToList().ForEach(k => _message.Headers.Add(k, Headers[k]));
-
- _message.Attachments.Clear();
- _message.AlternateViews.Clear();
-
- if (Attachments != null)
- {
- foreach (var attachment in Attachments)
- {
- _message.Attachments.Add(new Attachment(attachment, MediaTypeNames.Application.Octet));
- }
- }
-
- if (StreamedAttachments != null)
- {
- foreach (var attachment in StreamedAttachments)
- {
- attachment.Value.Position = 0;
- _message.Attachments.Add(new Attachment(attachment.Value, attachment.Key));
- }
- }
-
- if (Text != null)
- {
- var plainView = AlternateView.CreateAlternateViewFromString(Text, null, "text/plain");
- _message.AlternateViews.Add(plainView);
- }
-
- if (Html == null) return _message;
-
- var htmlView = AlternateView.CreateAlternateViewFromString(Html, null, "text/html");
- _message.AlternateViews.Add(htmlView);
-
- //message.SubjectEncoding = Encoding.GetEncoding(charset);
- //message.BodyEncoding = Encoding.GetEncoding(charset);
-
- return _message;
- }
-
- /// <summary>
- /// Helper function lets us look at the mime before it is sent
- /// </summary>
- /// <param name="directory">directory in which we store this mime message</param>
- internal void SaveMessage(String directory)
- {
- var client = new SmtpClient("localhost")
- {
- DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory,
- PickupDirectoryLocation = @"C:\temp"
- };
- var msg = CreateMimeMessage();
- client.Send(msg);
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGridMail/SendGridMail.pfx b/SendGrid/SendGridMail/SendGridMail.pfx
deleted file mode 100644
index 867e499..0000000
--- a/SendGrid/SendGridMail/SendGridMail.pfx
+++ /dev/null
Binary files differ
diff --git a/SendGrid/SendGridMail/StreamedFileBody.cs b/SendGrid/SendGridMail/StreamedFileBody.cs
deleted file mode 100644
index 125fe24..0000000
--- a/SendGrid/SendGridMail/StreamedFileBody.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-
-namespace SendGridMail
-{
- public class StreamedFileBody
- {
- private string _name;
- private string _filename;
- private byte[] _content;
-
- public StreamedFileBody(MemoryStream stream, String name)
- {
- if (stream == null) throw new ArgumentException("Invalid attachment stream");
- if (String.IsNullOrEmpty(name)) throw new ArgumentException("Invalid attachment name");
-
- _name = "files[" + Path.GetFileName(name) + "]";
- _filename = name;
- _content = stream.ToArray();
- }
-
- public byte[] GetContent(string boundry)
- {
- var bytes = new List<byte>();
-
- string paramBoundry = "--" + boundry + "\r\n";
- string stringParam = "Content-Disposition: form-data; name=\"" + _name + "\"; filename=\"" + _filename + "\"\r\n";
- string paramEnd = "Content-Type: image/png\r\n\r\n";
-
- bytes.AddRange(Encoding.ASCII.GetBytes(paramBoundry + stringParam + paramEnd));
- bytes.AddRange(_content);
- bytes.AddRange(Encoding.ASCII.GetBytes("\r\n"));
- return bytes.ToArray();
- }
- }
-}
diff --git a/SendGrid/SendGridMail/Transport/ErrorChecker.cs b/SendGrid/SendGridMail/Transport/ErrorChecker.cs
deleted file mode 100644
index 035d2b8..0000000
--- a/SendGrid/SendGridMail/Transport/ErrorChecker.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-namespace SendGrid
-{
- using System;
- using System.IO;
- using System.Net;
- using System.Net.Http;
- using System.Threading.Tasks;
- using System.Xml;
-
- using Exceptions;
-
- public static class ErrorChecker
- {
- public static void CheckForErrors(HttpResponseMessage response)
- {
- CheckForErrors(response, response.Content.ReadAsStreamAsync().Result);
- }
-
- public static async Task CheckForErrorsAsync(HttpResponseMessage response)
- {
- CheckForErrors(response, await response.Content.ReadAsStreamAsync());
- }
-
- private static void CheckForErrors(HttpResponseMessage response, Stream stream)
- {
- if (response.StatusCode != HttpStatusCode.OK)
- {
- using (var reader = XmlReader.Create(stream))
- {
- while (reader.Read())
- {
- if (!reader.IsStartElement())
- {
- continue;
- }
-
- switch (reader.Name)
- {
- case "result":
- continue;
- case "message":
- continue;
- case "errors":
- reader.ReadToFollowing("error");
- var message = reader.ReadElementContentAsString("error", reader.NamespaceURI);
- throw new InvalidApiRequestException(response.StatusCode, new[] { message }, response.ReasonPhrase);
- case "error":
- throw new ProtocolViolationException();
- default:
- throw new ArgumentException("Unknown element: " + reader.Name);
- }
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGridMail/Transport/ITransport.cs b/SendGrid/SendGridMail/Transport/ITransport.cs
deleted file mode 100644
index 94a2d7f..0000000
--- a/SendGrid/SendGridMail/Transport/ITransport.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Threading.Tasks;
-
-
-namespace SendGrid
-{
- /// <summary>
- /// Encapsulates the transport mechanism so that it can be used in a generic way,
- /// regardless of the transport type
- /// </summary>
- public interface ITransport
- {
- /// <summary>
- /// Asynchronously delivers a message using the protocol of the derived class
- /// </summary>
- /// <param name="message">the message to be delivered</param>
- Task DeliverAsync(ISendGrid message);
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGridMail/Transport/Web.cs b/SendGrid/SendGridMail/Transport/Web.cs
deleted file mode 100644
index dbf5d28..0000000
--- a/SendGrid/SendGridMail/Transport/Web.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Reflection;
-using System.Threading.Tasks;
-using SendGrid.SmtpApi;
-
-// ReSharper disable MemberCanBePrivate.Global
-namespace SendGrid
-{
- public class Web : ITransport
- {
- #region Properties
-
- //TODO: Make this configurable
- public const String Endpoint = "https://api.sendgrid.com/api/mail.send.xml";
- private readonly NetworkCredential _credentials;
- private readonly HttpClient _client;
- private readonly string _apiKey;
-
- #endregion
-
- /// <summary>
- /// Creates a new Web interface for sending mail
- /// </summary>
- /// <param name="apiKey">The API Key with which to send</param>
- public Web(string apiKey)
- : this(apiKey, null, TimeSpan.FromSeconds(100)) { }
-
- /// <summary>
- /// Creates a new Web interface for sending mail
- /// </summary>
- /// <param name="credentials">SendGridMessage user parameters</param>
- public Web(NetworkCredential credentials)
- : this(null, credentials, TimeSpan.FromSeconds(100)) { }
-
- /// <summary>
- /// Creates a new Web interface for sending mail.
- /// </summary>
- /// <param name="apKey">The API Key with which to send</param>
- /// <param name="credentials">SendGridMessage user parameters</param>
- /// <param name="httpTimeout">HTTP request timeout</param>
- public Web(string apiKey, NetworkCredential credentials, TimeSpan httpTimeout)
- {
- _credentials = credentials;
- _client = new HttpClient();
- _apiKey = apiKey;
-
- var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
- if (credentials == null)
- {
- _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _apiKey);
- }
- _client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "sendgrid/" + version + ";csharp");
- _client.Timeout = httpTimeout;
- }
-
- /// <summary>
- /// Asynchronously delivers a message over SendGrid's Web interface
- /// </summary>
- /// <param name="message"></param>
- public async Task DeliverAsync(ISendGrid message)
- {
- var content = new MultipartFormDataContent();
- AttachFormParams(message, content);
- AttachFiles(message, content);
- var response = await _client.PostAsync(Endpoint, content);
- await ErrorChecker.CheckForErrorsAsync(response);
- }
-
- #region Support Methods
-
- private void AttachFormParams(ISendGrid message, MultipartFormDataContent content)
- {
- var formParams = FetchFormParams(message);
- foreach (var keyValuePair in formParams)
- {
- content.Add(new StringContent(keyValuePair.Value), keyValuePair.Key);
- }
- }
-
- private void AttachFiles(ISendGrid message, MultipartFormDataContent content)
- {
- var files = FetchFileBodies(message);
- foreach (var file in files)
- {
- var fs = new FileStream(file.Key, FileMode.Open, FileAccess.Read);
- var fileContent = new StreamContent(fs);
-
- fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
- {
- Name = "files[" + Path.GetFileName(file.Key) + "]",
- FileName = Path.GetFileName(file.Key)
- };
-
- fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
- content.Add(fileContent);
- }
-
- var streamingFiles = FetchStreamingFileBodies(message);
- foreach (var file in streamingFiles)
- {
- var stream = file.Value;
- var fileContent = new StreamContent(stream);
-
- fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
- {
- Name = "files[" + Path.GetFileName(file.Key) + "]",
- FileName = Path.GetFileName(file.Key)
- };
-
- fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
- content.Add(fileContent);
- }
- }
-
- internal List<KeyValuePair<String, String>> FetchFormParams(ISendGrid message)
- {
- var result = new List<KeyValuePair<string, string>>
- {
- new KeyValuePair<String, String>("headers",
- message.Headers.Count == 0 ? null : Utils.SerializeDictionary(message.Headers)),
- new KeyValuePair<String, String>("replyto",
- message.ReplyTo.Length == 0 ? null : message.ReplyTo.ToList().First().Address),
- new KeyValuePair<String, String>("from", message.From.Address),
- new KeyValuePair<String, String>("fromname", message.From.DisplayName),
- new KeyValuePair<String, String>("subject", message.Subject),
- new KeyValuePair<String, String>("text", message.Text),
- new KeyValuePair<String, String>("html", message.Html),
- new KeyValuePair<String, String>("x-smtpapi", message.Header.JsonString() ?? "")
- };
-
- //If the API key is not specified, use the username and password
- if (_credentials != null)
- {
- var creds = new List<KeyValuePair<string, string>>
- {
- new KeyValuePair<string, string>("api_user", _credentials.UserName),
- new KeyValuePair<string, string>("api_key", _credentials.Password)
- };
- result.AddRange(creds);
- }
-
- if (message.To != null)
- {
- result = result.Concat(message.To.ToList().Select(a => new KeyValuePair<String, String>("to[]", a.Address)))
- .Concat(message.To.ToList().Select(a => new KeyValuePair<String, String>("toname[]", a.DisplayName)))
- .ToList();
- }
-
- if (message.Cc != null)
- {
- result.AddRange(message.Cc.Select(c => new KeyValuePair<string, string>("cc[]", c.Address)));
- }
-
- if (message.Bcc != null)
- {
- result.AddRange(message.Bcc.Select(c => new KeyValuePair<string, string>("bcc[]", c.Address)));
- }
-
- if (message.GetEmbeddedImages().Count > 0) {
- result = result.Concat(message.GetEmbeddedImages().ToList().Select(x => new KeyValuePair<String, String>(string.Format("content[{0}]", x.Key), x.Value)))
- .ToList();
- }
- return result.Where(r => !String.IsNullOrEmpty(r.Value)).ToList();
- }
-
- internal IEnumerable<KeyValuePair<string, MemoryStream>> FetchStreamingFileBodies(ISendGrid message)
- {
- return message.StreamedAttachments.Select(kvp => kvp).ToList();
- }
-
- internal List<KeyValuePair<String, FileInfo>> FetchFileBodies(ISendGrid message)
- {
- return message.Attachments == null
- ? new List<KeyValuePair<string, FileInfo>>()
- : message.Attachments.Select(name => new KeyValuePair<String, FileInfo>(name, new FileInfo(name))).ToList();
- }
-
- #endregion
- }
-}
diff --git a/SendGrid/SendGridMail/Web/IWebApi.cs b/SendGrid/SendGridMail/Web/IWebApi.cs
deleted file mode 100644
index 52d4cb2..0000000
--- a/SendGrid/SendGridMail/Web/IWebApi.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace SendGridMail.Web
-{
- interface IWebApi
- {
- String user { get; set; }
- String pass { get; set; }
-
- String GetBounces(int date, String days, DateTime start_date, DateTime end_date, int limit, int offset, int type, String email);
- void DeleteBounces(DateTime start_date, DateTime end_date, String type, String email);
- String GetBlocks(int days, DateTime start_date, DateTime end_date, String email);
- void DeleteBlocks(String email);
- String GetEmailParse(String hostname, String url);
- void SetEmailParse(String hostname, String url);
- void EditEmailParse(String hostname, String url);
- void DeleteEmailParse(String hostname);
- String GetNotificationUrl();
- void SetNotificationUrl(String url);
- void DeleteNotificationUrl();
- String GetFilter();
- void ActivateFilter(String name);
- void DeactivateFilter(String name);
- void SetupFilter(String user, String password, Dictionary<String, String> args);
- String GetFilterSettings(String name);
- void GetInvalidEmails(int date, int days, DateTime start_date, DateTime end_date, int limit, int offset, String email);
- void DeleteInvalidEmails(DateTime start_date, DateTime end_date, String email);
- String CountInvalidEmails(DateTime start_date, DateTime end_date);
- String GetProfile();
- void UpdateProfile(String First_name, String last_name, String address, String city, String state, String country, int zip, int phone, String website);
- void SetUsername(String username);
- void SetPassword(String password, String confpass);
- void SetEmail(String email);
- String GetSpamReports(int date, int days, DateTime start_date, DateTime end_date, int limit, int offset, String email);
- void DeleteSpamReports(DateTime start_date, DateTime end_date, String email);
- String GetStats(int days, DateTime start_date, DateTime end_date);
- String GetAggregateStats();
- String GetCategoryStats();
- String GetCategoryStats(String category, int days, DateTime start_date, DateTime end_date);
- String GetUnsubscribes(int date, int days, DateTime start_date, DateTime end_date, int limit, int offset, String email);
- void DeleteUnsubscribes(DateTime start_date, DateTime end_date, String email);
- void AddUnsubscribes(String email);
- }
-}
diff --git a/SendGrid/SendGridMail/app.config b/SendGrid/SendGridMail/app.config
deleted file mode 100644
index 67113e6..0000000
--- a/SendGrid/SendGridMail/app.config
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-</configuration> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/nuget/Sendgrid.2.1.1.nuspec b/SendGrid/SendGridMail/nuget/Sendgrid.2.1.1.nuspec
deleted file mode 100644
index a6cc5f9..0000000
--- a/SendGrid/SendGridMail/nuget/Sendgrid.2.1.1.nuspec
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
- <metadata>
- <id>Sendgrid</id>
- <version>2.1.1</version>
- <title>SendGrid</title>
- <authors>CJ Buchmann, Tyler Bischel, Eric Becking, Brandon West</authors>
- <owners>CJ Buchmann, Tyler Bischel, Eric Becking, Brandon West</owners>
- <licenseUrl>https://github.com/sendgrid/sendgrid-csharp/blob/master/MIT.LICENSE</licenseUrl>
- <projectUrl>https://github.com/sendgrid/sendgrid-csharp</projectUrl>
- <requireLicenseAcceptance>false</requireLicenseAcceptance>
- <description>Basic C# client library and examples for using SendGrid API's to send mail. Github repo located at : https://github.com/sendgrid/sendgrid-csharp</description>
- <releaseNotes>BREAKING CHANGE: Deprecates SMTP transport and adds dependency on smtpapi package for building headers.
-
-For an example of how to continue using SMTP, see https://github.com/sendgrid/smtpapi-csharp</releaseNotes>
- <copyright>Copyright 2014</copyright>
- <tags>SendGrid Email Mail Microsoft Azure</tags>
- <dependencies>
- <dependency id="Microsoft.Net.Http" version="2.2.13" />
- <dependency id="Microsoft.Bcl.Async" version="1.0.16" />
- <dependency id="smtpapi" version="1.0.0" />
- </dependencies>
- </metadata>
-</package> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/nuget/lib/SendGridMail.dll b/SendGrid/SendGridMail/nuget/lib/SendGridMail.dll
deleted file mode 100644
index 47d8c95..0000000
--- a/SendGrid/SendGridMail/nuget/lib/SendGridMail.dll
+++ /dev/null
Binary files differ
diff --git a/SendGrid/SendGridMail/packages.config b/SendGrid/SendGridMail/packages.config
deleted file mode 100644
index 030933b..0000000
--- a/SendGrid/SendGridMail/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="SendGrid.SmtpApi" version="1.3.1" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/sendgrid-csharp.snk b/SendGrid/SendGridMail/sendgrid-csharp.snk
deleted file mode 100644
index aff2944..0000000
--- a/SendGrid/SendGridMail/sendgrid-csharp.snk
+++ /dev/null
Binary files differ
diff --git a/SendGrid/Tests/Properties/AssemblyInfo.cs b/SendGrid/Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8b518a9..0000000
--- a/SendGrid/Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Tests")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("ce0ad7f8-ecce-46c6-a057-f7aa74bb3518")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-
-[assembly: AssemblyVersion("1.2.0")]
-[assembly: AssemblyFileVersion("1.2.0")] \ No newline at end of file
diff --git a/SendGrid/Tests/TestSendgrid.cs b/SendGrid/Tests/TestSendgrid.cs
deleted file mode 100644
index 3ce0c6e..0000000
--- a/SendGrid/Tests/TestSendgrid.cs
+++ /dev/null
@@ -1,418 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net.Mail;
-using NUnit.Framework;
-using SendGrid.SmtpApi;
-using SendGrid;
-
-namespace Tests
-{
- [TestFixture]
- internal class TestSendgrid
- {
- [Test]
- public void CreateMimeMessage()
- {
- var message = new SendGridMessage();
- var attachment = Path.GetTempFileName();
- var text = "this is a test";
- var html = "<b>This<\b> is a better test";
- var headers = new KeyValuePair<String, String>("custom", "header");
- message.AddAttachment(attachment);
- message.Text = text;
- message.Html = html;
- message.AddTo("foo@bar.com");
- message.From = new MailAddress("foo@bar.com");
- message.AddHeaders(new Dictionary<string, string> {{headers.Key, headers.Value}});
- message.EnableGravatar();
-
- var mime = message.CreateMimeMessage();
-
- var sr = new StreamReader(mime.AlternateViews[0].ContentStream);
- var result = sr.ReadToEnd();
- Assert.AreEqual(text, result);
-
- sr = new StreamReader(mime.AlternateViews[1].ContentStream);
- result = sr.ReadToEnd();
- Assert.AreEqual(html, result);
-
- result = mime.Headers.Get(headers.Key);
- Assert.AreEqual(headers.Value, result);
-
- result = mime.Headers.Get("X-Smtpapi");
- var expected = "{\"filters\" : {\"gravatar\" : {\"settings\" : {\"enable\" : \"1\"}}}}";
- Assert.AreEqual(expected, result);
-
- result = mime.Attachments[0].Name;
- Assert.AreEqual(Path.GetFileName(attachment), result);
- }
-
- [Test]
- public void DisableBcc()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableBcc();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"bcc\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void DisableBypassListManagement()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableBypassListManagement();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"bypass_list_management\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void DisableClickTracking()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableClickTracking();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"clicktrack\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void DisableFooter()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableFooter();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"footer\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void DisableGoogleAnalytics()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableGoogleAnalytics();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"ganalytics\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void DisableSpamCheck()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableSpamCheck();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"spamcheck\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void DisableTemplate()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableTemplate();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"template\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void DisableUnsubscribe()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableUnsubscribe();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"subscriptiontrack\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void EnableBcc()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- var email = "somebody@someplace.com";
- sendgrid.EnableBcc(email);
-
- var json = header.JsonString();
- Assert.AreEqual(
- "{\"filters\" : {\"bcc\" : {\"settings\" : {\"enable\" : \"1\",\"email\" : \"" + email + "\"}}}}",
- json);
- }
-
- [Test]
- public void EnableBypassListManagement()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.EnableBypassListManagement();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"bypass_list_management\" : {\"settings\" : {\"enable\" : \"1\"}}}}", json);
- }
-
- [Test]
- public void EnableClickTracking()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
- sendgrid.EnableClickTracking(true);
-
- var json = header.JsonString();
- Assert.AreEqual(
- "{\"filters\" : {\"clicktrack\" : {\"settings\" : {\"enable\" : \"1\",\"enable_text\" : \"1\"}}}}",
- json);
- }
-
- [Test]
- public void EnableFooter()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- var text = "My Text";
- var html = "<body><p>hello, <% name %></p></body>";
- var escHtml = "<body><p>hello, <% name %><\\/p><\\/body>";
-
- sendgrid.EnableFooter(text, html);
-
- var json = header.JsonString();
- Assert.AreEqual(
- "{\"filters\" : {\"footer\" : {\"settings\" : {\"enable\" : \"1\",\"text\\/plain\" : \"" + text +
- "\",\"text\\/html\" : \"" + escHtml + "\"}}}}", json);
- }
-
- [Test]
- public void EnableGoogleAnalytics()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- var source = "SomeDomain.com";
- var medium = "Email";
- var term = "keyword1, keyword2, keyword3";
- var content = "PG, PG13";
- var campaign = "my_campaign";
-
- sendgrid.EnableGoogleAnalytics(source, medium, term, content, campaign);
-
- var jsonSource = "\"utm_source\" : \"SomeDomain.com\"";
- var jsonMedium = "\"utm_medium\" : \"" + medium + "\"";
- var jsonTerm = "\"utm_term\" : \"" + term + "\"";
- var jsonContent = "\"utm_content\" : \"" + content + "\"";
- var jsonCampaign = "\"utm_campaign\" : \"" + campaign + "\"";
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"ganalytics\" : {\"settings\" : {\"enable\" : \"1\"," +
- jsonSource + "," + jsonMedium + "," + jsonTerm + "," + jsonContent + "," + jsonCampaign +
- "}}}}",
- json);
- }
-
- [Test]
- public void EnableGravatar()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.EnableGravatar();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"gravatar\" : {\"settings\" : {\"enable\" : \"1\"}}}}", json);
- }
-
- [Test]
- public void EnableOpenTracking()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.EnableOpenTracking();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"opentrack\" : {\"settings\" : {\"enable\" : \"1\"}}}}", json);
- }
-
- [Test]
- public void EnableSpamCheck()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- var score = 5;
- var url = "http://www.example.com";
- sendgrid.EnableSpamCheck(score, url);
-
- var json = header.JsonString();
- Assert.AreEqual(
- "{\"filters\" : {\"spamcheck\" : {\"settings\" : {\"enable\" : \"1\",\"maxscore\" : \"5\",\"url\" : \"http:\\/\\/www.example.com\"}}}}",
- json);
- }
-
- [Test]
- public void EnableTemplate()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
- var html = "<% body %>";
-
- var escHtml = "<% body %>";
- sendgrid.EnableTemplate(html);
-
- var json = header.JsonString();
- Assert.AreEqual(
- "{\"filters\" : {\"template\" : {\"settings\" : {\"enable\" : \"1\",\"text\\/html\" : \"" + escHtml +
- "\"}}}}", json);
-
- escHtml = "bad";
- Assert.Throws<Exception>(() => sendgrid.EnableTemplate(escHtml));
- }
-
- [Test]
- public void EnableUnsubscribe()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- var text = "<% %>";
- var html = "<% name %>";
-
- var jsonText = "\"text\\/plain\" : \"" + text + "\"";
- var jsonHtml = "\"text\\/html\" : \"" + html + "\"";
-
- sendgrid.EnableUnsubscribe(text, html);
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"subscriptiontrack\" : {\"settings\" : {\"enable\" : \"1\"," +
- jsonText + "," + jsonHtml + "}}}}", json);
-
- header = new Header();
- sendgrid = new SendGridMessage(header);
-
- var replace = "John";
- var jsonReplace = "\"replace\" : \"" + replace + "\"";
-
- sendgrid.EnableUnsubscribe(replace);
-
- json = header.JsonString();
- Assert.AreEqual(
- "{\"filters\" : {\"subscriptiontrack\" : {\"settings\" : {\"enable\" : \"1\"," + jsonReplace + "}}}}",
- json);
-
- text = "bad";
- html = "<% name %>";
- Assert.Throws<Exception>(() => sendgrid.EnableUnsubscribe(text, html));
-
- text = "<% %>";
- html = "bad";
- Assert.Throws<Exception>(() => sendgrid.EnableUnsubscribe(text, html));
- }
-
- [Test]
- public void TestDisableGravatar()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableGravatar();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"gravatar\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void TestDisableOpenTracking()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.DisableOpenTracking();
-
- var json = header.JsonString();
- Assert.AreEqual("{\"filters\" : {\"opentrack\" : {\"settings\" : {\"enable\" : \"0\"}}}}", json);
- }
-
- [Test]
- public void TestAddSection()
- {
- var header = new Header();
- var sendgrid = new SendGridMessage(header);
-
- sendgrid.AddSection("tag", "value");
-
- var json = header.JsonString();
- Assert.AreEqual("{\"section\" : {\"tag\" : \"value\"}}", json);
- }
-
- [Test]
- public void TestSendToSink()
- {
- // Arrange
-
- var message = new SendGridMessage();
- message.To = new[]
- {
- new MailAddress("foo@bar.com", "Foo Bar"),
- };
- message.AddTo("foo1@bar1.com");
-
- // Act
-
- message.SendToSink();
-
- // Assert
-
- Assert.AreEqual("foo_at_bar.com@sink.sendgrid.net", message.To[0].Address);
- Assert.AreEqual("Foo Bar", message.To[0].DisplayName);
-
- Assert.AreEqual("foo1_at_bar1.com@sink.sendgrid.net", message.To[1].Address);
- Assert.AreEqual("", message.To[1].DisplayName);
- }
-
- [Test]
- public void TestSendToSinkOff()
- {
- // Arrange
-
- var message = new SendGridMessage();
- message.To = new[]
- {
- new MailAddress("foo@bar.com", "Foo Bar"),
- };
- message.AddTo("foo1@bar1.com");
- message.SendToSink();
-
- // Act
-
- message.SendToSink(false);
-
- // Assert
-
- Assert.AreEqual("foo@bar.com", message.To[0].Address);
- Assert.AreEqual("Foo Bar", message.To[0].DisplayName);
-
- Assert.AreEqual("foo1@bar1.com", message.To[1].Address);
- Assert.AreEqual("", message.To[1].DisplayName);
- }
- }
-}
diff --git a/SendGrid/Tests/Tests.csproj b/SendGrid/Tests/Tests.csproj
deleted file mode 100644
index ff31ea6..0000000
--- a/SendGrid/Tests/Tests.csproj
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup Condition=" '$(Configuration)' == 'BuildNet45' ">
- <SignAssembly>false</SignAssembly>
- <DebugSymbols>True</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>False</Optimize>
- <OutputPath>bin\BuildNet45\</OutputPath>
- <DefineConstants>BUILD;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>True</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>False</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>TRACE, DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- <Optimize>True</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- <RestorePackages>true</RestorePackages>
- <ProjectGuid>{0319E73A-7039-4858-B047-1EDF88BB6BD1}</ProjectGuid>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <TargetFrameworkProfile />
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>Tests</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'BuildNet45|AnyCPU'">
- <DefineConstants>TRACE, BUILD</DefineConstants>
- <SignAssembly>false</SignAssembly>
- </PropertyGroup>
- <PropertyGroup>
- <OutputType>Library</OutputType>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- <Reference Include="Moq">
- <HintPath>..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll</HintPath>
- </Reference>
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
- <Private>True</Private>
- </Reference>
- <Reference Include="nunit.core, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" Condition="'$(OS)' != 'Unix'">
- <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="nunit.core.interfaces, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" Condition="'$(OS)' != 'Unix'">
- <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="nunit.framework">
- <HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="nunit.util, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" Condition="'$(OS)' != 'Unix'">
- <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="NUnit.VisualStudio.TestAdapter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4cb40d35494691ac, processorArchitecture=MSIL" Condition="'$(OS)' != 'Unix'">
- <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="SendGrid.SmtpApi">
- <HintPath>..\packages\SendGrid.SmtpApi.1.3.1\lib\net40\SendGrid.SmtpApi.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Net" />
- <Reference Include="System.Net.Http" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="TestSendgrid.cs" />
- <Compile Include="Transport\TestErrorChecker.cs" />
- <Compile Include="Transport\TestWebApi.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config">
- <SubType>Designer</SubType>
- </None>
- <None Include="packages.config">
- <SubType>Designer</SubType>
- </None>
- <None Include="sendgrid-csharp.snk" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\SendGridMail\Mail.csproj">
- <Project>{3C687BEF-FF50-44AD-8315-2D4237281AF8}</Project>
- <Name>Mail</Name>
- </ProjectReference>
- <ProjectReference Include="..\SendGrid\SendGrid.csproj">
- <Project>{1c318867-440b-4eb9-99e3-c0cc2c556962}</Project>
- <Name>SendGrid</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
-</Project> \ No newline at end of file
diff --git a/SendGrid/Tests/Transport/TestErrorChecker.cs b/SendGrid/Tests/Transport/TestErrorChecker.cs
deleted file mode 100644
index f178064..0000000
--- a/SendGrid/Tests/Transport/TestErrorChecker.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-namespace Transport
-{
- #region Using Directives
-
- using System;
- using System.Net;
- using System.Net.Http;
-
- using Exceptions;
-
- using NUnit.Framework;
-
- using SendGrid;
-
- #endregion
-
- [TestFixture]
- public class TestErrorChecker
- {
- private const string BadUsernameOrPasswordResponseMessage = "<result><message>error</message><errors><error>Bad username / password</error></errors></result>";
-
- [Test]
- [ExpectedException(typeof(InvalidApiRequestException))]
- public void WhenHttpResponseContainsBadUserErrorItIsDetectedAndAInvalidApiRequestIsThrown()
- {
- var response = new HttpResponseMessage(HttpStatusCode.BadRequest)
- {
- Content = new StringContent(BadUsernameOrPasswordResponseMessage)
- };
-
- ErrorChecker.CheckForErrors(response);
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/Tests/Transport/TestWebApi.cs b/SendGrid/Tests/Transport/TestWebApi.cs
deleted file mode 100644
index ecb1ad8..0000000
--- a/SendGrid/Tests/Transport/TestWebApi.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Net.Mail;
-using Moq;
-using NUnit.Framework;
-using SendGrid;
-
-namespace Transport
-{
- [TestFixture]
- internal class TestWebApi
- {
- private const string TestUsername = "username";
- private const string TestPassword = "password";
- private const string TestApiKey = "apikey";
-
- [Test]
- public void TestFetchFileBodies()
- {
- TestFetchFileBodiesHelper(new Web(new NetworkCredential(TestUsername, TestPassword)));
- TestFetchFileBodiesHelper(new Web(TestApiKey));
- }
-
- public void TestFetchFileBodiesHelper(Web webApi)
- {
- // Test using credentials
- var message = new Mock<ISendGrid>();
- var attachments = new[] {"foo", "bar", "foobar"};
- message.SetupProperty(foo => foo.Attachments, null);
- var result = webApi.FetchFileBodies(message.Object);
- Assert.AreEqual(0, result.Count);
-
- message.SetupProperty(foo => foo.Attachments, attachments);
- result = webApi.FetchFileBodies(message.Object);
- Assert.AreEqual(attachments.Count(), result.Count);
- for (var index = 0; index < attachments.Length; index++)
- Assert.AreEqual(result[index].Value.Name, attachments[index]);
- }
-
- [Test]
- public void TestFetchFormParams()
- {
- TestFetchFormParamsHelper(new Web(new NetworkCredential(TestUsername, TestPassword)), true);
- TestFetchFormParamsHelper(new Web(TestApiKey), false);
- }
-
- public void TestFetchFormParamsHelper(Web webApi, bool credentials)
- {
- // Test Variables
- const string toAddress = "foobar@outlook.com";
- const string ccAddress = "cc@outlook.com";
- const string bcc1Address = "bcc1@outlook.com";
- const string bcc2Address = "bcc2@outlook.com";
- MailAddress[] bccAddresses = {new MailAddress(bcc1Address), new MailAddress(bcc2Address)};
- const string fromAddress = "test@outlook.com";
- const string subject = "Test Subject";
- const string textBody = "Test Text Body";
- const string htmlBody = "<p>Test HTML Body</p>";
- const string headerKey = "headerkey";
- var testHeader = new Dictionary<string, string> { { headerKey, "headervalue" } };
- const string categoryName = "Example Category";
-
- var message = new SendGridMessage();
- message.AddTo(toAddress);
- message.AddCc(ccAddress);
- message.Bcc = bccAddresses;
- message.From = new MailAddress(fromAddress);
- message.Subject = subject;
- message.Text = textBody;
- message.Html = htmlBody;
- message.AddHeaders(testHeader);
- message.Header.SetCategory(categoryName);
-
- var result = webApi.FetchFormParams(message);
- if (credentials)
- {
- Assert.True(result.Any(r => r.Key == "api_user" && r.Value == TestUsername));
- Assert.True(result.Any(r => r.Key == "api_key" && r.Value == TestPassword));
- }
- Assert.True(result.Any(r => r.Key == "to[]" && r.Value == toAddress));
- Assert.True(result.Any(r => r.Key == "cc[]" && r.Value == ccAddress));
- Assert.True(result.Any(r => r.Key == "bcc[]" && r.Value == bcc1Address));
- Assert.True(result.Any(r => r.Key == "bcc[]" && r.Value == bcc2Address));
- Assert.True(result.Any(r => r.Key == "from" && r.Value == fromAddress));
- Assert.True(result.Any(r => r.Key == "subject" && r.Value == subject));
- Assert.True(result.Any(r => r.Key == "text" && r.Value == textBody));
- Assert.True(result.Any(r => r.Key == "html" && r.Value == htmlBody));
- Assert.True(
- result.Any(
- r => r.Key == "headers" && r.Value == String.Format("{{\"{0}\":\"{1}\"}}", headerKey, testHeader[headerKey])));
- Assert.True(
- result.Any(r => r.Key == "x-smtpapi" && r.Value == String.Format("{{\"category\" : \"{0}\"}}", categoryName)));
- }
- }
-}
diff --git a/SendGrid/Tests/app.config b/SendGrid/Tests/app.config
deleted file mode 100644
index 199cd2d..0000000
--- a/SendGrid/Tests/app.config
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
- <startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
- </startup>
-</configuration> \ No newline at end of file
diff --git a/SendGrid/Tests/packages.config b/SendGrid/Tests/packages.config
deleted file mode 100644
index 8b08e52..0000000
--- a/SendGrid/Tests/packages.config
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Moq" version="4.2.1402.2112" targetFramework="net4" />
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
- <package id="NUnit" version="2.6.3" targetFramework="net4" />
- <package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" />
- <package id="SendGrid.SmtpApi" version="1.3.1" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/SendGrid/Tests/sendgrid-csharp.snk b/SendGrid/Tests/sendgrid-csharp.snk
deleted file mode 100644
index aff2944..0000000
--- a/SendGrid/Tests/sendgrid-csharp.snk
+++ /dev/null
Binary files differ
diff --git a/SendGrid/UnitTest/Properties/AssemblyInfo.cs b/SendGrid/UnitTest/Properties/AssemblyInfo.cs
index 8eb53f6..ba41e5e 100644
--- a/SendGrid/UnitTest/Properties/AssemblyInfo.cs
+++ b/SendGrid/UnitTest/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UnitTest")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -25,12 +25,12 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("7.0.0.0")]
+[assembly: AssemblyFileVersion("7.0.0.0")]
diff --git a/SendGrid/UnitTest/UnitTest.cs b/SendGrid/UnitTest/UnitTest.cs
index 11f55cd..67bcf30 100644
--- a/SendGrid/UnitTest/UnitTest.cs
+++ b/SendGrid/UnitTest/UnitTest.cs
@@ -1,282 +1,5013 @@
using System;
-using System.Net;
-using System.Net.Http;
-using System.Threading.Tasks;
using NUnit.Framework;
-using Newtonsoft.Json.Linq;
-using SendGrid;
-using Newtonsoft.Json;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+using System.Net;
namespace UnitTest
{
+ // Test the building of the v3/mail/send request body
[TestFixture]
- public class APIKeys
+ public class Mail
{
- static string _baseUri = "https://api.sendgrid.com/";
static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
- public Client client = new Client(_apiKey, _baseUri);
- private static string _api_key_id = "";
+ public dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+ // Base case for sending an email
[Test]
- public void ApiKeysIntegrationTest()
+ public void TestHelloEmail()
{
- TestGet();
- TestPost();
- TestPatch();
- TestDelete();
+ SendGrid.Helpers.Mail.Mail mail = new SendGrid.Helpers.Mail.Mail();
+
+ Email email = new Email();
+ email.Address = "test@example.com";
+ mail.From = email;
+
+ Personalization personalization = new Personalization();
+ email = new Email();
+ email.Address = "test@example.com";
+ personalization.AddTo(email);
+ mail.AddPersonalization(personalization);
+
+ mail.Subject = "Hello World from the SendGrid CSharp Library";
+
+ Content content = new Content();
+ content.Type = "text/plain";
+ content.Value = "Textual content";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/html";
+ content.Value = "<html><body>HTML content</body></html>";
+ mail.AddContent(content);
+
+ String ret = mail.Get();
+ Assert.AreEqual(ret, "{\"from\":{\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"email\":\"test@example.com\"}]}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"}]}");
}
- private void TestGet()
+ // All paramaters available for sending an email
+ [Test]
+ public void TestKitchenSink()
{
- HttpResponseMessage response = client.ApiKeys.Get().Result;
- Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- string jsonString = jsonObject.result.ToString();
- Assert.IsNotNull(jsonString);
+ SendGrid.Helpers.Mail.Mail mail = new SendGrid.Helpers.Mail.Mail();
+
+ Email email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ mail.From = email;
+
+ mail.Subject = "Hello World from the SendGrid CSharp Library";
+
+ Personalization personalization = new Personalization();
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddBcc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddBcc(email);
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Example User");
+ personalization.AddSubstitution("%city%", "Denver");
+ personalization.AddCustomArgs("marketing", "false");
+ personalization.AddCustomArgs("transactional", "true");
+ personalization.SendAt = 1461775051;
+ mail.AddPersonalization(personalization);
+
+ personalization = new Personalization();
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddBcc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddBcc(email);
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Example User");
+ personalization.AddSubstitution("%city%", "Denver");
+ personalization.AddCustomArgs("marketing", "false");
+ personalization.AddCustomArgs("transactional", "true");
+ personalization.SendAt = 1461775051;
+ mail.AddPersonalization(personalization);
+
+ Content content = new Content();
+ content.Type = "text/plain";
+ content.Value = "Textual content";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/html";
+ content.Value = "<html><body>HTML content</body></html>";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/calendar";
+ content.Value = "Party Time!!";
+ mail.AddContent(content);
+
+ Attachment attachment = new Attachment();
+ attachment.Content = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12";
+ attachment.Type = "application/pdf";
+ attachment.Filename = "balance_001.pdf";
+ attachment.Disposition = "attachment";
+ attachment.ContentId = "Balance Sheet";
+ mail.AddAttachment(attachment);
+
+ attachment = new Attachment();
+ attachment.Content = "BwdW";
+ attachment.Type = "image/png";
+ attachment.Filename = "banner.png";
+ attachment.Disposition = "inline";
+ attachment.ContentId = "Banner";
+ mail.AddAttachment(attachment);
+
+ mail.TemplateId = "13b8f94f-bcae-4ec6-b752-70d6cb59f932";
+
+ mail.AddHeader("X-Day", "Monday");
+ mail.AddHeader("X-Month", "January");
+
+ mail.AddSection("%section1", "Substitution for Section 1 Tag");
+ mail.AddSection("%section2", "Substitution for Section 2 Tag");
+
+ mail.AddCategory("customer");
+ mail.AddCategory("vip");
+
+ mail.AddCustomArgs("campaign", "welcome");
+ mail.AddCustomArgs("sequence", "2");
+
+ ASM asm = new ASM();
+ asm.GroupId = 3;
+ List<int> groups_to_display = new List<int>()
+ {
+ 1, 4, 5
+ };
+ asm.GroupsToDisplay = groups_to_display;
+ mail.Asm = asm;
+
+ mail.SendAt = 1461775051;
+
+ mail.SetIpPoolId = "23";
+
+ // This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)
+ // mail.BatchId = "some_batch_id";
+
+ MailSettings mailSettings = new MailSettings();
+ BCCSettings bccSettings = new BCCSettings();
+ bccSettings.Enable = true;
+ bccSettings.Email = "test@example.com";
+ mailSettings.BccSettings = bccSettings;
+ BypassListManagement bypassListManagement = new BypassListManagement();
+ bypassListManagement.Enable = true;
+ mailSettings.BypassListManagement = bypassListManagement;
+ FooterSettings footerSettings = new FooterSettings();
+ footerSettings.Enable = true;
+ footerSettings.Text = "Some Footer Text";
+ footerSettings.Html = "<bold>Some HTML Here</bold>";
+ mailSettings.FooterSettings = footerSettings;
+ SandboxMode sandboxMode = new SandboxMode();
+ sandboxMode.Enable = true;
+ mailSettings.SandboxMode = sandboxMode;
+ SpamCheck spamCheck = new SpamCheck();
+ spamCheck.Enable = true;
+ spamCheck.Threshold = 1;
+ spamCheck.PostToUrl = "https://gotchya.example.com";
+ mailSettings.SpamCheck = spamCheck;
+ mail.MailSettings = mailSettings;
+
+ TrackingSettings trackingSettings = new TrackingSettings();
+ ClickTracking clickTracking = new ClickTracking();
+ clickTracking.Enable = true;
+ clickTracking.EnableText = false;
+ trackingSettings.ClickTracking = clickTracking;
+ OpenTracking openTracking = new OpenTracking();
+ openTracking.Enable = true;
+ openTracking.SubstitutionTag = "Optional tag to replace with the open image in the body of the message";
+ trackingSettings.OpenTracking = openTracking;
+ SubscriptionTracking subscriptionTracking = new SubscriptionTracking();
+ subscriptionTracking.Enable = true;
+ subscriptionTracking.Text = "text to insert into the text/plain portion of the message";
+ subscriptionTracking.Html = "<bold>HTML to insert into the text/html portion of the message</bold>";
+ subscriptionTracking.SubstitutionTag = "text to insert into the text/plain portion of the message";
+ trackingSettings.SubscriptionTracking = subscriptionTracking;
+ Ganalytics ganalytics = new Ganalytics();
+ ganalytics.Enable = true;
+ ganalytics.UtmCampaign = "some campaign";
+ ganalytics.UtmContent = "some content";
+ ganalytics.UtmMedium = "some medium";
+ ganalytics.UtmSource = "some source";
+ ganalytics.UtmTerm = "some term";
+ trackingSettings.Ganalytics = ganalytics;
+ mail.TrackingSettings = trackingSettings;
+
+ email = new Email();
+ email.Address = "test@example.com";
+ mail.ReplyTo = email;
+
+ String ret = mail.Get();
+ Assert.AreEqual(ret, "{\"from\":{\"name\":\"Example User\",\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"},{\"type\":\"text/calendar\",\"value\":\"Party Time!!\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"headers\":{\"X-Day\":\"Monday\",\"X-Month\":\"January\"},\"sections\":{\"%section1\":\"Substitution for Section 1 Tag\",\"%section2\":\"Substitution for Section 2 Tag\"},\"categories\":[\"customer\",\"vip\"],\"custom_args\":{\"campaign\":\"welcome\",\"sequence\":\"2\"},\"send_at\":1461775051,\"asm\":{\"group_id\":3,\"groups_to_display\":[1,4,5]},\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"test@example.com\"},\"bypass_list_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Some Footer Text\",\"html\":\"<bold>Some HTML Here</bold>\"},\"sandbox_mode\":{\"enable\":true},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://gotchya.example.com\"}},\"tracking_settings\":{\"click_tracking\":{\"enable\":true},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<bold>HTML to insert into the text/html portion of the message</bold>\",\"substitution_tag\":\"text to insert into the text/plain portion of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_medium\":\"some medium\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_campaign\":\"some campaign\"}},\"reply_to\":{\"email\":\"test@example.com\"}}");
}
+ }
- private void TestPost()
+ [TestFixture]
+ public class v3WebAPI
+ {
+
+ [Test]
+ public void test_access_settings_activity_get()
{
- HttpResponseMessage response = client.ApiKeys.Post("CSharpTestKey").Result;
- Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- string api_key = jsonObject.api_key.ToString();
- _api_key_id = jsonObject.api_key_id.ToString();
- string name = jsonObject.name.ToString();
- Assert.IsNotNull(api_key);
- Assert.IsNotNull(_api_key_id);
- Assert.IsNotNull(name);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'limit': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.access_settings.activity.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
- private void TestPatch()
+ [Test]
+ public void test_access_settings_whitelist_post()
{
- HttpResponseMessage response = client.ApiKeys.Patch(_api_key_id, "CSharpTestKeyPatched").Result;
- Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- _api_key_id = jsonObject.api_key_id.ToString();
- string name = jsonObject.name.ToString();
- Assert.IsNotNull(_api_key_id);
- Assert.IsNotNull(name);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'ips': [
+ {
+ 'ip': '192.168.1.1'
+ },
+ {
+ 'ip': '192.*.*.*'
+ },
+ {
+ 'ip': '192.168.1.3/32'
+ }
+ ]
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.access_settings.whitelist.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
}
- private void TestDelete()
+ [Test]
+ public void test_access_settings_whitelist_get()
{
- HttpResponseMessage response = client.ApiKeys.Delete(_api_key_id).Result;
- Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.access_settings.whitelist.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
[Test]
- public void TestGetOnce()
+ public void test_access_settings_whitelist_delete()
{
- var responseGet = client.ApiKeys.Get().Result;
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'ids': [
+ 1,
+ 2,
+ 3
+ ]
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.access_settings.whitelist.delete(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
}
[Test]
- public void TestGetTenTimes()
+ public void test_access_settings_whitelist__rule_id__get()
{
- HttpResponseMessage responseGet;
- for (int i = 0; i < 10; i++)
- {
- responseGet = client.ApiKeys.Get().Result;
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
}
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var rule_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.access_settings.whitelist._(rule_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
[Test]
- public void TestGetTenTimesAsync()
+ public void test_access_settings_whitelist__rule_id__delete()
{
- Task[] tasks = new Task[10];
- for (int i = 0; i < 10; i++)
- {
- tasks[i] = client.ApiKeys.Get();
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
}
- Task.WaitAll(tasks);
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var rule_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.access_settings.whitelist._(rule_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
}
- }
- [TestFixture]
- public class UnsubscribeGroups
- {
- static string _baseUri = "https://api.sendgrid.com/";
- static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
- public Client client = new Client(_apiKey, _baseUri);
- private static string _unsubscribe_groups_key_id = "";
+ [Test]
+ public void test_api_keys_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'My API Key',
+ 'scopes': [
+ 'mail.send',
+ 'alerts.create',
+ 'alerts.read'
+ ]
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.api_keys.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_api_keys_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.api_keys.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_api_keys__api_key_id__put()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'A New Hope',
+ 'scopes': [
+ 'user.profile.read',
+ 'user.profile.update'
+ ]
+}";
+ var api_key_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.api_keys._(api_key_id).put(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_api_keys__api_key_id__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'A New Hope'
+}";
+ var api_key_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.api_keys._(api_key_id).patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
[Test]
- public void UnsubscribeGroupsIntegrationTest()
+ public void test_api_keys__api_key_id__get()
{
- int unsubscribeGroupId = 69;
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var api_key_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.api_keys._(api_key_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
- TestGet();
- TestGetUnique(unsubscribeGroupId);
- TestPost();
- TestDelete();
+ [Test]
+ public void test_api_keys__api_key_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var api_key_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.api_keys._(api_key_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
}
- private void TestGet()
+ [Test]
+ public void test_asm_groups_post()
{
- HttpResponseMessage response = client.UnsubscribeGroups.Get().Result;
- Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JsonConvert.DeserializeObject(rawString);
- Assert.IsNotNull(jsonObject);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'description': 'Suggestions for products our users might like.',
+ 'is_default': true,
+ 'name': 'Product Suggestions'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.asm.groups.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
}
- private void TestGetUnique(int unsubscribeGroupId)
+ [Test]
+ public void test_asm_groups_get()
{
- HttpResponseMessage response = client.UnsubscribeGroups.Get(unsubscribeGroupId).Result;
- Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JsonConvert.DeserializeObject(rawString);
- Assert.IsNotNull(jsonObject);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'id': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.asm.groups.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
- private void TestPost()
+ [Test]
+ public void test_asm_groups__group_id__patch()
{
- HttpResponseMessage response = client.UnsubscribeGroups.Post("C Sharp Unsubscribes", "Testing the C Sharp Library", false).Result;
- Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- string name = jsonObject.name.ToString();
- string description = jsonObject.description.ToString();
- _unsubscribe_groups_key_id = jsonObject.id.ToString();
- bool is_default = jsonObject.is_default;
- Assert.IsNotNull(name);
- Assert.IsNotNull(description);
- Assert.IsNotNull(_unsubscribe_groups_key_id);
- Assert.IsNotNull(is_default);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'description': 'Suggestions for items our users might like.',
+ 'id': 103,
+ 'name': 'Item Suggestions'
+}";
+ var group_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.asm.groups._(group_id).patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
}
- private void TestDelete()
+ [Test]
+ public void test_asm_groups__group_id__get()
{
- HttpResponseMessage response = client.UnsubscribeGroups.Delete(_unsubscribe_groups_key_id).Result;
- Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var group_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.asm.groups._(group_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
- }
+ [Test]
+ public void test_asm_groups__group_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var group_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.asm.groups._(group_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
- [TestFixture]
- public class Suppressions
- {
- static string _baseUri = "https://api.sendgrid.com/";
- static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
- public Client client = new Client(_apiKey, _baseUri);
+ [Test]
+ public void test_asm_groups__group_id__suppressions_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'recipient_emails': [
+ 'test1@example.com',
+ 'test2@example.com'
+ ]
+}";
+ var group_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.asm.groups._(group_id).suppressions.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
[Test]
- public void SuppressionsIntegrationTest()
+ public void test_asm_groups__group_id__suppressions_get()
{
- int unsubscribeGroupId = 69;
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var group_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.asm.groups._(group_id).suppressions.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
- TestGet(unsubscribeGroupId);
- string[] emails = { "example@example.com", "example2@example.com" };
- TestPost(unsubscribeGroupId, emails);
- TestDelete(unsubscribeGroupId, "example@example.com");
- TestDelete(unsubscribeGroupId, "example2@example.com");
+ [Test]
+ public void test_asm_groups__group_id__suppressions__email__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var group_id = "test_url_param";
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.asm.groups._(group_id).suppressions._(email).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
}
- private void TestGet(int unsubscribeGroupId)
+ [Test]
+ public void test_asm_suppressions_get()
{
- HttpResponseMessage response = client.Suppressions.Get(unsubscribeGroupId).Result;
- Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JsonConvert.DeserializeObject(rawString);
- Assert.IsNotNull(jsonObject);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.asm.suppressions.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
- private void TestPost(int unsubscribeGroupId, string[] emails)
+ [Test]
+ public void test_asm_suppressions_global_post()
{
- HttpResponseMessage response = client.Suppressions.Post(unsubscribeGroupId, emails).Result;
- Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- string recipient_emails = jsonObject.recipient_emails.ToString();
- Assert.IsNotNull(recipient_emails);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'recipient_emails': [
+ 'test1@example.com',
+ 'test2@example.com'
+ ]
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.asm.suppressions.global.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
}
- private void TestDelete(int unsubscribeGroupId, string email)
+ [Test]
+ public void test_asm_suppressions_global__email__get()
{
- HttpResponseMessage response = client.Suppressions.Delete(unsubscribeGroupId, email).Result;
- Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.asm.suppressions.global._(email).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_asm_suppressions_global__email__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.asm.suppressions.global._(email).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
}
+ [Test]
+ public void test_asm_suppressions__email__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.asm.suppressions._(email).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_browsers_stats_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'browsers': 'test_string',
+ 'end_date': '2016-04-01',
+ 'limit': 'test_string',
+ 'offset': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.browsers.stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_campaigns_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'categories': [
+ 'spring line'
+ ],
+ 'custom_unsubscribe_url': '',
+ 'html_content': '<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>',
+ 'ip_pool': 'marketing',
+ 'list_ids': [
+ 110,
+ 124
+ ],
+ 'plain_content': 'Check out our spring line!',
+ 'segment_ids': [
+ 110
+ ],
+ 'sender_id': 124451,
+ 'subject': 'New Products for Spring!',
+ 'suppression_group_id': 42,
+ 'title': 'March Newsletter'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.campaigns.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_campaigns_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'limit': 0,
+ 'offset': 0
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.campaigns.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_campaigns__campaign_id__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'categories': [
+ 'summer line'
+ ],
+ 'html_content': '<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>',
+ 'plain_content': 'Check out our summer line!',
+ 'subject': 'New Products for Summer!',
+ 'title': 'May Newsletter'
+}";
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.campaigns._(campaign_id).patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_campaigns__campaign_id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.campaigns._(campaign_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_campaigns__campaign_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.campaigns._(campaign_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_campaigns__campaign_id__schedules_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'send_at': 1489451436
+}";
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.campaigns._(campaign_id).schedules.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_campaigns__campaign_id__schedules_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'send_at': 1489771528
+}";
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.campaigns._(campaign_id).schedules.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_campaigns__campaign_id__schedules_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.campaigns._(campaign_id).schedules.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_campaigns__campaign_id__schedules_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.campaigns._(campaign_id).schedules.delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_campaigns__campaign_id__schedules_now_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.campaigns._(campaign_id).schedules.now.post(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_campaigns__campaign_id__schedules_test_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'to': 'your.email@example.com'
+}";
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.campaigns._(campaign_id).schedules.test.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_categories_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'category': 'test_string',
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.categories.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_categories_stats_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'categories': 'test_string',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.categories.stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_categories_stats_sums_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.categories.stats.sums.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_clients_stats_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.clients.stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_clients__client_type__stats_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'start_date': '2016-01-01'
+}";
+ var client_type = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.clients._(client_type).stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_custom_fields_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'pet',
+ 'type': 'text'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.contactdb.custom_fields.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_contactdb_custom_fields_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.custom_fields.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_custom_fields__custom_field_id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var custom_field_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.custom_fields._(custom_field_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_custom_fields__custom_field_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var custom_field_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "202");
+ dynamic response = sg.client.contactdb.custom_fields._(custom_field_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Accepted);
+ }
+
+ [Test]
+ public void test_contactdb_lists_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'your list name'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.contactdb.lists.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_contactdb_lists_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.lists.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_lists_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"[
+ 1,
+ 2,
+ 3,
+ 4
+]";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.contactdb.lists.delete(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_contactdb_lists__list_id__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'newlistname'
+}";
+ string queryParams = @"{
+ 'list_id': 0
+}";
+ var list_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.lists._(list_id).patch(requestBody: data, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_lists__list_id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'list_id': 0
+}";
+ var list_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.lists._(list_id).get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_lists__list_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'delete_contacts': 'true'
+}";
+ var list_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "202");
+ dynamic response = sg.client.contactdb.lists._(list_id).delete(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Accepted);
+ }
+
+ [Test]
+ public void test_contactdb_lists__list_id__recipients_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"[
+ 'recipient_id1',
+ 'recipient_id2'
+]";
+ var list_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.contactdb.lists._(list_id).recipients.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_contactdb_lists__list_id__recipients_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'list_id': 0,
+ 'page': 1,
+ 'page_size': 1
+}";
+ var list_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.lists._(list_id).recipients.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_lists__list_id__recipients__recipient_id__post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var list_id = "test_url_param";
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_contactdb_lists__list_id__recipients__recipient_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'list_id': 0,
+ 'recipient_id': 0
+}";
+ var list_id = "test_url_param";
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_contactdb_recipients_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"[
+ {
+ 'email': 'jones@example.com',
+ 'first_name': 'Guy',
+ 'last_name': 'Jones'
+ }
+]";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.contactdb.recipients.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_contactdb_recipients_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"[
+ {
+ 'age': 25,
+ 'email': 'example@example.com',
+ 'first_name': '',
+ 'last_name': 'User'
+ },
+ {
+ 'age': 25,
+ 'email': 'example2@example.com',
+ 'first_name': 'Example',
+ 'last_name': 'User'
+ }
+]";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.contactdb.recipients.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_contactdb_recipients_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'page': 1,
+ 'page_size': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.recipients.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_recipients_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"[
+ 'recipient_id1',
+ 'recipient_id2'
+]";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.recipients.delete(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_recipients_billable_count_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.recipients.billable_count.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_recipients_count_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.recipients.count.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_recipients_search_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ '{field_name}': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.recipients.search.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_recipients__recipient_id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.recipients._(recipient_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_recipients__recipient_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.contactdb.recipients._(recipient_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_contactdb_recipients__recipient_id__lists_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.recipients._(recipient_id).lists.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_reserved_fields_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.reserved_fields.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_segments_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'conditions': [
+ {
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
+ 'value': 'Miller'
+ },
+ {
+ 'and_or': 'and',
+ 'field': 'last_clicked',
+ 'operator': 'gt',
+ 'value': '01/02/2015'
+ },
+ {
+ 'and_or': 'or',
+ 'field': 'clicks.campaign_identifier',
+ 'operator': 'eq',
+ 'value': '513'
}
+ ],
+ 'list_id': 4,
+ 'name': 'Last Name Miller'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.segments.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
- [TestFixture]
- public class GlobalSuppressions
+ [Test]
+ public void test_contactdb_segments_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.segments.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_contactdb_segments__segment_id__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'conditions': [
{
- static string _baseUri = "https://api.sendgrid.com/";
- static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
- public Client client = new Client(_apiKey, _baseUri);
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
+ 'value': 'Miller'
+ }
+ ],
+ 'list_id': 5,
+ 'name': 'The Millers'
+}";
+ string queryParams = @"{
+ 'segment_id': 'test_string'
+}";
+ var segment_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.segments._(segment_id).patch(requestBody: data, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
[Test]
- public void GlobalSuppressionsIntegrationTest()
+ public void test_contactdb_segments__segment_id__get()
{
- string email = "example3@example.com";
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'segment_id': 0
+}";
+ var segment_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.segments._(segment_id).get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
- TestGet(email);
- string[] emails = { "example1@example.com", "example2@example.com" };
- TestPost(emails);
- TestDelete("example1@example.com");
- TestDelete("example2@example.com");
+ [Test]
+ public void test_contactdb_segments__segment_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'delete_contacts': 'true'
+}";
+ var segment_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.contactdb.segments._(segment_id).delete(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
}
- private void TestGet(string email)
+ [Test]
+ public void test_contactdb_segments__segment_id__recipients_get()
{
- HttpResponseMessage response = client.GlobalSuppressions.Get(email).Result;
- Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JsonConvert.DeserializeObject(rawString);
- Assert.IsNotNull(jsonObject);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'page': 1,
+ 'page_size': 1
+}";
+ var segment_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.contactdb.segments._(segment_id).recipients.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
- private void TestPost(string[] emails)
+ [Test]
+ public void test_devices_stats_get()
{
- HttpResponseMessage response = client.GlobalSuppressions.Post(emails).Result;
- Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- string recipient_emails = jsonObject.recipient_emails.ToString();
- Assert.IsNotNull(recipient_emails);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.devices.stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
- private void TestDelete(string email)
+ [Test]
+ public void test_geo_stats_get()
{
- HttpResponseMessage response = client.GlobalSuppressions.Delete(email).Result;
- Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'country': 'US',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.geo.stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
- }
- [TestFixture]
- public class GlobalStats
+ [Test]
+ public void test_ips_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'exclude_whitelabels': 'true',
+ 'ip': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'subuser': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_ips_assigned_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips.assigned.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_ips_pools_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'marketing'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips.pools.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_ips_pools_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips.pools.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_ips_pools__pool_name__put()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'new_pool_name'
+}";
+ var pool_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips.pools._(pool_name).put(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_ips_pools__pool_name__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var pool_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips.pools._(pool_name).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_ips_pools__pool_name__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var pool_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.ips.pools._(pool_name).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_ips_pools__pool_name__ips_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'ip': '0.0.0.0'
+}";
+ var pool_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.ips.pools._(pool_name).ips.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_ips_pools__pool_name__ips__ip__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var pool_name = "test_url_param";
+ var ip = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.ips.pools._(pool_name).ips._(ip).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_ips_warmup_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'ip': '0.0.0.0'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips.warmup.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_ips_warmup_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips.warmup.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_ips_warmup__ip_address__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var ip_address = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips.warmup._(ip_address).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_ips_warmup__ip_address__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var ip_address = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.ips.warmup._(ip_address).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_ips__ip_address__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var ip_address = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.ips._(ip_address).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_batch_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.mail.batch.post(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_mail_batch__batch_id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var batch_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail.batch._(batch_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_send_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'asm': {
+ 'group_id': 1,
+ 'groups_to_display': [
+ 1,
+ 2,
+ 3
+ ]
+ },
+ 'attachments': [
{
- static string _baseUri = "https://api.sendgrid.com/";
- static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
- public Client client = new Client(_apiKey, _baseUri);
+ '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]',
+ 'categories': [
+ 'category1',
+ 'category2'
+ ],
+ 'content': [
+ {
+ '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',
+ 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
+ },
+ 'from': {
+ 'email': 'sam.smith@example.com',
+ 'name': 'Sam Smith'
+ },
+ 'headers': {},
+ 'ip_pool_name': '[YOUR POOL NAME GOES HERE]',
+ 'mail_settings': {
+ 'bcc': {
+ 'email': 'ben.doe@example.com',
+ 'enable': true
+ },
+ 'bypass_list_management': {
+ 'enable': true
+ },
+ 'footer': {
+ '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',
+ 'threshold': 3
+ }
+ },
+ 'personalizations': [
+ {
+ 'bcc': [
+ {
+ 'email': 'sam.doe@example.com',
+ 'name': 'Sam Doe'
+ }
+ ],
+ 'cc': [
+ {
+ 'email': 'jane.doe@example.com',
+ 'name': 'Jane Doe'
+ }
+ ],
+ 'custom_args': {
+ 'New Argument 1': 'New Value 1',
+ 'activationAttempt': '1',
+ 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
+ },
+ 'headers': {
+ 'X-Accept-Language': 'en',
+ 'X-Mailer': 'MyApp'
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
+ 'substitutions': {
+ 'sub': {
+ '%name%': [
+ 'John',
+ 'Jane',
+ 'Sam'
+ ]
+ }
+ },
+ 'to': [
+ {
+ 'email': 'john.doe@example.com',
+ 'name': 'John Doe'
+ }
+ ]
+ }
+ ],
+ 'reply_to': {
+ 'email': 'sam.smith@example.com',
+ 'name': 'Sam Smith'
+ },
+ 'sections': {
+ 'section': {
+ ':sectionName1': 'section 1 text',
+ ':sectionName2': 'section 2 text'
+ }
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
+ 'template_id': '[YOUR TEMPLATE ID GOES HERE]',
+ 'tracking_settings': {
+ 'click_tracking': {
+ '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]',
+ 'utm_term': '[IDENTIFY PAID KEYWORDS HERE]'
+ },
+ 'open_tracking': {
+ '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%>',
+ 'text': 'If you would like to unsubscribe and stop receiveing these emails <% click here %>.'
+ }
+ }
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "202");
+ dynamic response = sg.client.mail.send.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Accepted);
+ }
+
+ [Test]
+ public void test_mail_settings_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_address_whitelist_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': true,
+ 'list': [
+ 'email1@example.com',
+ 'example.com'
+ ]
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.address_whitelist.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_address_whitelist_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.address_whitelist.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_bcc_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'email': 'email@example.com',
+ 'enabled': false
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.bcc.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_bcc_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.bcc.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_bounce_purge_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': true,
+ 'hard_bounces': 5,
+ 'soft_bounces': 5
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.bounce_purge.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_bounce_purge_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.bounce_purge.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_footer_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': true,
+ 'html_content': '...',
+ 'plain_content': '...'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.footer.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_footer_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.footer.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_forward_bounce_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'email': 'example@example.com',
+ 'enabled': true
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.forward_bounce.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_forward_bounce_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.forward_bounce.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_forward_spam_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'email': '',
+ 'enabled': false
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.forward_spam.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_forward_spam_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.forward_spam.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_plain_content_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': false
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.plain_content.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_plain_content_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.plain_content.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_spam_check_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': true,
+ 'max_score': 5,
+ 'url': 'url'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.spam_check.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_spam_check_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.spam_check.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_template_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': true,
+ 'html_content': '<% body %>'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.template.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mail_settings_template_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mail_settings.template.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_mailbox_providers_stats_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'mailbox_providers': 'test_string',
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.mailbox_providers.stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_partner_settings_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.partner_settings.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_partner_settings_new_relic_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enable_subuser_statistics': true,
+ 'enabled': true,
+ 'license_key': ''
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.partner_settings.new_relic.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_partner_settings_new_relic_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.partner_settings.new_relic.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_scopes_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.scopes.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_stats_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'email': 'John@example.com',
+ 'ips': [
+ '1.1.1.1',
+ '2.2.2.2'
+ ],
+ 'password': 'johns_password',
+ 'username': 'John@example.com'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'limit': 0,
+ 'offset': 0,
+ 'username': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers_reputations_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'usernames': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers.reputations.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers_stats_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01',
+ 'subusers': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers.stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers_stats_monthly_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'date': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'subuser': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers.stats.monthly.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers_stats_sums_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers.stats.sums.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers__subuser_name__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'disabled': false
+}";
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.subusers._(subuser_name).patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
[Test]
- public void GlobalStatsIntegrationTest()
+ public void test_subusers__subuser_name__delete()
{
- string startDate = "2015-11-01";
- string endDate = "2015-12-01";
- string aggregatedBy = "day";
- TestGet(startDate);
- TestGet(startDate, endDate);
- TestGet(startDate, endDate, aggregatedBy);
- aggregatedBy = "week";
- TestGet(startDate, endDate, aggregatedBy);
- aggregatedBy = "month";
- TestGet(startDate, endDate, aggregatedBy);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.subusers._(subuser_name).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
}
- private void TestGet(string startDate, string endDate=null, string aggregatedBy=null)
+ [Test]
+ public void test_subusers__subuser_name__ips_put()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"[
+ '127.0.0.1'
+]";
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers._(subuser_name).ips.put(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers__subuser_name__monitor_put()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'email': 'example@example.com',
+ 'frequency': 500
+}";
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers._(subuser_name).monitor.put(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers__subuser_name__monitor_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'email': 'example@example.com',
+ 'frequency': 50000
+}";
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers._(subuser_name).monitor.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers__subuser_name__monitor_get()
{
- HttpResponseMessage response = client.GlobalStats.Get(startDate, endDate, aggregatedBy).Result;
- Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
- string rawString = response.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JsonConvert.DeserializeObject(rawString);
- Assert.IsNotNull(jsonObject);
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers._(subuser_name).monitor.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_subusers__subuser_name__monitor_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.subusers._(subuser_name).monitor.delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_subusers__subuser_name__stats_monthly_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'date': 'test_string',
+ 'limit': 0,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string'
+}";
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.subusers._(subuser_name).stats.monthly.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_suppression_blocks_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.suppression.blocks.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_suppression_blocks_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ 'example1@example.com',
+ 'example2@example.com'
+ ]
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.suppression.blocks.delete(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_suppression_blocks__email__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.suppression.blocks._(email).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_suppression_blocks__email__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.suppression.blocks._(email).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_suppression_bounces_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'end_time': 0,
+ 'start_time': 0
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.suppression.bounces.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_suppression_bounces_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'delete_all': true,
+ 'emails': [
+ 'example@example.com',
+ 'example2@example.com'
+ ]
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.suppression.bounces.delete(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_suppression_bounces__email__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.suppression.bounces._(email).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_suppression_bounces__email__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'email_address': 'example@example.com'
+}";
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.suppression.bounces._(email).delete(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_suppression_invalid_emails_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.suppression.invalid_emails.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_suppression_invalid_emails_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ 'example1@example.com',
+ 'example2@example.com'
+ ]
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.suppression.invalid_emails.delete(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_suppression_invalid_emails__email__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.suppression.invalid_emails._(email).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_suppression_invalid_emails__email__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.suppression.invalid_emails._(email).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_suppression_spam_report__email__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.suppression.spam_report._(email).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_suppression_spam_report__email__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.suppression.spam_report._(email).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_suppression_spam_reports_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.suppression.spam_reports.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_suppression_spam_reports_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ 'example1@example.com',
+ 'example2@example.com'
+ ]
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.suppression.spam_reports.delete(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_suppression_unsubscribes_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.suppression.unsubscribes.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_templates_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'example_name'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.templates.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_templates_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.templates.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_templates__template_id__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'name': 'new_example_name'
+}";
+ var template_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.templates._(template_id).patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_templates__template_id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var template_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.templates._(template_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_templates__template_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var template_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.templates._(template_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_templates__template_id__versions_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'active': 1,
+ 'html_content': '<%body%>',
+ 'name': 'example_version_name',
+ 'plain_content': '<%body%>',
+ 'subject': '<%subject%>',
+ 'template_id': 'ddb96bbc-9b92-425e-8979-99464621b543'
+}";
+ var template_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.templates._(template_id).versions.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_templates__template_id__versions__version_id__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'active': 1,
+ 'html_content': '<%body%>',
+ 'name': 'updated_example_name',
+ 'plain_content': '<%body%>',
+ 'subject': '<%subject%>'
+}";
+ var template_id = "test_url_param";
+ var version_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.templates._(template_id).versions._(version_id).patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_templates__template_id__versions__version_id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var template_id = "test_url_param";
+ var version_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.templates._(template_id).versions._(version_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_templates__template_id__versions__version_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var template_id = "test_url_param";
+ var version_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.templates._(template_id).versions._(version_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_templates__template_id__versions__version_id__activate_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var template_id = "test_url_param";
+ var version_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.templates._(template_id).versions._(version_id).activate.post(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_tracking_settings_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.tracking_settings.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_tracking_settings_click_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': true
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.tracking_settings.click.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_tracking_settings_click_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.tracking_settings.click.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_tracking_settings_google_analytics_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': true,
+ 'utm_campaign': 'website',
+ 'utm_content': '',
+ 'utm_medium': 'email',
+ 'utm_source': 'sendgrid.com',
+ 'utm_term': ''
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.tracking_settings.google_analytics.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}
+
+ [Test]
+ public void test_tracking_settings_google_analytics_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.tracking_settings.google_analytics.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_tracking_settings_open_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': true
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.tracking_settings.open.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_tracking_settings_open_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.tracking_settings.open.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_tracking_settings_subscription_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'enabled': true,
+ 'html_content': 'html content',
+ 'landing': 'landing page html',
+ 'plain_content': 'text content',
+ 'replace': 'replacement tag',
+ 'url': 'url'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.tracking_settings.subscription.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_tracking_settings_subscription_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.tracking_settings.subscription.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_account_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.account.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_credits_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.credits.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_email_put()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'email': 'example@example.com'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.email.put(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_email_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.email.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_password_put()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'new_password': 'new_password',
+ 'old_password': 'old_password'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.password.put(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_profile_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'city': 'Orange',
+ 'first_name': 'Example',
+ 'last_name': 'User'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.profile.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_profile_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.profile.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_scheduled_sends_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'batch_id': 'YOUR_BATCH_ID',
+ 'status': 'pause'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.user.scheduled_sends.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_user_scheduled_sends_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.scheduled_sends.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_scheduled_sends__batch_id__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'status': 'pause'
+}";
+ var batch_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.user.scheduled_sends._(batch_id).patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_user_scheduled_sends__batch_id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var batch_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.scheduled_sends._(batch_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_scheduled_sends__batch_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var batch_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.user.scheduled_sends._(batch_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_user_settings_enforced_tls_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'require_tls': true,
+ 'require_valid_cert': false
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.settings.enforced_tls.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_settings_enforced_tls_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.settings.enforced_tls.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_username_put()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'username': 'test_username'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.username.put(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_username_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.username.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_webhooks_event_settings_patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'bounce': true,
+ 'click': true,
+ 'deferred': true,
+ 'delivered': true,
+ 'dropped': true,
+ 'enabled': true,
+ 'group_resubscribe': true,
+ 'group_unsubscribe': true,
+ 'open': true,
+ 'processed': true,
+ 'spam_report': true,
+ 'unsubscribe': true,
+ 'url': 'url'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.webhooks._("event").settings.patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_webhooks_event_settings_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.webhooks._("event").settings.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_webhooks_event_test_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'url': 'url'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.user.webhooks._("event").test.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_user_webhooks_parse_settings_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.webhooks.parse.settings.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_user_webhooks_parse_stats_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 'test_string',
+ 'offset': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.user.webhooks.parse.stats.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_domains_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'automatic_security': false,
+ 'custom_spf': true,
+ 'default': true,
+ 'domain': 'example.com',
+ 'ips': [
+ '192.168.1.1',
+ '192.168.1.2'
+ ],
+ 'subdomain': 'news',
+ 'username': 'john@example.com'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.whitelabel.domains.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_whitelabel_domains_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'domain': 'test_string',
+ 'exclude_subusers': 'true',
+ 'limit': 1,
+ 'offset': 1,
+ 'username': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.domains.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_domains_default_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.domains._("default").get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_domains_subuser_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.domains.subuser.get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_domains_subuser_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.whitelabel.domains.subuser.delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_whitelabel_domains__domain_id__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'custom_spf': true,
+ 'default': false
+}";
+ var domain_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.domains._(domain_id).patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_domains__domain_id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var domain_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.domains._(domain_id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_domains__domain_id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var domain_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.whitelabel.domains._(domain_id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_whitelabel_domains__domain_id__subuser_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'username': 'jane@example.com'
+}";
+ var domain_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.whitelabel.domains._(domain_id).subuser.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_whitelabel_domains__id__ips_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'ip': '192.168.0.1'
+}";
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.domains._(id).ips.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_domains__id__ips__ip__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var id = "test_url_param";
+ var ip = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.domains._(id).ips._(ip).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_domains__id__validate_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.domains._(id).validate.post(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_ips_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'domain': 'example.com',
+ 'ip': '192.168.1.1',
+ 'subdomain': 'email'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.whitelabel.ips.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_whitelabel_ips_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'ip': 'test_string',
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.ips.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_ips__id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.ips._(id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_ips__id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.whitelabel.ips._(id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_whitelabel_ips__id__validate_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.ips._(id).validate.post(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_links_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'default': true,
+ 'domain': 'example.com',
+ 'subdomain': 'mail'
+}";
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ dynamic response = sg.client.whitelabel.links.post(requestBody: data, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public void test_whitelabel_links_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'limit': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.links.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_links_default_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'domain': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.links._("default").get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_links_subuser_get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'username': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.links.subuser.get(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_links_subuser_delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string queryParams = @"{
+ 'username': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.whitelabel.links.subuser.delete(queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_whitelabel_links__id__patch()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'default': true
+}";
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.links._(id).patch(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_links__id__get()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.links._(id).get(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_links__id__delete()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ dynamic response = sg.client.whitelabel.links._(id).delete(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public void test_whitelabel_links__id__validate_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.links._(id).validate.post(requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public void test_whitelabel_links__link_id__subuser_post()
+ {
+ string _apiKey = "SendGrid API Key";
+ string host = "";
+ if( Environment.GetEnvironmentVariable("TRAVIS") == "true" ) {
+ host = Environment.GetEnvironmentVariable("MOCK_HOST");
+ } else {
+ host = "http://localhost:4010";
+ }
+ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
+ string data = @"{
+ 'username': 'jane@example.com'
+}";
+ var link_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ dynamic response = sg.client.whitelabel.links._(link_id).subuser.post(requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
}
}
diff --git a/SendGrid/UnitTest/UnitTests.csproj b/SendGrid/UnitTest/UnitTests.csproj
index d6ef8ae..68ea851 100644
--- a/SendGrid/UnitTest/UnitTests.csproj
+++ b/SendGrid/UnitTest/UnitTests.csproj
@@ -8,7 +8,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTest</RootNamespace>
<AssemblyName>UnitTest</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
@@ -28,7 +28,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
+ <DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
@@ -67,8 +67,13 @@
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath>
<Private>False</Private>
</Reference>
+ <Reference Include="SendGrid.CSharp.HTTP.Client, Version=2.0.0.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
+ <HintPath>..\packages\SendGrid.CSharp.HTTP.Client.2.0.1\lib\SendGrid.CSharp.HTTP.Client.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Net.Http" />
+ <Reference Include="System.Web.Extensions" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@@ -113,7 +118,7 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
diff --git a/SendGrid/UnitTest/packages.config b/SendGrid/UnitTest/packages.config
index 6cc1a28..95691d8 100644
--- a/SendGrid/UnitTest/packages.config
+++ b/SendGrid/UnitTest/packages.config
@@ -3,4 +3,5 @@
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" />
+ <package id="SendGrid.CSharp.HTTP.Client" version="2.0.1" targetFramework="net452" />
</packages> \ No newline at end of file
diff --git a/USAGE.md b/USAGE.md
new file mode 100644
index 0000000..e5515c8
--- /dev/null
+++ b/USAGE.md
@@ -0,0 +1,5317 @@
+This documentation is based on our [OAI specification](https://github.com/sendgrid/sendgrid-oai).
+
+# INITIALIZATION
+
+```csharp
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+```
+
+# Table of Contents
+
+* [ACCESS SETTINGS](#access_settings)
+* [API KEYS](#api_keys)
+* [ASM](#asm)
+* [BROWSERS](#browsers)
+* [CAMPAIGNS](#campaigns)
+* [CATEGORIES](#categories)
+* [CLIENTS](#clients)
+* [CONTACTDB](#contactdb)
+* [DEVICES](#devices)
+* [GEO](#geo)
+* [IPS](#ips)
+* [MAIL](#mail)
+* [MAIL SETTINGS](#mail_settings)
+* [MAILBOX PROVIDERS](#mailbox_providers)
+* [PARTNER SETTINGS](#partner_settings)
+* [SCOPES](#scopes)
+* [STATS](#stats)
+* [SUBUSERS](#subusers)
+* [SUPPRESSION](#suppression)
+* [TEMPLATES](#templates)
+* [TRACKING SETTINGS](#tracking_settings)
+* [USER](#user)
+* [WHITELABEL](#whitelabel)
+
+
+<a name="access_settings"></a>
+# ACCESS SETTINGS
+
+## Retrieve all recent access attempts
+
+**This endpoint allows you to retrieve a list of all of the IP addresses that recently attempted to access your account either through the User Interface or the API.**
+
+IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.
+
+For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).
+
+### GET /access_settings/activity
+
+
+```csharp
+string queryParams = @"{
+ 'limit': 1
+}";
+dynamic response = sg.client.access_settings.activity.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Add one or more IPs to the whitelist
+
+**This endpoint allows you to add one or more IP addresses to your IP whitelist.**
+
+When adding an IP to your whitelist, include the IP address in an array. You can whitelist one IP at a time, or you can whitelist multiple IPs at once.
+
+IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.
+
+For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).
+
+### POST /access_settings/whitelist
+
+
+```csharp
+string data = @"{
+ 'ips': [
+ {
+ 'ip': '192.168.1.1'
+ },
+ {
+ 'ip': '192.*.*.*'
+ },
+ {
+ 'ip': '192.168.1.3/32'
+ }
+ ]
+}";
+dynamic response = sg.client.access_settings.whitelist.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a list of currently whitelisted IPs
+
+**This endpoint allows you to retrieve a list of IP addresses that are currently whitelisted.**
+
+IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.
+
+For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).
+
+### GET /access_settings/whitelist
+
+
+```csharp
+dynamic response = sg.client.access_settings.whitelist.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Remove one or more IPs from the whitelist
+
+**This endpoint allows you to remove one or more IPs from your IP whitelist.**
+
+You can remove one IP at a time, or you can remove multiple IP addresses.
+
+IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.
+
+For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).
+
+### DELETE /access_settings/whitelist
+
+
+```csharp
+string data = @"{
+ 'ids': [
+ 1,
+ 2,
+ 3
+ ]
+}";
+dynamic response = sg.client.access_settings.whitelist.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a specific whitelisted IP
+
+**This endpoint allows you to retreive a specific IP address that has been whitelisted.**
+
+You must include the ID for the specific IP address you want to retrieve in your call.
+
+IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.
+
+For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).
+
+### GET /access_settings/whitelist/{rule_id}
+
+
+```csharp
+var rule_id = "test_url_param";
+dynamic response = sg.client.access_settings.whitelist._(rule_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Remove a specific IP from the whitelist
+
+**This endpoint allows you to remove a specific IP address from your IP whitelist.**
+
+When removing a specific IP address from your whitelist, you must include the ID in your call.
+
+IP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.
+
+For more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).
+
+### DELETE /access_settings/whitelist/{rule_id}
+
+
+```csharp
+var rule_id = "test_url_param";
+dynamic response = sg.client.access_settings.whitelist._(rule_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="api_keys"></a>
+# API KEYS
+
+## Create API keys
+
+**This enpoint allows you to create a new random API Key for the user.**
+
+A JSON request body containing a "name" property is required. If number of maximum keys is reached, HTTP 403 will be returned.
+
+There is a limit of 100 API Keys on your account.
+
+The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
+
+See the [API Key Permissions List](https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/api_key_permissions_list.html) for a list of all available scopes.
+
+### POST /api_keys
+
+
+```csharp
+string data = @"{
+ 'name': 'My API Key',
+ 'scopes': [
+ 'mail.send',
+ 'alerts.create',
+ 'alerts.read'
+ ]
+}";
+dynamic response = sg.client.api_keys.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all API Keys belonging to the authenticated user
+
+**This endpoint allows you to retrieve all API Keys that belong to the authenticated user.**
+
+The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
+
+### GET /api_keys
+
+
+```csharp
+dynamic response = sg.client.api_keys.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update the name & scopes of an API Key
+
+**This endpoint allows you to update the name and scopes of a given API key.**
+
+A JSON request body with a "name" property is required.
+Most provide the list of all the scopes an api key should have.
+
+The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
+
+
+### PUT /api_keys/{api_key_id}
+
+
+```csharp
+string data = @"{
+ 'name': 'A New Hope',
+ 'scopes': [
+ 'user.profile.read',
+ 'user.profile.update'
+ ]
+}";
+var api_key_id = "test_url_param";
+dynamic response = sg.client.api_keys._(api_key_id).put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update API keys
+
+**This endpoint allows you to update the name of an existing API Key.**
+
+A JSON request body with a "name" property is required.
+
+The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
+
+## URI Parameters
+
+| URI Parameter | Type | Required? | Description |
+|---|---|---|---|
+|api_key_id |string | required | The ID of the API Key you are updating.|
+
+### PATCH /api_keys/{api_key_id}
+
+
+```csharp
+string data = @"{
+ 'name': 'A New Hope'
+}";
+var api_key_id = "test_url_param";
+dynamic response = sg.client.api_keys._(api_key_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve an existing API Key
+
+**This endpoint allows you to retrieve a single api key.**
+
+If the API Key ID does not exist an HTTP 404 will be returned.
+
+### GET /api_keys/{api_key_id}
+
+
+```csharp
+var api_key_id = "test_url_param";
+dynamic response = sg.client.api_keys._(api_key_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete API keys
+
+**This endpoint allows you to revoke an existing API Key**
+
+Authentications using this API Key will fail after this request is made, with some small propogation delay.If the API Key ID does not exist an HTTP 404 will be returned.
+
+The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
+
+## URI Parameters
+
+| URI Parameter | Type | Required? | Description |
+|---|---|---|---|
+|api_key_id |string | required | The ID of the API Key you are deleting.|
+
+### DELETE /api_keys/{api_key_id}
+
+
+```csharp
+var api_key_id = "test_url_param";
+dynamic response = sg.client.api_keys._(api_key_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="asm"></a>
+# ASM
+
+## Create a new suppression group
+
+**This endpoint allows you to create a new suppression group.**
+
+Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
+
+The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.
+
+Each user can create up to 25 different suppression groups.
+
+### POST /asm/groups
+
+
+```csharp
+string data = @"{
+ 'description': 'Suggestions for products our users might like.',
+ 'is_default': true,
+ 'name': 'Product Suggestions'
+}";
+dynamic response = sg.client.asm.groups.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve information about multiple suppression groups
+
+**This endpoint allows you to retrieve information about multiple suppression groups.**
+
+This endpoint will return information for each group ID that you include in your request. To add a group ID to your request, simply append `&id=` followed by the group ID.
+
+### GET /asm/groups
+
+
+```csharp
+string queryParams = @"{
+ 'id': 1
+}";
+dynamic response = sg.client.asm.groups.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update a suppression group.
+
+**This endpoint allows you to update or change a suppression group.**
+
+Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
+
+The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.
+
+Each user can create up to 25 different suppression groups.
+
+### PATCH /asm/groups/{group_id}
+
+
+```csharp
+string data = @"{
+ 'description': 'Suggestions for items our users might like.',
+ 'id': 103,
+ 'name': 'Item Suggestions'
+}";
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Get information on a single suppression group.
+
+**This endpoint allows you to retrieve a single suppression group.**
+
+Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
+
+The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.
+
+Each user can create up to 25 different suppression groups.
+
+### GET /asm/groups/{group_id}
+
+
+```csharp
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a suppression group.
+
+**This endpoint allows you to delete a suppression group.**
+
+You can only delete groups that have not been attached to sent mail in the last 60 days. If a recipient uses the "one-click unsubscribe" option on an email associated with a deleted group, that recipient will be added to the global suppression list.
+
+Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
+
+The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.
+
+Each user can create up to 25 different suppression groups.
+
+### DELETE /asm/groups/{group_id}
+
+
+```csharp
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Add suppressions to a suppression group
+
+**This endpoint allows you to add email addresses to an unsubscribe group.**
+
+If you attempt to add suppressions to a group that has been deleted or does not exist, the suppressions will be added to the global suppressions list.
+
+Suppressions are recipient email addresses that are added to [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). Once a recipient's address is on the suppressions list for an unsubscribe group, they will not receive any emails that are tagged with that unsubscribe group.
+
+### POST /asm/groups/{group_id}/suppressions
+
+
+```csharp
+string data = @"{
+ 'recipient_emails': [
+ 'test1@example.com',
+ 'test2@example.com'
+ ]
+}";
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).suppressions.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all suppressions for a suppression group
+
+**This endpoint allows you to retrieve all suppressed email addresses belonging to the given group.**
+
+Suppressions are recipient email addresses that are added to [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). Once a recipient's address is on the suppressions list for an unsubscribe group, they will not receive any emails that are tagged with that unsubscribe group.
+
+### GET /asm/groups/{group_id}/suppressions
+
+
+```csharp
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).suppressions.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a suppression from a suppression group
+
+**This endpoint allows you to remove a suppressed email address from the given suppression group.**
+
+Suppressions are recipient email addresses that are added to [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). Once a recipient's address is on the suppressions list for an unsubscribe group, they will not receive any emails that are tagged with that unsubscribe group.
+
+### DELETE /asm/groups/{group_id}/suppressions/{email}
+
+
+```csharp
+var group_id = "test_url_param";
+var email = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).suppressions._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all suppressions
+
+**This endpoint allows you to retrieve a list of all suppressions.**
+
+Suppressions are email addresses that can be added to [groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html) to prevent certain types of emails from being delivered to those addresses.
+
+### GET /asm/suppressions
+
+
+```csharp
+dynamic response = sg.client.asm.suppressions.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Add recipient addresses to the global suppression group.
+
+**This endpoint allows you to add one or more email addresses to the global suppressions group.**
+
+A global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html).
+
+### POST /asm/suppressions/global
+
+
+```csharp
+string data = @"{
+ 'recipient_emails': [
+ 'test1@example.com',
+ 'test2@example.com'
+ ]
+}";
+dynamic response = sg.client.asm.suppressions.global.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a Global Suppression
+
+**This endpoint allows you to retrieve a global suppression. You can also use this endpoint to confirm if an email address is already globally suppresed.**
+
+If the email address you include in the URL path parameter `{email}` is alreayd globally suppressed, the response will include that email address. If the address you enter for `{email}` is not globally suppressed, an empty JSON object `{}` will be returned.
+
+A global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html).
+
+### GET /asm/suppressions/global/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.asm.suppressions.global._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a Global Suppression
+
+**This endpoint allows you to remove an email address from the global suppressions group.**
+
+A global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html).
+
+### DELETE /asm/suppressions/global/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.asm.suppressions.global._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all suppression groups for an email address
+
+**This endpoint will return a list of all suppression groups, indicating if the given email address is suppressed for each group.**
+
+Suppressions are email addresses that can be added to [groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html) to prevent certain types of emails from being delivered to those addresses.
+
+### GET /asm/suppressions/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.asm.suppressions._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="browsers"></a>
+# BROWSERS
+
+## Retrieve email statistics by browser.
+
+**This endpoint allows you to retrieve your email statistics segmented by browser type.**
+
+**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
+
+Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).
+
+### GET /browsers/stats
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'browsers': 'test_string',
+ 'end_date': '2016-04-01',
+ 'limit': 'test_string',
+ 'offset': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.browsers.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="campaigns"></a>
+# CAMPAIGNS
+
+## Create a Campaign
+
+**This endpoint allows you to create a campaign.**
+
+Our Marketing Campaigns API lets you create, manage, send, and schedule campaigns.
+
+Note: In order to send or schedule the campaign, you will be required to provide a subject, sender ID, content (we suggest both html and plain text), and at least one list or segment ID. This information is not required when you create a campaign.
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### POST /campaigns
+
+
+```csharp
+string data = @"{
+ 'categories': [
+ 'spring line'
+ ],
+ 'custom_unsubscribe_url': '',
+ 'html_content': '<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>',
+ 'ip_pool': 'marketing',
+ 'list_ids': [
+ 110,
+ 124
+ ],
+ 'plain_content': 'Check out our spring line!',
+ 'segment_ids': [
+ 110
+ ],
+ 'sender_id': 124451,
+ 'subject': 'New Products for Spring!',
+ 'suppression_group_id': 42,
+ 'title': 'March Newsletter'
+}";
+dynamic response = sg.client.campaigns.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all Campaigns
+
+**This endpoint allows you to retrieve a list of all of your campaigns.**
+
+Returns campaigns in reverse order they were created (newest first).
+
+Returns an empty array if no campaigns exist.
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### GET /campaigns
+
+
+```csharp
+string queryParams = @"{
+ 'limit': 0,
+ 'offset': 0
+}";
+dynamic response = sg.client.campaigns.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update a Campaign
+
+Update a campaign. This is especially useful if you only set up the campaign using POST /campaigns, but didn't set many of the parameters.
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### PATCH /campaigns/{campaign_id}
+
+
+```csharp
+string data = @"{
+ 'categories': [
+ 'summer line'
+ ],
+ 'html_content': '<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>',
+ 'plain_content': 'Check out our summer line!',
+ 'subject': 'New Products for Summer!',
+ 'title': 'May Newsletter'
+}";
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a single campaign
+
+**This endpoint allows you to retrieve a specific campaign.**
+
+Our Marketing Campaigns API lets you create, manage, send, and schedule campaigns.
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### GET /campaigns/{campaign_id}
+
+
+```csharp
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a Campaign
+
+**This endpoint allows you to delete a specific campaign.**
+
+Our Marketing Campaigns API lets you create, manage, send, and schedule campaigns.
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### DELETE /campaigns/{campaign_id}
+
+
+```csharp
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update a Scheduled Campaign
+
+**This endpoint allows to you change the scheduled time and date for a campaign to be sent.**
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### PATCH /campaigns/{campaign_id}/schedules
+
+
+```csharp
+string data = @"{
+ 'send_at': 1489451436
+}";
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Schedule a Campaign
+
+**This endpoint allows you to schedule a specific date and time for your campaign to be sent.**
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### POST /campaigns/{campaign_id}/schedules
+
+
+```csharp
+string data = @"{
+ 'send_at': 1489771528
+}";
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## View Scheduled Time of a Campaign
+
+**This endpoint allows you to retrieve the date and time that the given campaign has been scheduled to be sent.**
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### GET /campaigns/{campaign_id}/schedules
+
+
+```csharp
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Unschedule a Scheduled Campaign
+
+**This endpoint allows you to unschedule a campaign that has already been scheduled to be sent.**
+
+A successful unschedule will return a 204.
+If the specified campaign is in the process of being sent, the only option is to cancel (a different method).
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### DELETE /campaigns/{campaign_id}/schedules
+
+
+```csharp
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Send a Campaign
+
+**This endpoint allows you to immediately send a campaign at the time you make the API call.**
+
+Normally a POST would have a request body, but since this endpoint is telling us to send a resource that is already created, a request body is not needed.
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### POST /campaigns/{campaign_id}/schedules/now
+
+
+```csharp
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.now.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Send a Test Campaign
+
+**This endpoint allows you to send a test campaign.**
+
+To send to multiple addresses, use an array for the JSON "to" value ["one@address","two@address"]
+
+For more information:
+
+* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)
+
+### POST /campaigns/{campaign_id}/schedules/test
+
+
+```csharp
+string data = @"{
+ 'to': 'your.email@example.com'
+}";
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.test.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="categories"></a>
+# CATEGORIES
+
+## Retrieve all categories
+
+**This endpoint allows you to retrieve a list of all of your categories.**
+
+Categories can help organize your email analytics by enabling you to tag emails by type or broad topic. You can define your own custom categories. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/categories.html).
+
+### GET /categories
+
+
+```csharp
+string queryParams = @"{
+ 'category': 'test_string',
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.categories.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve Email Statistics for Categories
+
+**This endpoint allows you to retrieve all of your email statistics for each of your categories.**
+
+If you do not define any query parameters, this endpoint will return a sum for each category in groups of 10.
+
+Categories allow you to group your emails together according to broad topics that you define. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/categories.html).
+
+### GET /categories/stats
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'categories': 'test_string',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.categories.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve sums of email stats for each category [Needs: Stats object defined, has category ID?]
+
+**This endpoint allows you to retrieve the total sum of each email statistic for every category over the given date range.**
+
+If you do not define any query parameters, this endpoint will return a sum for each category in groups of 10.
+
+Categories allow you to group your emails together according to broad topics that you define. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/categories.html).
+
+### GET /categories/stats/sums
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.categories.stats.sums.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="clients"></a>
+# CLIENTS
+
+## Retrieve email statistics by client type.
+
+**This endpoint allows you to retrieve your email statistics segmented by client type.**
+
+**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
+
+Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).
+
+### GET /clients/stats
+
+
+```csharp
+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.
+
+**This endpoint allows you to retrieve your email statistics segmented by a specific client type.**
+
+**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
+
+## Available Client Types
+- phone
+- tablet
+- webmail
+- desktop
+
+Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).
+
+### GET /clients/{client_type}/stats
+
+
+```csharp
+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();
+```
+
+<a name="contactdb"></a>
+# CONTACTDB
+
+## Create a Custom Field
+
+**This endpoint allows you to create a custom field.**
+
+The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).
+
+### POST /contactdb/custom_fields
+
+
+```csharp
+string data = @"{
+ 'name': 'pet',
+ 'type': 'text'
+}";
+dynamic response = sg.client.contactdb.custom_fields.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all custom fields
+
+**This endpoint allows you to retrieve all custom fields.**
+
+The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).
+
+### GET /contactdb/custom_fields
+
+
+```csharp
+dynamic response = sg.client.contactdb.custom_fields.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a Custom Field
+
+**This endpoint allows you to retrieve a custom field by ID.**
+
+The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).
+
+### GET /contactdb/custom_fields/{custom_field_id}
+
+
+```csharp
+var custom_field_id = "test_url_param";
+dynamic response = sg.client.contactdb.custom_fields._(custom_field_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a Custom Field
+
+**This endpoint allows you to delete a custom field by ID.**
+
+The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).
+
+### DELETE /contactdb/custom_fields/{custom_field_id}
+
+
+```csharp
+var custom_field_id = "test_url_param";
+dynamic response = sg.client.contactdb.custom_fields._(custom_field_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Create a List
+
+**This endpoint allows you to create a list for your recipients.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### POST /contactdb/lists
+
+
+```csharp
+string data = @"{
+ 'name': 'your list name'
+}";
+dynamic response = sg.client.contactdb.lists.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all lists
+
+**This endpoint allows you to retrieve all of your recipient lists. If you don't have any lists, an empty array will be returned.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### GET /contactdb/lists
+
+
+```csharp
+dynamic response = sg.client.contactdb.lists.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete Multiple lists
+
+**This endpoint allows you to delete multiple recipient lists.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### DELETE /contactdb/lists
+
+
+```csharp
+string data = @"[
+ 1,
+ 2,
+ 3,
+ 4
+]";
+dynamic response = sg.client.contactdb.lists.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update a List
+
+**This endpoint allows you to update the name of one of your recipient lists.**
+
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### PATCH /contactdb/lists/{list_id}
+
+
+```csharp
+string data = @"{
+ 'name': 'newlistname'
+}";
+string queryParams = @"{
+ 'list_id': 0
+}";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).patch(requestBody: data, queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a single list
+
+This endpoint allows you to retrieve a single recipient list.
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### GET /contactdb/lists/{list_id}
+
+
+```csharp
+string queryParams = @"{
+ 'list_id': 0
+}";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a List
+
+**This endpoint allows you to delete a specific recipient list with the given ID.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### DELETE /contactdb/lists/{list_id}
+
+
+```csharp
+string queryParams = @"{
+ 'delete_contacts': 'true'
+}";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Add Multiple Recipients to a List
+
+**This endpoint allows you to add multiple recipients to a list.**
+
+Adds existing recipients to a list, passing in the recipient IDs to add. Recipient IDs should be passed exactly as they are returned from recipient endpoints.
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### POST /contactdb/lists/{list_id}/recipients
+
+
+```csharp
+string data = @"[
+ 'recipient_id1',
+ 'recipient_id2'
+]";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).recipients.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all recipients on a List
+
+**This endpoint allows you to retrieve all recipients on the list with the given ID.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### GET /contactdb/lists/{list_id}/recipients
+
+
+```csharp
+string queryParams = @"{
+ 'list_id': 0,
+ 'page': 1,
+ 'page_size': 1
+}";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).recipients.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Add a Single Recipient to a List
+
+**This endpoint allows you to add a single recipient to a list.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### POST /contactdb/lists/{list_id}/recipients/{recipient_id}
+
+
+```csharp
+var list_id = "test_url_param";
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a Single Recipient from a Single List
+
+**This endpoint allows you to delete a single recipient from a list.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### DELETE /contactdb/lists/{list_id}/recipients/{recipient_id}
+
+
+```csharp
+string queryParams = @"{
+ 'list_id': 0,
+ 'recipient_id': 0
+}";
+var list_id = "test_url_param";
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update Recipient
+
+**This endpoint allows you to update one or more recipients.**
+
+The body of an API call to this endpoint must include an array of one or more recipient objects.
+
+It is of note that you can add custom field data as parameters on recipient objects. We have provided an example using some of the default custom fields SendGrid provides.
+
+The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).
+
+### PATCH /contactdb/recipients
+
+
+```csharp
+string data = @"[
+ {
+ 'email': 'jones@example.com',
+ 'first_name': 'Guy',
+ 'last_name': 'Jones'
+ }
+]";
+dynamic response = sg.client.contactdb.recipients.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Add recipients
+
+**This endpoint allows you to add a Marketing Campaigns recipient.**
+
+It is of note that you can add custom field data as a parameter on this endpoint. We have provided an example using some of the default custom fields SendGrid provides.
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### POST /contactdb/recipients
+
+
+```csharp
+string data = @"[
+ {
+ 'age': 25,
+ 'email': 'example@example.com',
+ 'first_name': '',
+ 'last_name': 'User'
+ },
+ {
+ 'age': 25,
+ 'email': 'example2@example.com',
+ 'first_name': 'Example',
+ 'last_name': 'User'
+ }
+]";
+dynamic response = sg.client.contactdb.recipients.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve recipients
+
+**This endpoint allows you to retrieve all of your Marketing Campaigns recipients.**
+
+Batch deletion of a page makes it possible to receive an empty page of recipients before reaching the end of
+the list of recipients. To avoid this issue; iterate over pages until a 404 is retrieved.
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### GET /contactdb/recipients
+
+
+```csharp
+string queryParams = @"{
+ 'page': 1,
+ 'page_size': 1
+}";
+dynamic response = sg.client.contactdb.recipients.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete Recipient
+
+**This endpoint allows you to deletes one or more recipients.**
+
+The body of an API call to this endpoint must include an array of recipient IDs of the recipients you want to delete.
+
+The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).
+
+### DELETE /contactdb/recipients
+
+
+```csharp
+string data = @"[
+ 'recipient_id1',
+ 'recipient_id2'
+]";
+dynamic response = sg.client.contactdb.recipients.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve the count of billable recipients
+
+**This endpoint allows you to retrieve the number of Marketing Campaigns recipients that you will be billed for.**
+
+You are billed for marketing campaigns based on the highest number of recipients you have had in your account at one time. This endpoint will allow you to know the current billable count value.
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### GET /contactdb/recipients/billable_count
+
+
+```csharp
+dynamic response = sg.client.contactdb.recipients.billable_count.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a Count of Recipients
+
+**This endpoint allows you to retrieve the total number of Marketing Campaigns recipients.**
+
+The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).
+
+### GET /contactdb/recipients/count
+
+
+```csharp
+dynamic response = sg.client.contactdb.recipients.count.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve recipients matching search criteria
+
+**This endpoint allows you to perform a search on all of your Marketing Campaigns recipients.**
+
+field_name:
+
+* is a variable that is substituted for your actual custom field name from your recipient.
+* Text fields must be url-encoded. Date fields are searchable only by unix timestamp (e.g. 2/2/2015 becomes 1422835200)
+* If field_name is a 'reserved' date field, such as created_at or updated_at, the system will internally convert
+your epoch time to a date range encompassing the entire day. For example, an epoch time of 1422835600 converts to
+Mon, 02 Feb 2015 00:06:40 GMT, but internally the system will search from Mon, 02 Feb 2015 00:00:00 GMT through
+Mon, 02 Feb 2015 23:59:59 GMT.
+
+The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).
+
+### GET /contactdb/recipients/search
+
+
+```csharp
+string queryParams = @"{
+ '{field_name}': 'test_string'
+}";
+dynamic response = sg.client.contactdb.recipients.search.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a single recipient
+
+**This endpoint allows you to retrieve a single recipient by ID from your contact database.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### GET /contactdb/recipients/{recipient_id}
+
+
+```csharp
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.recipients._(recipient_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a Recipient
+
+**This endpoint allows you to delete a single recipient with the given ID from your contact database.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### DELETE /contactdb/recipients/{recipient_id}
+
+
+```csharp
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.recipients._(recipient_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve the lists that a recipient is on
+
+**This endpoint allows you to retrieve the lists that a given recipient belongs to.**
+
+Each recipient can be on many lists. This endpoint gives you all of the lists that any one recipient has been added to.
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+### GET /contactdb/recipients/{recipient_id}/lists
+
+
+```csharp
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.recipients._(recipient_id).lists.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve reserved fields
+
+**This endpoint allows you to list all fields that are reserved and can't be used for custom field names.**
+
+The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).
+
+### GET /contactdb/reserved_fields
+
+
+```csharp
+dynamic response = sg.client.contactdb.reserved_fields.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Create a Segment
+
+**This endpoint allows you to create a segment.**
+
+All recipients in your contactdb will be added or removed automatically depending on whether they match the criteria for this segment.
+
+List Id:
+
+* Send this to segment from an existing list
+* Don't send this in order to segment from your entire contactdb.
+
+Valid operators for create and update depend on the type of the field you are segmenting:
+
+* **Dates:** "eq", "ne", "lt" (before), "gt" (after)
+* **Text:** "contains", "eq" (is - matches the full field), "ne" (is not - matches any field where the entire field is not the condition value)
+* **Numbers:** "eq", "lt", "gt"
+* **Email Clicks and Opens:** "eq" (opened), "ne" (not opened)
+
+Segment conditions using "eq" or "ne" for email clicks and opens should provide a "field" of either *clicks.campaign_identifier* or *opens.campaign_identifier*. The condition value should be a string containing the id of a completed campaign.
+
+Segments may contain multiple condtions, joined by an "and" or "or" in the "and_or" field. The first condition in the conditions list must have an empty "and_or", and subsequent conditions must all specify an "and_or".
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).
+
+### POST /contactdb/segments
+
+
+```csharp
+string data = @"{
+ 'conditions': [
+ {
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
+ 'value': 'Miller'
+ },
+ {
+ 'and_or': 'and',
+ 'field': 'last_clicked',
+ 'operator': 'gt',
+ 'value': '01/02/2015'
+ },
+ {
+ 'and_or': 'or',
+ 'field': 'clicks.campaign_identifier',
+ 'operator': 'eq',
+ 'value': '513'
+ }
+ ],
+ 'list_id': 4,
+ 'name': 'Last Name Miller'
+}";
+dynamic response = sg.client.contactdb.segments.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all segments
+
+**This endpoint allows you to retrieve all of your segments.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).
+
+### GET /contactdb/segments
+
+
+```csharp
+dynamic response = sg.client.contactdb.segments.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update a segment
+
+**This endpoint allows you to update a segment.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).
+
+### PATCH /contactdb/segments/{segment_id}
+
+
+```csharp
+string data = @"{
+ 'conditions': [
+ {
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
+ 'value': 'Miller'
+ }
+ ],
+ 'list_id': 5,
+ 'name': 'The Millers'
+}";
+string queryParams = @"{
+ 'segment_id': 'test_string'
+}";
+var segment_id = "test_url_param";
+dynamic response = sg.client.contactdb.segments._(segment_id).patch(requestBody: data, queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a segment
+
+**This endpoint allows you to retrieve a single segment with the given ID.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).
+
+### GET /contactdb/segments/{segment_id}
+
+
+```csharp
+string queryParams = @"{
+ 'segment_id': 0
+}";
+var segment_id = "test_url_param";
+dynamic response = sg.client.contactdb.segments._(segment_id).get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a segment
+
+**This endpoint allows you to delete a segment from your recipients database.**
+
+You also have the option to delete all the contacts from your Marketing Campaigns recipient database who were in this segment.
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).
+
+### DELETE /contactdb/segments/{segment_id}
+
+
+```csharp
+string queryParams = @"{
+ 'delete_contacts': 'true'
+}";
+var segment_id = "test_url_param";
+dynamic response = sg.client.contactdb.segments._(segment_id).delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve recipients on a segment
+
+**This endpoint allows you to retrieve all of the recipients in a segment with the given ID.**
+
+The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
+
+For more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).
+
+### GET /contactdb/segments/{segment_id}/recipients
+
+
+```csharp
+string queryParams = @"{
+ 'page': 1,
+ 'page_size': 1
+}";
+var segment_id = "test_url_param";
+dynamic response = sg.client.contactdb.segments._(segment_id).recipients.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="devices"></a>
+# DEVICES
+
+## Retrieve email statistics by device type.
+
+**This endpoint allows you to retrieve your email statistics segmented by the device type.**
+
+**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
+
+## Available Device Types
+| **Device** | **Description** | **Example** |
+|---|---|---|
+| Desktop | Email software on desktop computer. | I.E., Outlook, Sparrow, or Apple Mail. |
+| Webmail | A web-based email client. | I.E., Yahoo, Google, AOL, or Outlook.com. |
+| Phone | A smart phone. | iPhone, Android, Blackberry, etc.
+| Tablet | A tablet computer. | iPad, android based tablet, etc. |
+| Other | An unrecognized device. |
+
+Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).
+
+### GET /devices/stats
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.devices.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="geo"></a>
+# GEO
+
+## Retrieve email statistics by country and state/province.
+
+**This endpoint allows you to retrieve your email statistics segmented by country and state/province.**
+
+**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
+
+Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).
+
+### GET /geo/stats
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'country': 'US',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.geo.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="ips"></a>
+# IPS
+
+## Retrieve all IP addresses
+
+**This endpoint allows you to retrieve a list of all assigned and unassigned IPs.**
+
+Response includes warm up status, pools, assigned subusers, and whitelabel info. The start_date field corresponds to when warmup started for that IP.
+
+A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.
+
+### GET /ips
+
+
+```csharp
+string queryParams = @"{
+ 'exclude_whitelabels': 'true',
+ 'ip': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'subuser': 'test_string'
+}";
+dynamic response = sg.client.ips.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all assigned IPs
+
+**This endpoint allows you to retrieve only assigned IP addresses.**
+
+A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.
+
+### GET /ips/assigned
+
+
+```csharp
+dynamic response = sg.client.ips.assigned.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Create an IP pool.
+
+**This endpoint allows you to create an IP pool.**
+
+**Each user can create up to 10 different IP pools.**
+
+IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.
+
+IP pools can only be used with whitelabeled IP addresses.
+
+If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.
+
+### POST /ips/pools
+
+
+```csharp
+string data = @"{
+ 'name': 'marketing'
+}";
+dynamic response = sg.client.ips.pools.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all IP pools.
+
+**This endpoint allows you to retreive all of your IP pools.**
+
+IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.
+
+IP pools can only be used with whitelabeled IP addresses.
+
+If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.
+
+### GET /ips/pools
+
+
+```csharp
+dynamic response = sg.client.ips.pools.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update an IP pools name.
+
+**This endpoint allows you to update the name of an IP pool.**
+
+IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.
+
+IP pools can only be used with whitelabeled IP addresses.
+
+If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.
+
+### PUT /ips/pools/{pool_name}
+
+
+```csharp
+string data = @"{
+ 'name': 'new_pool_name'
+}";
+var pool_name = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all IPs in a specified pool.
+
+**This endpoint allows you to list all of the IP addresses that are in a specific IP pool.**
+
+IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.
+
+IP pools can only be used with whitelabeled IP addresses.
+
+If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.
+
+### GET /ips/pools/{pool_name}
+
+
+```csharp
+var pool_name = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete an IP pool.
+
+**This endpoint allows you to delete an IP pool.**
+
+IP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.
+
+IP pools can only be used with whitelabeled IP addresses.
+
+If an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.
+
+### DELETE /ips/pools/{pool_name}
+
+
+```csharp
+var pool_name = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Add an IP address to a pool
+
+**This endpoint allows you to add an IP address to an IP pool.**
+
+You can add the same IP address to multiple pools. It may take up to 60 seconds for your IP address to be added to a pool after your request is made.
+
+A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.
+
+### POST /ips/pools/{pool_name}/ips
+
+
+```csharp
+string data = @"{
+ 'ip': '0.0.0.0'
+}";
+var pool_name = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).ips.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Remove an IP address from a pool.
+
+**This endpoint allows you to remove an IP address from an IP pool.**
+
+The same IP address can be added to multiple IP pools.
+
+A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.
+
+### DELETE /ips/pools/{pool_name}/ips/{ip}
+
+
+```csharp
+var pool_name = "test_url_param";
+var ip = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).ips._(ip).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Add an IP to warmup
+
+**This endpoint allows you to enter an IP address into warmup mode.**
+
+SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup.
+
+For more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html).
+
+### POST /ips/warmup
+
+
+```csharp
+string data = @"{
+ 'ip': '0.0.0.0'
+}";
+dynamic response = sg.client.ips.warmup.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all IPs currently in warmup
+
+**This endpoint allows you to retrieve all of your IP addresses that are currently warming up.**
+
+SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup.
+
+For more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html).
+
+### GET /ips/warmup
+
+
+```csharp
+dynamic response = sg.client.ips.warmup.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve warmup status for a specific IP address
+
+**This endpoint allows you to retrieve the warmup status for a specific IP address.**
+
+SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup.
+
+For more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html).
+
+### GET /ips/warmup/{ip_address}
+
+
+```csharp
+var ip_address = "test_url_param";
+dynamic response = sg.client.ips.warmup._(ip_address).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Remove an IP from warmup
+
+**This endpoint allows you to remove an IP address from warmup mode.**
+
+SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup.
+
+For more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html).
+
+### DELETE /ips/warmup/{ip_address}
+
+
+```csharp
+var ip_address = "test_url_param";
+dynamic response = sg.client.ips.warmup._(ip_address).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all IP pools an IP address belongs to
+
+**This endpoint allows you to see which IP pools a particular IP address has been added to.**
+
+The same IP address can be added to multiple IP pools.
+
+A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.
+
+### GET /ips/{ip_address}
+
+
+```csharp
+var ip_address = "test_url_param";
+dynamic response = sg.client.ips._(ip_address).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="mail"></a>
+# MAIL
+
+## Create a batch ID
+
+**This endpoint allows you to generate a new batch ID. This batch ID can be associated with scheduled sends via the mail/send endpoint.**
+
+If you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at anytime up to 10 minutes before the schedule date, you can cancel all of the mail/send requests that have this batch ID by calling the Cancel Scheduled Send endpoint.
+
+More Information:
+
+* [Scheduling Parameters > Batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)
+
+### POST /mail/batch
+
+
+```csharp
+dynamic response = sg.client.mail.batch.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Validate batch ID
+
+**This endpoint allows you to validate a batch ID.**
+
+If you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at anytime up to 10 minutes before the schedule date, you can cancel all of the mail/send requests that have this batch ID by calling the Cancel Scheduled Send endpoint.
+
+More Information:
+
+* [Scheduling Parameters > Batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)
+
+### GET /mail/batch/{batch_id}
+
+
+```csharp
+var batch_id = "test_url_param";
+dynamic response = sg.client.mail.batch._(batch_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## 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).
+
+* Top level parameters are referred to as "global".
+* Individual fields within the personalizations array will override any other global, or message level, parameters that are defined outside of personalizations.
+
+For an overview of the v3 Mail Send endpoint, please visit our [v3 API Reference](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html)
+
+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
+
+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 = @"{
+ 'asm': {
+ 'group_id': 1,
+ 'groups_to_display': [
+ 1,
+ 2,
+ 3
+ ]
+ },
+ 'attachments': [
+ {
+ '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]',
+ 'categories': [
+ 'category1',
+ 'category2'
+ ],
+ 'content': [
+ {
+ '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',
+ 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
+ },
+ 'from': {
+ 'email': 'sam.smith@example.com',
+ 'name': 'Sam Smith'
+ },
+ 'headers': {},
+ 'ip_pool_name': '[YOUR POOL NAME GOES HERE]',
+ 'mail_settings': {
+ 'bcc': {
+ 'email': 'ben.doe@example.com',
+ 'enable': true
+ },
+ 'bypass_list_management': {
+ 'enable': true
+ },
+ 'footer': {
+ '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',
+ 'threshold': 3
+ }
+ },
+ 'personalizations': [
+ {
+ 'bcc': [
+ {
+ 'email': 'sam.doe@example.com',
+ 'name': 'Sam Doe'
+ }
+ ],
+ 'cc': [
+ {
+ 'email': 'jane.doe@example.com',
+ 'name': 'Jane Doe'
+ }
+ ],
+ 'custom_args': {
+ 'New Argument 1': 'New Value 1',
+ 'activationAttempt': '1',
+ 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
+ },
+ 'headers': {
+ 'X-Accept-Language': 'en',
+ 'X-Mailer': 'MyApp'
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
+ 'substitutions': {
+ 'sub': {
+ '%name%': [
+ 'John',
+ 'Jane',
+ 'Sam'
+ ]
+ }
+ },
+ 'to': [
+ {
+ 'email': 'john.doe@example.com',
+ 'name': 'John Doe'
+ }
+ ]
+ }
+ ],
+ 'reply_to': {
+ 'email': 'sam.smith@example.com',
+ 'name': 'Sam Smith'
+ },
+ 'sections': {
+ 'section': {
+ ':sectionName1': 'section 1 text',
+ ':sectionName2': 'section 2 text'
+ }
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
+ 'template_id': '[YOUR TEMPLATE ID GOES HERE]',
+ 'tracking_settings': {
+ 'click_tracking': {
+ '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]',
+ 'utm_term': '[IDENTIFY PAID KEYWORDS HERE]'
+ },
+ 'open_tracking': {
+ '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%>',
+ 'text': 'If you would like to unsubscribe and stop receiveing these emails <% click here %>.'
+ }
+ }
+}";
+dynamic response = sg.client.mail.send.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="mail_settings"></a>
+# MAIL SETTINGS
+
+## Retrieve all mail settings
+
+**This endpoint allows you to retrieve a list of all mail settings.**
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings
+
+
+```csharp
+string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.mail_settings.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update address whitelist mail settings
+
+**This endpoint allows you to update your current email address whitelist settings.**
+
+The address whitelist setting whitelists a specified email address or domain for which mail should never be suppressed. For example, you own the domain example.com, and one or more of your recipients use email@example.com addresses, by placing example.com in the address whitelist setting, all bounces, blocks, and unsubscribes logged for that domain will be ignored and sent as if under normal sending conditions.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### PATCH /mail_settings/address_whitelist
+
+
+```csharp
+string data = @"{
+ 'enabled': true,
+ 'list': [
+ 'email1@example.com',
+ 'example.com'
+ ]
+}";
+dynamic response = sg.client.mail_settings.address_whitelist.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve address whitelist mail settings
+
+**This endpoint allows you to retrieve your current email address whitelist settings.**
+
+The address whitelist setting whitelists a specified email address or domain for which mail should never be suppressed. For example, you own the domain example.com, and one or more of your recipients use email@example.com addresses, by placing example.com in the address whitelist setting, all bounces, blocks, and unsubscribes logged for that domain will be ignored and sent as if under normal sending conditions.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings/address_whitelist
+
+
+```csharp
+dynamic response = sg.client.mail_settings.address_whitelist.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update BCC mail settings
+
+**This endpoint allows you to update your current BCC mail settings.**
+
+When the BCC mail setting is enabled, SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field, if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### PATCH /mail_settings/bcc
+
+
+```csharp
+string data = @"{
+ 'email': 'email@example.com',
+ 'enabled': false
+}";
+dynamic response = sg.client.mail_settings.bcc.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all BCC mail settings
+
+**This endpoint allows you to retrieve your current BCC mail settings.**
+
+When the BCC mail setting is enabled, SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field, if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings/bcc
+
+
+```csharp
+dynamic response = sg.client.mail_settings.bcc.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update bounce purge mail settings
+
+**This endpoint allows you to update your current bounce purge settings.**
+
+This setting allows you to set a schedule for SendGrid to automatically delete contacts from your soft and hard bounce suppression lists.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### PATCH /mail_settings/bounce_purge
+
+
+```csharp
+string data = @"{
+ 'enabled': true,
+ 'hard_bounces': 5,
+ 'soft_bounces': 5
+}";
+dynamic response = sg.client.mail_settings.bounce_purge.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve bounce purge mail settings
+
+**This endpoint allows you to retrieve your current bounce purge settings.**
+
+This setting allows you to set a schedule for SendGrid to automatically delete contacts from your soft and hard bounce suppression lists.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings/bounce_purge
+
+
+```csharp
+dynamic response = sg.client.mail_settings.bounce_purge.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update footer mail settings
+
+**This endpoint allows you to update your current Footer mail settings.**
+
+The footer setting will insert a custom footer at the bottom of the text and HTML bodies. Use the embedded HTML editor and plain text entry fields to create the content of the footers to be inserted into your emails.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### PATCH /mail_settings/footer
+
+
+```csharp
+string data = @"{
+ 'enabled': true,
+ 'html_content': '...',
+ 'plain_content': '...'
+}";
+dynamic response = sg.client.mail_settings.footer.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve footer mail settings
+
+**This endpoint allows you to retrieve your current Footer mail settings.**
+
+The footer setting will insert a custom footer at the bottom of the text and HTML bodies. Use the embedded HTML editor and plain text entry fields to create the content of the footers to be inserted into your emails.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings/footer
+
+
+```csharp
+dynamic response = sg.client.mail_settings.footer.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update forward bounce mail settings
+
+**This endpoint allows you to update your current bounce forwarding mail settings.**
+
+Activating this setting allows you to specify an email address to which bounce reports are forwarded.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### PATCH /mail_settings/forward_bounce
+
+
+```csharp
+string data = @"{
+ 'email': 'example@example.com',
+ 'enabled': true
+}";
+dynamic response = sg.client.mail_settings.forward_bounce.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve forward bounce mail settings
+
+**This endpoint allows you to retrieve your current bounce forwarding mail settings.**
+
+Activating this setting allows you to specify an email address to which bounce reports are forwarded.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings/forward_bounce
+
+
+```csharp
+dynamic response = sg.client.mail_settings.forward_bounce.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update forward spam mail settings
+
+**This endpoint allows you to update your current Forward Spam mail settings.**
+
+Enabling the forward spam setting allows you to specify an email address to which spam reports will be forwarded.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### PATCH /mail_settings/forward_spam
+
+
+```csharp
+string data = @"{
+ 'email': '',
+ 'enabled': false
+}";
+dynamic response = sg.client.mail_settings.forward_spam.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve forward spam mail settings
+
+**This endpoint allows you to retrieve your current Forward Spam mail settings.**
+
+Enabling the forward spam setting allows you to specify an email address to which spam reports will be forwarded.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings/forward_spam
+
+
+```csharp
+dynamic response = sg.client.mail_settings.forward_spam.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update plain content mail settings
+
+**This endpoint allows you to update your current Plain Content mail settings.**
+
+The plain content setting will automatically convert any plain text emails that you send to HTML before sending.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### PATCH /mail_settings/plain_content
+
+
+```csharp
+string data = @"{
+ 'enabled': false
+}";
+dynamic response = sg.client.mail_settings.plain_content.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve plain content mail settings
+
+**This endpoint allows you to retrieve your current Plain Content mail settings.**
+
+The plain content setting will automatically convert any plain text emails that you send to HTML before sending.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings/plain_content
+
+
+```csharp
+dynamic response = sg.client.mail_settings.plain_content.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update spam check mail settings
+
+**This endpoint allows you to update your current spam checker mail settings.**
+
+The spam checker filter notifies you when emails are detected that exceed a predefined spam threshold.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### PATCH /mail_settings/spam_check
+
+
+```csharp
+string data = @"{
+ 'enabled': true,
+ 'max_score': 5,
+ 'url': 'url'
+}";
+dynamic response = sg.client.mail_settings.spam_check.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve spam check mail settings
+
+**This endpoint allows you to retrieve your current Spam Checker mail settings.**
+
+The spam checker filter notifies you when emails are detected that exceed a predefined spam threshold.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings/spam_check
+
+
+```csharp
+dynamic response = sg.client.mail_settings.spam_check.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update template mail settings
+
+**This endpoint allows you to update your current legacy email template settings.**
+
+This setting refers to our original email templates. We currently support more fully featured [transactional templates](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+The legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### PATCH /mail_settings/template
+
+
+```csharp
+string data = @"{
+ 'enabled': true,
+ 'html_content': '<% body %>'
+}";
+dynamic response = sg.client.mail_settings.template.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve legacy template mail settings
+
+**This endpoint allows you to retrieve your current legacy email template settings.**
+
+This setting refers to our original email templates. We currently support more fully featured [transactional templates](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+The legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages.
+
+Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
+
+### GET /mail_settings/template
+
+
+```csharp
+dynamic response = sg.client.mail_settings.template.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="mailbox_providers"></a>
+# MAILBOX PROVIDERS
+
+## Retrieve email statistics by mailbox provider.
+
+**This endpoint allows you to retrieve your email statistics segmented by recipient mailbox provider.**
+
+**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
+
+Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).
+
+### GET /mailbox_providers/stats
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'mailbox_providers': 'test_string',
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.mailbox_providers.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="partner_settings"></a>
+# PARTNER SETTINGS
+
+## Returns a list of all partner settings.
+
+**This endpoint allows you to retrieve a list of all partner settings that you can enable.**
+
+Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html).
+
+### GET /partner_settings
+
+
+```csharp
+string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.partner_settings.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Updates New Relic partner settings.
+
+**This endpoint allows you to update or change your New Relic partner settings.**
+
+Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html).
+
+By integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html).
+
+### PATCH /partner_settings/new_relic
+
+
+```csharp
+string data = @"{
+ 'enable_subuser_statistics': true,
+ 'enabled': true,
+ 'license_key': ''
+}";
+dynamic response = sg.client.partner_settings.new_relic.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Returns all New Relic partner settings.
+
+**This endpoint allows you to retrieve your current New Relic partner settings.**
+
+Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html).
+
+By integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html).
+
+### GET /partner_settings/new_relic
+
+
+```csharp
+dynamic response = sg.client.partner_settings.new_relic.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="scopes"></a>
+# SCOPES
+
+## Retrieve a list of scopes for which this user has access.
+
+**This endpoint returns a list of all scopes that this user has access to.**
+
+API Keys can be used to authenticate the use of [SendGrids v3 Web API](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html), or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). API Keys may be assigned certain permissions, or scopes, that limit which API endpoints they are able to access. For a more detailed explanation of how you can use API Key permissios, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/api_keys.html#-API-Key-Permissions) or [Classroom](https://sendgrid.com/docs/Classroom/Basics/API/api_key_permissions.html).
+
+### GET /scopes
+
+
+```csharp
+dynamic response = sg.client.scopes.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="stats"></a>
+# STATS
+
+## Retrieve global email statistics
+
+**This endpoint allows you to retrieve all of your global email statistics between a given date range.**
+
+Parent accounts will see aggregated stats for their account and all subuser accounts. Subuser accounts will only see their own stats.
+
+### GET /stats
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="subusers"></a>
+# SUBUSERS
+
+## Create Subuser
+
+This endpoint allows you to retrieve a list of all of your subusers. You can choose to retrieve specific subusers as well as limit the results that come back from the API.
+
+For more information about Subusers:
+
+* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html)
+* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html)
+
+### POST /subusers
+
+
+```csharp
+string data = @"{
+ 'email': 'John@example.com',
+ 'ips': [
+ '1.1.1.1',
+ '2.2.2.2'
+ ],
+ 'password': 'johns_password',
+ 'username': 'John@example.com'
+}";
+dynamic response = sg.client.subusers.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## List all Subusers
+
+This endpoint allows you to retrieve a list of all of your subusers. You can choose to retrieve specific subusers as well as limit the results that come back from the API.
+
+For more information about Subusers:
+
+* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html)
+* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html)
+
+### GET /subusers
+
+
+```csharp
+string queryParams = @"{
+ 'limit': 0,
+ 'offset': 0,
+ 'username': 'test_string'
+}";
+dynamic response = sg.client.subusers.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve Subuser Reputations
+
+Subuser sender reputations give a good idea how well a sender is doing with regards to how recipients and recipient servers react to the mail that is being received. When a bounce, spam report, or other negative action happens on a sent email, it will effect your sender rating.
+
+This endpoint allows you to request the reputations for your subusers.
+
+### GET /subusers/reputations
+
+
+```csharp
+string queryParams = @"{
+ 'usernames': 'test_string'
+}";
+dynamic response = sg.client.subusers.reputations.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve email statistics for your subusers.
+
+**This endpoint allows you to retrieve the email statistics for the given subusers.**
+
+You may retrieve statistics for up to 10 different subusers by including an additional _subusers_ parameter for each additional subuser.
+
+While you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings.
+
+For more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html).
+
+### GET /subusers/stats
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01',
+ 'subusers': 'test_string'
+}";
+dynamic response = sg.client.subusers.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve monthly stats for all subusers
+
+**This endpoint allows you to retrieve the monthly email statistics for all subusers over the given date range.**
+
+While you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats for your subusers. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings.
+
+When using the `sort_by_metric` to sort your stats by a specific metric, you can not sort by the following metrics:
+`bounce_drops`, `deferred`, `invalid_emails`, `processed`, `spam_report_drops`, `spam_reports`, or `unsubscribe_drops`.
+
+For more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html).
+
+### GET /subusers/stats/monthly
+
+
+```csharp
+string queryParams = @"{
+ 'date': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'subuser': 'test_string'
+}";
+dynamic response = sg.client.subusers.stats.monthly.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve the totals for each email statistic metric for all subusers.
+
+**This endpoint allows you to retrieve the total sums of each email statistic metric for all subusers over the given date range.**
+
+
+While you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings.
+
+For more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html).
+
+### GET /subusers/stats/sums
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.subusers.stats.sums.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Enable/disable a subuser
+
+This endpoint allows you to enable or disable a subuser.
+
+For more information about Subusers:
+
+* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html)
+* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html)
+
+### PATCH /subusers/{subuser_name}
+
+
+```csharp
+string data = @"{
+ 'disabled': false
+}";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a subuser
+
+This endpoint allows you to delete a subuser. This is a permanent action, once deleted a subuser cannot be retrieved.
+
+For more information about Subusers:
+
+* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html)
+* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html)
+
+### DELETE /subusers/{subuser_name}
+
+
+```csharp
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update IPs assigned to a subuser
+
+Each subuser should be assigned to an IP address, from which all of this subuser's mail will be sent. Often, this is the same IP as the parent account, but each subuser can have their own, or multiple, IP addresses as well.
+
+More information:
+
+* [How to request more IPs](https://sendgrid.com/docs/Classroom/Basics/Account/adding_an_additional_dedicated_ip_to_your_account.html)
+* [IPs can be whitelabeled](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/ips.html)
+
+### PUT /subusers/{subuser_name}/ips
+
+
+```csharp
+string data = @"[
+ '127.0.0.1'
+]";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).ips.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update Monitor Settings for a subuser
+
+Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails.
+
+### PUT /subusers/{subuser_name}/monitor
+
+
+```csharp
+string data = @"{
+ 'email': 'example@example.com',
+ 'frequency': 500
+}";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).monitor.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Create monitor settings
+
+Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails.
+
+### POST /subusers/{subuser_name}/monitor
+
+
+```csharp
+string data = @"{
+ 'email': 'example@example.com',
+ 'frequency': 50000
+}";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).monitor.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve monitor settings for a subuser
+
+Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails.
+
+### GET /subusers/{subuser_name}/monitor
+
+
+```csharp
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).monitor.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete monitor settings
+
+Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails.
+
+### DELETE /subusers/{subuser_name}/monitor
+
+
+```csharp
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).monitor.delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve the monthly email statistics for a single subuser
+
+**This endpoint allows you to retrive the monthly email statistics for a specific subuser.**
+
+While you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats for your subusers. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings.
+
+When using the `sort_by_metric` to sort your stats by a specific metric, you can not sort by the following metrics:
+`bounce_drops`, `deferred`, `invalid_emails`, `processed`, `spam_report_drops`, `spam_reports`, or `unsubscribe_drops`.
+
+For more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html).
+
+### GET /subusers/{subuser_name}/stats/monthly
+
+
+```csharp
+string queryParams = @"{
+ 'date': 'test_string',
+ 'limit': 0,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string'
+}";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).stats.monthly.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="suppression"></a>
+# SUPPRESSION
+
+## Retrieve all blocks
+
+**This endpoint allows you to retrieve a list of all email addresses that are currently on your blocks list.**
+
+[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html).
+
+### GET /suppression/blocks
+
+
+```csharp
+string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+dynamic response = sg.client.suppression.blocks.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete blocks
+
+**This endpoint allows you to delete all email addresses on your blocks list.**
+
+There are two options for deleting blocked emails:
+
+1. You can delete all blocked emails by setting `delete_all` to true in the request body.
+2. You can delete some blocked emails by specifying the email addresses in an array in the request body.
+
+[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html).
+
+### DELETE /suppression/blocks
+
+
+```csharp
+string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ 'example1@example.com',
+ 'example2@example.com'
+ ]
+}";
+dynamic response = sg.client.suppression.blocks.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a specific block
+
+**This endpoint allows you to retrieve a specific email address from your blocks list.**
+
+[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html).
+
+### GET /suppression/blocks/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.suppression.blocks._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a specific block
+
+**This endpoint allows you to delete a specific email address from your blocks list.**
+
+[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html).
+
+### DELETE /suppression/blocks/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.suppression.blocks._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all bounces
+
+**This endpoint allows you to retrieve all of your bounces.**
+
+Bounces are messages that are returned to the server that sent it.
+
+For more information see:
+
+* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information
+* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html)
+
+### GET /suppression/bounces
+
+
+```csharp
+string queryParams = @"{
+ 'end_time': 0,
+ 'start_time': 0
+}";
+dynamic response = sg.client.suppression.bounces.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete bounces
+
+**This endpoint allows you to delete all of your bounces. You can also use this endpoint to remove a specific email address from your bounce list.**
+
+Bounces are messages that are returned to the server that sent it.
+
+For more information see:
+
+* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information
+* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html)
+* [Classroom > List Scrubbing Guide](https://sendgrid.com/docs/Classroom/Deliver/list_scrubbing.html)
+
+Note: the `delete_all` and `emails` parameters should be used independently of each other as they have different purposes.
+
+### DELETE /suppression/bounces
+
+
+```csharp
+string data = @"{
+ 'delete_all': true,
+ 'emails': [
+ 'example@example.com',
+ 'example2@example.com'
+ ]
+}";
+dynamic response = sg.client.suppression.bounces.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a Bounce
+
+**This endpoint allows you to retrieve a specific bounce for a given email address.**
+
+Bounces are messages that are returned to the server that sent it.
+
+For more information see:
+
+* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information
+* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html)
+* [Classroom > List Scrubbing Guide](https://sendgrid.com/docs/Classroom/Deliver/list_scrubbing.html)
+
+### GET /suppression/bounces/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.suppression.bounces._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a bounce
+
+**This endpoint allows you to remove an email address from your bounce list.**
+
+Bounces are messages that are returned to the server that sent it. This endpoint allows you to delete a single email addresses from your bounce list.
+
+For more information see:
+
+* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information
+* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html)
+* [Classroom > List Scrubbing Guide](https://sendgrid.com/docs/Classroom/Deliver/list_scrubbing.html)
+
+### DELETE /suppression/bounces/{email}
+
+
+```csharp
+string queryParams = @"{
+ 'email_address': 'example@example.com'
+}";
+var email = "test_url_param";
+dynamic response = sg.client.suppression.bounces._(email).delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all invalid emails
+
+**This endpoint allows you to retrieve a list of all invalid email addresses.**
+
+An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipients mail server.
+
+Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html).
+
+### GET /suppression/invalid_emails
+
+
+```csharp
+string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+dynamic response = sg.client.suppression.invalid_emails.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete invalid emails
+
+**This endpoint allows you to remove email addresses from your invalid email address list.**
+
+There are two options for deleting invalid email addresses:
+
+1) You can delete all invalid email addresses by setting `delete_all` to true in the request body.
+2) You can delete some invalid email addresses by specifying certain addresses in an array in the request body.
+
+An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipients mail server.
+
+Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html).
+
+### DELETE /suppression/invalid_emails
+
+
+```csharp
+string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ 'example1@example.com',
+ 'example2@example.com'
+ ]
+}";
+dynamic response = sg.client.suppression.invalid_emails.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a specific invalid email
+
+**This endpoint allows you to retrieve a specific invalid email addresses.**
+
+An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipients mail server.
+
+Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html).
+
+### GET /suppression/invalid_emails/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.suppression.invalid_emails._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a specific invalid email
+
+**This endpoint allows you to remove a specific email address from the invalid email address list.**
+
+An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipients mail server.
+
+Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html).
+
+### DELETE /suppression/invalid_emails/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.suppression.invalid_emails._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a specific spam report
+
+**This endpoint allows you to retrieve a specific spam report.**
+
+[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html).
+
+### GET /suppression/spam_report/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.suppression.spam_report._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a specific spam report
+
+**This endpoint allows you to delete a specific spam report.**
+
+[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html).
+
+### DELETE /suppression/spam_report/{email}
+
+
+```csharp
+var email = "test_url_param";
+dynamic response = sg.client.suppression.spam_report._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all spam reports
+
+**This endpoint allows you to retrieve all spam reports.**
+
+[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html).
+
+### GET /suppression/spam_reports
+
+
+```csharp
+string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+dynamic response = sg.client.suppression.spam_reports.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete spam reports
+
+**This endpoint allows you to delete your spam reports.**
+
+There are two options for deleting spam reports:
+
+1) You can delete all spam reports by setting "delete_all" to true in the request body.
+2) You can delete some spam reports by specifying the email addresses in an array in the request body.
+
+[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html).
+
+### DELETE /suppression/spam_reports
+
+
+```csharp
+string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ 'example1@example.com',
+ 'example2@example.com'
+ ]
+}";
+dynamic response = sg.client.suppression.spam_reports.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all global suppressions
+
+**This endpoint allows you to retrieve a list of all email address that are globally suppressed.**
+
+A global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html).
+
+### GET /suppression/unsubscribes
+
+
+```csharp
+string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+dynamic response = sg.client.suppression.unsubscribes.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="templates"></a>
+# TEMPLATES
+
+## Create a transactional template.
+
+**This endpoint allows you to create a transactional template.**
+
+Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.
+
+Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+### POST /templates
+
+
+```csharp
+string data = @"{
+ 'name': 'example_name'
+}";
+dynamic response = sg.client.templates.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all transactional templates.
+
+**This endpoint allows you to retrieve all transactional templates.**
+
+Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.
+
+Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+### GET /templates
+
+
+```csharp
+dynamic response = sg.client.templates.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Edit a transactional template.
+
+**This endpoint allows you to edit a transactional template.**
+
+Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.
+
+Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+
+### PATCH /templates/{template_id}
+
+
+```csharp
+string data = @"{
+ 'name': 'new_example_name'
+}";
+var template_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a single transactional template.
+
+**This endpoint allows you to retrieve a single transactional template.**
+
+Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.
+
+Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+
+### GET /templates/{template_id}
+
+
+```csharp
+var template_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a template.
+
+**This endpoint allows you to delete a transactional template.**
+
+Each user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.
+
+Transactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+
+### DELETE /templates/{template_id}
+
+
+```csharp
+var template_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Create a new transactional template version.
+
+**This endpoint allows you to create a new version of a template.**
+
+Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.
+
+For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+
+### POST /templates/{template_id}/versions
+
+
+```csharp
+string data = @"{
+ 'active': 1,
+ 'html_content': '<%body%>',
+ 'name': 'example_version_name',
+ 'plain_content': '<%body%>',
+ 'subject': '<%subject%>',
+ 'template_id': 'ddb96bbc-9b92-425e-8979-99464621b543'
+}";
+var template_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Edit a transactional template version.
+
+**This endpoint allows you to edit a version of one of your transactional templates.**
+
+Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.
+
+For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| template_id | string | The ID of the original template |
+| version_id | string | The ID of the template version |
+
+### PATCH /templates/{template_id}/versions/{version_id}
+
+
+```csharp
+string data = @"{
+ 'active': 1,
+ 'html_content': '<%body%>',
+ 'name': 'updated_example_name',
+ 'plain_content': '<%body%>',
+ 'subject': '<%subject%>'
+}";
+var template_id = "test_url_param";
+var version_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions._(version_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a specific transactional template version.
+
+**This endpoint allows you to retrieve a specific version of a template.**
+
+Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.
+
+For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| template_id | string | The ID of the original template |
+| version_id | string | The ID of the template version |
+
+### GET /templates/{template_id}/versions/{version_id}
+
+
+```csharp
+var template_id = "test_url_param";
+var version_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions._(version_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a transactional template version.
+
+**This endpoint allows you to delete one of your transactional template versions.**
+
+Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.
+
+For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| template_id | string | The ID of the original template |
+| version_id | string | The ID of the template version |
+
+### DELETE /templates/{template_id}/versions/{version_id}
+
+
+```csharp
+var template_id = "test_url_param";
+var version_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions._(version_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Activate a transactional template version.
+
+**This endpoint allows you to activate a version of one of your templates.**
+
+Each transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.
+
+
+For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| template_id | string | The ID of the original template |
+| version_id | string | The ID of the template version |
+
+### POST /templates/{template_id}/versions/{version_id}/activate
+
+
+```csharp
+var template_id = "test_url_param";
+var version_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions._(version_id).activate.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="tracking_settings"></a>
+# TRACKING SETTINGS
+
+## Retrieve Tracking Settings
+
+**This endpoint allows you to retrieve a list of all tracking settings that you can enable on your account.**
+
+You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.
+
+For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).
+
+### GET /tracking_settings
+
+
+```csharp
+string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.tracking_settings.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update Click Tracking Settings
+
+**This endpoint allows you to change your current click tracking setting. You can enable, or disable, click tracking using this endpoint.**
+
+You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.
+
+For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).
+
+### PATCH /tracking_settings/click
+
+
+```csharp
+string data = @"{
+ 'enabled': true
+}";
+dynamic response = sg.client.tracking_settings.click.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve Click Track Settings
+
+**This endpoint allows you to retrieve your current click tracking setting.**
+
+You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.
+
+For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).
+
+### GET /tracking_settings/click
+
+
+```csharp
+dynamic response = sg.client.tracking_settings.click.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update Google Analytics Settings
+
+**This endpoint allows you to update your current setting for Google Analytics.**
+
+For more information about using Google Analytics, please refer to [Googles URL Builder](https://support.google.com/analytics/answer/1033867?hl=en) and their article on ["Best Practices for Campaign Building"](https://support.google.com/analytics/answer/1037445).
+
+We default the settings to Googles recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/google_analytics_demystified_ga_statistics_vs_sg_statistics.html).
+
+You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.
+
+For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).
+
+### PATCH /tracking_settings/google_analytics
+
+
+```csharp
+string data = @"{
+ 'enabled': true,
+ 'utm_campaign': 'website',
+ 'utm_content': '',
+ 'utm_medium': 'email',
+ 'utm_source': 'sendgrid.com',
+ 'utm_term': ''
+}";
+dynamic response = sg.client.tracking_settings.google_analytics.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve Google Analytics Settings
+
+**This endpoint allows you to retrieve your current setting for Google Analytics.**
+
+For more information about using Google Analytics, please refer to [Googles URL Builder](https://support.google.com/analytics/answer/1033867?hl=en) and their article on ["Best Practices for Campaign Building"](https://support.google.com/analytics/answer/1037445).
+
+We default the settings to Googles recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/google_analytics_demystified_ga_statistics_vs_sg_statistics.html).
+
+You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.
+
+For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).
+
+### GET /tracking_settings/google_analytics
+
+
+```csharp
+dynamic response = sg.client.tracking_settings.google_analytics.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update Open Tracking Settings
+
+**This endpoint allows you to update your current settings for open tracking.**
+
+Open Tracking adds an invisible image at the end of the email which can track email opens. If the email recipient has images enabled on their email client, a request to SendGrids server for the invisible image is executed and an open event is logged. These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.
+
+You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.
+
+For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).
+
+### PATCH /tracking_settings/open
+
+
+```csharp
+string data = @"{
+ 'enabled': true
+}";
+dynamic response = sg.client.tracking_settings.open.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Get Open Tracking Settings
+
+**This endpoint allows you to retrieve your current settings for open tracking.**
+
+Open Tracking adds an invisible image at the end of the email which can track email opens. If the email recipient has images enabled on their email client, a request to SendGrids server for the invisible image is executed and an open event is logged. These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.
+
+You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.
+
+For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).
+
+### GET /tracking_settings/open
+
+
+```csharp
+dynamic response = sg.client.tracking_settings.open.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update Subscription Tracking Settings
+
+**This endpoint allows you to update your current settings for subscription tracking.**
+
+Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.
+
+You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.
+
+For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).
+
+### PATCH /tracking_settings/subscription
+
+
+```csharp
+string data = @"{
+ 'enabled': true,
+ 'html_content': 'html content',
+ 'landing': 'landing page html',
+ 'plain_content': 'text content',
+ 'replace': 'replacement tag',
+ 'url': 'url'
+}";
+dynamic response = sg.client.tracking_settings.subscription.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve Subscription Tracking Settings
+
+**This endpoint allows you to retrieve your current settings for subscription tracking.**
+
+Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.
+
+You can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.
+
+For more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).
+
+### GET /tracking_settings/subscription
+
+
+```csharp
+dynamic response = sg.client.tracking_settings.subscription.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="user"></a>
+# USER
+
+## Get a user's account information.
+
+**This endpoint allows you to retrieve your user account details.**
+
+Your user's account information includes the user's account type and reputation.
+
+Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.
+
+For more information about your user profile:
+
+* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)
+
+### GET /user/account
+
+
+```csharp
+dynamic response = sg.client.user.account.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve your credit balance
+
+**This endpoint allows you to retrieve the current credit balance for your account.**
+
+Your monthly credit allotment limits the number of emails you may send before incurring overage charges. For more information about credits and billing, please visit our [Clssroom](https://sendgrid.com/docs/Classroom/Basics/Billing/billing_info_and_faqs.html).
+
+### GET /user/credits
+
+
+```csharp
+dynamic response = sg.client.user.credits.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update your account email address
+
+**This endpoint allows you to update the email address currently on file for your account.**
+
+Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.
+
+For more information about your user profile:
+
+* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)
+
+### PUT /user/email
+
+
+```csharp
+string data = @"{
+ 'email': 'example@example.com'
+}";
+dynamic response = sg.client.user.email.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve your account email address
+
+**This endpoint allows you to retrieve the email address currently on file for your account.**
+
+Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.
+
+For more information about your user profile:
+
+* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)
+
+### GET /user/email
+
+
+```csharp
+dynamic response = sg.client.user.email.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update your password
+
+**This endpoint allows you to update your password.**
+
+Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.
+
+For more information about your user profile:
+
+* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)
+
+### PUT /user/password
+
+
+```csharp
+string data = @"{
+ 'new_password': 'new_password',
+ 'old_password': 'old_password'
+}";
+dynamic response = sg.client.user.password.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update a user's profile
+
+**This endpoint allows you to update your current profile details.**
+
+Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.
+
+For more information about your user profile:
+
+* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)
+
+It should be noted that any one or more of the parameters can be updated via the PATCH /user/profile endpoint. The only requirement is that you include at least one when you PATCH.
+
+### PATCH /user/profile
+
+
+```csharp
+string data = @"{
+ 'city': 'Orange',
+ 'first_name': 'Example',
+ 'last_name': 'User'
+}";
+dynamic response = sg.client.user.profile.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Get a user's profile
+
+Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.
+
+For more information about your user profile:
+
+* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)
+
+### GET /user/profile
+
+
+```csharp
+dynamic response = sg.client.user.profile.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Cancel or pause a scheduled send
+
+**This endpoint allows you to cancel or pause an email that has been scheduled to be sent.**
+
+If the maximum number of cancellations/pauses are added, HTTP 400 will
+be returned.
+
+The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.
+
+### POST /user/scheduled_sends
+
+
+```csharp
+string data = @"{
+ 'batch_id': 'YOUR_BATCH_ID',
+ 'status': 'pause'
+}";
+dynamic response = sg.client.user.scheduled_sends.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all scheduled sends
+
+**This endpoint allows you to retrieve all cancel/paused scheduled send information.**
+
+The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.
+
+### GET /user/scheduled_sends
+
+
+```csharp
+dynamic response = sg.client.user.scheduled_sends.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update user scheduled send information
+
+**This endpoint allows you to update the status of a scheduled send for the given `batch_id`.**
+
+The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.
+
+### PATCH /user/scheduled_sends/{batch_id}
+
+
+```csharp
+string data = @"{
+ 'status': 'pause'
+}";
+var batch_id = "test_url_param";
+dynamic response = sg.client.user.scheduled_sends._(batch_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve scheduled send
+
+**This endpoint allows you to retrieve the cancel/paused scheduled send information for a specific `batch_id`.**
+
+The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.
+
+### GET /user/scheduled_sends/{batch_id}
+
+
+```csharp
+var batch_id = "test_url_param";
+dynamic response = sg.client.user.scheduled_sends._(batch_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a cancellation or pause of a scheduled send
+
+**This endpoint allows you to delete the cancellation/pause of a scheduled send.**
+
+The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.
+
+### DELETE /user/scheduled_sends/{batch_id}
+
+
+```csharp
+var batch_id = "test_url_param";
+dynamic response = sg.client.user.scheduled_sends._(batch_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update Enforced TLS settings
+
+**This endpoint allows you to update your current Enforced TLS settings.**
+
+The Enforced TLS settings specify whether or not the recipient is required to support TLS or have a valid certificate. See the [SMTP Ports User Guide](https://sendgrid.com/docs/Classroom/Basics/Email_Infrastructure/smtp_ports.html) for more information on opportunistic TLS.
+
+**Note:** If either setting is enabled and the recipient does not support TLS or have a valid certificate, we drop the message and send a block event with TLS required but not supported as the description.
+
+### PATCH /user/settings/enforced_tls
+
+
+```csharp
+string data = @"{
+ 'require_tls': true,
+ 'require_valid_cert': false
+}";
+dynamic response = sg.client.user.settings.enforced_tls.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve current Enforced TLS settings.
+
+**This endpoint allows you to retrieve your current Enforced TLS settings.**
+
+The Enforced TLS settings specify whether or not the recipient is required to support TLS or have a valid certificate. See the [SMTP Ports User Guide](https://sendgrid.com/docs/Classroom/Basics/Email_Infrastructure/smtp_ports.html) for more information on opportunistic TLS.
+
+**Note:** If either setting is enabled and the recipient does not support TLS or have a valid certificate, we drop the message and send a block event with TLS required but not supported as the description.
+
+### GET /user/settings/enforced_tls
+
+
+```csharp
+dynamic response = sg.client.user.settings.enforced_tls.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update your username
+
+**This endpoint allows you to update the username for your account.**
+
+Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.
+
+For more information about your user profile:
+
+* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)
+
+### PUT /user/username
+
+
+```csharp
+string data = @"{
+ 'username': 'test_username'
+}";
+dynamic response = sg.client.user.username.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve your username
+
+**This endpoint allows you to retrieve your current account username.**
+
+Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.
+
+For more information about your user profile:
+
+* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)
+
+### GET /user/username
+
+
+```csharp
+dynamic response = sg.client.user.username.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update Event Notification Settings
+
+**This endpoint allows you to update your current event webhook settings.**
+
+If an event type is marked as `true`, then the event webhook will include information about that event.
+
+SendGrids Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.
+
+Common uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.
+
+### PATCH /user/webhooks/event/settings
+
+
+```csharp
+string data = @"{
+ 'bounce': true,
+ 'click': true,
+ 'deferred': true,
+ 'delivered': true,
+ 'dropped': true,
+ 'enabled': true,
+ 'group_resubscribe': true,
+ 'group_unsubscribe': true,
+ 'open': true,
+ 'processed': true,
+ 'spam_report': true,
+ 'unsubscribe': true,
+ 'url': 'url'
+}";
+dynamic response = sg.client.user.webhooks._("event").settings.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve Event Webhook settings
+
+**This endpoint allows you to retrieve your current event webhook settings.**
+
+If an event type is marked as `true`, then the event webhook will include information about that event.
+
+SendGrids Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.
+
+Common uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.
+
+### GET /user/webhooks/event/settings
+
+
+```csharp
+dynamic response = sg.client.user.webhooks._("event").settings.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Test Event Notification Settings
+
+**This endpoint allows you to test your event webhook by sending a fake event notification post to the provided URL.**
+
+SendGrids Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.
+
+Common uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.
+
+### POST /user/webhooks/event/test
+
+
+```csharp
+string data = @"{
+ 'url': 'url'
+}";
+dynamic response = sg.client.user.webhooks._("event").test.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve Parse Webhook settings
+
+**This endpoint allows you to retrieve your current inbound parse webhook settings.**
+
+SendGrid can parse the attachments and contents of incoming emails. The Parse API will POST the parsed email to a URL that you specify. For more information, see our Inbound [Parse Webhook documentation](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).
+
+### GET /user/webhooks/parse/settings
+
+
+```csharp
+dynamic response = sg.client.user.webhooks.parse.settings.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieves Inbound Parse Webhook statistics.
+
+**This endpoint allows you to retrieve the statistics for your Parse Webhook useage.**
+
+SendGrid's Inbound Parse Webhook allows you to parse the contents and attachments of incomming emails. The Parse API can then POST the parsed emails to a URL that you specify. The Inbound Parse Webhook cannot parse messages greater than 20MB in size, including all attachments.
+
+There are a number of pre-made integrations for the SendGrid Parse Webhook which make processing events easy. You can find these integrations in the [Library Index](https://sendgrid.com/docs/Integrate/libraries.html#-Webhook-Libraries).
+
+### GET /user/webhooks/parse/stats
+
+
+```csharp
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 'test_string',
+ 'offset': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.user.webhooks.parse.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+<a name="whitelabel"></a>
+# WHITELABEL
+
+## Create a domain whitelabel.
+
+**This endpoint allows you to create a whitelabel for one of your domains.**
+
+If you are creating a domain whitelabel that you would like a subuser to use, you have two options:
+1. Use the "username" parameter. This allows you to create a whitelabel on behalf of your subuser. This means the subuser is able to see and modify the created whitelabel.
+2. Use the Association workflow (see Associate Domain section). This allows you to assign a whitelabel created by the parent to a subuser. This means the subuser will default to the assigned whitelabel, but will not be able to see or modify that whitelabel. However, if the subuser creates their own whitelabel it will overwrite the assigned whitelabel.
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+### POST /whitelabel/domains
+
+
+```csharp
+string data = @"{
+ 'automatic_security': false,
+ 'custom_spf': true,
+ 'default': true,
+ 'domain': 'example.com',
+ 'ips': [
+ '192.168.1.1',
+ '192.168.1.2'
+ ],
+ 'subdomain': 'news',
+ 'username': 'john@example.com'
+}";
+dynamic response = sg.client.whitelabel.domains.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## List all domain whitelabels.
+
+**This endpoint allows you to retrieve a list of all domain whitelabels you have created.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+
+### GET /whitelabel/domains
+
+
+```csharp
+string queryParams = @"{
+ 'domain': 'test_string',
+ 'exclude_subusers': 'true',
+ 'limit': 1,
+ 'offset': 1,
+ 'username': 'test_string'
+}";
+dynamic response = sg.client.whitelabel.domains.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Get the default domain whitelabel.
+
+**This endpoint allows you to retrieve the default whitelabel for a domain.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| domain | string |The domain to find a default domain whitelabel for. |
+
+### GET /whitelabel/domains/default
+
+
+```csharp
+dynamic response = sg.client.whitelabel.domains._("default").get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## List the domain whitelabel associated with the given user.
+
+**This endpoint allows you to retrieve all of the whitelabels that have been assigned to a specific subuser.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+Domain whitelabels can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's whitelabels. To associate a whitelabel with a subuser, the parent account must first create the whitelabel and validate it. The the parent may then associate the whitelabel via the subuser management tools.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| username | string | Username of the subuser to find associated whitelabels for. |
+
+### GET /whitelabel/domains/subuser
+
+
+```csharp
+dynamic response = sg.client.whitelabel.domains.subuser.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Disassociate a domain whitelabel from a given user.
+
+**This endpoint allows you to disassociate a specific whitelabel from a subuser.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+Domain whitelabels can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's whitelabels. To associate a whitelabel with a subuser, the parent account must first create the whitelabel and validate it. The the parent may then associate the whitelabel via the subuser management tools.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+## URI Parameters
+| URI Parameter | Type | Required? | Description |
+|---|---|---|---|
+| username | string | required | Username for the subuser to find associated whitelabels for. |
+
+### DELETE /whitelabel/domains/subuser
+
+
+```csharp
+dynamic response = sg.client.whitelabel.domains.subuser.delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update a domain whitelabel.
+
+**This endpoint allows you to update the settings for a domain whitelabel.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+### PATCH /whitelabel/domains/{domain_id}
+
+
+```csharp
+string data = @"{
+ 'custom_spf': true,
+ 'default': false
+}";
+var domain_id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(domain_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a domain whitelabel.
+
+**This endpoint allows you to retrieve a specific domain whitelabel.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+
+### GET /whitelabel/domains/{domain_id}
+
+
+```csharp
+var domain_id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(domain_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a domain whitelabel.
+
+**This endpoint allows you to delete a domain whitelabel.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+### DELETE /whitelabel/domains/{domain_id}
+
+
+```csharp
+var domain_id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(domain_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Associate a domain whitelabel with a given user.
+
+**This endpoint allows you to associate a specific domain whitelabel with a subuser.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+Domain whitelabels can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's whitelabels. To associate a whitelabel with a subuser, the parent account must first create the whitelabel and validate it. The the parent may then associate the whitelabel via the subuser management tools.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| domain_id | integer | ID of the domain whitelabel to associate with the subuser. |
+
+### POST /whitelabel/domains/{domain_id}/subuser
+
+
+```csharp
+string data = @"{
+ 'username': 'jane@example.com'
+}";
+var domain_id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(domain_id).subuser.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Add an IP to a domain whitelabel.
+
+**This endpoint allows you to add an IP address to a domain whitelabel.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| id | integer | ID of the domain to which you are adding an IP |
+
+### POST /whitelabel/domains/{id}/ips
+
+
+```csharp
+string data = @"{
+ 'ip': '192.168.0.1'
+}";
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(id).ips.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Remove an IP from a domain whitelabel.
+
+**This endpoint allows you to remove a domain's IP address from that domain's whitelabel.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| id | integer | ID of the domain whitelabel to delete the IP from. |
+| ip | string | IP to remove from the domain whitelabel. |
+
+### DELETE /whitelabel/domains/{id}/ips/{ip}
+
+
+```csharp
+var id = "test_url_param";
+var ip = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(id).ips._(ip).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Validate a domain whitelabel.
+
+**This endpoint allows you to validate a domain whitelabel. If it fails, it will return an error message describing why the whitelabel could not be validated.**
+
+A domain whitelabel allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.
+
+For more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)
+
+## URI Parameters
+| URI Parameter | Type | Description |
+|---|---|---|
+| id | integer |ID of the domain whitelabel to validate. |
+
+### POST /whitelabel/domains/{id}/validate
+
+
+```csharp
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(id).validate.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Create an IP whitelabel
+
+**This endpoint allows you to create an IP whitelabel.**
+
+When creating an IP whitelable, you should use the same subdomain that you used when you created a domain whitelabel.
+
+A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).
+
+### POST /whitelabel/ips
+
+
+```csharp
+string data = @"{
+ 'domain': 'example.com',
+ 'ip': '192.168.1.1',
+ 'subdomain': 'email'
+}";
+dynamic response = sg.client.whitelabel.ips.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all IP whitelabels
+
+**This endpoint allows you to retrieve all of the IP whitelabels that have been createdy by this account.**
+
+You may include a search key by using the "ip" parameter. This enables you to perform a prefix search for a given IP segment (e.g. "192.").
+
+A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).
+
+### GET /whitelabel/ips
+
+
+```csharp
+string queryParams = @"{
+ 'ip': 'test_string',
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.whitelabel.ips.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve an IP whitelabel
+
+**This endpoint allows you to retrieve an IP whitelabel.**
+
+A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).
+
+### GET /whitelabel/ips/{id}
+
+
+```csharp
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.ips._(id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete an IP whitelabel
+
+**This endpoint allows you to delete an IP whitelabel.**
+
+A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).
+
+### DELETE /whitelabel/ips/{id}
+
+
+```csharp
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.ips._(id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Validate an IP whitelabel
+
+**This endpoint allows you to validate an IP whitelabel.**
+
+A IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).
+
+### POST /whitelabel/ips/{id}/validate
+
+
+```csharp
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.ips._(id).validate.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Create a Link Whitelabel
+
+**This endpoint allows you to create a new link whitelabel.**
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### POST /whitelabel/links
+
+
+```csharp
+string data = @"{
+ 'default': true,
+ 'domain': 'example.com',
+ 'subdomain': 'mail'
+}";
+string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.whitelabel.links.post(requestBody: data, queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve all link whitelabels
+
+**This endpoint allows you to retrieve all link whitelabels.**
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### GET /whitelabel/links
+
+
+```csharp
+string queryParams = @"{
+ 'limit': 1
+}";
+dynamic response = sg.client.whitelabel.links.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a Default Link Whitelabel
+
+**This endpoint allows you to retrieve the default link whitelabel.**
+
+Default link whitelabel is the actual link whitelabel to be used when sending messages. If there are multiple link whitelabels, the default is determined by the following order:
+<ul>
+ <li>Validated link whitelabels marked as "default"</li>
+ <li>Legacy link whitelabels (migrated from the whitelabel wizard)</li>
+ <li>Default SendGrid link whitelabel (i.e. 100.ct.sendgrid.net)</li>
+</ul>
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### GET /whitelabel/links/default
+
+
+```csharp
+string queryParams = @"{
+ 'domain': 'test_string'
+}";
+dynamic response = sg.client.whitelabel.links._("default").get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve Associated Link Whitelabel
+
+**This endpoint allows you to retrieve the associated link whitelabel for a subuser.**
+
+Link whitelables can be associated with subusers from the parent account. This functionality allows
+subusers to send mail using their parent's linke whitelabels. To associate a link whitelabel, the parent account
+must first create a whitelabel and validate it. The parent may then associate that whitelabel with a subuser via the API or the Subuser Management page in the user interface.
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### GET /whitelabel/links/subuser
+
+
+```csharp
+string queryParams = @"{
+ 'username': 'test_string'
+}";
+dynamic response = sg.client.whitelabel.links.subuser.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Disassociate a Link Whitelabel
+
+**This endpoint allows you to disassociate a link whitelabel from a subuser.**
+
+Link whitelables can be associated with subusers from the parent account. This functionality allows
+subusers to send mail using their parent's linke whitelabels. To associate a link whitelabel, the parent account
+must first create a whitelabel and validate it. The parent may then associate that whitelabel with a subuser via the API or the Subuser Management page in the user interface.
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### DELETE /whitelabel/links/subuser
+
+
+```csharp
+string queryParams = @"{
+ 'username': 'test_string'
+}";
+dynamic response = sg.client.whitelabel.links.subuser.delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Update a Link Whitelabel
+
+**This endpoint allows you to update a specific link whitelabel. You can use this endpoint to change a link whitelabel's default status.**
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### PATCH /whitelabel/links/{id}
+
+
+```csharp
+string data = @"{
+ 'default': true
+}";
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Retrieve a Link Whitelabel
+
+**This endpoint allows you to retrieve a specific link whitelabel.**
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### GET /whitelabel/links/{id}
+
+
+```csharp
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Delete a Link Whitelabel
+
+**This endpoint allows you to delete a link whitelabel.**
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### DELETE /whitelabel/links/{id}
+
+
+```csharp
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Validate a Link Whitelabel
+
+**This endpoint allows you to validate a link whitelabel.**
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### POST /whitelabel/links/{id}/validate
+
+
+```csharp
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(id).validate.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+## Associate a Link Whitelabel
+
+**This endpoint allows you to associate a link whitelabel with a subuser account.**
+
+Link whitelables can be associated with subusers from the parent account. This functionality allows
+subusers to send mail using their parent's linke whitelabels. To associate a link whitelabel, the parent account
+must first create a whitelabel and validate it. The parent may then associate that whitelabel with a subuser via the API or the Subuser Management page in the user interface.
+
+Email link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.
+
+For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).
+
+### POST /whitelabel/links/{link_id}/subuser
+
+
+```csharp
+string data = @"{
+ 'username': 'jane@example.com'
+}";
+var link_id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(link_id).subuser.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+```
+
+
diff --git a/examples/accesssettings/accesssettings.cs b/examples/accesssettings/accesssettings.cs
new file mode 100644
index 0000000..15fe8b0
--- /dev/null
+++ b/examples/accesssettings/accesssettings.cs
@@ -0,0 +1,92 @@
+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 all recent access attempts
+// GET /access_settings/activity
+
+string queryParams = @"{
+ 'limit': 1
+}";
+dynamic response = sg.client.access_settings.activity.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Add one or more IPs to the whitelist
+// POST /access_settings/whitelist
+
+string data = @"{
+ 'ips': [
+ {
+ 'ip': '192.168.1.1'
+ },
+ {
+ 'ip': '192.*.*.*'
+ },
+ {
+ 'ip': '192.168.1.3/32'
+ }
+ ]
+}";
+dynamic response = sg.client.access_settings.whitelist.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a list of currently whitelisted IPs
+// GET /access_settings/whitelist
+
+dynamic response = sg.client.access_settings.whitelist.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Remove one or more IPs from the whitelist
+// DELETE /access_settings/whitelist
+
+string data = @"{
+ 'ids': [
+ 1,
+ 2,
+ 3
+ ]
+}";
+dynamic response = sg.client.access_settings.whitelist.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a specific whitelisted IP
+// GET /access_settings/whitelist/{rule_id}
+
+var rule_id = "test_url_param";
+dynamic response = sg.client.access_settings.whitelist._(rule_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Remove a specific IP from the whitelist
+// DELETE /access_settings/whitelist/{rule_id}
+
+var rule_id = "test_url_param";
+dynamic response = sg.client.access_settings.whitelist._(rule_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/apikeys/apikeys.cs b/examples/apikeys/apikeys.cs
new file mode 100644
index 0000000..eff23ec
--- /dev/null
+++ b/examples/apikeys/apikeys.cs
@@ -0,0 +1,89 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Create API keys
+// POST /api_keys
+
+string data = @"{
+ 'name': 'My API Key',
+ 'scopes': [
+ 'mail.send',
+ 'alerts.create',
+ 'alerts.read'
+ ]
+}";
+dynamic response = sg.client.api_keys.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all API Keys belonging to the authenticated user
+// GET /api_keys
+
+dynamic response = sg.client.api_keys.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update the name & scopes of an API Key
+// PUT /api_keys/{api_key_id}
+
+string data = @"{
+ 'name': 'A New Hope',
+ 'scopes': [
+ 'user.profile.read',
+ 'user.profile.update'
+ ]
+}";
+var api_key_id = "test_url_param";
+dynamic response = sg.client.api_keys._(api_key_id).put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update API keys
+// PATCH /api_keys/{api_key_id}
+
+string data = @"{
+ 'name': 'A New Hope'
+}";
+var api_key_id = "test_url_param";
+dynamic response = sg.client.api_keys._(api_key_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve an existing API Key
+// GET /api_keys/{api_key_id}
+
+var api_key_id = "test_url_param";
+dynamic response = sg.client.api_keys._(api_key_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete API keys
+// DELETE /api_keys/{api_key_id}
+
+var api_key_id = "test_url_param";
+dynamic response = sg.client.api_keys._(api_key_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/asm/asm.cs b/examples/asm/asm.cs
new file mode 100644
index 0000000..4f5bde7
--- /dev/null
+++ b/examples/asm/asm.cs
@@ -0,0 +1,172 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Create a new suppression group
+// POST /asm/groups
+
+string data = @"{
+ 'description': 'Suggestions for products our users might like.',
+ 'is_default': true,
+ 'name': 'Product Suggestions'
+}";
+dynamic response = sg.client.asm.groups.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve information about multiple suppression groups
+// GET /asm/groups
+
+string queryParams = @"{
+ 'id': 1
+}";
+dynamic response = sg.client.asm.groups.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update a suppression group.
+// PATCH /asm/groups/{group_id}
+
+string data = @"{
+ 'description': 'Suggestions for items our users might like.',
+ 'id': 103,
+ 'name': 'Item Suggestions'
+}";
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Get information on a single suppression group.
+// GET /asm/groups/{group_id}
+
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a suppression group.
+// DELETE /asm/groups/{group_id}
+
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Add suppressions to a suppression group
+// POST /asm/groups/{group_id}/suppressions
+
+string data = @"{
+ 'recipient_emails': [
+ 'test1@example.com',
+ 'test2@example.com'
+ ]
+}";
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).suppressions.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all suppressions for a suppression group
+// GET /asm/groups/{group_id}/suppressions
+
+var group_id = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).suppressions.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a suppression from a suppression group
+// DELETE /asm/groups/{group_id}/suppressions/{email}
+
+var group_id = "test_url_param";
+var email = "test_url_param";
+dynamic response = sg.client.asm.groups._(group_id).suppressions._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all suppressions
+// GET /asm/suppressions
+
+dynamic response = sg.client.asm.suppressions.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Add recipient addresses to the global suppression group.
+// POST /asm/suppressions/global
+
+string data = @"{
+ 'recipient_emails': [
+ 'test1@example.com',
+ 'test2@example.com'
+ ]
+}";
+dynamic response = sg.client.asm.suppressions.global.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a Global Suppression
+// GET /asm/suppressions/global/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.asm.suppressions.global._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a Global Suppression
+// DELETE /asm/suppressions/global/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.asm.suppressions.global._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all suppression groups for an email address
+// GET /asm/suppressions/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.asm.suppressions._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/browsers/browsers.cs b/examples/browsers/browsers.cs
new file mode 100644
index 0000000..43d52e5
--- /dev/null
+++ b/examples/browsers/browsers.cs
@@ -0,0 +1,25 @@
+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 browser.
+// GET /browsers/stats
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'browsers': 'test_string',
+ 'end_date': '2016-04-01',
+ 'limit': 'test_string',
+ 'offset': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.browsers.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/campaigns/campaigns.cs b/examples/campaigns/campaigns.cs
new file mode 100644
index 0000000..03bbadc
--- /dev/null
+++ b/examples/campaigns/campaigns.cs
@@ -0,0 +1,168 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Create a Campaign
+// POST /campaigns
+
+string data = @"{
+ 'categories': [
+ 'spring line'
+ ],
+ 'custom_unsubscribe_url': '',
+ 'html_content': '<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>',
+ 'ip_pool': 'marketing',
+ 'list_ids': [
+ 110,
+ 124
+ ],
+ 'plain_content': 'Check out our spring line!',
+ 'segment_ids': [
+ 110
+ ],
+ 'sender_id': 124451,
+ 'subject': 'New Products for Spring!',
+ 'suppression_group_id': 42,
+ 'title': 'March Newsletter'
+}";
+dynamic response = sg.client.campaigns.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all Campaigns
+// GET /campaigns
+
+string queryParams = @"{
+ 'limit': 0,
+ 'offset': 0
+}";
+dynamic response = sg.client.campaigns.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update a Campaign
+// PATCH /campaigns/{campaign_id}
+
+string data = @"{
+ 'categories': [
+ 'summer line'
+ ],
+ 'html_content': '<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>',
+ 'plain_content': 'Check out our summer line!',
+ 'subject': 'New Products for Summer!',
+ 'title': 'May Newsletter'
+}";
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a single campaign
+// GET /campaigns/{campaign_id}
+
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a Campaign
+// DELETE /campaigns/{campaign_id}
+
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update a Scheduled Campaign
+// PATCH /campaigns/{campaign_id}/schedules
+
+string data = @"{
+ 'send_at': 1489451436
+}";
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Schedule a Campaign
+// POST /campaigns/{campaign_id}/schedules
+
+string data = @"{
+ 'send_at': 1489771528
+}";
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// View Scheduled Time of a Campaign
+// GET /campaigns/{campaign_id}/schedules
+
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Unschedule a Scheduled Campaign
+// DELETE /campaigns/{campaign_id}/schedules
+
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Send a Campaign
+// POST /campaigns/{campaign_id}/schedules/now
+
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.now.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Send a Test Campaign
+// POST /campaigns/{campaign_id}/schedules/test
+
+string data = @"{
+ 'to': 'your.email@example.com'
+}";
+var campaign_id = "test_url_param";
+dynamic response = sg.client.campaigns._(campaign_id).schedules.test.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/categories/categories.cs b/examples/categories/categories.cs
new file mode 100644
index 0000000..82899ea
--- /dev/null
+++ b/examples/categories/categories.cs
@@ -0,0 +1,59 @@
+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 all categories
+// GET /categories
+
+string queryParams = @"{
+ 'category': 'test_string',
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.categories.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve Email Statistics for Categories
+// GET /categories/stats
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'categories': 'test_string',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.categories.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve sums of email stats for each category [Needs: Stats object defined, has category ID?]
+// GET /categories/stats/sums
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.categories.stats.sums.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/clients/clients.cs b/examples/clients/clients.cs
new file mode 100644
index 0000000..ecefdcd
--- /dev/null
+++ b/examples/clients/clients.cs
@@ -0,0 +1,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();
+
diff --git a/examples/contactdb/contactdb.cs b/examples/contactdb/contactdb.cs
new file mode 100644
index 0000000..ea388d2
--- /dev/null
+++ b/examples/contactdb/contactdb.cs
@@ -0,0 +1,454 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Create a Custom Field
+// POST /contactdb/custom_fields
+
+string data = @"{
+ 'name': 'pet',
+ 'type': 'text'
+}";
+dynamic response = sg.client.contactdb.custom_fields.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all custom fields
+// GET /contactdb/custom_fields
+
+dynamic response = sg.client.contactdb.custom_fields.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a Custom Field
+// GET /contactdb/custom_fields/{custom_field_id}
+
+var custom_field_id = "test_url_param";
+dynamic response = sg.client.contactdb.custom_fields._(custom_field_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a Custom Field
+// DELETE /contactdb/custom_fields/{custom_field_id}
+
+var custom_field_id = "test_url_param";
+dynamic response = sg.client.contactdb.custom_fields._(custom_field_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Create a List
+// POST /contactdb/lists
+
+string data = @"{
+ 'name': 'your list name'
+}";
+dynamic response = sg.client.contactdb.lists.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all lists
+// GET /contactdb/lists
+
+dynamic response = sg.client.contactdb.lists.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete Multiple lists
+// DELETE /contactdb/lists
+
+string data = @"[
+ 1,
+ 2,
+ 3,
+ 4
+]";
+dynamic response = sg.client.contactdb.lists.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update a List
+// PATCH /contactdb/lists/{list_id}
+
+string data = @"{
+ 'name': 'newlistname'
+}";
+string queryParams = @"{
+ 'list_id': 0
+}";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).patch(requestBody: data, queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a single list
+// GET /contactdb/lists/{list_id}
+
+string queryParams = @"{
+ 'list_id': 0
+}";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a List
+// DELETE /contactdb/lists/{list_id}
+
+string queryParams = @"{
+ 'delete_contacts': 'true'
+}";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Add Multiple Recipients to a List
+// POST /contactdb/lists/{list_id}/recipients
+
+string data = @"[
+ 'recipient_id1',
+ 'recipient_id2'
+]";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).recipients.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all recipients on a List
+// GET /contactdb/lists/{list_id}/recipients
+
+string queryParams = @"{
+ 'list_id': 0,
+ 'page': 1,
+ 'page_size': 1
+}";
+var list_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).recipients.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Add a Single Recipient to a List
+// POST /contactdb/lists/{list_id}/recipients/{recipient_id}
+
+var list_id = "test_url_param";
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a Single Recipient from a Single List
+// DELETE /contactdb/lists/{list_id}/recipients/{recipient_id}
+
+string queryParams = @"{
+ 'list_id': 0,
+ 'recipient_id': 0
+}";
+var list_id = "test_url_param";
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update Recipient
+// PATCH /contactdb/recipients
+
+string data = @"[
+ {
+ 'email': 'jones@example.com',
+ 'first_name': 'Guy',
+ 'last_name': 'Jones'
+ }
+]";
+dynamic response = sg.client.contactdb.recipients.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Add recipients
+// POST /contactdb/recipients
+
+string data = @"[
+ {
+ 'age': 25,
+ 'email': 'example@example.com',
+ 'first_name': '',
+ 'last_name': 'User'
+ },
+ {
+ 'age': 25,
+ 'email': 'example2@example.com',
+ 'first_name': 'Example',
+ 'last_name': 'User'
+ }
+]";
+dynamic response = sg.client.contactdb.recipients.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve recipients
+// GET /contactdb/recipients
+
+string queryParams = @"{
+ 'page': 1,
+ 'page_size': 1
+}";
+dynamic response = sg.client.contactdb.recipients.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete Recipient
+// DELETE /contactdb/recipients
+
+string data = @"[
+ 'recipient_id1',
+ 'recipient_id2'
+]";
+dynamic response = sg.client.contactdb.recipients.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve the count of billable recipients
+// GET /contactdb/recipients/billable_count
+
+dynamic response = sg.client.contactdb.recipients.billable_count.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a Count of Recipients
+// GET /contactdb/recipients/count
+
+dynamic response = sg.client.contactdb.recipients.count.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve recipients matching search criteria
+// GET /contactdb/recipients/search
+
+string queryParams = @"{
+ '{field_name}': 'test_string'
+}";
+dynamic response = sg.client.contactdb.recipients.search.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a single recipient
+// GET /contactdb/recipients/{recipient_id}
+
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.recipients._(recipient_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a Recipient
+// DELETE /contactdb/recipients/{recipient_id}
+
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.recipients._(recipient_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve the lists that a recipient is on
+// GET /contactdb/recipients/{recipient_id}/lists
+
+var recipient_id = "test_url_param";
+dynamic response = sg.client.contactdb.recipients._(recipient_id).lists.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve reserved fields
+// GET /contactdb/reserved_fields
+
+dynamic response = sg.client.contactdb.reserved_fields.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Create a Segment
+// POST /contactdb/segments
+
+string data = @"{
+ 'conditions': [
+ {
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
+ 'value': 'Miller'
+ },
+ {
+ 'and_or': 'and',
+ 'field': 'last_clicked',
+ 'operator': 'gt',
+ 'value': '01/02/2015'
+ },
+ {
+ 'and_or': 'or',
+ 'field': 'clicks.campaign_identifier',
+ 'operator': 'eq',
+ 'value': '513'
+ }
+ ],
+ 'list_id': 4,
+ 'name': 'Last Name Miller'
+}";
+dynamic response = sg.client.contactdb.segments.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all segments
+// GET /contactdb/segments
+
+dynamic response = sg.client.contactdb.segments.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update a segment
+// PATCH /contactdb/segments/{segment_id}
+
+string data = @"{
+ 'conditions': [
+ {
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
+ 'value': 'Miller'
+ }
+ ],
+ 'list_id': 5,
+ 'name': 'The Millers'
+}";
+string queryParams = @"{
+ 'segment_id': 'test_string'
+}";
+var segment_id = "test_url_param";
+dynamic response = sg.client.contactdb.segments._(segment_id).patch(requestBody: data, queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a segment
+// GET /contactdb/segments/{segment_id}
+
+string queryParams = @"{
+ 'segment_id': 0
+}";
+var segment_id = "test_url_param";
+dynamic response = sg.client.contactdb.segments._(segment_id).get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a segment
+// DELETE /contactdb/segments/{segment_id}
+
+string queryParams = @"{
+ 'delete_contacts': 'true'
+}";
+var segment_id = "test_url_param";
+dynamic response = sg.client.contactdb.segments._(segment_id).delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve recipients on a segment
+// GET /contactdb/segments/{segment_id}/recipients
+
+string queryParams = @"{
+ 'page': 1,
+ 'page_size': 1
+}";
+var segment_id = "test_url_param";
+dynamic response = sg.client.contactdb.segments._(segment_id).recipients.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/devices/devices.cs b/examples/devices/devices.cs
new file mode 100644
index 0000000..e813871
--- /dev/null
+++ b/examples/devices/devices.cs
@@ -0,0 +1,24 @@
+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 device type.
+// GET /devices/stats
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.devices.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/geo/geo.cs b/examples/geo/geo.cs
new file mode 100644
index 0000000..25faa04
--- /dev/null
+++ b/examples/geo/geo.cs
@@ -0,0 +1,25 @@
+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 country and state/province.
+// GET /geo/stats
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'country': 'US',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.geo.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/ips/ips.cs b/examples/ips/ips.cs
new file mode 100644
index 0000000..640da91
--- /dev/null
+++ b/examples/ips/ips.cs
@@ -0,0 +1,175 @@
+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 all IP addresses
+// GET /ips
+
+string queryParams = @"{
+ 'exclude_whitelabels': 'true',
+ 'ip': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'subuser': 'test_string'
+}";
+dynamic response = sg.client.ips.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all assigned IPs
+// GET /ips/assigned
+
+dynamic response = sg.client.ips.assigned.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Create an IP pool.
+// POST /ips/pools
+
+string data = @"{
+ 'name': 'marketing'
+}";
+dynamic response = sg.client.ips.pools.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all IP pools.
+// GET /ips/pools
+
+dynamic response = sg.client.ips.pools.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update an IP pools name.
+// PUT /ips/pools/{pool_name}
+
+string data = @"{
+ 'name': 'new_pool_name'
+}";
+var pool_name = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all IPs in a specified pool.
+// GET /ips/pools/{pool_name}
+
+var pool_name = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete an IP pool.
+// DELETE /ips/pools/{pool_name}
+
+var pool_name = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Add an IP address to a pool
+// POST /ips/pools/{pool_name}/ips
+
+string data = @"{
+ 'ip': '0.0.0.0'
+}";
+var pool_name = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).ips.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Remove an IP address from a pool.
+// DELETE /ips/pools/{pool_name}/ips/{ip}
+
+var pool_name = "test_url_param";
+var ip = "test_url_param";
+dynamic response = sg.client.ips.pools._(pool_name).ips._(ip).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Add an IP to warmup
+// POST /ips/warmup
+
+string data = @"{
+ 'ip': '0.0.0.0'
+}";
+dynamic response = sg.client.ips.warmup.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all IPs currently in warmup
+// GET /ips/warmup
+
+dynamic response = sg.client.ips.warmup.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve warmup status for a specific IP address
+// GET /ips/warmup/{ip_address}
+
+var ip_address = "test_url_param";
+dynamic response = sg.client.ips.warmup._(ip_address).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Remove an IP from warmup
+// DELETE /ips/warmup/{ip_address}
+
+var ip_address = "test_url_param";
+dynamic response = sg.client.ips.warmup._(ip_address).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all IP pools an IP address belongs to
+// GET /ips/{ip_address}
+
+var ip_address = "test_url_param";
+dynamic response = sg.client.ips._(ip_address).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/mail/mail.cs b/examples/mail/mail.cs
new file mode 100644
index 0000000..7cad2be
--- /dev/null
+++ b/examples/mail/mail.cs
@@ -0,0 +1,182 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Create a batch ID
+// POST /mail/batch
+
+dynamic response = sg.client.mail.batch.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Validate batch ID
+// GET /mail/batch/{batch_id}
+
+var batch_id = "test_url_param";
+dynamic response = sg.client.mail.batch._(batch_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// 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,
+ 'groups_to_display': [
+ 1,
+ 2,
+ 3
+ ]
+ },
+ 'attachments': [
+ {
+ '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]',
+ 'categories': [
+ 'category1',
+ 'category2'
+ ],
+ 'content': [
+ {
+ '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',
+ 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
+ },
+ 'from': {
+ 'email': 'sam.smith@example.com',
+ 'name': 'Sam Smith'
+ },
+ 'headers': {},
+ 'ip_pool_name': '[YOUR POOL NAME GOES HERE]',
+ 'mail_settings': {
+ 'bcc': {
+ 'email': 'ben.doe@example.com',
+ 'enable': true
+ },
+ 'bypass_list_management': {
+ 'enable': true
+ },
+ 'footer': {
+ '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',
+ 'threshold': 3
+ }
+ },
+ 'personalizations': [
+ {
+ 'bcc': [
+ {
+ 'email': 'sam.doe@example.com',
+ 'name': 'Sam Doe'
+ }
+ ],
+ 'cc': [
+ {
+ 'email': 'jane.doe@example.com',
+ 'name': 'Jane Doe'
+ }
+ ],
+ 'custom_args': {
+ 'New Argument 1': 'New Value 1',
+ 'activationAttempt': '1',
+ 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
+ },
+ 'headers': {
+ 'X-Accept-Language': 'en',
+ 'X-Mailer': 'MyApp'
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
+ 'substitutions': {
+ 'sub': {
+ '%name%': [
+ 'John',
+ 'Jane',
+ 'Sam'
+ ]
+ }
+ },
+ 'to': [
+ {
+ 'email': 'john.doe@example.com',
+ 'name': 'John Doe'
+ }
+ ]
+ }
+ ],
+ 'reply_to': {
+ 'email': 'sam.smith@example.com',
+ 'name': 'Sam Smith'
+ },
+ 'sections': {
+ 'section': {
+ ':sectionName1': 'section 1 text',
+ ':sectionName2': 'section 2 text'
+ }
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
+ 'template_id': '[YOUR TEMPLATE ID GOES HERE]',
+ 'tracking_settings': {
+ 'click_tracking': {
+ '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]',
+ 'utm_term': '[IDENTIFY PAID KEYWORDS HERE]'
+ },
+ 'open_tracking': {
+ '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%>',
+ 'text': 'If you would like to unsubscribe and stop receiveing these emails <% click here %>.'
+ }
+ }
+}";
+dynamic response = sg.client.mail.send.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/mailboxproviders/mailboxproviders.cs b/examples/mailboxproviders/mailboxproviders.cs
new file mode 100644
index 0000000..b307fc4
--- /dev/null
+++ b/examples/mailboxproviders/mailboxproviders.cs
@@ -0,0 +1,25 @@
+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 mailbox provider.
+// GET /mailbox_providers/stats
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'mailbox_providers': 'test_string',
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.mailbox_providers.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/mailsettings/mailsettings.cs b/examples/mailsettings/mailsettings.cs
new file mode 100644
index 0000000..8f0c519
--- /dev/null
+++ b/examples/mailsettings/mailsettings.cs
@@ -0,0 +1,242 @@
+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 all mail settings
+// GET /mail_settings
+
+string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.mail_settings.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update address whitelist mail settings
+// PATCH /mail_settings/address_whitelist
+
+string data = @"{
+ 'enabled': true,
+ 'list': [
+ 'email1@example.com',
+ 'example.com'
+ ]
+}";
+dynamic response = sg.client.mail_settings.address_whitelist.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve address whitelist mail settings
+// GET /mail_settings/address_whitelist
+
+dynamic response = sg.client.mail_settings.address_whitelist.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update BCC mail settings
+// PATCH /mail_settings/bcc
+
+string data = @"{
+ 'email': 'email@example.com',
+ 'enabled': false
+}";
+dynamic response = sg.client.mail_settings.bcc.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all BCC mail settings
+// GET /mail_settings/bcc
+
+dynamic response = sg.client.mail_settings.bcc.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update bounce purge mail settings
+// PATCH /mail_settings/bounce_purge
+
+string data = @"{
+ 'enabled': true,
+ 'hard_bounces': 5,
+ 'soft_bounces': 5
+}";
+dynamic response = sg.client.mail_settings.bounce_purge.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve bounce purge mail settings
+// GET /mail_settings/bounce_purge
+
+dynamic response = sg.client.mail_settings.bounce_purge.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update footer mail settings
+// PATCH /mail_settings/footer
+
+string data = @"{
+ 'enabled': true,
+ 'html_content': '...',
+ 'plain_content': '...'
+}";
+dynamic response = sg.client.mail_settings.footer.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve footer mail settings
+// GET /mail_settings/footer
+
+dynamic response = sg.client.mail_settings.footer.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update forward bounce mail settings
+// PATCH /mail_settings/forward_bounce
+
+string data = @"{
+ 'email': 'example@example.com',
+ 'enabled': true
+}";
+dynamic response = sg.client.mail_settings.forward_bounce.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve forward bounce mail settings
+// GET /mail_settings/forward_bounce
+
+dynamic response = sg.client.mail_settings.forward_bounce.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update forward spam mail settings
+// PATCH /mail_settings/forward_spam
+
+string data = @"{
+ 'email': '',
+ 'enabled': false
+}";
+dynamic response = sg.client.mail_settings.forward_spam.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve forward spam mail settings
+// GET /mail_settings/forward_spam
+
+dynamic response = sg.client.mail_settings.forward_spam.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update plain content mail settings
+// PATCH /mail_settings/plain_content
+
+string data = @"{
+ 'enabled': false
+}";
+dynamic response = sg.client.mail_settings.plain_content.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve plain content mail settings
+// GET /mail_settings/plain_content
+
+dynamic response = sg.client.mail_settings.plain_content.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update spam check mail settings
+// PATCH /mail_settings/spam_check
+
+string data = @"{
+ 'enabled': true,
+ 'max_score': 5,
+ 'url': 'url'
+}";
+dynamic response = sg.client.mail_settings.spam_check.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve spam check mail settings
+// GET /mail_settings/spam_check
+
+dynamic response = sg.client.mail_settings.spam_check.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update template mail settings
+// PATCH /mail_settings/template
+
+string data = @"{
+ 'enabled': true,
+ 'html_content': '<% body %>'
+}";
+dynamic response = sg.client.mail_settings.template.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve legacy template mail settings
+// GET /mail_settings/template
+
+dynamic response = sg.client.mail_settings.template.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/partnersettings/partnersettings.cs b/examples/partnersettings/partnersettings.cs
new file mode 100644
index 0000000..5f253b3
--- /dev/null
+++ b/examples/partnersettings/partnersettings.cs
@@ -0,0 +1,46 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Returns a list of all partner settings.
+// GET /partner_settings
+
+string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.partner_settings.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Updates New Relic partner settings.
+// PATCH /partner_settings/new_relic
+
+string data = @"{
+ 'enable_subuser_statistics': true,
+ 'enabled': true,
+ 'license_key': ''
+}";
+dynamic response = sg.client.partner_settings.new_relic.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Returns all New Relic partner settings.
+// GET /partner_settings/new_relic
+
+dynamic response = sg.client.partner_settings.new_relic.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/scopes/scopes.cs b/examples/scopes/scopes.cs
new file mode 100644
index 0000000..c5a5c68
--- /dev/null
+++ b/examples/scopes/scopes.cs
@@ -0,0 +1,17 @@
+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 a list of scopes for which this user has access.
+// GET /scopes
+
+dynamic response = sg.client.scopes.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/stats/stats.cs b/examples/stats/stats.cs
new file mode 100644
index 0000000..a363952
--- /dev/null
+++ b/examples/stats/stats.cs
@@ -0,0 +1,24 @@
+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 global email statistics
+// GET /stats
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/subusers/subusers.cs b/examples/subusers/subusers.cs
new file mode 100644
index 0000000..208e13c
--- /dev/null
+++ b/examples/subusers/subusers.cs
@@ -0,0 +1,218 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Create Subuser
+// POST /subusers
+
+string data = @"{
+ 'email': 'John@example.com',
+ 'ips': [
+ '1.1.1.1',
+ '2.2.2.2'
+ ],
+ 'password': 'johns_password',
+ 'username': 'John@example.com'
+}";
+dynamic response = sg.client.subusers.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// List all Subusers
+// GET /subusers
+
+string queryParams = @"{
+ 'limit': 0,
+ 'offset': 0,
+ 'username': 'test_string'
+}";
+dynamic response = sg.client.subusers.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve Subuser Reputations
+// GET /subusers/reputations
+
+string queryParams = @"{
+ 'usernames': 'test_string'
+}";
+dynamic response = sg.client.subusers.reputations.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve email statistics for your subusers.
+// GET /subusers/stats
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01',
+ 'subusers': 'test_string'
+}";
+dynamic response = sg.client.subusers.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve monthly stats for all subusers
+// GET /subusers/stats/monthly
+
+string queryParams = @"{
+ 'date': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'subuser': 'test_string'
+}";
+dynamic response = sg.client.subusers.stats.monthly.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve the totals for each email statistic metric for all subusers.
+// GET /subusers/stats/sums
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.subusers.stats.sums.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Enable/disable a subuser
+// PATCH /subusers/{subuser_name}
+
+string data = @"{
+ 'disabled': false
+}";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a subuser
+// DELETE /subusers/{subuser_name}
+
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update IPs assigned to a subuser
+// PUT /subusers/{subuser_name}/ips
+
+string data = @"[
+ '127.0.0.1'
+]";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).ips.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update Monitor Settings for a subuser
+// PUT /subusers/{subuser_name}/monitor
+
+string data = @"{
+ 'email': 'example@example.com',
+ 'frequency': 500
+}";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).monitor.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Create monitor settings
+// POST /subusers/{subuser_name}/monitor
+
+string data = @"{
+ 'email': 'example@example.com',
+ 'frequency': 50000
+}";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).monitor.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve monitor settings for a subuser
+// GET /subusers/{subuser_name}/monitor
+
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).monitor.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete monitor settings
+// DELETE /subusers/{subuser_name}/monitor
+
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).monitor.delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve the monthly email statistics for a single subuser
+// GET /subusers/{subuser_name}/stats/monthly
+
+string queryParams = @"{
+ 'date': 'test_string',
+ 'limit': 0,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string'
+}";
+var subuser_name = "test_url_param";
+dynamic response = sg.client.subusers._(subuser_name).stats.monthly.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/suppression/suppression.cs b/examples/suppression/suppression.cs
new file mode 100644
index 0000000..6cd819a
--- /dev/null
+++ b/examples/suppression/suppression.cs
@@ -0,0 +1,244 @@
+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 all blocks
+// GET /suppression/blocks
+
+string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+dynamic response = sg.client.suppression.blocks.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete blocks
+// DELETE /suppression/blocks
+
+string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ 'example1@example.com',
+ 'example2@example.com'
+ ]
+}";
+dynamic response = sg.client.suppression.blocks.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a specific block
+// GET /suppression/blocks/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.suppression.blocks._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a specific block
+// DELETE /suppression/blocks/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.suppression.blocks._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all bounces
+// GET /suppression/bounces
+
+string queryParams = @"{
+ 'end_time': 0,
+ 'start_time': 0
+}";
+dynamic response = sg.client.suppression.bounces.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete bounces
+// DELETE /suppression/bounces
+
+string data = @"{
+ 'delete_all': true,
+ 'emails': [
+ 'example@example.com',
+ 'example2@example.com'
+ ]
+}";
+dynamic response = sg.client.suppression.bounces.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a Bounce
+// GET /suppression/bounces/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.suppression.bounces._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a bounce
+// DELETE /suppression/bounces/{email}
+
+string queryParams = @"{
+ 'email_address': 'example@example.com'
+}";
+var email = "test_url_param";
+dynamic response = sg.client.suppression.bounces._(email).delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all invalid emails
+// GET /suppression/invalid_emails
+
+string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+dynamic response = sg.client.suppression.invalid_emails.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete invalid emails
+// DELETE /suppression/invalid_emails
+
+string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ 'example1@example.com',
+ 'example2@example.com'
+ ]
+}";
+dynamic response = sg.client.suppression.invalid_emails.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a specific invalid email
+// GET /suppression/invalid_emails/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.suppression.invalid_emails._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a specific invalid email
+// DELETE /suppression/invalid_emails/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.suppression.invalid_emails._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a specific spam report
+// GET /suppression/spam_report/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.suppression.spam_report._(email).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a specific spam report
+// DELETE /suppression/spam_report/{email}
+
+var email = "test_url_param";
+dynamic response = sg.client.suppression.spam_report._(email).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all spam reports
+// GET /suppression/spam_reports
+
+string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+dynamic response = sg.client.suppression.spam_reports.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete spam reports
+// DELETE /suppression/spam_reports
+
+string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ 'example1@example.com',
+ 'example2@example.com'
+ ]
+}";
+dynamic response = sg.client.suppression.spam_reports.delete(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all global suppressions
+// GET /suppression/unsubscribes
+
+string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+dynamic response = sg.client.suppression.unsubscribes.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/templates/templates.cs b/examples/templates/templates.cs
new file mode 100644
index 0000000..beea4d0
--- /dev/null
+++ b/examples/templates/templates.cs
@@ -0,0 +1,140 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Create a transactional template.
+// POST /templates
+
+string data = @"{
+ 'name': 'example_name'
+}";
+dynamic response = sg.client.templates.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all transactional templates.
+// GET /templates
+
+dynamic response = sg.client.templates.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Edit a transactional template.
+// PATCH /templates/{template_id}
+
+string data = @"{
+ 'name': 'new_example_name'
+}";
+var template_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a single transactional template.
+// GET /templates/{template_id}
+
+var template_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a template.
+// DELETE /templates/{template_id}
+
+var template_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Create a new transactional template version.
+// POST /templates/{template_id}/versions
+
+string data = @"{
+ 'active': 1,
+ 'html_content': '<%body%>',
+ 'name': 'example_version_name',
+ 'plain_content': '<%body%>',
+ 'subject': '<%subject%>',
+ 'template_id': 'ddb96bbc-9b92-425e-8979-99464621b543'
+}";
+var template_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Edit a transactional template version.
+// PATCH /templates/{template_id}/versions/{version_id}
+
+string data = @"{
+ 'active': 1,
+ 'html_content': '<%body%>',
+ 'name': 'updated_example_name',
+ 'plain_content': '<%body%>',
+ 'subject': '<%subject%>'
+}";
+var template_id = "test_url_param";
+var version_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions._(version_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a specific transactional template version.
+// GET /templates/{template_id}/versions/{version_id}
+
+var template_id = "test_url_param";
+var version_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions._(version_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a transactional template version.
+// DELETE /templates/{template_id}/versions/{version_id}
+
+var template_id = "test_url_param";
+var version_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions._(version_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Activate a transactional template version.
+// POST /templates/{template_id}/versions/{version_id}/activate
+
+var template_id = "test_url_param";
+var version_id = "test_url_param";
+dynamic response = sg.client.templates._(template_id).versions._(version_id).activate.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/trackingsettings/trackingsettings.cs b/examples/trackingsettings/trackingsettings.cs
new file mode 100644
index 0000000..cba044d
--- /dev/null
+++ b/examples/trackingsettings/trackingsettings.cs
@@ -0,0 +1,123 @@
+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 Tracking Settings
+// GET /tracking_settings
+
+string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.tracking_settings.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update Click Tracking Settings
+// PATCH /tracking_settings/click
+
+string data = @"{
+ 'enabled': true
+}";
+dynamic response = sg.client.tracking_settings.click.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve Click Track Settings
+// GET /tracking_settings/click
+
+dynamic response = sg.client.tracking_settings.click.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update Google Analytics Settings
+// PATCH /tracking_settings/google_analytics
+
+string data = @"{
+ 'enabled': true,
+ 'utm_campaign': 'website',
+ 'utm_content': '',
+ 'utm_medium': 'email',
+ 'utm_source': 'sendgrid.com',
+ 'utm_term': ''
+}";
+dynamic response = sg.client.tracking_settings.google_analytics.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve Google Analytics Settings
+// GET /tracking_settings/google_analytics
+
+dynamic response = sg.client.tracking_settings.google_analytics.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update Open Tracking Settings
+// PATCH /tracking_settings/open
+
+string data = @"{
+ 'enabled': true
+}";
+dynamic response = sg.client.tracking_settings.open.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Get Open Tracking Settings
+// GET /tracking_settings/open
+
+dynamic response = sg.client.tracking_settings.open.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update Subscription Tracking Settings
+// PATCH /tracking_settings/subscription
+
+string data = @"{
+ 'enabled': true,
+ 'html_content': 'html content',
+ 'landing': 'landing page html',
+ 'plain_content': 'text content',
+ 'replace': 'replacement tag',
+ 'url': 'url'
+}";
+dynamic response = sg.client.tracking_settings.subscription.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve Subscription Tracking Settings
+// GET /tracking_settings/subscription
+
+dynamic response = sg.client.tracking_settings.subscription.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/user/user.cs b/examples/user/user.cs
new file mode 100644
index 0000000..c81acc6
--- /dev/null
+++ b/examples/user/user.cs
@@ -0,0 +1,271 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Get a user's account information.
+// GET /user/account
+
+dynamic response = sg.client.user.account.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve your credit balance
+// GET /user/credits
+
+dynamic response = sg.client.user.credits.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update your account email address
+// PUT /user/email
+
+string data = @"{
+ 'email': 'example@example.com'
+}";
+dynamic response = sg.client.user.email.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve your account email address
+// GET /user/email
+
+dynamic response = sg.client.user.email.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update your password
+// PUT /user/password
+
+string data = @"{
+ 'new_password': 'new_password',
+ 'old_password': 'old_password'
+}";
+dynamic response = sg.client.user.password.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update a user's profile
+// PATCH /user/profile
+
+string data = @"{
+ 'city': 'Orange',
+ 'first_name': 'Example',
+ 'last_name': 'User'
+}";
+dynamic response = sg.client.user.profile.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Get a user's profile
+// GET /user/profile
+
+dynamic response = sg.client.user.profile.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Cancel or pause a scheduled send
+// POST /user/scheduled_sends
+
+string data = @"{
+ 'batch_id': 'YOUR_BATCH_ID',
+ 'status': 'pause'
+}";
+dynamic response = sg.client.user.scheduled_sends.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all scheduled sends
+// GET /user/scheduled_sends
+
+dynamic response = sg.client.user.scheduled_sends.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update user scheduled send information
+// PATCH /user/scheduled_sends/{batch_id}
+
+string data = @"{
+ 'status': 'pause'
+}";
+var batch_id = "test_url_param";
+dynamic response = sg.client.user.scheduled_sends._(batch_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve scheduled send
+// GET /user/scheduled_sends/{batch_id}
+
+var batch_id = "test_url_param";
+dynamic response = sg.client.user.scheduled_sends._(batch_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a cancellation or pause of a scheduled send
+// DELETE /user/scheduled_sends/{batch_id}
+
+var batch_id = "test_url_param";
+dynamic response = sg.client.user.scheduled_sends._(batch_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update Enforced TLS settings
+// PATCH /user/settings/enforced_tls
+
+string data = @"{
+ 'require_tls': true,
+ 'require_valid_cert': false
+}";
+dynamic response = sg.client.user.settings.enforced_tls.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve current Enforced TLS settings.
+// GET /user/settings/enforced_tls
+
+dynamic response = sg.client.user.settings.enforced_tls.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update your username
+// PUT /user/username
+
+string data = @"{
+ 'username': 'test_username'
+}";
+dynamic response = sg.client.user.username.put(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve your username
+// GET /user/username
+
+dynamic response = sg.client.user.username.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update Event Notification Settings
+// PATCH /user/webhooks/event/settings
+
+string data = @"{
+ 'bounce': true,
+ 'click': true,
+ 'deferred': true,
+ 'delivered': true,
+ 'dropped': true,
+ 'enabled': true,
+ 'group_resubscribe': true,
+ 'group_unsubscribe': true,
+ 'open': true,
+ 'processed': true,
+ 'spam_report': true,
+ 'unsubscribe': true,
+ 'url': 'url'
+}";
+dynamic response = sg.client.user.webhooks._("event").settings.patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve Event Webhook settings
+// GET /user/webhooks/event/settings
+
+dynamic response = sg.client.user.webhooks._("event").settings.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Test Event Notification Settings
+// POST /user/webhooks/event/test
+
+string data = @"{
+ 'url': 'url'
+}";
+dynamic response = sg.client.user.webhooks._("event").test.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve Parse Webhook settings
+// GET /user/webhooks/parse/settings
+
+dynamic response = sg.client.user.webhooks.parse.settings.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieves Inbound Parse Webhook statistics.
+// GET /user/webhooks/parse/stats
+
+string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 'test_string',
+ 'offset': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+dynamic response = sg.client.user.webhooks.parse.stats.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
diff --git a/examples/whitelabel/whitelabel.cs b/examples/whitelabel/whitelabel.cs
new file mode 100644
index 0000000..80be1c1
--- /dev/null
+++ b/examples/whitelabel/whitelabel.cs
@@ -0,0 +1,359 @@
+using System;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
+
+////////////////////////////////////////////////////////
+// Create a domain whitelabel.
+// POST /whitelabel/domains
+
+string data = @"{
+ 'automatic_security': false,
+ 'custom_spf': true,
+ 'default': true,
+ 'domain': 'example.com',
+ 'ips': [
+ '192.168.1.1',
+ '192.168.1.2'
+ ],
+ 'subdomain': 'news',
+ 'username': 'john@example.com'
+}";
+dynamic response = sg.client.whitelabel.domains.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// List all domain whitelabels.
+// GET /whitelabel/domains
+
+string queryParams = @"{
+ 'domain': 'test_string',
+ 'exclude_subusers': 'true',
+ 'limit': 1,
+ 'offset': 1,
+ 'username': 'test_string'
+}";
+dynamic response = sg.client.whitelabel.domains.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Get the default domain whitelabel.
+// GET /whitelabel/domains/default
+
+dynamic response = sg.client.whitelabel.domains._("default").get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// List the domain whitelabel associated with the given user.
+// GET /whitelabel/domains/subuser
+
+dynamic response = sg.client.whitelabel.domains.subuser.get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Disassociate a domain whitelabel from a given user.
+// DELETE /whitelabel/domains/subuser
+
+dynamic response = sg.client.whitelabel.domains.subuser.delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update a domain whitelabel.
+// PATCH /whitelabel/domains/{domain_id}
+
+string data = @"{
+ 'custom_spf': true,
+ 'default': false
+}";
+var domain_id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(domain_id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a domain whitelabel.
+// GET /whitelabel/domains/{domain_id}
+
+var domain_id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(domain_id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a domain whitelabel.
+// DELETE /whitelabel/domains/{domain_id}
+
+var domain_id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(domain_id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Associate a domain whitelabel with a given user.
+// POST /whitelabel/domains/{domain_id}/subuser
+
+string data = @"{
+ 'username': 'jane@example.com'
+}";
+var domain_id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(domain_id).subuser.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Add an IP to a domain whitelabel.
+// POST /whitelabel/domains/{id}/ips
+
+string data = @"{
+ 'ip': '192.168.0.1'
+}";
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(id).ips.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Remove an IP from a domain whitelabel.
+// DELETE /whitelabel/domains/{id}/ips/{ip}
+
+var id = "test_url_param";
+var ip = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(id).ips._(ip).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Validate a domain whitelabel.
+// POST /whitelabel/domains/{id}/validate
+
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.domains._(id).validate.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Create an IP whitelabel
+// POST /whitelabel/ips
+
+string data = @"{
+ 'domain': 'example.com',
+ 'ip': '192.168.1.1',
+ 'subdomain': 'email'
+}";
+dynamic response = sg.client.whitelabel.ips.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all IP whitelabels
+// GET /whitelabel/ips
+
+string queryParams = @"{
+ 'ip': 'test_string',
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.whitelabel.ips.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve an IP whitelabel
+// GET /whitelabel/ips/{id}
+
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.ips._(id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete an IP whitelabel
+// DELETE /whitelabel/ips/{id}
+
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.ips._(id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Validate an IP whitelabel
+// POST /whitelabel/ips/{id}/validate
+
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.ips._(id).validate.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Create a Link Whitelabel
+// POST /whitelabel/links
+
+string data = @"{
+ 'default': true,
+ 'domain': 'example.com',
+ 'subdomain': 'mail'
+}";
+string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+dynamic response = sg.client.whitelabel.links.post(requestBody: data, queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve all link whitelabels
+// GET /whitelabel/links
+
+string queryParams = @"{
+ 'limit': 1
+}";
+dynamic response = sg.client.whitelabel.links.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a Default Link Whitelabel
+// GET /whitelabel/links/default
+
+string queryParams = @"{
+ 'domain': 'test_string'
+}";
+dynamic response = sg.client.whitelabel.links._("default").get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve Associated Link Whitelabel
+// GET /whitelabel/links/subuser
+
+string queryParams = @"{
+ 'username': 'test_string'
+}";
+dynamic response = sg.client.whitelabel.links.subuser.get(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Disassociate a Link Whitelabel
+// DELETE /whitelabel/links/subuser
+
+string queryParams = @"{
+ 'username': 'test_string'
+}";
+dynamic response = sg.client.whitelabel.links.subuser.delete(queryParams: queryParams);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Update a Link Whitelabel
+// PATCH /whitelabel/links/{id}
+
+string data = @"{
+ 'default': true
+}";
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(id).patch(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Retrieve a Link Whitelabel
+// GET /whitelabel/links/{id}
+
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(id).get();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Delete a Link Whitelabel
+// DELETE /whitelabel/links/{id}
+
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(id).delete();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Validate a Link Whitelabel
+// POST /whitelabel/links/{id}/validate
+
+var id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(id).validate.post();
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+
+////////////////////////////////////////////////////////
+// Associate a Link Whitelabel
+// POST /whitelabel/links/{link_id}/subuser
+
+string data = @"{
+ 'username': 'jane@example.com'
+}";
+var link_id = "test_url_param";
+dynamic response = sg.client.whitelabel.links._(link_id).subuser.post(requestBody: data);
+Console.WriteLine(response.StatusCode);
+Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+Console.WriteLine(response.Headers.ToString());
+Console.ReadLine();
+