summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElmer Thomas <elmer@ThinkingSerious.com>2016-07-18 14:17:13 -0700
committerGitHub <noreply@github.com>2016-07-18 14:17:13 -0700
commite77fd46dd863f51cd5fb5786a50002968858379f (patch)
treeb51575c984fe94d7498e91b5d3ff05d46c6a9725
parent7d04be36d6a73ed69dd6ccbc0fb6590d3be94587 (diff)
parent9d48986ef4662e9cd91235ef91fc097ca07e7a8d (diff)
downloadsendgrid-csharp-e77fd46dd863f51cd5fb5786a50002968858379f.zip
sendgrid-csharp-e77fd46dd863f51cd5fb5786a50002968858379f.tar.gz
sendgrid-csharp-e77fd46dd863f51cd5fb5786a50002968858379f.tar.bz2
Merge pull request #282 from sendgrid/256-bad-json
256 bad json
-rw-r--r--CHANGELOG.md8
-rw-r--r--SendGrid/Example/Example.cs24
-rw-r--r--SendGrid/Example/Example.csproj12
-rw-r--r--SendGrid/Example/app.config2
-rw-r--r--SendGrid/Example/packages.config3
-rw-r--r--SendGrid/SendGrid/App.config2
-rw-r--r--SendGrid/SendGrid/SendGrid.csproj8
-rw-r--r--SendGrid/SendGrid/packages.config4
-rw-r--r--SendGrid/UnitTest/UnitTest.cs834
-rw-r--r--SendGrid/UnitTest/UnitTests.csproj8
-rw-r--r--SendGrid/UnitTest/app.config2
-rw-r--r--SendGrid/UnitTest/packages.config3
-rw-r--r--USAGE.md161
-rw-r--r--examples/accesssettings/accesssettings.cs5
-rw-r--r--examples/alerts/alerts.cs5
-rw-r--r--examples/apikeys/apikeys.cs7
-rw-r--r--examples/asm/asm.cs11
-rw-r--r--examples/browsers/browsers.cs1
-rw-r--r--examples/campaigns/campaigns.cs11
-rw-r--r--examples/categories/categories.cs1
-rw-r--r--examples/clients/clients.cs1
-rw-r--r--examples/contactdb/contactdb.cs21
-rw-r--r--examples/devices/devices.cs1
-rw-r--r--examples/geo/geo.cs1
-rw-r--r--examples/ips/ips.cs9
-rw-r--r--examples/mail/mail.cs3
-rw-r--r--examples/mailboxproviders/mailboxproviders.cs1
-rw-r--r--examples/mailsettings/mailsettings.cs19
-rw-r--r--examples/partnersettings/partnersettings.cs3
-rw-r--r--examples/scopes/scopes.cs1
-rw-r--r--examples/senders/senders.cs5
-rw-r--r--examples/stats/stats.cs1
-rw-r--r--examples/subusers/subusers.cs11
-rw-r--r--examples/suppression/suppression.cs9
-rw-r--r--examples/templates/templates.cs9
-rw-r--r--examples/trackingsettings/trackingsettings.cs9
-rw-r--r--examples/user/user.cs23
-rw-r--r--examples/whitelabel/whitelabel.cs17
38 files changed, 878 insertions, 378 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f31ea8..a0cd091 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,14 @@
# Change Log
All notable changes to this project will be documented in this file.
+## [7.0.7] - 2016-07-18
+- Fix for [issue #256](https://github.com/sendgrid/sendgrid-csharp/issues/256): SendGrid v3 and HTML emails - Creates bad Json
+- Updated dependency to SendGrid.Csharp.HTTP.Client to 2.0.6
+- Updated dependency to JSON.NET to 9.0.1 in the Example and SendGrid projects
+- Removed dependencies to SendGrid.CSharp.HTTP.Client and SendGrid.SmtpApi from the Example and UnitTests projects as they are not needed
+- Update examples, unit tests and USAGE.md to pass in valid JSON
+- Thanks to [Gunnar Liljas](https://github.com/gliljas) for helping find the root cause quickly!
+
## [7.0.6] - 2016-07-12
### Added
- Update docs, unit tests and examples to include Sender ID
diff --git a/SendGrid/Example/Example.cs b/SendGrid/Example/Example.cs
index 6ad2ae3..133160f 100644
--- a/SendGrid/Example/Example.cs
+++ b/SendGrid/Example/Example.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Web.Script.Serialization;
using SendGrid.Helpers.Mail;
+using Newtonsoft.Json;
namespace Example
{
@@ -31,15 +32,12 @@ namespace Example
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.post(requestBody: requestBody);
+ dynamic response = sg.client.mail.send.post(requestBody: mail.Get());
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
- Console.WriteLine(ret);
+ Console.WriteLine(mail.Get());
Console.ReadLine();
}
@@ -231,15 +229,12 @@ namespace Example
email.Address = "test@example.com";
mail.ReplyTo = email;
- String ret = mail.Get();
-
- string requestBody = ret;
- dynamic response = sg.client.mail.send.post(requestBody: requestBody);
+ dynamic response = sg.client.mail.send.post(requestBody: mail.Get());
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
- Console.WriteLine(ret);
+ Console.WriteLine(mail.Get());
Console.ReadLine();
}
@@ -268,7 +263,8 @@ namespace Example
'alerts.read'
]
}";
- response = sg.client.api_keys.post(requestBody: requestBody);
+ Object json = JsonConvert.DeserializeObject<Object>(requestBody);
+ response = sg.client.api_keys.post(requestBody: json.ToString());
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
@@ -292,7 +288,8 @@ namespace Example
requestBody = @"{
'name': 'A New Hope'
}";
- response = sg.client.api_keys._(api_key_id).patch(requestBody: requestBody);
+ json = JsonConvert.DeserializeObject<Object>(requestBody);
+ response = sg.client.api_keys._(api_key_id).patch(requestBody: json.ToString());
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
@@ -308,7 +305,8 @@ namespace Example
' user.profile.update'
]
}";
- response = sg.client.api_keys._(api_key_id).put(requestBody: requestBody);
+ json = JsonConvert.DeserializeObject<Object>(requestBody);
+ response = sg.client.api_keys._(api_key_id).put(requestBody: json.ToString());
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
diff --git a/SendGrid/Example/Example.csproj b/SendGrid/Example/Example.csproj
index 94d11f6..a10f143 100644
--- a/SendGrid/Example/Example.csproj
+++ b/SendGrid/Example/Example.csproj
@@ -46,18 +46,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
- <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>
+ <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
- <Reference Include="SendGrid.CSharp.HTTP.Client, Version=2.0.4.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
- <HintPath>..\packages\SendGrid.CSharp.HTTP.Client.2.0.4\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">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\SendGrid.SmtpApi.1.3.1\lib\net40\SendGrid.SmtpApi.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net" />
diff --git a/SendGrid/Example/app.config b/SendGrid/Example/app.config
index 8382638..ac5a484 100644
--- a/SendGrid/Example/app.config
+++ b/SendGrid/Example/app.config
@@ -19,7 +19,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
+ <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
diff --git a/SendGrid/Example/packages.config b/SendGrid/Example/packages.config
index 119cfba..6576d88 100644
--- a/SendGrid/Example/packages.config
+++ b/SendGrid/Example/packages.config
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
- <package id="SendGrid.CSharp.HTTP.Client" version="2.0.4" targetFramework="net452" />
+ <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
</packages> \ No newline at end of file
diff --git a/SendGrid/SendGrid/App.config b/SendGrid/SendGrid/App.config
index faf56dd..b77fa40 100644
--- a/SendGrid/SendGrid/App.config
+++ b/SendGrid/SendGrid/App.config
@@ -7,7 +7,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
+ <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
diff --git a/SendGrid/SendGrid/SendGrid.csproj b/SendGrid/SendGrid/SendGrid.csproj
index 81592a8..a691366 100644
--- a/SendGrid/SendGrid/SendGrid.csproj
+++ b/SendGrid/SendGrid/SendGrid.csproj
@@ -43,12 +43,12 @@
<AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
- <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=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
- <Reference Include="SendGrid.CSharp.HTTP.Client, Version=2.0.4.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
- <HintPath>..\packages\SendGrid.CSharp.HTTP.Client.2.0.4\lib\SendGrid.CSharp.HTTP.Client.dll</HintPath>
+ <Reference Include="SendGrid.CSharp.HTTP.Client, Version=2.0.6.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
+ <HintPath>..\packages\SendGrid.CSharp.HTTP.Client.2.0.6\lib\SendGrid.CSharp.HTTP.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
diff --git a/SendGrid/SendGrid/packages.config b/SendGrid/SendGrid/packages.config
index 2f37910..2ce6d8f 100644
--- a/SendGrid/SendGrid/packages.config
+++ b/SendGrid/SendGrid/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<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.4" targetFramework="net452" />
+ <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
+ <package id="SendGrid.CSharp.HTTP.Client" version="2.0.6" targetFramework="net452" />
</packages> \ No newline at end of file
diff --git a/SendGrid/UnitTest/UnitTest.cs b/SendGrid/UnitTest/UnitTest.cs
index d312e4a..b63a51b 100644
--- a/SendGrid/UnitTest/UnitTest.cs
+++ b/SendGrid/UnitTest/UnitTest.cs
@@ -32,7 +32,9 @@ namespace UnitTest
process.StartInfo = startInfo;
process.Start();
System.Threading.Thread.Sleep(15000);
- } else {
+ }
+ else
+ {
System.Threading.Thread.Sleep(15000);
}
}
@@ -283,15 +285,17 @@ namespace UnitTest
'ips': [
{
'ip': '192.168.1.1'
- },
+ },
{
'ip': '192.*.*.*'
- },
+ },
{
'ip': '192.168.1.3/32'
}
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -314,11 +318,13 @@ namespace UnitTest
{
string data = @"{
'ids': [
- 1,
- 2,
+ 1,
+ 2,
3
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
@@ -352,10 +358,12 @@ namespace UnitTest
public void test_alerts_post()
{
string data = @"{
- 'email_to': 'example@example.com',
- 'frequency': 'daily',
+ 'email_to': 'example@example.com',
+ 'frequency': 'daily',
'type': 'stats_notification'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -379,6 +387,8 @@ namespace UnitTest
string data = @"{
'email_to': 'example@example.com'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var alert_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -413,14 +423,16 @@ namespace UnitTest
public void test_api_keys_post()
{
string data = @"{
- 'name': 'My API Key',
- 'sample': 'data',
+ 'name': 'My API Key',
+ 'sample': 'data',
'scopes': [
- 'mail.send',
- 'alerts.create',
+ 'mail.send',
+ 'alerts.create',
'alerts.read'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -445,12 +457,14 @@ namespace UnitTest
public void test_api_keys__api_key_id__put()
{
string data = @"{
- 'name': 'A New Hope',
+ 'name': 'A New Hope',
'scopes': [
- 'user.profile.read',
+ 'user.profile.read',
'user.profile.update'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var api_key_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -465,6 +479,8 @@ namespace UnitTest
string data = @"{
'name': 'A New Hope'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var api_key_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -499,10 +515,12 @@ namespace UnitTest
public void test_asm_groups_post()
{
string data = @"{
- 'description': 'Suggestions for products our users might like.',
- 'is_default': true,
+ 'description': 'Suggestions for products our users might like.',
+ 'is_default': true,
'name': 'Product Suggestions'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -527,10 +545,12 @@ namespace UnitTest
public void test_asm_groups__group_id__patch()
{
string data = @"{
- 'description': 'Suggestions for items our users might like.',
- 'id': 103,
+ 'description': 'Suggestions for items our users might like.',
+ 'id': 103,
'name': 'Item Suggestions'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var group_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -566,10 +586,12 @@ namespace UnitTest
{
string data = @"{
'recipient_emails': [
- 'test1@example.com',
+ 'test1@example.com',
'test2@example.com'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var group_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -594,11 +616,13 @@ namespace UnitTest
{
string data = @"{
'recipient_emails': [
- 'exists1@example.com',
- 'exists2@example.com',
+ 'exists1@example.com',
+ 'exists2@example.com',
'doesnotexists@example.com'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var group_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -634,10 +658,12 @@ namespace UnitTest
{
string data = @"{
'recipient_emails': [
- 'test1@example.com',
+ 'test1@example.com',
'test2@example.com'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -682,11 +708,11 @@ namespace UnitTest
public void test_browsers_stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'browsers': 'test_string',
- 'end_date': '2016-04-01',
- 'limit': 'test_string',
- 'offset': 'test_string',
+ '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>();
@@ -702,23 +728,25 @@ namespace UnitTest
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',
+ ],
+ '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,
+ 110,
124
- ],
- 'plain_content': 'Check out our spring line!',
+ ],
+ 'plain_content': 'Check out our spring line!',
'segment_ids': [
110
- ],
- 'sender_id': 124451,
- 'subject': 'New Products for Spring!',
- 'suppression_group_id': 42,
+ ],
+ 'sender_id': 124451,
+ 'subject': 'New Products for Spring!',
+ 'suppression_group_id': 42,
'title': 'March Newsletter'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -730,7 +758,7 @@ namespace UnitTest
public void test_campaigns_get()
{
string queryParams = @"{
- 'limit': 1,
+ 'limit': 1,
'offset': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -746,12 +774,14 @@ namespace UnitTest
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!',
+ ],
+ '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'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var campaign_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -788,6 +818,8 @@ namespace UnitTest
string data = @"{
'send_at': 1489451436
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var campaign_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -802,6 +834,8 @@ namespace UnitTest
string data = @"{
'send_at': 1489771528
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var campaign_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -849,6 +883,8 @@ namespace UnitTest
string data = @"{
'to': 'your.email@example.com'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var campaign_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -861,8 +897,8 @@ namespace UnitTest
public void test_categories_get()
{
string queryParams = @"{
- 'category': 'test_string',
- 'limit': 1,
+ 'category': 'test_string',
+ 'limit': 1,
'offset': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -876,11 +912,11 @@ namespace UnitTest
public void test_categories_stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'categories': 'test_string',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
+ '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>();
@@ -894,12 +930,12 @@ namespace UnitTest
public void test_categories_stats_sums_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
- 'sort_by_direction': 'asc',
- 'sort_by_metric': 'test_string',
+ '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>();
@@ -913,8 +949,8 @@ namespace UnitTest
public void test_clients_stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
'start_date': '2016-01-01'
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -928,8 +964,8 @@ namespace UnitTest
public void test_clients__client_type__stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
'start_date': '2016-01-01'
}";
var client_type = "test_url_param";
@@ -944,9 +980,11 @@ namespace UnitTest
public void test_contactdb_custom_fields_post()
{
string data = @"{
- 'name': 'pet',
+ 'name': 'pet',
'type': 'text'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -992,6 +1030,8 @@ namespace UnitTest
string data = @"{
'name': 'your list name'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -1013,11 +1053,13 @@ namespace UnitTest
public void test_contactdb_lists_delete()
{
string data = @"[
- 1,
- 2,
- 3,
+ 1,
+ 2,
+ 3,
4
]";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
@@ -1031,6 +1073,8 @@ namespace UnitTest
string data = @"{
'name': 'newlistname'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
string queryParams = @"{
'list_id': 1
}";
@@ -1074,9 +1118,11 @@ namespace UnitTest
public void test_contactdb_lists__list_id__recipients_post()
{
string data = @"[
- 'recipient_id1',
+ 'recipient_id1',
'recipient_id2'
]";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var list_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -1089,8 +1135,8 @@ namespace UnitTest
public void test_contactdb_lists__list_id__recipients_get()
{
string queryParams = @"{
- 'list_id': 1,
- 'page': 1,
+ 'list_id': 1,
+ 'page': 1,
'page_size': 1
}";
var list_id = "test_url_param";
@@ -1117,7 +1163,7 @@ namespace UnitTest
public void test_contactdb_lists__list_id__recipients__recipient_id__delete()
{
string queryParams = @"{
- 'list_id': 1,
+ 'list_id': 1,
'recipient_id': 1
}";
var list_id = "test_url_param";
@@ -1134,11 +1180,13 @@ namespace UnitTest
{
string data = @"[
{
- 'email': 'jones@example.com',
- 'first_name': 'Guy',
+ 'email': 'jones@example.com',
+ 'first_name': 'Guy',
'last_name': 'Jones'
}
]";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -1151,18 +1199,20 @@ namespace UnitTest
{
string data = @"[
{
- 'age': 25,
- 'email': 'example@example.com',
- 'first_name': '',
+ 'age': 25,
+ 'email': 'example@example.com',
+ 'first_name': '',
'last_name': 'User'
- },
+ },
{
- 'age': 25,
- 'email': 'example2@example.com',
- 'first_name': 'Example',
+ 'age': 25,
+ 'email': 'example2@example.com',
+ 'first_name': 'Example',
'last_name': 'User'
}
]";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -1174,7 +1224,7 @@ namespace UnitTest
public void test_contactdb_recipients_get()
{
string queryParams = @"{
- 'page': 1,
+ 'page': 1,
'page_size': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -1188,9 +1238,11 @@ namespace UnitTest
public void test_contactdb_recipients_delete()
{
string data = @"[
- 'recipient_id1',
+ 'recipient_id1',
'recipient_id2'
]";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1280,27 +1332,29 @@ namespace UnitTest
string data = @"{
'conditions': [
{
- 'and_or': '',
- 'field': 'last_name',
- 'operator': 'eq',
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
'value': 'Miller'
- },
+ },
{
- 'and_or': 'and',
- 'field': 'last_clicked',
- 'operator': 'gt',
+ 'and_or': 'and',
+ 'field': 'last_clicked',
+ 'operator': 'gt',
'value': '01/02/2015'
- },
+ },
{
- 'and_or': 'or',
- 'field': 'clicks.campaign_identifier',
- 'operator': 'eq',
+ 'and_or': 'or',
+ 'field': 'clicks.campaign_identifier',
+ 'operator': 'eq',
'value': '513'
}
- ],
- 'list_id': 4,
+ ],
+ 'list_id': 4,
'name': 'Last Name Miller'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1324,15 +1378,17 @@ namespace UnitTest
string data = @"{
'conditions': [
{
- 'and_or': '',
- 'field': 'last_name',
- 'operator': 'eq',
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
'value': 'Miller'
}
- ],
- 'list_id': 5,
+ ],
+ 'list_id': 5,
'name': 'The Millers'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
string queryParams = @"{
'segment_id': 'test_string'
}";
@@ -1376,7 +1432,7 @@ namespace UnitTest
public void test_contactdb_segments__segment_id__recipients_get()
{
string queryParams = @"{
- 'page': 1,
+ 'page': 1,
'page_size': 1
}";
var segment_id = "test_url_param";
@@ -1391,10 +1447,10 @@ namespace UnitTest
public void test_devices_stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
+ '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>();
@@ -1408,11 +1464,11 @@ namespace UnitTest
public void test_geo_stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'country': 'US',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
+ '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>();
@@ -1426,10 +1482,10 @@ namespace UnitTest
public void test_ips_get()
{
string queryParams = @"{
- 'exclude_whitelabels': 'true',
- 'ip': 'test_string',
- 'limit': 1,
- 'offset': 1,
+ 'exclude_whitelabels': 'true',
+ 'ip': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
'subuser': 'test_string'
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -1455,6 +1511,8 @@ namespace UnitTest
string data = @"{
'name': 'marketing'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1478,6 +1536,8 @@ namespace UnitTest
string data = @"{
'name': 'new_pool_name'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var pool_name = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -1514,6 +1574,8 @@ namespace UnitTest
string data = @"{
'ip': '0.0.0.0'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var pool_name = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -1540,6 +1602,8 @@ namespace UnitTest
string data = @"{
'ip': '0.0.0.0'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1616,142 +1680,144 @@ namespace UnitTest
{
string data = @"{
'asm': {
- 'group_id': 1,
+ 'group_id': 1,
'groups_to_display': [
- 1,
- 2,
+ 1,
+ 2,
3
]
- },
+ },
'attachments': [
{
- 'content': '[BASE64 encoded content block here]',
- 'content_id': 'ii_139db99fdb5c3704',
- 'disposition': 'inline',
- 'filename': 'file1.jpg',
- 'name': 'file1',
+ 'content': '[BASE64 encoded content block here]',
+ 'content_id': 'ii_139db99fdb5c3704',
+ 'disposition': 'inline',
+ 'filename': 'file1.jpg',
+ 'name': 'file1',
'type': 'jpg'
}
- ],
- 'batch_id': '[YOUR BATCH ID GOES HERE]',
+ ],
+ 'batch_id': '[YOUR BATCH ID GOES HERE]',
'categories': [
- 'category1',
+ 'category1',
'category2'
- ],
+ ],
'content': [
{
- 'type': 'text/html',
+ 'type': 'text/html',
'value': '<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>'
}
- ],
+ ],
'custom_args': {
- 'New Argument 1': 'New Value 1',
- 'activationAttempt': '1',
+ 'New Argument 1': 'New Value 1',
+ 'activationAttempt': '1',
'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
- },
+ },
'from': {
- 'email': 'sam.smith@example.com',
+ 'email': 'sam.smith@example.com',
'name': 'Sam Smith'
- },
- 'headers': {},
- 'ip_pool_name': '[YOUR POOL NAME GOES HERE]',
+ },
+ 'headers': {},
+ 'ip_pool_name': '[YOUR POOL NAME GOES HERE]',
'mail_settings': {
'bcc': {
- 'email': 'ben.doe@example.com',
+ 'email': 'ben.doe@example.com',
'enable': true
- },
+ },
'bypass_list_management': {
'enable': true
- },
+ },
'footer': {
- 'enable': true,
- 'html': '<p>Thanks</br>The SendGrid Team</p>',
+ 'enable': true,
+ 'html': '<p>Thanks</br>The SendGrid Team</p>',
'text': 'Thanks,/n The SendGrid Team'
- },
+ },
'sandbox_mode': {
'enable': false
- },
+ },
'spam_check': {
- 'enable': true,
- 'post_to_url': 'http://example.com/compliance',
+ 'enable': true,
+ 'post_to_url': 'http://example.com/compliance',
'threshold': 3
}
- },
+ },
'personalizations': [
{
'bcc': [
{
- 'email': 'sam.doe@example.com',
+ 'email': 'sam.doe@example.com',
'name': 'Sam Doe'
}
- ],
+ ],
'cc': [
{
- 'email': 'jane.doe@example.com',
+ 'email': 'jane.doe@example.com',
'name': 'Jane Doe'
}
- ],
+ ],
'custom_args': {
- 'New Argument 1': 'New Value 1',
- 'activationAttempt': '1',
+ 'New Argument 1': 'New Value 1',
+ 'activationAttempt': '1',
'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
- },
+ },
'headers': {
- 'X-Accept-Language': 'en',
+ 'X-Accept-Language': 'en',
'X-Mailer': 'MyApp'
- },
- 'send_at': 1409348513,
- 'subject': 'Hello, World!',
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
'substitutions': {
- 'id': 'substitutions',
+ 'id': 'substitutions',
'type': 'object'
- },
+ },
'to': [
{
- 'email': 'john.doe@example.com',
+ 'email': 'john.doe@example.com',
'name': 'John Doe'
}
]
}
- ],
+ ],
'reply_to': {
- 'email': 'sam.smith@example.com',
+ 'email': 'sam.smith@example.com',
'name': 'Sam Smith'
- },
+ },
'sections': {
'section': {
- ':sectionName1': 'section 1 text',
+ ':sectionName1': 'section 1 text',
':sectionName2': 'section 2 text'
}
- },
- 'send_at': 1409348513,
- 'subject': 'Hello, World!',
- 'template_id': '[YOUR TEMPLATE ID GOES HERE]',
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
+ 'template_id': '[YOUR TEMPLATE ID GOES HERE]',
'tracking_settings': {
'click_tracking': {
- 'enable': true,
+ 'enable': true,
'enable_text': true
- },
+ },
'ganalytics': {
- 'enable': true,
- 'utm_campaign': '[NAME OF YOUR REFERRER SOURCE]',
- 'utm_content': '[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]',
- 'utm_medium': '[NAME OF YOUR MARKETING MEDIUM e.g. email]',
- 'utm_name': '[NAME OF YOUR CAMPAIGN]',
+ 'enable': true,
+ 'utm_campaign': '[NAME OF YOUR REFERRER SOURCE]',
+ 'utm_content': '[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]',
+ 'utm_medium': '[NAME OF YOUR MARKETING MEDIUM e.g. email]',
+ 'utm_name': '[NAME OF YOUR CAMPAIGN]',
'utm_term': '[IDENTIFY PAID KEYWORDS HERE]'
- },
+ },
'open_tracking': {
- 'enable': true,
+ 'enable': true,
'substitution_tag': '%opentrack'
- },
+ },
'subscription_tracking': {
- 'enable': true,
- 'html': 'If you would like to unsubscribe and stop receiving these emails <% clickhere %>.',
- 'substitution_tag': '<%click here%>',
+ 'enable': true,
+ 'html': 'If you would like to unsubscribe and stop receiving these emails <% clickhere %>.',
+ 'substitution_tag': '<%click here%>',
'text': 'If you would like to unsubscribe and stop receiveing these emails <% click here %>.'
}
}
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "202");
@@ -1763,7 +1829,7 @@ namespace UnitTest
public void test_mail_settings_get()
{
string queryParams = @"{
- 'limit': 1,
+ 'limit': 1,
'offset': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -1777,12 +1843,14 @@ namespace UnitTest
public void test_mail_settings_address_whitelist_patch()
{
string data = @"{
- 'enabled': true,
+ 'enabled': true,
'list': [
- 'email1@example.com',
+ 'email1@example.com',
'example.com'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1804,9 +1872,11 @@ namespace UnitTest
public void test_mail_settings_bcc_patch()
{
string data = @"{
- 'email': 'email@example.com',
+ 'email': 'email@example.com',
'enabled': false
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1828,10 +1898,12 @@ namespace UnitTest
public void test_mail_settings_bounce_purge_patch()
{
string data = @"{
- 'enabled': true,
- 'hard_bounces': 5,
+ 'enabled': true,
+ 'hard_bounces': 5,
'soft_bounces': 5
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1853,10 +1925,12 @@ namespace UnitTest
public void test_mail_settings_footer_patch()
{
string data = @"{
- 'enabled': true,
- 'html_content': '...',
+ 'enabled': true,
+ 'html_content': '...',
'plain_content': '...'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1878,9 +1952,11 @@ namespace UnitTest
public void test_mail_settings_forward_bounce_patch()
{
string data = @"{
- 'email': 'example@example.com',
+ 'email': 'example@example.com',
'enabled': true
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1902,9 +1978,11 @@ namespace UnitTest
public void test_mail_settings_forward_spam_patch()
{
string data = @"{
- 'email': '',
+ 'email': '',
'enabled': false
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1928,6 +2006,8 @@ namespace UnitTest
string data = @"{
'enabled': false
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1949,10 +2029,12 @@ namespace UnitTest
public void test_mail_settings_spam_check_patch()
{
string data = @"{
- 'enabled': true,
- 'max_score': 5,
+ 'enabled': true,
+ 'max_score': 5,
'url': 'url'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1974,9 +2056,11 @@ namespace UnitTest
public void test_mail_settings_template_patch()
{
string data = @"{
- 'enabled': true,
+ 'enabled': true,
'html_content': '<% body %>'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -1998,11 +2082,11 @@ namespace UnitTest
public void test_mailbox_providers_stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'mailbox_providers': 'test_string',
- 'offset': 1,
+ '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>();
@@ -2016,7 +2100,7 @@ namespace UnitTest
public void test_partner_settings_get()
{
string queryParams = @"{
- 'limit': 1,
+ 'limit': 1,
'offset': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2030,10 +2114,12 @@ namespace UnitTest
public void test_partner_settings_new_relic_patch()
{
string data = @"{
- 'enable_subuser_statistics': true,
- 'enabled': true,
+ 'enable_subuser_statistics': true,
+ 'enabled': true,
'license_key': ''
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -2065,22 +2151,24 @@ namespace UnitTest
public void test_senders_post()
{
string data = @"{
- 'address': '123 Elm St.',
- 'address_2': 'Apt. 456',
- 'city': 'Denver',
- 'country': 'United States',
+ 'address': '123 Elm St.',
+ 'address_2': 'Apt. 456',
+ 'city': 'Denver',
+ 'country': 'United States',
'from': {
- 'email': 'from@example.com',
+ 'email': 'from@example.com',
'name': 'Example INC'
- },
- 'nickname': 'My Sender ID',
+ },
+ 'nickname': 'My Sender ID',
'reply_to': {
- 'email': 'replyto@example.com',
+ 'email': 'replyto@example.com',
'name': 'Example INC'
- },
- 'state': 'Colorado',
+ },
+ 'state': 'Colorado',
'zip': '80202'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -2102,22 +2190,24 @@ namespace UnitTest
public void test_senders__sender_id__patch()
{
string data = @"{
- 'address': '123 Elm St.',
- 'address_2': 'Apt. 456',
- 'city': 'Denver',
- 'country': 'United States',
+ 'address': '123 Elm St.',
+ 'address_2': 'Apt. 456',
+ 'city': 'Denver',
+ 'country': 'United States',
'from': {
- 'email': 'from@example.com',
+ 'email': 'from@example.com',
'name': 'Example INC'
- },
- 'nickname': 'My Sender ID',
+ },
+ 'nickname': 'My Sender ID',
'reply_to': {
- 'email': 'replyto@example.com',
+ 'email': 'replyto@example.com',
'name': 'Example INC'
- },
- 'state': 'Colorado',
+ },
+ 'state': 'Colorado',
'zip': '80202'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var sender_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -2163,10 +2253,10 @@ namespace UnitTest
public void test_stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
+ '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>();
@@ -2180,14 +2270,16 @@ namespace UnitTest
public void test_subusers_post()
{
string data = @"{
- 'email': 'John@example.com',
+ 'email': 'John@example.com',
'ips': [
- '1.1.1.1',
+ '1.1.1.1',
'2.2.2.2'
- ],
- 'password': 'johns_password',
+ ],
+ 'password': 'johns_password',
'username': 'John@example.com'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -2199,8 +2291,8 @@ namespace UnitTest
public void test_subusers_get()
{
string queryParams = @"{
- 'limit': 1,
- 'offset': 1,
+ 'limit': 1,
+ 'offset': 1,
'username': 'test_string'
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2227,11 +2319,11 @@ namespace UnitTest
public void test_subusers_stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
- 'start_date': '2016-01-01',
+ '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>();
@@ -2245,11 +2337,11 @@ namespace UnitTest
public void test_subusers_stats_monthly_get()
{
string queryParams = @"{
- 'date': 'test_string',
- 'limit': 1,
- 'offset': 1,
- 'sort_by_direction': 'asc',
- 'sort_by_metric': 'test_string',
+ '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>();
@@ -2263,12 +2355,12 @@ namespace UnitTest
public void test_subusers_stats_sums_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
- 'sort_by_direction': 'asc',
- 'sort_by_metric': 'test_string',
+ '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>();
@@ -2284,6 +2376,8 @@ namespace UnitTest
string data = @"{
'disabled': false
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var subuser_name = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -2309,6 +2403,8 @@ namespace UnitTest
string data = @"[
'127.0.0.1'
]";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var subuser_name = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -2321,9 +2417,11 @@ namespace UnitTest
public void test_subusers__subuser_name__monitor_put()
{
string data = @"{
- 'email': 'example@example.com',
+ 'email': 'example@example.com',
'frequency': 500
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var subuser_name = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -2336,9 +2434,11 @@ namespace UnitTest
public void test_subusers__subuser_name__monitor_post()
{
string data = @"{
- 'email': 'example@example.com',
+ 'email': 'example@example.com',
'frequency': 50000
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var subuser_name = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -2373,10 +2473,10 @@ namespace UnitTest
public void test_subusers__subuser_name__stats_monthly_get()
{
string queryParams = @"{
- 'date': 'test_string',
- 'limit': 1,
- 'offset': 1,
- 'sort_by_direction': 'asc',
+ 'date': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
'sort_by_metric': 'test_string'
}";
var subuser_name = "test_url_param";
@@ -2391,9 +2491,9 @@ namespace UnitTest
public void test_suppression_blocks_get()
{
string queryParams = @"{
- 'end_time': 1,
- 'limit': 1,
- 'offset': 1,
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
'start_time': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2407,12 +2507,14 @@ namespace UnitTest
public void test_suppression_blocks_delete()
{
string data = @"{
- 'delete_all': false,
+ 'delete_all': false,
'emails': [
- 'example1@example.com',
+ 'example1@example.com',
'example2@example.com'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
@@ -2446,7 +2548,7 @@ namespace UnitTest
public void test_suppression_bounces_get()
{
string queryParams = @"{
- 'end_time': 1,
+ 'end_time': 1,
'start_time': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2460,12 +2562,14 @@ namespace UnitTest
public void test_suppression_bounces_delete()
{
string data = @"{
- 'delete_all': true,
+ 'delete_all': true,
'emails': [
- 'example@example.com',
+ 'example@example.com',
'example2@example.com'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
@@ -2502,9 +2606,9 @@ namespace UnitTest
public void test_suppression_invalid_emails_get()
{
string queryParams = @"{
- 'end_time': 1,
- 'limit': 1,
- 'offset': 1,
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
'start_time': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2518,12 +2622,14 @@ namespace UnitTest
public void test_suppression_invalid_emails_delete()
{
string data = @"{
- 'delete_all': false,
+ 'delete_all': false,
'emails': [
- 'example1@example.com',
+ 'example1@example.com',
'example2@example.com'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
@@ -2579,9 +2685,9 @@ namespace UnitTest
public void test_suppression_spam_reports_get()
{
string queryParams = @"{
- 'end_time': 1,
- 'limit': 1,
- 'offset': 1,
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
'start_time': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2595,12 +2701,14 @@ namespace UnitTest
public void test_suppression_spam_reports_delete()
{
string data = @"{
- 'delete_all': false,
+ 'delete_all': false,
'emails': [
- 'example1@example.com',
+ 'example1@example.com',
'example2@example.com'
]
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
@@ -2612,9 +2720,9 @@ namespace UnitTest
public void test_suppression_unsubscribes_get()
{
string queryParams = @"{
- 'end_time': 1,
- 'limit': 1,
- 'offset': 1,
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
'start_time': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2630,6 +2738,8 @@ namespace UnitTest
string data = @"{
'name': 'example_name'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -2653,6 +2763,8 @@ namespace UnitTest
string data = @"{
'name': 'new_example_name'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var template_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -2687,13 +2799,15 @@ namespace UnitTest
public void test_templates__template_id__versions_post()
{
string data = @"{
- 'active': 1,
- 'html_content': '<%body%>',
- 'name': 'example_version_name',
- 'plain_content': '<%body%>',
- 'subject': '<%subject%>',
+ 'active': 1,
+ 'html_content': '<%body%>',
+ 'name': 'example_version_name',
+ 'plain_content': '<%body%>',
+ 'subject': '<%subject%>',
'template_id': 'ddb96bbc-9b92-425e-8979-99464621b543'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var template_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -2706,12 +2820,14 @@ namespace UnitTest
public void test_templates__template_id__versions__version_id__patch()
{
string data = @"{
- 'active': 1,
- 'html_content': '<%body%>',
- 'name': 'updated_example_name',
- 'plain_content': '<%body%>',
+ 'active': 1,
+ 'html_content': '<%body%>',
+ 'name': 'updated_example_name',
+ 'plain_content': '<%body%>',
'subject': '<%subject%>'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var template_id = "test_url_param";
var version_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2761,7 +2877,7 @@ namespace UnitTest
public void test_tracking_settings_get()
{
string queryParams = @"{
- 'limit': 1,
+ 'limit': 1,
'offset': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2777,6 +2893,8 @@ namespace UnitTest
string data = @"{
'enabled': true
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -2798,13 +2916,15 @@ namespace UnitTest
public void test_tracking_settings_google_analytics_patch()
{
string data = @"{
- 'enabled': true,
- 'utm_campaign': 'website',
- 'utm_content': '',
- 'utm_medium': 'email',
- 'utm_source': 'sendgrid.com',
+ 'enabled': true,
+ 'utm_campaign': 'website',
+ 'utm_content': '',
+ 'utm_medium': 'email',
+ 'utm_source': 'sendgrid.com',
'utm_term': ''
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -2828,6 +2948,8 @@ namespace UnitTest
string data = @"{
'enabled': true
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -2849,13 +2971,15 @@ namespace UnitTest
public void test_tracking_settings_subscription_patch()
{
string data = @"{
- 'enabled': true,
- 'html_content': 'html content',
- 'landing': 'landing page html',
- 'plain_content': 'text content',
- 'replace': 'replacement tag',
+ 'enabled': true,
+ 'html_content': 'html content',
+ 'landing': 'landing page html',
+ 'plain_content': 'text content',
+ 'replace': 'replacement tag',
'url': 'url'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -2899,6 +3023,8 @@ namespace UnitTest
string data = @"{
'email': 'example@example.com'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -2920,9 +3046,11 @@ namespace UnitTest
public void test_user_password_put()
{
string data = @"{
- 'new_password': 'new_password',
+ 'new_password': 'new_password',
'old_password': 'old_password'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -2934,10 +3062,12 @@ namespace UnitTest
public void test_user_profile_patch()
{
string data = @"{
- 'city': 'Orange',
- 'first_name': 'Example',
+ 'city': 'Orange',
+ 'first_name': 'Example',
'last_name': 'User'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -2959,9 +3089,11 @@ namespace UnitTest
public void test_user_scheduled_sends_post()
{
string data = @"{
- 'batch_id': 'YOUR_BATCH_ID',
+ 'batch_id': 'YOUR_BATCH_ID',
'status': 'pause'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -2985,6 +3117,8 @@ namespace UnitTest
string data = @"{
'status': 'pause'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var batch_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -3019,9 +3153,11 @@ namespace UnitTest
public void test_user_settings_enforced_tls_patch()
{
string data = @"{
- 'require_tls': true,
+ 'require_tls': true,
'require_valid_cert': false
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -3045,6 +3181,8 @@ namespace UnitTest
string data = @"{
'username': 'test_username'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -3066,20 +3204,22 @@ namespace UnitTest
public void test_user_webhooks_event_settings_patch()
{
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,
+ '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'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
@@ -3103,6 +3243,8 @@ namespace UnitTest
string data = @"{
'url': 'url'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
@@ -3114,11 +3256,13 @@ namespace UnitTest
public void test_user_webhooks_parse_settings_post()
{
string data = @"{
- 'hostname': 'myhostname.com',
- 'send_raw': false,
- 'spam_check': true,
+ 'hostname': 'myhostname.com',
+ 'send_raw': false,
+ 'spam_check': true,
'url': 'http://email.myhosthame.com'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -3140,10 +3284,12 @@ namespace UnitTest
public void test_user_webhooks_parse_settings__hostname__patch()
{
string data = @"{
- 'send_raw': true,
- 'spam_check': false,
+ 'send_raw': true,
+ 'spam_check': false,
'url': 'http://newdomain.com/parse'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var hostname = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -3178,10 +3324,10 @@ namespace UnitTest
public void test_user_webhooks_parse_stats_get()
{
string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 'test_string',
- 'offset': 'test_string',
+ '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>();
@@ -3195,17 +3341,19 @@ namespace UnitTest
public void test_whitelabel_domains_post()
{
string data = @"{
- 'automatic_security': false,
- 'custom_spf': true,
- 'default': true,
- 'domain': 'example.com',
+ 'automatic_security': false,
+ 'custom_spf': true,
+ 'default': true,
+ 'domain': 'example.com',
'ips': [
- '192.168.1.1',
+ '192.168.1.1',
'192.168.1.2'
- ],
- 'subdomain': 'news',
+ ],
+ 'subdomain': 'news',
'username': 'john@example.com'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -3217,10 +3365,10 @@ namespace UnitTest
public void test_whitelabel_domains_get()
{
string queryParams = @"{
- 'domain': 'test_string',
- 'exclude_subusers': 'true',
- 'limit': 1,
- 'offset': 1,
+ 'domain': 'test_string',
+ 'exclude_subusers': 'true',
+ 'limit': 1,
+ 'offset': 1,
'username': 'test_string'
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -3264,9 +3412,11 @@ namespace UnitTest
public void test_whitelabel_domains__domain_id__patch()
{
string data = @"{
- 'custom_spf': true,
+ 'custom_spf': true,
'default': false
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var domain_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -3303,6 +3453,8 @@ namespace UnitTest
string data = @"{
'username': 'jane@example.com'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var domain_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -3317,6 +3469,8 @@ namespace UnitTest
string data = @"{
'ip': '192.168.0.1'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -3352,10 +3506,12 @@ namespace UnitTest
public void test_whitelabel_ips_post()
{
string data = @"{
- 'domain': 'example.com',
- 'ip': '192.168.1.1',
+ 'domain': 'example.com',
+ 'ip': '192.168.1.1',
'subdomain': 'email'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
@@ -3367,8 +3523,8 @@ namespace UnitTest
public void test_whitelabel_ips_get()
{
string queryParams = @"{
- 'ip': 'test_string',
- 'limit': 1,
+ 'ip': 'test_string',
+ 'limit': 1,
'offset': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -3415,12 +3571,14 @@ namespace UnitTest
public void test_whitelabel_links_post()
{
string data = @"{
- 'default': true,
- 'domain': 'example.com',
+ 'default': true,
+ 'domain': 'example.com',
'subdomain': 'mail'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
string queryParams = @"{
- 'limit': 1,
+ 'limit': 1,
'offset': 1
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -3488,6 +3646,8 @@ namespace UnitTest
string data = @"{
'default': true
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
@@ -3535,6 +3695,8 @@ namespace UnitTest
string data = @"{
'username': 'jane@example.com'
}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
var link_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
diff --git a/SendGrid/UnitTest/UnitTests.csproj b/SendGrid/UnitTest/UnitTests.csproj
index e90a902..d0209e2 100644
--- a/SendGrid/UnitTest/UnitTests.csproj
+++ b/SendGrid/UnitTest/UnitTests.csproj
@@ -43,8 +43,8 @@
</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=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.9.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'">
@@ -67,10 +67,6 @@
<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.4.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
- <HintPath>..\packages\SendGrid.CSharp.HTTP.Client.2.0.4\lib\SendGrid.CSharp.HTTP.Client.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Web.Extensions" />
diff --git a/SendGrid/UnitTest/app.config b/SendGrid/UnitTest/app.config
index 8f7aefe..0a0c8e6 100644
--- a/SendGrid/UnitTest/app.config
+++ b/SendGrid/UnitTest/app.config
@@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
+ <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
diff --git a/SendGrid/UnitTest/packages.config b/SendGrid/UnitTest/packages.config
index 47fd280..8f2a947 100644
--- a/SendGrid/UnitTest/packages.config
+++ b/SendGrid/UnitTest/packages.config
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
+ <package id="Newtonsoft.Json" version="9.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.4" targetFramework="net452" />
</packages> \ No newline at end of file
diff --git a/USAGE.md b/USAGE.md
index e65fb6e..4624955 100644
--- a/USAGE.md
+++ b/USAGE.md
@@ -5,6 +5,7 @@ This documentation is based on our [OAI specification](https://github.com/sendgr
```csharp
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -91,6 +92,8 @@ string data = @"{
}
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.access_settings.whitelist.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -138,6 +141,8 @@ string data = @"{
3
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.access_settings.whitelist.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -211,6 +216,8 @@ string data = @"{
'frequency': 'daily',
'type': 'stats_notification'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.alerts.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -256,6 +263,8 @@ For more information about alerts, please see our [User Guide](https://sendgrid.
string data = @"{
'email_to': 'example@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var alert_id = "test_url_param";
dynamic response = sg.client.alerts._(alert_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -336,6 +345,8 @@ string data = @"{
'alerts.read'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.api_keys.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -384,6 +395,8 @@ string data = @"{
'user.profile.update'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var api_key_id = "test_url_param";
dynamic response = sg.client.api_keys._(api_key_id).put(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -413,6 +426,8 @@ The API Keys feature allows customers to be able to generate an API Key credenti
string data = @"{
'name': 'A New Hope'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var api_key_id = "test_url_param";
dynamic response = sg.client.api_keys._(api_key_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -487,6 +502,8 @@ string data = @"{
'is_default': true,
'name': 'Product Suggestions'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.asm.groups.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -537,6 +554,8 @@ string data = @"{
'id': 103,
'name': 'Item Suggestions'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var group_id = "test_url_param";
dynamic response = sg.client.asm.groups._(group_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -609,6 +628,8 @@ string data = @"{
'test2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var group_id = "test_url_param";
dynamic response = sg.client.asm.groups._(group_id).suppressions.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -654,6 +675,8 @@ string data = @"{
'doesnotexists@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var group_id = "test_url_param";
dynamic response = sg.client.asm.groups._(group_id).suppressions.search.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -714,6 +737,8 @@ string data = @"{
'test2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.asm.suppressions.global.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -846,6 +871,8 @@ string data = @"{
'suppression_group_id': 42,
'title': 'March Newsletter'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.campaigns.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -901,6 +928,8 @@ string data = @"{
'subject': 'New Products for Summer!',
'title': 'May Newsletter'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var campaign_id = "test_url_param";
dynamic response = sg.client.campaigns._(campaign_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -968,6 +997,8 @@ For more information:
string data = @"{
'send_at': 1489451436
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var campaign_id = "test_url_param";
dynamic response = sg.client.campaigns._(campaign_id).schedules.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -991,6 +1022,8 @@ For more information:
string data = @"{
'send_at': 1489771528
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var campaign_id = "test_url_param";
dynamic response = sg.client.campaigns._(campaign_id).schedules.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -1081,6 +1114,8 @@ For more information:
string data = @"{
'to': 'your.email@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var campaign_id = "test_url_param";
dynamic response = sg.client.campaigns._(campaign_id).schedules.test.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -1244,6 +1279,8 @@ string data = @"{
'name': 'pet',
'type': 'text'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.custom_fields.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -1317,6 +1354,8 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co
string data = @"{
'name': 'your list name'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.lists.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -1357,6 +1396,8 @@ string data = @"[
3,
4
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.lists.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -1378,6 +1419,8 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co
string data = @"{
'name': 'newlistname'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
string queryParams = @"{
'list_id': 1
}";
@@ -1447,6 +1490,8 @@ string data = @"[
'recipient_id1',
'recipient_id2'
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var list_id = "test_url_param";
dynamic response = sg.client.contactdb.lists._(list_id).recipients.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -1541,6 +1586,8 @@ string data = @"[
'last_name': 'Jones'
}
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.recipients.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -1574,6 +1621,8 @@ string data = @"[
'last_name': 'User'
}
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.recipients.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -1621,6 +1670,8 @@ string data = @"[
'recipient_id1',
'recipient_id2'
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.recipients.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -1820,6 +1871,8 @@ string data = @"{
'list_id': 4,
'name': 'Last Name Miller'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.segments.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -1870,6 +1923,8 @@ string data = @"{
'list_id': 5,
'name': 'The Millers'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
string queryParams = @"{
'segment_id': 'test_string'
}";
@@ -2086,6 +2141,8 @@ If an IP pool is NOT specified for an email, it will use any IP available, inclu
string data = @"{
'name': 'marketing'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.ips.pools.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2131,6 +2188,8 @@ If an IP pool is NOT specified for an email, it will use any IP available, inclu
string data = @"{
'name': 'new_pool_name'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var pool_name = "test_url_param";
dynamic response = sg.client.ips.pools._(pool_name).put(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -2198,6 +2257,8 @@ A single IP address or a range of IP addresses may be dedicated to an account in
string data = @"{
'ip': '0.0.0.0'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var pool_name = "test_url_param";
dynamic response = sg.client.ips.pools._(pool_name).ips.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -2242,6 +2303,8 @@ For more general information about warming up IPs, please see our [Classroom](ht
string data = @"{
'ip': '0.0.0.0'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.ips.warmup.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2528,6 +2591,8 @@ string data = @"{
}
}
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail.send.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2578,6 +2643,8 @@ string data = @"{
'example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.address_whitelist.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2620,6 +2687,8 @@ string data = @"{
'email': 'email@example.com',
'enabled': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.bcc.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2663,6 +2732,8 @@ string data = @"{
'hard_bounces': 5,
'soft_bounces': 5
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.bounce_purge.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2706,6 +2777,8 @@ string data = @"{
'html_content': '...',
'plain_content': '...'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.footer.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2748,6 +2821,8 @@ string data = @"{
'email': 'example@example.com',
'enabled': true
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.forward_bounce.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2790,6 +2865,8 @@ string data = @"{
'email': '',
'enabled': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.forward_spam.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2831,6 +2908,8 @@ Mail settings allow you to tell SendGrid specific things to do to every email th
string data = @"{
'enabled': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.plain_content.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2874,6 +2953,8 @@ string data = @"{
'max_score': 5,
'url': 'url'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.spam_check.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -2918,6 +2999,8 @@ string data = @"{
'enabled': true,
'html_content': '<% body %>'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.template.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -3017,6 +3100,8 @@ string data = @"{
'enabled': true,
'license_key': ''
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.partner_settings.new_relic.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -3095,6 +3180,8 @@ string data = @"{
'state': 'Colorado',
'zip': '80202'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.senders.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -3148,6 +3235,8 @@ string data = @"{
'state': 'Colorado',
'zip': '80202'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var sender_id = "test_url_param";
dynamic response = sg.client.senders._(sender_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -3262,6 +3351,8 @@ string data = @"{
'password': 'johns_password',
'username': 'John@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.subusers.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -3418,6 +3509,8 @@ For more information about Subusers:
string data = @"{
'disabled': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var subuser_name = "test_url_param";
dynamic response = sg.client.subusers._(subuser_name).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -3463,6 +3556,8 @@ More information:
string data = @"[
'127.0.0.1'
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var subuser_name = "test_url_param";
dynamic response = sg.client.subusers._(subuser_name).ips.put(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -3483,6 +3578,8 @@ string data = @"{
'email': 'example@example.com',
'frequency': 500
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var subuser_name = "test_url_param";
dynamic response = sg.client.subusers._(subuser_name).monitor.put(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -3503,6 +3600,8 @@ string data = @"{
'email': 'example@example.com',
'frequency': 50000
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var subuser_name = "test_url_param";
dynamic response = sg.client.subusers._(subuser_name).monitor.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -3625,6 +3724,8 @@ string data = @"{
'example2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.suppression.blocks.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -3723,6 +3824,8 @@ string data = @"{
'example2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.suppression.bounces.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -3834,6 +3937,8 @@ string data = @"{
'example2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.suppression.invalid_emails.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -3974,6 +4079,8 @@ string data = @"{
'example2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.suppression.spam_reports.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4022,6 +4129,8 @@ Transactional templates are templates created specifically for transactional ema
string data = @"{
'name': 'example_name'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.templates.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4064,6 +4173,8 @@ Transactional templates are templates created specifically for transactional ema
string data = @"{
'name': 'new_example_name'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var template_id = "test_url_param";
dynamic response = sg.client.templates._(template_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -4135,6 +4246,8 @@ string data = @"{
'subject': '<%subject%>',
'template_id': 'ddb96bbc-9b92-425e-8979-99464621b543'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var template_id = "test_url_param";
dynamic response = sg.client.templates._(template_id).versions.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -4168,6 +4281,8 @@ string data = @"{
'plain_content': '<%body%>',
'subject': '<%subject%>'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
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);
@@ -4300,6 +4415,8 @@ For more information about tracking, please see our [User Guide](https://sendgri
string data = @"{
'enabled': true
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.tracking_settings.click.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4350,6 +4467,8 @@ string data = @"{
'utm_source': 'sendgrid.com',
'utm_term': ''
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.tracking_settings.google_analytics.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4397,6 +4516,8 @@ For more information about tracking, please see our [User Guide](https://sendgri
string data = @"{
'enabled': true
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.tracking_settings.open.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4447,6 +4568,8 @@ string data = @"{
'replace': 'replacement tag',
'url': 'url'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.tracking_settings.subscription.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4535,6 +4658,8 @@ For more information about your user profile:
string data = @"{
'email': 'example@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.email.put(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4581,6 +4706,8 @@ string data = @"{
'new_password': 'new_password',
'old_password': 'old_password'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.password.put(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4609,6 +4736,8 @@ string data = @"{
'first_name': 'Example',
'last_name': 'User'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.profile.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4652,6 +4781,8 @@ string data = @"{
'batch_id': 'YOUR_BATCH_ID',
'status': 'pause'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.scheduled_sends.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4689,6 +4820,8 @@ The Cancel Scheduled Sends feature allows the customer to cancel a scheduled sen
string data = @"{
'status': 'pause'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var batch_id = "test_url_param";
dynamic response = sg.client.user.scheduled_sends._(batch_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -4749,6 +4882,8 @@ string data = @"{
'require_tls': true,
'require_valid_cert': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.settings.enforced_tls.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4792,6 +4927,8 @@ For more information about your user profile:
string data = @"{
'username': 'test_username'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.username.put(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4849,6 +4986,8 @@ string data = @"{
'unsubscribe': true,
'url': 'url'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.webhooks._("_("event")").settings.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4892,6 +5031,8 @@ Common uses of this data are to remove unsubscribes, react to spam reports, dete
string data = @"{
'url': 'url'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.webhooks._("_("event")").test.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4915,6 +5056,8 @@ string data = @"{
'spam_check': true,
'url': 'http://email.myhosthame.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.webhooks.parse.settings.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -4954,6 +5097,8 @@ string data = @"{
'spam_check': false,
'url': 'http://newdomain.com/parse'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var hostname = "test_url_param";
dynamic response = sg.client.user.webhooks.parse.settings._(hostname).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -5055,6 +5200,8 @@ string data = @"{
'subdomain': 'news',
'username': 'john@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.whitelabel.domains.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -5181,6 +5328,8 @@ string data = @"{
'custom_spf': true,
'default': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var domain_id = "test_url_param";
dynamic response = sg.client.whitelabel.domains._(domain_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -5252,6 +5401,8 @@ For more information on whitelabeling, please see our [User Guide](https://sendg
string data = @"{
'username': 'jane@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var domain_id = "test_url_param";
dynamic response = sg.client.whitelabel.domains._(domain_id).subuser.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -5280,6 +5431,8 @@ For more information on whitelabeling, please see our [User Guide](https://sendg
string data = @"{
'ip': '192.168.0.1'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var id = "test_url_param";
dynamic response = sg.client.whitelabel.domains._(id).ips.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -5359,6 +5512,8 @@ string data = @"{
'ip': '192.168.1.1',
'subdomain': 'email'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.whitelabel.ips.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -5469,6 +5624,8 @@ string data = @"{
'domain': 'example.com',
'subdomain': 'mail'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
string queryParams = @"{
'limit': 1,
'offset': 1
@@ -5598,6 +5755,8 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_
string data = @"{
'default': true
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var id = "test_url_param";
dynamic response = sg.client.whitelabel.links._(id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -5685,6 +5844,8 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_
string data = @"{
'username': 'jane@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var link_id = "test_url_param";
dynamic response = sg.client.whitelabel.links._(link_id).subuser.post(requestBody: data);
Console.WriteLine(response.StatusCode);
diff --git a/examples/accesssettings/accesssettings.cs b/examples/accesssettings/accesssettings.cs
index 09b822c..013a37c 100644
--- a/examples/accesssettings/accesssettings.cs
+++ b/examples/accesssettings/accesssettings.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -34,6 +35,8 @@ string data = @"{
}
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.access_settings.whitelist.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -61,6 +64,8 @@ string data = @"{
3
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.access_settings.whitelist.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
diff --git a/examples/alerts/alerts.cs b/examples/alerts/alerts.cs
index 26bd8f2..49766a7 100644
--- a/examples/alerts/alerts.cs
+++ b/examples/alerts/alerts.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -13,6 +14,8 @@ string data = @"{
'frequency': 'daily',
'type': 'stats_notification'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.alerts.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -36,6 +39,8 @@ Console.ReadLine();
string data = @"{
'email_to': 'example@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var alert_id = "test_url_param";
dynamic response = sg.client.alerts._(alert_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
diff --git a/examples/apikeys/apikeys.cs b/examples/apikeys/apikeys.cs
index 67dce33..6538543 100644
--- a/examples/apikeys/apikeys.cs
+++ b/examples/apikeys/apikeys.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -17,6 +18,8 @@ string data = @"{
'alerts.read'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.api_keys.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -47,6 +50,8 @@ string data = @"{
'user.profile.update'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var api_key_id = "test_url_param";
dynamic response = sg.client.api_keys._(api_key_id).put(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -61,6 +66,8 @@ Console.ReadLine();
string data = @"{
'name': 'A New Hope'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var api_key_id = "test_url_param";
dynamic response = sg.client.api_keys._(api_key_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
diff --git a/examples/asm/asm.cs b/examples/asm/asm.cs
index fb2a5c6..e20810a 100644
--- a/examples/asm/asm.cs
+++ b/examples/asm/asm.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -13,6 +14,8 @@ string data = @"{
'is_default': true,
'name': 'Product Suggestions'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.asm.groups.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -41,6 +44,8 @@ string data = @"{
'id': 103,
'name': 'Item Suggestions'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var group_id = "test_url_param";
dynamic response = sg.client.asm.groups._(group_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -80,6 +85,8 @@ string data = @"{
'test2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var group_id = "test_url_param";
dynamic response = sg.client.asm.groups._(group_id).suppressions.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -109,6 +116,8 @@ string data = @"{
'doesnotexists@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var group_id = "test_url_param";
dynamic response = sg.client.asm.groups._(group_id).suppressions.search.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -148,6 +157,8 @@ string data = @"{
'test2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.asm.suppressions.global.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
diff --git a/examples/browsers/browsers.cs b/examples/browsers/browsers.cs
index 4e34f82..2d902c7 100644
--- a/examples/browsers/browsers.cs
+++ b/examples/browsers/browsers.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
diff --git a/examples/campaigns/campaigns.cs b/examples/campaigns/campaigns.cs
index c16baa5..dbaaeb3 100644
--- a/examples/campaigns/campaigns.cs
+++ b/examples/campaigns/campaigns.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -28,6 +29,8 @@ string data = @"{
'suppression_group_id': 42,
'title': 'March Newsletter'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.campaigns.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -61,6 +64,8 @@ string data = @"{
'subject': 'New Products for Summer!',
'title': 'May Newsletter'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var campaign_id = "test_url_param";
dynamic response = sg.client.campaigns._(campaign_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -97,6 +102,8 @@ Console.ReadLine();
string data = @"{
'send_at': 1489451436
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var campaign_id = "test_url_param";
dynamic response = sg.client.campaigns._(campaign_id).schedules.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -111,6 +118,8 @@ Console.ReadLine();
string data = @"{
'send_at': 1489771528
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var campaign_id = "test_url_param";
dynamic response = sg.client.campaigns._(campaign_id).schedules.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -158,6 +167,8 @@ Console.ReadLine();
string data = @"{
'to': 'your.email@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var campaign_id = "test_url_param";
dynamic response = sg.client.campaigns._(campaign_id).schedules.test.post(requestBody: data);
Console.WriteLine(response.StatusCode);
diff --git a/examples/categories/categories.cs b/examples/categories/categories.cs
index 7e18c8e..c120b4b 100644
--- a/examples/categories/categories.cs
+++ b/examples/categories/categories.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
diff --git a/examples/clients/clients.cs b/examples/clients/clients.cs
index ac224b8..51eb584 100644
--- a/examples/clients/clients.cs
+++ b/examples/clients/clients.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
diff --git a/examples/contactdb/contactdb.cs b/examples/contactdb/contactdb.cs
index 38e6e01..11deca5 100644
--- a/examples/contactdb/contactdb.cs
+++ b/examples/contactdb/contactdb.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -12,6 +13,8 @@ string data = @"{
'name': 'pet',
'type': 'text'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.custom_fields.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -57,6 +60,8 @@ Console.ReadLine();
string data = @"{
'name': 'your list name'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.lists.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -83,6 +88,8 @@ string data = @"[
3,
4
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.lists.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -96,6 +103,8 @@ Console.ReadLine();
string data = @"{
'name': 'newlistname'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
string queryParams = @"{
'list_id': 1
}";
@@ -142,6 +151,8 @@ string data = @"[
'recipient_id1',
'recipient_id2'
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var list_id = "test_url_param";
dynamic response = sg.client.contactdb.lists._(list_id).recipients.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -204,6 +215,8 @@ string data = @"[
'last_name': 'Jones'
}
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.recipients.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -228,6 +241,8 @@ string data = @"[
'last_name': 'User'
}
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.recipients.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -256,6 +271,8 @@ string data = @"[
'recipient_id1',
'recipient_id2'
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.recipients.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -366,6 +383,8 @@ string data = @"{
'list_id': 4,
'name': 'Last Name Miller'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.contactdb.segments.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -398,6 +417,8 @@ string data = @"{
'list_id': 5,
'name': 'The Millers'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
string queryParams = @"{
'segment_id': 'test_string'
}";
diff --git a/examples/devices/devices.cs b/examples/devices/devices.cs
index 8bdc361..275f8b7 100644
--- a/examples/devices/devices.cs
+++ b/examples/devices/devices.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
diff --git a/examples/geo/geo.cs b/examples/geo/geo.cs
index 405b768..e721bc9 100644
--- a/examples/geo/geo.cs
+++ b/examples/geo/geo.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
diff --git a/examples/ips/ips.cs b/examples/ips/ips.cs
index 26f5503..b72fe55 100644
--- a/examples/ips/ips.cs
+++ b/examples/ips/ips.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -38,6 +39,8 @@ Console.ReadLine();
string data = @"{
'name': 'marketing'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.ips.pools.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -61,6 +64,8 @@ Console.ReadLine();
string data = @"{
'name': 'new_pool_name'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var pool_name = "test_url_param";
dynamic response = sg.client.ips.pools._(pool_name).put(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -97,6 +102,8 @@ Console.ReadLine();
string data = @"{
'ip': '0.0.0.0'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var pool_name = "test_url_param";
dynamic response = sg.client.ips.pools._(pool_name).ips.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -123,6 +130,8 @@ Console.ReadLine();
string data = @"{
'ip': '0.0.0.0'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.ips.warmup.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
diff --git a/examples/mail/mail.cs b/examples/mail/mail.cs
index 66e118b..64ec761 100644
--- a/examples/mail/mail.cs
+++ b/examples/mail/mail.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -168,6 +169,8 @@ string data = @"{
}
}
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail.send.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
diff --git a/examples/mailboxproviders/mailboxproviders.cs b/examples/mailboxproviders/mailboxproviders.cs
index 74bf7ed..be6f5f6 100644
--- a/examples/mailboxproviders/mailboxproviders.cs
+++ b/examples/mailboxproviders/mailboxproviders.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
diff --git a/examples/mailsettings/mailsettings.cs b/examples/mailsettings/mailsettings.cs
index 8f08b32..e4df297 100644
--- a/examples/mailsettings/mailsettings.cs
+++ b/examples/mailsettings/mailsettings.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -29,6 +30,8 @@ string data = @"{
'example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.address_whitelist.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -53,6 +56,8 @@ string data = @"{
'email': 'email@example.com',
'enabled': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.bcc.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -78,6 +83,8 @@ string data = @"{
'hard_bounces': 5,
'soft_bounces': 5
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.bounce_purge.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -103,6 +110,8 @@ string data = @"{
'html_content': '...',
'plain_content': '...'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.footer.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -127,6 +136,8 @@ string data = @"{
'email': 'example@example.com',
'enabled': true
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.forward_bounce.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -151,6 +162,8 @@ string data = @"{
'email': '',
'enabled': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.forward_spam.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -174,6 +187,8 @@ Console.ReadLine();
string data = @"{
'enabled': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.plain_content.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -199,6 +214,8 @@ string data = @"{
'max_score': 5,
'url': 'url'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.spam_check.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -223,6 +240,8 @@ string data = @"{
'enabled': true,
'html_content': '<% body %>'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.mail_settings.template.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
diff --git a/examples/partnersettings/partnersettings.cs b/examples/partnersettings/partnersettings.cs
index 50b445f..f28905d 100644
--- a/examples/partnersettings/partnersettings.cs
+++ b/examples/partnersettings/partnersettings.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -27,6 +28,8 @@ string data = @"{
'enabled': true,
'license_key': ''
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.partner_settings.new_relic.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
diff --git a/examples/scopes/scopes.cs b/examples/scopes/scopes.cs
index 53d8bd5..6b6b5e3 100644
--- a/examples/scopes/scopes.cs
+++ b/examples/scopes/scopes.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
diff --git a/examples/senders/senders.cs b/examples/senders/senders.cs
index 7e8279d..d706729 100644
--- a/examples/senders/senders.cs
+++ b/examples/senders/senders.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -25,6 +26,8 @@ string data = @"{
'state': 'Colorado',
'zip': '80202'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.senders.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -62,6 +65,8 @@ string data = @"{
'state': 'Colorado',
'zip': '80202'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var sender_id = "test_url_param";
dynamic response = sg.client.senders._(sender_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
diff --git a/examples/stats/stats.cs b/examples/stats/stats.cs
index 464ce3c..6525b8d 100644
--- a/examples/stats/stats.cs
+++ b/examples/stats/stats.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
diff --git a/examples/subusers/subusers.cs b/examples/subusers/subusers.cs
index 942ad5e..0aebae4 100644
--- a/examples/subusers/subusers.cs
+++ b/examples/subusers/subusers.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -17,6 +18,8 @@ string data = @"{
'password': 'johns_password',
'username': 'John@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.subusers.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -113,6 +116,8 @@ Console.ReadLine();
string data = @"{
'disabled': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var subuser_name = "test_url_param";
dynamic response = sg.client.subusers._(subuser_name).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -138,6 +143,8 @@ Console.ReadLine();
string data = @"[
'127.0.0.1'
]";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var subuser_name = "test_url_param";
dynamic response = sg.client.subusers._(subuser_name).ips.put(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -153,6 +160,8 @@ string data = @"{
'email': 'example@example.com',
'frequency': 500
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var subuser_name = "test_url_param";
dynamic response = sg.client.subusers._(subuser_name).monitor.put(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -168,6 +177,8 @@ string data = @"{
'email': 'example@example.com',
'frequency': 50000
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var subuser_name = "test_url_param";
dynamic response = sg.client.subusers._(subuser_name).monitor.post(requestBody: data);
Console.WriteLine(response.StatusCode);
diff --git a/examples/suppression/suppression.cs b/examples/suppression/suppression.cs
index 4ce0623..821685a 100644
--- a/examples/suppression/suppression.cs
+++ b/examples/suppression/suppression.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -31,6 +32,8 @@ string data = @"{
'example2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.suppression.blocks.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -84,6 +87,8 @@ string data = @"{
'example2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.suppression.bounces.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -142,6 +147,8 @@ string data = @"{
'example2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.suppression.invalid_emails.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -219,6 +226,8 @@ string data = @"{
'example2@example.com'
]
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.suppression.spam_reports.delete(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
diff --git a/examples/templates/templates.cs b/examples/templates/templates.cs
index c3e7291..92c78cc 100644
--- a/examples/templates/templates.cs
+++ b/examples/templates/templates.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -11,6 +12,8 @@ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
string data = @"{
'name': 'example_name'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.templates.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -34,6 +37,8 @@ Console.ReadLine();
string data = @"{
'name': 'new_example_name'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var template_id = "test_url_param";
dynamic response = sg.client.templates._(template_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -75,6 +80,8 @@ string data = @"{
'subject': '<%subject%>',
'template_id': 'ddb96bbc-9b92-425e-8979-99464621b543'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var template_id = "test_url_param";
dynamic response = sg.client.templates._(template_id).versions.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -93,6 +100,8 @@ string data = @"{
'plain_content': '<%body%>',
'subject': '<%subject%>'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
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);
diff --git a/examples/trackingsettings/trackingsettings.cs b/examples/trackingsettings/trackingsettings.cs
index 73bb3b0..ff2398a 100644
--- a/examples/trackingsettings/trackingsettings.cs
+++ b/examples/trackingsettings/trackingsettings.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -25,6 +26,8 @@ Console.ReadLine();
string data = @"{
'enabled': true
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.tracking_settings.click.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -53,6 +56,8 @@ string data = @"{
'utm_source': 'sendgrid.com',
'utm_term': ''
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.tracking_settings.google_analytics.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -76,6 +81,8 @@ Console.ReadLine();
string data = @"{
'enabled': true
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.tracking_settings.open.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -104,6 +111,8 @@ string data = @"{
'replace': 'replacement tag',
'url': 'url'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.tracking_settings.subscription.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
diff --git a/examples/user/user.cs b/examples/user/user.cs
index 8fef557..37691dd 100644
--- a/examples/user/user.cs
+++ b/examples/user/user.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -31,6 +32,8 @@ Console.ReadLine();
string data = @"{
'email': 'example@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.email.put(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -55,6 +58,8 @@ string data = @"{
'new_password': 'new_password',
'old_password': 'old_password'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.password.put(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -70,6 +75,8 @@ string data = @"{
'first_name': 'Example',
'last_name': 'User'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.profile.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -94,6 +101,8 @@ string data = @"{
'batch_id': 'YOUR_BATCH_ID',
'status': 'pause'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.scheduled_sends.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -117,6 +126,8 @@ Console.ReadLine();
string data = @"{
'status': 'pause'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var batch_id = "test_url_param";
dynamic response = sg.client.user.scheduled_sends._(batch_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -154,6 +165,8 @@ string data = @"{
'require_tls': true,
'require_valid_cert': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.settings.enforced_tls.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -177,6 +190,8 @@ Console.ReadLine();
string data = @"{
'username': 'test_username'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.username.put(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -212,6 +227,8 @@ string data = @"{
'unsubscribe': true,
'url': 'url'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.webhooks._("_("event")").settings.patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -235,6 +252,8 @@ Console.ReadLine();
string data = @"{
'url': 'url'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.webhooks._("_("event")").test.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -251,6 +270,8 @@ string data = @"{
'spam_check': true,
'url': 'http://email.myhosthame.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.user.webhooks.parse.settings.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -276,6 +297,8 @@ string data = @"{
'spam_check': false,
'url': 'http://newdomain.com/parse'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var hostname = "test_url_param";
dynamic response = sg.client.user.webhooks.parse.settings._(hostname).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
diff --git a/examples/whitelabel/whitelabel.cs b/examples/whitelabel/whitelabel.cs
index 3f856e1..a0eb41e 100644
--- a/examples/whitelabel/whitelabel.cs
+++ b/examples/whitelabel/whitelabel.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -20,6 +21,8 @@ string data = @"{
'subdomain': 'news',
'username': 'john@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.whitelabel.domains.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -81,6 +84,8 @@ string data = @"{
'custom_spf': true,
'default': false
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var domain_id = "test_url_param";
dynamic response = sg.client.whitelabel.domains._(domain_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -117,6 +122,8 @@ Console.ReadLine();
string data = @"{
'username': 'jane@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var domain_id = "test_url_param";
dynamic response = sg.client.whitelabel.domains._(domain_id).subuser.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -131,6 +138,8 @@ Console.ReadLine();
string data = @"{
'ip': '192.168.0.1'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var id = "test_url_param";
dynamic response = sg.client.whitelabel.domains._(id).ips.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -170,6 +179,8 @@ string data = @"{
'ip': '192.168.1.1',
'subdomain': 'email'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.whitelabel.ips.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -233,6 +244,8 @@ string data = @"{
'domain': 'example.com',
'subdomain': 'mail'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
string queryParams = @"{
'limit': 1,
'offset': 1
@@ -302,6 +315,8 @@ Console.ReadLine();
string data = @"{
'default': true
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var id = "test_url_param";
dynamic response = sg.client.whitelabel.links._(id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -349,6 +364,8 @@ Console.ReadLine();
string data = @"{
'username': 'jane@example.com'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var link_id = "test_url_param";
dynamic response = sg.client.whitelabel.links._(link_id).subuser.post(requestBody: data);
Console.WriteLine(response.StatusCode);