summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElmer Thomas <elmer@thinkingserious.com>2016-12-06 03:00:28 -0800
committerElmer Thomas <elmer@thinkingserious.com>2016-12-06 03:00:28 -0800
commit4ce5b88f6047af9d9d4bc45a38c9dfb65a9e7e07 (patch)
tree60f9d17f011f632f5c4d9b86aa75fab0e7a60e41
parent3131327a73273df4485a26de5ad4ec645918f8b3 (diff)
downloadsendgrid-csharp-4ce5b88f6047af9d9d4bc45a38c9dfb65a9e7e07.zip
sendgrid-csharp-4ce5b88f6047af9d9d4bc45a38c9dfb65a9e7e07.tar.gz
sendgrid-csharp-4ce5b88f6047af9d9d4bc45a38c9dfb65a9e7e07.tar.bz2
.NET 4.5.X, 4.6.X and CORE Support
-rw-r--r--.gitignore345
-rw-r--r--ExampleNet45/App.config6
-rw-r--r--ExampleNet45/ExampleNet45.csproj (renamed from SendGrid/SendGrid/SendGrid.csproj)167
-rw-r--r--ExampleNet45/Program.cs131
-rw-r--r--ExampleNet45/Properties/AssemblyInfo.cs (renamed from SendGrid/Example/Properties/AssemblyInfo.cs)74
-rw-r--r--ExampleNet45/packages.config (renamed from SendGrid/Example/packages.config)6
-rw-r--r--SendGrid.sln58
-rw-r--r--SendGrid/.ci/tests.sh5
-rw-r--r--SendGrid/.nuget/NuGet.exebin1662976 -> 0 bytes
-rw-r--r--SendGrid/.nuget/NuGet.targets144
-rw-r--r--SendGrid/Example/Example.cs385
-rw-r--r--SendGrid/Example/Example.csproj90
-rw-r--r--SendGrid/Example/app.config26
-rw-r--r--SendGrid/SendGrid.sln83
-rw-r--r--SendGrid/SendGrid/App.config14
-rw-r--r--SendGrid/SendGrid/packages.config5
-rw-r--r--SendGrid/SendGrid/sendgrid-csharp.snkbin596 -> 0 bytes
-rw-r--r--SendGrid/UnitTest/app.config11
-rw-r--r--SendGrid/UnitTest/packages.config6
-rw-r--r--SendGrid/UnitTest/sendgrid-csharp.snkbin596 -> 0 bytes
-rw-r--r--UnitTest/Properties/AssemblyInfo.cs (renamed from SendGrid/UnitTest/Properties/AssemblyInfo.cs)18
-rw-r--r--UnitTest/UnitTest.cs (renamed from SendGrid/UnitTest/UnitTest.cs)7673
-rw-r--r--UnitTest/UnitTest.csproj (renamed from SendGrid/UnitTest/UnitTests.csproj)55
-rw-r--r--UnitTest/packages.config6
-rw-r--r--global.json6
-rw-r--r--nuspec/SendGrid.nuspec39
-rw-r--r--src/Example/ExampleCore.xproj21
-rw-r--r--src/Example/Program.cs131
-rw-r--r--src/Example/Properties/AssemblyInfo.cs19
-rw-r--r--src/Example/project.json26
-rw-r--r--src/SendGrid.nuspec39
-rw-r--r--src/SendGrid/Client.cs (renamed from SendGrid/SendGrid/Client.cs)8
-rw-r--r--src/SendGrid/Helpers/Mail/ASM.cs (renamed from SendGrid/SendGrid/Helpers/Mail/ASM.cs)26
-rw-r--r--src/SendGrid/Helpers/Mail/Attachment.cs (renamed from SendGrid/SendGrid/Helpers/Mail/Attachment.cs)42
-rw-r--r--src/SendGrid/Helpers/Mail/BCCSettings.cs (renamed from SendGrid/SendGrid/Helpers/Mail/BCCSettings.cs)24
-rw-r--r--src/SendGrid/Helpers/Mail/BypassListManagement.cs (renamed from SendGrid/SendGrid/Helpers/Mail/BypassListManagement.cs)10
-rw-r--r--src/SendGrid/Helpers/Mail/ClickTracking.cs (renamed from SendGrid/SendGrid/Helpers/Mail/ClickTracking.cs)24
-rw-r--r--src/SendGrid/Helpers/Mail/Content.cs (renamed from SendGrid/SendGrid/Helpers/Mail/Content.cs)44
-rw-r--r--src/SendGrid/Helpers/Mail/Email.cs (renamed from SendGrid/SendGrid/Helpers/Mail/Email.cs)44
-rw-r--r--src/SendGrid/Helpers/Mail/FooterSettings.cs (renamed from SendGrid/SendGrid/Helpers/Mail/FooterSettings.cs)10
-rw-r--r--src/SendGrid/Helpers/Mail/Ganalytics.cs (renamed from SendGrid/SendGrid/Helpers/Mail/Ganalytics.cs)48
-rw-r--r--src/SendGrid/Helpers/Mail/Mail.cs (renamed from SendGrid/SendGrid/Helpers/Mail/Mail.cs)304
-rw-r--r--src/SendGrid/Helpers/Mail/MailSettings.cs (renamed from SendGrid/SendGrid/Helpers/Mail/MailSettings.cs)10
-rw-r--r--src/SendGrid/Helpers/Mail/OpenTracking.cs (renamed from SendGrid/SendGrid/Helpers/Mail/OpenTracking.cs)24
-rw-r--r--src/SendGrid/Helpers/Mail/Personalization.cs (renamed from SendGrid/SendGrid/Helpers/Mail/Personalization.cs)158
-rw-r--r--src/SendGrid/Helpers/Mail/README.md (renamed from SendGrid/SendGrid/Helpers/Mail/README.md)0
-rw-r--r--src/SendGrid/Helpers/Mail/SandboxMode.cs (renamed from SendGrid/SendGrid/Helpers/Mail/SandboxMode.cs)18
-rw-r--r--src/SendGrid/Helpers/Mail/SpamCheck.cs (renamed from SendGrid/SendGrid/Helpers/Mail/SpamCheck.cs)30
-rw-r--r--src/SendGrid/Helpers/Mail/SubscriptionTracking.cs (renamed from SendGrid/SendGrid/Helpers/Mail/SubscriptionTracking.cs)10
-rw-r--r--src/SendGrid/Helpers/Mail/TrackingSettings.cs (renamed from SendGrid/SendGrid/Helpers/Mail/TrackingSettings.cs)36
-rw-r--r--src/SendGrid/Properties/AssemblyInfo.cs (renamed from SendGrid/SendGrid/Properties/AssemblyInfo.cs)21
-rw-r--r--src/SendGrid/SendGrid.xproj21
-rw-r--r--src/SendGrid/project.json46
53 files changed, 5161 insertions, 5386 deletions
diff --git a/.gitignore b/.gitignore
index bf1bcac..1ef2e15 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,23 +1,326 @@
-SendGrid/Example/bin/
-SendGrid/Example/obj/
-SendGrid/SendGrid.sln.DotSettings.user
-SendGrid/SendGrid/bin/
-SendGrid/SendGrid/obj/
-SendGrid/Tests/bin/
-SendGrid/Tests/obj/
-SendGrid/_ReSharper.SendGrid/
+# Created with the help of https://www.gitignore.io/api/visualstudio
+
+### VisualStudio ###
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
*.suo
-SendGrid/Example/bin/
-SendGrid/Example/obj/
-SendGrid/*/bin/
-SendGrid/*/obj/
-SendGrid/Tests/test-results/
-SendGrid/test-results/
-.DS_store
-SendGrid/SendGrid.userprefs
-SendGrid/packages/
-SendGrid/TestResult.xml
-SendGrid/SendGrid.sln.VisualState.xml
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
*.pfx
-*.PublicKey
-SendGrid/.vs/config/applicationhost.config \ No newline at end of file
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# WinMerge
+*.bak
+
+# Supercharger: http://supercharger.tools/
+*.scgdat
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake
+tools/
+
+### VisualStudio Patch ###
+build/
+
+
+# =========================
+# Operating System Files
+# =========================
+
+# ---------- OSX ----------
+
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Thumbnails
+._*
+
+# Files that might appear on external disk
+.Spotlight-V100
+.Trashes
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+# -------- Windows --------
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
diff --git a/ExampleNet45/App.config b/ExampleNet45/App.config
new file mode 100644
index 0000000..8227adb
--- /dev/null
+++ b/ExampleNet45/App.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
+ </startup>
+</configuration>
diff --git a/SendGrid/SendGrid/SendGrid.csproj b/ExampleNet45/ExampleNet45.csproj
index 0edef5d..35f6172 100644
--- a/SendGrid/SendGrid/SendGrid.csproj
+++ b/ExampleNet45/ExampleNet45.csproj
@@ -1,100 +1,69 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{1C318867-440B-4EB9-99E3-C0CC2C556962}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>SendGrid</RootNamespace>
- <AssemblyName>SendGrid</AssemblyName>
- <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
- <TargetFrameworkProfile />
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>none</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup>
- <StartupObject />
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
- <ItemGroup>
- <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="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
- <Private>True</Private>
- </Reference>
- <Reference Include="System.Web" />
- <Reference Include="System.Web.Extensions" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Client.cs" />
- <Compile Include="Helpers\Mail\ASM.cs" />
- <Compile Include="Helpers\Mail\Attachment.cs" />
- <Compile Include="Helpers\Mail\BCCSettings.cs" />
- <Compile Include="Helpers\Mail\BypassListManagement.cs" />
- <Compile Include="Helpers\Mail\ClickTracking.cs" />
- <Compile Include="Helpers\Mail\Content.cs" />
- <Compile Include="Helpers\Mail\Email.cs" />
- <Compile Include="Helpers\Mail\FooterSettings.cs" />
- <Compile Include="Helpers\Mail\Ganalytics.cs" />
- <Compile Include="Helpers\Mail\Mail.cs" />
- <Compile Include="Helpers\Mail\MailSettings.cs" />
- <Compile Include="Helpers\Mail\OpenTracking.cs" />
- <Compile Include="Helpers\Mail\Personalization.cs" />
- <Compile Include="Helpers\Mail\SandboxMode.cs" />
- <Compile Include="Helpers\Mail\SpamCheck.cs" />
- <Compile Include="Helpers\Mail\SubscriptionTracking.cs" />
- <Compile Include="Helpers\Mail\TrackingSettings.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <None Include="packages.config" />
- <None Include="sendgrid-csharp.snk" />
- </ItemGroup>
- <ItemGroup />
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{3B3F2699-F720-4498-8044-262EFE110A22}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ExampleNet45</RootNamespace>
+ <AssemblyName>ExampleNet45</AssemblyName>
+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <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">
+ <HintPath>..\src\SendGrid\bin\Debug\net452\SendGrid.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
</Project> \ No newline at end of file
diff --git a/ExampleNet45/Program.cs b/ExampleNet45/Program.cs
new file mode 100644
index 0000000..572ce7a
--- /dev/null
+++ b/ExampleNet45/Program.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+using SendGrid;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+namespace Example
+{
+ internal class Example
+ {
+ private static void Main()
+ {
+ Execute().Wait();
+ }
+
+ static async Task Execute()
+ {
+ string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
+ Client client = new Client(apiKey);
+
+ string data = @"{
+ 'personalizations': [
+ {
+ 'to': [
+ {
+ 'email': 'elmer@sendgrid.com'
+ }
+ ],
+ 'subject': 'Hello World from the SendGrid C# Library!'
+ }
+ ],
+ 'from': {
+ 'email': 'dx@sendgrid.com'
+ },
+ 'content': [
+ {
+ 'type': 'text/plain',
+ 'value': 'Hello, Email!'
+ }
+ ]
+ }";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ Response response = await client.RequestAsync(Client.Methods.POST,
+ json.ToString(),
+ urlPath: "mail/send");
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers);
+ Console.ReadLine();
+
+ Email from = new Email("dx@sendgrid");
+ string subject = "Hello World from the SendGrid CSharp Library Helper!";
+ Email to = new Email("elmer@sendgrid.com");
+ Content content = new Content("text/plain", "Hello, Email from the helper!");
+ Mail mail = new Mail(from, subject, to, content);
+
+ response = await client.RequestAsync(Client.Methods.POST,
+ mail.Get(),
+ urlPath: "mail/send");
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers);
+ Console.ReadLine();
+
+ // GET Collection
+ string queryParams = @"{
+ 'limit': 100
+ }";
+ response = await client.RequestAsync(method: Client.Methods.GET,
+ urlPath: "asm/groups",
+ queryParams: queryParams);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+ Console.WriteLine("\n\nPress any key to continue to POST.");
+ Console.ReadLine();
+
+ // POST
+ string requestBody = @"{
+ 'description': 'Suggestions for products our users might like.',
+ 'is_default': false,
+ 'name': 'Magic Products'
+ }";
+ json = JsonConvert.DeserializeObject<object>(requestBody);
+ response = await client.RequestAsync(method: Client.Methods.POST,
+ urlPath: "asm/groups",
+ requestBody: json.ToString());
+ var ds_response = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(response.Body.ReadAsStringAsync().Result);
+ string group_id = ds_response["id"].ToString();
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+ Console.WriteLine("\n\nPress any key to continue to GET single.");
+ Console.ReadLine();
+
+ // GET Single
+ response = await client.RequestAsync(method: Client.Methods.GET,
+ urlPath: string.Format("asm/groups/{0}", group_id));
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+ Console.WriteLine("\n\nPress any key to continue to PATCH.");
+ Console.ReadLine();
+
+ // PATCH
+ requestBody = @"{
+ 'name': 'Cool Magic Products'
+ }";
+ json = JsonConvert.DeserializeObject<object>(requestBody);
+
+ response = await client.RequestAsync(method: Client.Methods.PATCH,
+ urlPath: string.Format("asm/groups/{0}", group_id),
+ requestBody: json.ToString());
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to PUT.");
+ Console.ReadLine();
+
+ // DELETE
+ response = await client.RequestAsync(method: Client.Methods.DELETE,
+ urlPath: string.Format("asm/groups/{0}", group_id));
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Headers.ToString());
+ Console.WriteLine("\n\nPress any key to exit.");
+ Console.ReadLine();
+ }
+ }
+}
diff --git a/SendGrid/Example/Properties/AssemblyInfo.cs b/ExampleNet45/Properties/AssemblyInfo.cs
index 13b7c8a..3bde8af 100644
--- a/SendGrid/Example/Properties/AssemblyInfo.cs
+++ b/ExampleNet45/Properties/AssemblyInfo.cs
@@ -1,38 +1,36 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("Example")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Example")]
-[assembly: AssemblyCopyright("Copyright © SendGrid 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("4dec6d01-72a1-4243-904b-f906c58eb56f")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("9.0.0")]
-[assembly: AssemblyFileVersion("9.0.0")]
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ExampleNet45")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ExampleNet45")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3b3f2699-f720-4498-8044-262efe110a22")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/SendGrid/Example/packages.config b/ExampleNet45/packages.config
index 6576d88..9d64bf3 100644
--- a/SendGrid/Example/packages.config
+++ b/ExampleNet45/packages.config
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
</packages> \ No newline at end of file
diff --git a/SendGrid.sln b/SendGrid.sln
new file mode 100644
index 0000000..461573b
--- /dev/null
+++ b/SendGrid.sln
@@ -0,0 +1,58 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{71C09624-020B-410E-A8FE-1FD216A1FE31}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{33D9EC2F-B286-40BE-8148-E52A1D8A83E7}"
+ ProjectSection(SolutionItems) = preProject
+ global.json = global.json
+ EndProjectSection
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SendGrid", "src\SendGrid\SendGrid.xproj", "{377C20E4-2297-488F-933B-FB635C56D8FC}"
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ExampleCore", "src\Example\ExampleCore.xproj", "{4BD07A97-8AD2-4134-848E-6A74EB992050}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleNet45", "ExampleNet45\ExampleNet45.csproj", "{3B3F2699-F720-4498-8044-262EFE110A22}"
+ ProjectSection(ProjectDependencies) = postProject
+ {377C20E4-2297-488F-933B-FB635C56D8FC} = {377C20E4-2297-488F-933B-FB635C56D8FC}
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{D06BDAE9-BE83-448F-8AD4-3044BB187C11}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{084DCC9F-D8A3-4179-B966-5B1C72FFCA1F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {377C20E4-2297-488F-933B-FB635C56D8FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {377C20E4-2297-488F-933B-FB635C56D8FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {377C20E4-2297-488F-933B-FB635C56D8FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {377C20E4-2297-488F-933B-FB635C56D8FC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4BD07A97-8AD2-4134-848E-6A74EB992050}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4BD07A97-8AD2-4134-848E-6A74EB992050}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4BD07A97-8AD2-4134-848E-6A74EB992050}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4BD07A97-8AD2-4134-848E-6A74EB992050}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3B3F2699-F720-4498-8044-262EFE110A22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3B3F2699-F720-4498-8044-262EFE110A22}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3B3F2699-F720-4498-8044-262EFE110A22}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3B3F2699-F720-4498-8044-262EFE110A22}.Release|Any CPU.Build.0 = Release|Any CPU
+ {084DCC9F-D8A3-4179-B966-5B1C72FFCA1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {084DCC9F-D8A3-4179-B966-5B1C72FFCA1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {084DCC9F-D8A3-4179-B966-5B1C72FFCA1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {084DCC9F-D8A3-4179-B966-5B1C72FFCA1F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {377C20E4-2297-488F-933B-FB635C56D8FC} = {71C09624-020B-410E-A8FE-1FD216A1FE31}
+ {4BD07A97-8AD2-4134-848E-6A74EB992050} = {71C09624-020B-410E-A8FE-1FD216A1FE31}
+ {3B3F2699-F720-4498-8044-262EFE110A22} = {71C09624-020B-410E-A8FE-1FD216A1FE31}
+ {084DCC9F-D8A3-4179-B966-5B1C72FFCA1F} = {D06BDAE9-BE83-448F-8AD4-3044BB187C11}
+ EndGlobalSection
+EndGlobal
diff --git a/SendGrid/.ci/tests.sh b/SendGrid/.ci/tests.sh
deleted file mode 100644
index e109d30..0000000
--- a/SendGrid/.ci/tests.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh -x
-
-mono --runtime=v4.0 .nuget/NuGet.exe install NUnit.Runners -Version 2.6.1 -o packages
-mono --runtime=v4.0 packages/NUnit.Runners.2.6.1/tools/nunit-console.exe -noxml -nodots -labels -stoponerror Tests/bin/BuildNet45/Tests.dll
-exit $?
diff --git a/SendGrid/.nuget/NuGet.exe b/SendGrid/.nuget/NuGet.exe
deleted file mode 100644
index c41a0d0..0000000
--- a/SendGrid/.nuget/NuGet.exe
+++ /dev/null
Binary files differ
diff --git a/SendGrid/.nuget/NuGet.targets b/SendGrid/.nuget/NuGet.targets
deleted file mode 100644
index 7e7bb65..0000000
--- a/SendGrid/.nuget/NuGet.targets
+++ /dev/null
@@ -1,144 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
-
- <!-- Enable the restore command to run before builds -->
- <RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
-
- <!-- Property that enables building a package from a project -->
- <BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
-
- <!-- Determines if package restore consent is required to restore packages -->
- <RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
-
- <!-- Download NuGet.exe if it does not already exist -->
- <DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
- </PropertyGroup>
-
- <ItemGroup Condition=" '$(PackageSources)' == '' ">
- <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
- <!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
- <!--
- <PackageSource Include="https://www.nuget.org/api/v2/" />
- <PackageSource Include="https://my-nuget-source/nuget/" />
- -->
- </ItemGroup>
-
- <PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
- <!-- Windows specific commands -->
- <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
- <!-- We need to launch nuget.exe with the mono command if we're not on windows -->
- <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
- </PropertyGroup>
-
- <PropertyGroup>
- <PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
- <PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
- </PropertyGroup>
-
- <PropertyGroup>
- <PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
- <PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
- </PropertyGroup>
-
- <PropertyGroup>
- <!-- NuGet command -->
- <NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
- <PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
-
- <NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
- <NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
-
- <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir)</PackageOutputDir>
-
- <RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
- <NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
-
- <PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
- <PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
-
- <!-- Commands -->
- <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
- <BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
-
- <!-- We need to ensure packages are restored prior to assembly resolve -->
- <BuildDependsOn Condition="$(RestorePackages) == 'true'">
- RestorePackages;
- $(BuildDependsOn);
- </BuildDependsOn>
-
- <!-- Make the build depend on restore packages -->
- <BuildDependsOn Condition="$(BuildPackage) == 'true'">
- $(BuildDependsOn);
- BuildPackage;
- </BuildDependsOn>
- </PropertyGroup>
-
- <Target Name="CheckPrerequisites">
- <!-- Raise an error if we're unable to locate nuget.exe -->
- <Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
- <!--
- Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
- This effectively acts as a lock that makes sure that the download operation will only happen once and all
- parallel builds will have to wait for it to complete.
- -->
- <MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
- </Target>
-
- <Target Name="_DownloadNuGet">
- <DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
- </Target>
-
- <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
- <Exec Command="$(RestoreCommand)"
- Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
-
- <Exec Command="$(RestoreCommand)"
- LogStandardErrorAsError="true"
- Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
- </Target>
-
- <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
- <Exec Command="$(BuildCommand)"
- Condition=" '$(OS)' != 'Windows_NT' " />
-
- <Exec Command="$(BuildCommand)"
- LogStandardErrorAsError="true"
- Condition=" '$(OS)' == 'Windows_NT' " />
- </Target>
-
- <UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
- <ParameterGroup>
- <OutputFilename ParameterType="System.String" Required="true" />
- </ParameterGroup>
- <Task>
- <Reference Include="System.Core" />
- <Using Namespace="System" />
- <Using Namespace="System.IO" />
- <Using Namespace="System.Net" />
- <Using Namespace="Microsoft.Build.Framework" />
- <Using Namespace="Microsoft.Build.Utilities" />
- <Code Type="Fragment" Language="cs">
- <![CDATA[
- try {
- OutputFilename = Path.GetFullPath(OutputFilename);
-
- Log.LogMessage("Downloading latest version of NuGet.exe...");
- WebClient webClient = new WebClient();
- webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
-
- return true;
- }
- catch (Exception ex) {
- Log.LogErrorFromException(ex);
- return false;
- }
- ]]>
- </Code>
- </Task>
- </UsingTask>
-</Project>
diff --git a/SendGrid/Example/Example.cs b/SendGrid/Example/Example.cs
deleted file mode 100644
index 0f6c8a3..0000000
--- a/SendGrid/Example/Example.cs
+++ /dev/null
@@ -1,385 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Newtonsoft.Json;
-using SendGrid;
-using SendGrid.Helpers.Mail;
-
-namespace Example
-{
- internal class Example
- {
- private static void Main()
- {
- // v3 Mail Helper
- //HelloEmailAsync().Wait(); // this will actually send an email
- //KitchenSinkAsync().Wait(); // this will only send an email if you set SandBox Mode to false
-
- // v3 Template Example with Mail Helper
- //TemplateWithHelperAsync().Wait();
-
- // v3 Template Example without Mail Helper
- //TemplateWithoutHelperAsync().Wait();
-
- // v3 Web API
- ASMGroupsAsync().Wait();
- }
-
- private static async Task TemplateWithHelperAsync()
- {
- string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY",
- EnvironmentVariableTarget.User);
- Client client = new Client(apiKey: apiKey);
-
- Email from = new Email("test@example.com");
- string subject = "I'm replacing the subject tag";
- Email to = new Email("test@example.com");
- Content content = new Content("text/html", "I'm replacing the <strong>body tag</strong>");
- Mail mail = new Mail(from, subject, to, content);
-
- mail.TemplateId = "13b8f94f-bcae-4ec6-b752-70d6cb59f932";
- mail.Personalization[0].AddSubstitution("-name-", "Example User");
- mail.Personalization[0].AddSubstitution("-city-", "Denver");
-
- Response response = await client.RequestAsync(method: Client.Methods.POST,
- requestBody: mail.Get(),
- urlPath: "mail/send");
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Body.ReadAsStringAsync().Result);
- Console.WriteLine(response.Headers.ToString());
- Console.ReadLine();
- }
-
- private static async Task TemplateWithoutHelperAsync()
- {
- string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- Client client = new Client(apiKey);
-
- string data = @"{
- 'personalizations': [
- {
- 'to': [
- {
- 'email': 'test@example.com'
- }
- ],
- 'substitutions': {
- '-name-': 'Example User',
- '-city-': 'Denver'
- },
- 'subject': 'I\'m replacing the subject tag'
- }
- ],
- 'from': {
- 'email': 'test@example.com'
- },
- 'content': [
- {
- 'type': 'text/html',
- 'value': 'I\'m replacing the <strong>body tag</strong>'
- }
- ],
- 'template_id': '13b8f94f-bcae-4ec6-b752-70d6cb59f932'
- }";
- //test @example.com
- object json = JsonConvert.DeserializeObject<object>(data);
- Response response = await client.RequestAsync(method: Client.Methods.POST,
- requestBody: json.ToString(),
- urlPath: "mail/send");
-
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Body.ReadAsStringAsync().Result);
- Console.WriteLine(response.Headers.ToString());
- Console.ReadLine();
- }
-
- private static async Task HelloEmailAsync()
- {
- string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- Client client = new Client(apiKey);
-
- Email from = new Email("test@example.com");
- string subject = "Hello World from the SendGrid CSharp Library";
- Email to = new Email("test@example.com");
- Content content = new Content("text/plain", "Textual content");
- Mail mail = new Mail(from, subject, to, content);
- Email email = new Email("test2@example.com");
- mail.Personalization[0].AddTo(email);
-
- Response response = await client.RequestAsync(method: Client.Methods.POST,
- requestBody: mail.Get(),
- urlPath: "mail/send");
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Body.ReadAsStringAsync().Result);
- Console.WriteLine(response.Headers.ToString());
- Console.ReadLine();
- }
-
- private static async Task KitchenSinkAsync()
- {
- string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- Client client = new Client(apiKey);
-
- Mail mail = new Mail();
-
- Email email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- mail.From = email;
-
- mail.Subject = "Hello World from the SendGrid CSharp Library";
-
- Personalization personalization = new Personalization();
- email = new Email();
- email.Name = "Example User";
- email.Address = "test1@example.com";
- personalization.AddTo(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test2@example.com";
- personalization.AddCc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test3@example.com";
- personalization.AddCc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test4@example.com";
- personalization.AddBcc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test5@example.com";
- personalization.AddBcc(email);
- personalization.Subject = "Thank you for signing up, %name%";
- personalization.AddHeader("X-Test", "True");
- personalization.AddHeader("X-Mock", "True");
- personalization.AddSubstitution("%name%", "Example User");
- personalization.AddSubstitution("%city%", "Denver");
- personalization.AddCustomArgs("marketing", "false");
- personalization.AddCustomArgs("transactional", "true");
- personalization.SendAt = 1461775051;
- mail.AddPersonalization(personalization);
-
- personalization = new Personalization();
- email = new Email();
- email.Name = "Example User";
- email.Address = "test1@example.com";
- personalization.AddTo(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test2@example.com";
- personalization.AddCc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test3@example.com";
- personalization.AddCc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test4@example.com";
- personalization.AddBcc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test5@example.com";
- personalization.AddBcc(email);
- personalization.Subject = "Thank you for signing up, %name%";
- personalization.AddHeader("X-Test", "True");
- personalization.AddHeader("X-Mock", "True");
- personalization.AddSubstitution("%name%", "Example User");
- personalization.AddSubstitution("%city%", "Denver");
- personalization.AddCustomArgs("marketing", "false");
- personalization.AddCustomArgs("transactional", "true");
- personalization.SendAt = 1461775051;
- mail.AddPersonalization(personalization);
-
- Content content = new Content();
- content.Type = "text/plain";
- content.Value = "Textual content";
- mail.AddContent(content);
- content = new Content();
- content.Type = "text/html";
- content.Value = "<html><body>HTML content</body></html>";
- mail.AddContent(content);
- content = new Content();
- content.Type = "text/calendar";
- content.Value = "Party Time!!";
- mail.AddContent(content);
-
- Attachment attachment = new Attachment();
- attachment.Content = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12";
- attachment.Type = "application/pdf";
- attachment.Filename = "balance_001.pdf";
- attachment.Disposition = "attachment";
- attachment.ContentId = "Balance Sheet";
- mail.AddAttachment(attachment);
-
- attachment = new Attachment();
- attachment.Content = "BwdW";
- attachment.Type = "image/png";
- attachment.Filename = "banner.png";
- attachment.Disposition = "inline";
- attachment.ContentId = "Banner";
- mail.AddAttachment(attachment);
-
- mail.TemplateId = "13b8f94f-bcae-4ec6-b752-70d6cb59f932";
-
- mail.AddHeader("X-Day", "Monday");
- mail.AddHeader("X-Month", "January");
-
- mail.AddSection("%section1", "Substitution for Section 1 Tag");
- mail.AddSection("%section2", "Substitution for Section 2 Tag");
-
- mail.AddCategory("customer");
- mail.AddCategory("vip");
-
- mail.AddCustomArgs("campaign", "welcome");
- mail.AddCustomArgs("sequence", "2");
-
- ASM asm = new ASM();
- asm.GroupId = 3;
- List<int> groups_to_display = new List<int>()
- {
- 1, 4, 5
- };
- asm.GroupsToDisplay = groups_to_display;
- mail.Asm = asm;
-
- mail.SendAt = 1461775051;
-
- mail.SetIpPoolId = "23";
-
- // This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)
- // mail.BatchId = "some_batch_id";
-
- MailSettings mailSettings = new MailSettings();
- BCCSettings bccSettings = new BCCSettings();
- bccSettings.Enable = true;
- bccSettings.Email = "test@example.com";
- mailSettings.BccSettings = bccSettings;
- BypassListManagement bypassListManagement = new BypassListManagement();
- bypassListManagement.Enable = true;
- mailSettings.BypassListManagement = bypassListManagement;
- FooterSettings footerSettings = new FooterSettings();
- footerSettings.Enable = true;
- footerSettings.Text = "Some Footer Text";
- footerSettings.Html = "<bold>Some HTML Here</bold>";
- mailSettings.FooterSettings = footerSettings;
- SandboxMode sandboxMode = new SandboxMode();
- sandboxMode.Enable = true;
- mailSettings.SandboxMode = sandboxMode;
- SpamCheck spamCheck = new SpamCheck();
- spamCheck.Enable = true;
- spamCheck.Threshold = 1;
- spamCheck.PostToUrl = "https://gotchya.example.com";
- mailSettings.SpamCheck = spamCheck;
- mail.MailSettings = mailSettings;
-
- TrackingSettings trackingSettings = new TrackingSettings();
- ClickTracking clickTracking = new ClickTracking();
- clickTracking.Enable = true;
- clickTracking.EnableText = false;
- trackingSettings.ClickTracking = clickTracking;
- OpenTracking openTracking = new OpenTracking();
- openTracking.Enable = true;
- openTracking.SubstitutionTag = "Optional tag to replace with the open image in the body of the message";
- trackingSettings.OpenTracking = openTracking;
- SubscriptionTracking subscriptionTracking = new SubscriptionTracking();
- subscriptionTracking.Enable = true;
- subscriptionTracking.Text = "text to insert into the text/plain portion of the message";
- subscriptionTracking.Html = "<bold>HTML to insert into the text/html portion of the message</bold>";
- subscriptionTracking.SubstitutionTag = "text to insert into the text/plain portion of the message";
- trackingSettings.SubscriptionTracking = subscriptionTracking;
- Ganalytics ganalytics = new Ganalytics();
- ganalytics.Enable = true;
- ganalytics.UtmCampaign = "some campaign";
- ganalytics.UtmContent = "some content";
- ganalytics.UtmMedium = "some medium";
- ganalytics.UtmSource = "some source";
- ganalytics.UtmTerm = "some term";
- trackingSettings.Ganalytics = ganalytics;
- mail.TrackingSettings = trackingSettings;
-
- email = new Email();
- email.Address = "test@example.com";
- mail.ReplyTo = email;
-
- Response response = await client.RequestAsync(method: Client.Methods.POST,
- requestBody: mail.Get(),
- urlPath: "mail/send");
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Body.ReadAsStringAsync().Result);
- Console.WriteLine(response.Headers.ToString());
- Console.ReadLine();
- }
-
- private static async Task ASMGroupsAsync()
- {
- string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- Client client = new Client(apiKey);
-
- // GET Collection
- string queryParams = @"{
- 'limit': 100
- }";
- Response response = await client.RequestAsync(method: Client.Methods.GET,
- urlPath: "asm/groups",
- queryParams: queryParams);
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Body.ReadAsStringAsync().Result);
- Console.WriteLine(response.Headers.ToString());
- Console.WriteLine("\n\nPress any key to continue to POST.");
- Console.ReadLine();
-
- // POST
- string requestBody = @"{
- 'description': 'Suggestions for products our users might like.',
- 'is_default': false,
- 'name': 'Magic Products'
- }";
- object json = JsonConvert.DeserializeObject<object>(requestBody);
- response = await client.RequestAsync(method: Client.Methods.POST,
- urlPath: "asm/groups",
- requestBody: json.ToString());
- var ds_response = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(response.Body.ReadAsStringAsync().Result);
- string group_id = ds_response["id"].ToString();
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Body.ReadAsStringAsync().Result);
- Console.WriteLine(response.Headers.ToString());
- Console.WriteLine("\n\nPress any key to continue to GET single.");
- Console.ReadLine();
-
- // GET Single
- response = await client.RequestAsync(method: Client.Methods.GET,
- urlPath: string.Format("asm/groups/{0}", group_id));
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Body.ReadAsStringAsync().Result);
- Console.WriteLine(response.Headers.ToString());
- Console.WriteLine("\n\nPress any key to continue to PATCH.");
- Console.ReadLine();
-
- // PATCH
- requestBody = @"{
- 'name': 'Cool Magic Products'
- }";
- json = JsonConvert.DeserializeObject<object>(requestBody);
-
- response = await client.RequestAsync(method: Client.Methods.PATCH,
- urlPath: string.Format("asm/groups/{0}", group_id),
- requestBody: json.ToString());
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Body.ReadAsStringAsync().Result);
- Console.WriteLine(response.Headers.ToString());
-
- Console.WriteLine("\n\nPress any key to continue to PUT.");
- Console.ReadLine();
-
- // DELETE
- response = await client.RequestAsync(method: Client.Methods.DELETE,
- urlPath: string.Format("asm/groups/{0}", group_id));
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Headers.ToString());
- Console.WriteLine("\n\nPress any key to exit.");
- Console.ReadLine();
-
- }
- }
-}
diff --git a/SendGrid/Example/Example.csproj b/SendGrid/Example/Example.csproj
deleted file mode 100644
index a10f143..0000000
--- a/SendGrid/Example/Example.csproj
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition="'$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition="'$(Platform)' == '' ">x86</Platform>
- <ProjectGuid>{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Example</RootNamespace>
- <AssemblyName>Example</AssemblyName>
- <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
- <TargetFrameworkProfile>
- </TargetFrameworkProfile>
- <FileAlignment>512</FileAlignment>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- <RestorePackages>true</RestorePackages>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
- <PlatformTarget>x86</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)' == 'Release'">
- <PlatformTarget>x86</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)' == 'BuildNet45'">
- <OutputPath>bin\BuildNet45\</OutputPath>
- <WarningLevel>4</WarningLevel>
- <Optimize>false</Optimize>
- <Prefer32Bit>false</Prefer32Bit>
- <DefineConstants>
- </DefineConstants>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.CSharp" />
- <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="System" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="System.Net" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Web.Extensions" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Example.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config">
- <SubType>Designer</SubType>
- </None>
- <None Include="packages.config">
- <SubType>Designer</SubType>
- </None>
- </ItemGroup>
- <ItemGroup>
- <WCFMetadata Include="Service References\" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\SendGrid\SendGrid.csproj">
- <Project>{1c318867-440b-4eb9-99e3-c0cc2c556962}</Project>
- <Name>SendGrid</Name>
- <Aliases>global</Aliases>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file
diff --git a/SendGrid/Example/app.config b/SendGrid/Example/app.config
deleted file mode 100644
index ac5a484..0000000
--- a/SendGrid/Example/app.config
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
- <startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
- </startup>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.2.18.0" newVersion="2.2.18.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
-</configuration>
diff --git a/SendGrid/SendGrid.sln b/SendGrid/SendGrid.sln
deleted file mode 100644
index c80cffb..0000000
--- a/SendGrid/SendGrid.sln
+++ /dev/null
@@ -1,83 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.23107.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example", "Example\Example.csproj", "{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{DAC6CBA4-41D4-490D-B9BE-A8E3AB2E8A96}"
- ProjectSection(SolutionItems) = preProject
- .nuget\NuGet.exe = .nuget\NuGet.exe
- .nuget\NuGet.targets = .nuget\NuGet.targets
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendGrid", "SendGrid\SendGrid.csproj", "{1C318867-440B-4EB9-99E3-C0CC2C556962}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTest\UnitTests.csproj", "{8A66032B-0D1C-4F24-B0E3-A250F31D09D8}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- BuildNet45|Any CPU = BuildNet45|Any CPU
- BuildNet45|Mixed Platforms = BuildNet45|Mixed Platforms
- BuildNet45|x86 = BuildNet45|x86
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|Any CPU.ActiveCfg = BuildNet45|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|Mixed Platforms.ActiveCfg = Release|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|x86.ActiveCfg = BuildNet45|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Debug|Mixed Platforms.ActiveCfg = Release|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|x86.ActiveCfg = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.BuildNet45|Any CPU.ActiveCfg = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.BuildNet45|Any CPU.Build.0 = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.BuildNet45|Mixed Platforms.ActiveCfg = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.BuildNet45|Mixed Platforms.Build.0 = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.BuildNet45|x86.ActiveCfg = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.BuildNet45|x86.Build.0 = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Debug|Mixed Platforms.ActiveCfg = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Debug|Mixed Platforms.Build.0 = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Debug|x86.Build.0 = Debug|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Release|Any CPU.Build.0 = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Release|x86.ActiveCfg = Release|Any CPU
- {1C318867-440B-4EB9-99E3-C0CC2C556962}.Release|x86.Build.0 = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|Any CPU.ActiveCfg = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|Any CPU.Build.0 = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|Mixed Platforms.Build.0 = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|x86.ActiveCfg = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|x86.Build.0 = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|Mixed Platforms.Build.0 = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|x86.ActiveCfg = Debug|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|x86.Build.0 = Debug|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|Any CPU.Build.0 = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|x86.ActiveCfg = Release|Any CPU
- {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|x86.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = Tests\Tests.csproj
- EndGlobalSection
-EndGlobal
diff --git a/SendGrid/SendGrid/App.config b/SendGrid/SendGrid/App.config
deleted file mode 100644
index b77fa40..0000000
--- a/SendGrid/SendGrid/App.config
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
- <startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
- </startup>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
-</configuration>
diff --git a/SendGrid/SendGrid/packages.config b/SendGrid/SendGrid/packages.config
deleted file mode 100644
index d0f35fb..0000000
--- a/SendGrid/SendGrid/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
- <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
-</packages> \ No newline at end of file
diff --git a/SendGrid/SendGrid/sendgrid-csharp.snk b/SendGrid/SendGrid/sendgrid-csharp.snk
deleted file mode 100644
index aff2944..0000000
--- a/SendGrid/SendGrid/sendgrid-csharp.snk
+++ /dev/null
Binary files differ
diff --git a/SendGrid/UnitTest/app.config b/SendGrid/UnitTest/app.config
deleted file mode 100644
index 0a0c8e6..0000000
--- a/SendGrid/UnitTest/app.config
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
-<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>
diff --git a/SendGrid/UnitTest/packages.config b/SendGrid/UnitTest/packages.config
deleted file mode 100644
index 155a8dd..0000000
--- a/SendGrid/UnitTest/packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
- <package id="NUnit" version="2.6.4" targetFramework="net452" />
- <package id="NUnitTestAdapter" version="2.0.0" targetFramework="net452" />
-</packages> \ No newline at end of file
diff --git a/SendGrid/UnitTest/sendgrid-csharp.snk b/SendGrid/UnitTest/sendgrid-csharp.snk
deleted file mode 100644
index aff2944..0000000
--- a/SendGrid/UnitTest/sendgrid-csharp.snk
+++ /dev/null
Binary files differ
diff --git a/SendGrid/UnitTest/Properties/AssemblyInfo.cs b/UnitTest/Properties/AssemblyInfo.cs
index 211a7d5..90ad072 100644
--- a/SendGrid/UnitTest/Properties/AssemblyInfo.cs
+++ b/UnitTest/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UnitTest")]
@@ -10,27 +10,27 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTest")]
-[assembly: AssemblyCopyright("Copyright © SendGrid 2016")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("8a66032b-0d1c-4f24-b0e3-a250f31d09d8")]
+[assembly: Guid("084dcc9f-d8a3-4179-b966-5b1c72ffca1f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("9.0.0")]
-[assembly: AssemblyFileVersion("9.0.0")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/SendGrid/UnitTest/UnitTest.cs b/UnitTest/UnitTest.cs
index 3bc1da4..7ad0a11 100644
--- a/SendGrid/UnitTest/UnitTest.cs
+++ b/UnitTest/UnitTest.cs
@@ -1,3951 +1,3722 @@
-using System;
-using NUnit.Framework;
-using SendGrid;
-using SendGrid.Helpers.Mail;
-using System.Collections.Generic;
-using System.Net;
-using Newtonsoft.Json;
-using System.Diagnostics;
-
-namespace UnitTest
-{
-
- [TestFixture]
- public class UnitTests
- {
- static string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
- static string host = "http://localhost:4010";
- Process process = new Process();
-
- [TestFixtureSetUp]
- public void Init()
- {
- if (Environment.GetEnvironmentVariable("TRAVIS") != "true")
- {
- Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
- Trace.WriteLine("Starting Prism (~20 seconds)");
-
- ProcessStartInfo startInfo = new ProcessStartInfo();
- startInfo.WindowStyle = ProcessWindowStyle.Hidden;
- startInfo.FileName = "prism.exe";
- startInfo.Arguments = "run -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json";
- process.StartInfo = startInfo;
- process.Start();
- System.Threading.Thread.Sleep(15000);
- }
- else
- {
- System.Threading.Thread.Sleep(15000);
- }
- }
-
- // Base case for sending an email
- [Test]
- public void TestHelloEmail()
- {
- Mail mail = new Mail();
-
- Email email = new Email();
- email.Address = "test@example.com";
- mail.From = email;
-
- Personalization personalization = new Personalization();
- email = new Email();
- email.Address = "test@example.com";
- personalization.AddTo(email);
- mail.AddPersonalization(personalization);
-
- mail.Subject = "Hello World from the SendGrid CSharp Library";
-
- Content content = new Content();
- content.Type = "text/plain";
- content.Value = "Textual content";
- mail.AddContent(content);
- content = new Content();
- content.Type = "text/html";
- content.Value = "<html><body>HTML content</body></html>";
- mail.AddContent(content);
-
- String ret = mail.Get();
- String final = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ret),
- Formatting.None,
- new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore });
- Assert.AreEqual(final, "{\"from\":{\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"email\":\"test@example.com\"}]}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"}]}");
- }
-
- // All paramaters available for sending an email
- [Test]
- public void TestKitchenSink()
- {
- Mail mail = new Mail();
-
- Email email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- mail.From = email;
-
- mail.Subject = "Hello World from the SendGrid CSharp Library";
-
- Personalization personalization = new Personalization();
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddTo(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddCc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddCc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddBcc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddBcc(email);
- personalization.Subject = "Thank you for signing up, %name%";
- personalization.AddHeader("X-Test", "True");
- personalization.AddHeader("X-Mock", "True");
- personalization.AddSubstitution("%name%", "Example User");
- personalization.AddSubstitution("%city%", "Denver");
- personalization.AddCustomArgs("marketing", "false");
- personalization.AddCustomArgs("transactional", "true");
- personalization.SendAt = 1461775051;
- mail.AddPersonalization(personalization);
-
- personalization = new Personalization();
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddTo(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddCc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddCc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddBcc(email);
- email = new Email();
- email.Name = "Example User";
- email.Address = "test@example.com";
- personalization.AddBcc(email);
- personalization.Subject = "Thank you for signing up, %name%";
- personalization.AddHeader("X-Test", "True");
- personalization.AddHeader("X-Mock", "True");
- personalization.AddSubstitution("%name%", "Example User");
- personalization.AddSubstitution("%city%", "Denver");
- personalization.AddCustomArgs("marketing", "false");
- personalization.AddCustomArgs("transactional", "true");
- personalization.SendAt = 1461775051;
- mail.AddPersonalization(personalization);
-
- Content content = new Content();
- content.Type = "text/plain";
- content.Value = "Textual content";
- mail.AddContent(content);
- content = new Content();
- content.Type = "text/html";
- content.Value = "<html><body>HTML content</body></html>";
- mail.AddContent(content);
- content = new Content();
- content.Type = "text/calendar";
- content.Value = "Party Time!!";
- mail.AddContent(content);
-
- Attachment attachment = new Attachment();
- attachment.Content = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12";
- attachment.Type = "application/pdf";
- attachment.Filename = "balance_001.pdf";
- attachment.Disposition = "attachment";
- attachment.ContentId = "Balance Sheet";
- mail.AddAttachment(attachment);
-
- attachment = new Attachment();
- attachment.Content = "BwdW";
- attachment.Type = "image/png";
- attachment.Filename = "banner.png";
- attachment.Disposition = "inline";
- attachment.ContentId = "Banner";
- mail.AddAttachment(attachment);
-
- mail.TemplateId = "13b8f94f-bcae-4ec6-b752-70d6cb59f932";
-
- mail.AddHeader("X-Day", "Monday");
- mail.AddHeader("X-Month", "January");
-
- mail.AddSection("%section1", "Substitution for Section 1 Tag");
- mail.AddSection("%section2", "Substitution for Section 2 Tag");
-
- mail.AddCategory("customer");
- mail.AddCategory("vip");
-
- mail.AddCustomArgs("campaign", "welcome");
- mail.AddCustomArgs("sequence", "2");
-
- ASM asm = new ASM();
- asm.GroupId = 3;
- List<int> groups_to_display = new List<int>()
- {
- 1, 4, 5
- };
- asm.GroupsToDisplay = groups_to_display;
- mail.Asm = asm;
-
- mail.SendAt = 1461775051;
-
- mail.SetIpPoolId = "23";
-
- // This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)
- // mail.BatchId = "some_batch_id";
-
- MailSettings mailSettings = new MailSettings();
- BCCSettings bccSettings = new BCCSettings();
- bccSettings.Enable = true;
- bccSettings.Email = "test@example.com";
- mailSettings.BccSettings = bccSettings;
- BypassListManagement bypassListManagement = new BypassListManagement();
- bypassListManagement.Enable = true;
- mailSettings.BypassListManagement = bypassListManagement;
- FooterSettings footerSettings = new FooterSettings();
- footerSettings.Enable = true;
- footerSettings.Text = "Some Footer Text";
- footerSettings.Html = "<bold>Some HTML Here</bold>";
- mailSettings.FooterSettings = footerSettings;
- SandboxMode sandboxMode = new SandboxMode();
- sandboxMode.Enable = true;
- mailSettings.SandboxMode = sandboxMode;
- SpamCheck spamCheck = new SpamCheck();
- spamCheck.Enable = true;
- spamCheck.Threshold = 1;
- spamCheck.PostToUrl = "https://gotchya.example.com";
- mailSettings.SpamCheck = spamCheck;
- mail.MailSettings = mailSettings;
-
- TrackingSettings trackingSettings = new TrackingSettings();
- ClickTracking clickTracking = new ClickTracking();
- clickTracking.Enable = true;
- clickTracking.EnableText = false;
- trackingSettings.ClickTracking = clickTracking;
- OpenTracking openTracking = new OpenTracking();
- openTracking.Enable = true;
- openTracking.SubstitutionTag = "Optional tag to replace with the open image in the body of the message";
- trackingSettings.OpenTracking = openTracking;
- SubscriptionTracking subscriptionTracking = new SubscriptionTracking();
- subscriptionTracking.Enable = true;
- subscriptionTracking.Text = "text to insert into the text/plain portion of the message";
- subscriptionTracking.Html = "<bold>HTML to insert into the text/html portion of the message</bold>";
- subscriptionTracking.SubstitutionTag = "text to insert into the text/plain portion of the message";
- trackingSettings.SubscriptionTracking = subscriptionTracking;
- Ganalytics ganalytics = new Ganalytics();
- ganalytics.Enable = true;
- ganalytics.UtmCampaign = "some campaign";
- ganalytics.UtmContent = "some content";
- ganalytics.UtmMedium = "some medium";
- ganalytics.UtmSource = "some source";
- ganalytics.UtmTerm = "some term";
- trackingSettings.Ganalytics = ganalytics;
- mail.TrackingSettings = trackingSettings;
-
- email = new Email();
- email.Address = "test@example.com";
- mail.ReplyTo = email;
-
- String ret = mail.Get();
- String final = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ret),
- Formatting.None,
- new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore });
- Assert.AreEqual(final, "{\"from\":{\"name\":\"Example User\",\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"},{\"type\":\"text/calendar\",\"value\":\"Party Time!!\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"headers\":{\"X-Day\":\"Monday\",\"X-Month\":\"January\"},\"sections\":{\"%section1\":\"Substitution for Section 1 Tag\",\"%section2\":\"Substitution for Section 2 Tag\"},\"categories\":[\"customer\",\"vip\"],\"custom_args\":{\"campaign\":\"welcome\",\"sequence\":\"2\"},\"send_at\":1461775051,\"asm\":{\"group_id\":3,\"groups_to_display\":[1,4,5]},\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"test@example.com\"},\"bypass_list_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Some Footer Text\",\"html\":\"<bold>Some HTML Here</bold>\"},\"sandbox_mode\":{\"enable\":true},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://gotchya.example.com\"}},\"tracking_settings\":{\"click_tracking\":{\"enable\":true,\"enable_text\":false},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<bold>HTML to insert into the text/html portion of the message</bold>\",\"substitution_tag\":\"text to insert into the text/plain portion of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_medium\":\"some medium\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_campaign\":\"some campaign\"}},\"reply_to\":{\"email\":\"test@example.com\"}}");
- }
-
- [Test]
- public async void test_access_settings_activity_get()
- {
- string queryParams = @"{
- 'limit': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/activity", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_access_settings_whitelist_post()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "access_settings/whitelist", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_access_settings_whitelist_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_access_settings_whitelist_delete()
- {
- string data = @"{
- 'ids': [
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_access_settings_whitelist__rule_id__get()
- {
- var rule_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist/" + rule_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_access_settings_whitelist__rule_id__delete()
- {
- var rule_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist/" + rule_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_alerts_post()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "alerts", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_alerts_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "alerts", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_alerts__alert_id__patch()
- {
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "alerts/" + alert_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_alerts__alert_id__get()
- {
- var alert_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "alerts/" + alert_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_alerts__alert_id__delete()
- {
- var alert_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "alerts/" + alert_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_api_keys_post()
- {
- string data = @"{
- 'name': 'My API Key',
- 'sample': 'data',
- 'scopes': [
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "api_keys", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_api_keys_get()
- {
- string queryParams = @"{
- 'limit': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_api_keys__api_key_id__put()
- {
- string data = @"{
- 'name': 'A New Hope',
- 'scopes': [
- '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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "api_keys/" + api_key_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_api_keys__api_key_id__patch()
- {
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "api_keys/" + api_key_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_api_keys__api_key_id__get()
- {
- var api_key_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys/" + api_key_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_api_keys__api_key_id__delete()
- {
- var api_key_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "api_keys/" + api_key_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_asm_groups_post()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_asm_groups_get()
- {
- string queryParams = @"{
- 'id': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_asm_groups__group_id__patch()
- {
- string data = @"{
- '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();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "asm/groups/" + group_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_asm_groups__group_id__get()
- {
- var group_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups/" + group_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_asm_groups__group_id__delete()
- {
- var group_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/groups/" + group_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_asm_groups__group_id__suppressions_post()
- {
- string data = @"{
- 'recipient_emails': [
- '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();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups/" + group_id + "/suppressions", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_asm_groups__group_id__suppressions_get()
- {
- var group_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups/" + group_id + "/suppressions", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_asm_groups__group_id__suppressions_search_post()
- {
- string data = @"{
- 'recipient_emails': [
- '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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups/" + group_id + "/suppressions/search", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_asm_groups__group_id__suppressions__email__delete()
- {
- var group_id = "test_url_param";
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/groups/" + group_id + "/suppressions/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_asm_suppressions_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_asm_suppressions_global_post()
- {
- string data = @"{
- 'recipient_emails': [
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/suppressions/global", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_asm_suppressions_global__email__get()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions/global/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_asm_suppressions_global__email__delete()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/suppressions/global/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_asm_suppressions__email__get()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_browsers_stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'browsers': 'test_string',
- 'end_date': '2016-04-01',
- 'limit': 'test_string',
- 'offset': 'test_string',
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "browsers/stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_campaigns_post()
- {
- string data = @"{
- 'categories': [
- 'spring line'
- ],
- 'custom_unsubscribe_url': '',
- 'html_content': '<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>',
- 'ip_pool': 'marketing',
- 'list_ids': [
- 110,
- 124
- ],
- 'plain_content': 'Check out our spring line!',
- 'segment_ids': [
- 110
- ],
- 'sender_id': 124451,
- 'subject': 'New Products for Spring!',
- 'suppression_group_id': 42,
- 'title': 'March Newsletter'
-}";
- Object json = JsonConvert.DeserializeObject<Object>(data);
- data = json.ToString();
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_campaigns_get()
- {
- string queryParams = @"{
- 'limit': 1,
- 'offset': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_campaigns__campaign_id__patch()
- {
- string data = @"{
- 'categories': [
- 'summer line'
- ],
- 'html_content': '<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>',
- 'plain_content': 'Check out our summer line!',
- 'subject': 'New Products for Summer!',
- 'title': 'May Newsletter'
-}";
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "campaigns/" + campaign_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_campaigns__campaign_id__get()
- {
- var campaign_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns/" + campaign_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_campaigns__campaign_id__delete()
- {
- var campaign_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "campaigns/" + campaign_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_campaigns__campaign_id__schedules_patch()
- {
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "campaigns/" + campaign_id + "/schedules", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_campaigns__campaign_id__schedules_post()
- {
- 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();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_campaigns__campaign_id__schedules_get()
- {
- var campaign_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns/" + campaign_id + "/schedules", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_campaigns__campaign_id__schedules_delete()
- {
- var campaign_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "campaigns/" + campaign_id + "/schedules", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_campaigns__campaign_id__schedules_now_post()
- {
- var campaign_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules/now", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_campaigns__campaign_id__schedules_test_post()
- {
- 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();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules/test", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_categories_get()
- {
- string queryParams = @"{
- 'category': 'test_string',
- 'limit': 1,
- 'offset': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "categories", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_categories_stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'categories': 'test_string',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "categories/stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async 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',
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "categories/stats/sums", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_clients_stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "clients/stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_clients__client_type__stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'start_date': '2016-01-01'
-}";
- var client_type = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "clients/" + client_type + "/stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_custom_fields_post()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/custom_fields", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_contactdb_custom_fields_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/custom_fields", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_custom_fields__custom_field_id__get()
- {
- var custom_field_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/custom_fields/" + custom_field_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_custom_fields__custom_field_id__delete()
- {
- var custom_field_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "202");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/custom_fields/" + custom_field_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Accepted);
- }
-
- [Test]
- public async void test_contactdb_lists_post()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_contactdb_lists_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_lists_delete()
- {
- string data = @"[
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_contactdb_lists__list_id__patch()
- {
- string data = @"{
- 'name': 'newlistname'
-}";
- Object json = JsonConvert.DeserializeObject<Object>(data);
- data = json.ToString();
- string queryParams = @"{
- 'list_id': 1
-}";
- var list_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/lists/" + list_id, requestBody: data, queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_lists__list_id__get()
- {
- string queryParams = @"{
- 'list_id': 1
-}";
- var list_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists/" + list_id, queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_lists__list_id__delete()
- {
- string queryParams = @"{
- 'delete_contacts': 'true'
-}";
- var list_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "202");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists/" + list_id, queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Accepted);
- }
-
- [Test]
- public async void test_contactdb_lists__list_id__recipients_post()
- {
- string data = @"[
- '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();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists/" + list_id + "/recipients", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_contactdb_lists__list_id__recipients_get()
- {
- string queryParams = @"{
- 'list_id': 1,
- 'page': 1,
- 'page_size': 1
-}";
- var list_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists/" + list_id + "/recipients", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_lists__list_id__recipients__recipient_id__post()
- {
- var list_id = "test_url_param";
- var recipient_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists/" + list_id + "/recipients/" + recipient_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_contactdb_lists__list_id__recipients__recipient_id__delete()
- {
- string queryParams = @"{
- 'list_id': 1,
- 'recipient_id': 1
-}";
- var list_id = "test_url_param";
- var recipient_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists/" + list_id + "/recipients/" + recipient_id, queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_contactdb_recipients_patch()
- {
- string data = @"[
- {
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/recipients", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_contactdb_recipients_post()
- {
- string data = @"[
- {
- 'age': 25,
- 'email': 'example@example.com',
- 'first_name': '',
- 'last_name': 'User'
- },
- {
- 'age': 25,
- 'email': 'example2@example.com',
- 'first_name': 'Example',
- 'last_name': 'User'
- }
-]";
- Object json = JsonConvert.DeserializeObject<Object>(data);
- data = json.ToString();
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/recipients", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_contactdb_recipients_get()
- {
- string queryParams = @"{
- 'page': 1,
- 'page_size': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_recipients_delete()
- {
- string data = @"[
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/recipients", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_recipients_billable_count_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/billable_count", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_recipients_count_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/count", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_recipients_search_get()
- {
- string queryParams = @"{
- '{field_name}': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/search", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_recipients__recipient_id__get()
- {
- var recipient_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/" + recipient_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_recipients__recipient_id__delete()
- {
- var recipient_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/recipients/" + recipient_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_contactdb_recipients__recipient_id__lists_get()
- {
- var recipient_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/" + recipient_id + "/lists", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_reserved_fields_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/reserved_fields", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_segments_post()
- {
- string data = @"{
- 'conditions': [
- {
- 'and_or': '',
- 'field': 'last_name',
- 'operator': 'eq',
- 'value': 'Miller'
- },
- {
- 'and_or': 'and',
- 'field': 'last_clicked',
- 'operator': 'gt',
- 'value': '01/02/2015'
- },
- {
- 'and_or': 'or',
- 'field': 'clicks.campaign_identifier',
- 'operator': 'eq',
- 'value': '513'
- }
- ],
- 'list_id': 4,
- 'name': 'Last Name Miller'
-}";
- Object json = JsonConvert.DeserializeObject<Object>(data);
- data = json.ToString();
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/segments", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_segments_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_segments__segment_id__patch()
- {
- string data = @"{
- 'conditions': [
- {
- 'and_or': '',
- 'field': 'last_name',
- 'operator': 'eq',
- 'value': 'Miller'
- }
- ],
- 'list_id': 5,
- 'name': 'The Millers'
-}";
- Object json = JsonConvert.DeserializeObject<Object>(data);
- data = json.ToString();
- string queryParams = @"{
- 'segment_id': 'test_string'
-}";
- var segment_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/segments/" + segment_id, requestBody: data, queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_segments__segment_id__get()
- {
- string queryParams = @"{
- 'segment_id': 1
-}";
- var segment_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments/" + segment_id, queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_contactdb_segments__segment_id__delete()
- {
- string queryParams = @"{
- 'delete_contacts': 'true'
-}";
- var segment_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/segments/" + segment_id, queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_contactdb_segments__segment_id__recipients_get()
- {
- string queryParams = @"{
- 'page': 1,
- 'page_size': 1
-}";
- var segment_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments/" + segment_id + "/recipients", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_devices_stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "devices/stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_geo_stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'country': 'US',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "geo/stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_get()
- {
- string queryParams = @"{
- 'exclude_whitelabels': 'true',
- 'ip': 'test_string',
- 'limit': 1,
- 'offset': 1,
- 'subuser': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_assigned_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/assigned", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_pools_post()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "ips/pools", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_pools_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/pools", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_pools__pool_name__put()
- {
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "ips/pools/" + pool_name, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_pools__pool_name__get()
- {
- var pool_name = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/pools/" + pool_name, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_pools__pool_name__delete()
- {
- var pool_name = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/pools/" + pool_name, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_ips_pools__pool_name__ips_post()
- {
- 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();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "ips/pools/" + pool_name + "/ips", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_ips_pools__pool_name__ips__ip__delete()
- {
- var pool_name = "test_url_param";
- var ip = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/pools/" + pool_name + "/ips/" + ip, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_ips_warmup_post()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "ips/warmup", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_warmup_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/warmup", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_warmup__ip_address__get()
- {
- var ip_address = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/warmup/" + ip_address, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_ips_warmup__ip_address__delete()
- {
- var ip_address = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/warmup/" + ip_address, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_ips__ip_address__get()
- {
- var ip_address = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/" + ip_address, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_batch_post()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "mail/batch", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_mail_batch__batch_id__get()
- {
- var batch_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail/batch/" + batch_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_send_post()
- {
- string data = @"{
- 'asm': {
- 'group_id': 1,
- 'groups_to_display': [
- 1,
- 2,
- 3
- ]
- },
- 'attachments': [
- {
- 'content': '[BASE64 encoded content block here]',
- 'content_id': 'ii_139db99fdb5c3704',
- 'disposition': 'inline',
- 'filename': 'file1.jpg',
- 'name': 'file1',
- 'type': 'jpg'
- }
- ],
- 'batch_id': '[YOUR BATCH ID GOES HERE]',
- 'categories': [
- 'category1',
- 'category2'
- ],
- 'content': [
- {
- 'type': 'text/html',
- 'value': '<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>'
- }
- ],
- 'custom_args': {
- 'New Argument 1': 'New Value 1',
- 'activationAttempt': '1',
- 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
- },
- 'from': {
- 'email': 'sam.smith@example.com',
- 'name': 'Sam Smith'
- },
- 'headers': {},
- 'ip_pool_name': '[YOUR POOL NAME GOES HERE]',
- 'mail_settings': {
- 'bcc': {
- 'email': 'ben.doe@example.com',
- 'enable': true
- },
- 'bypass_list_management': {
- 'enable': true
- },
- 'footer': {
- 'enable': true,
- 'html': '<p>Thanks</br>The SendGrid Team</p>',
- 'text': 'Thanks,/n The SendGrid Team'
- },
- 'sandbox_mode': {
- 'enable': false
- },
- 'spam_check': {
- 'enable': true,
- 'post_to_url': 'http://example.com/compliance',
- 'threshold': 3
- }
- },
- 'personalizations': [
- {
- 'bcc': [
- {
- 'email': 'sam.doe@example.com',
- 'name': 'Sam Doe'
- }
- ],
- 'cc': [
- {
- 'email': 'jane.doe@example.com',
- 'name': 'Jane Doe'
- }
- ],
- 'custom_args': {
- 'New Argument 1': 'New Value 1',
- 'activationAttempt': '1',
- 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
- },
- 'headers': {
- 'X-Accept-Language': 'en',
- 'X-Mailer': 'MyApp'
- },
- 'send_at': 1409348513,
- 'subject': 'Hello, World!',
- 'substitutions': {
- 'id': 'substitutions',
- 'type': 'object'
- },
- 'to': [
- {
- 'email': 'john.doe@example.com',
- 'name': 'John Doe'
- }
- ]
- }
- ],
- 'reply_to': {
- 'email': 'sam.smith@example.com',
- 'name': 'Sam Smith'
- },
- 'sections': {
- 'section': {
- ':sectionName1': 'section 1 text',
- ':sectionName2': 'section 2 text'
- }
- },
- 'send_at': 1409348513,
- 'subject': 'Hello, World!',
- 'template_id': '[YOUR TEMPLATE ID GOES HERE]',
- 'tracking_settings': {
- 'click_tracking': {
- 'enable': true,
- 'enable_text': true
- },
- 'ganalytics': {
- 'enable': true,
- 'utm_campaign': '[NAME OF YOUR REFERRER SOURCE]',
- 'utm_content': '[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]',
- 'utm_medium': '[NAME OF YOUR MARKETING MEDIUM e.g. email]',
- 'utm_name': '[NAME OF YOUR CAMPAIGN]',
- 'utm_term': '[IDENTIFY PAID KEYWORDS HERE]'
- },
- 'open_tracking': {
- 'enable': true,
- 'substitution_tag': '%opentrack'
- },
- 'subscription_tracking': {
- 'enable': true,
- 'html': 'If you would like to unsubscribe and stop receiving these emails <% clickhere %>.',
- 'substitution_tag': '<%click here%>',
- 'text': 'If you would like to unsubscribe and stop receiveing these emails <% click here %>.'
- }
- }
-}";
- Object json = JsonConvert.DeserializeObject<Object>(data);
- data = json.ToString();
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "202");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "mail/send", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Accepted);
- }
-
- [Test]
- public async void test_mail_settings_get()
- {
- string queryParams = @"{
- 'limit': 1,
- 'offset': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_address_whitelist_patch()
- {
- string data = @"{
- 'enabled': true,
- 'list': [
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/address_whitelist", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_address_whitelist_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/address_whitelist", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_bcc_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/bcc", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_bcc_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/bcc", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_bounce_purge_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/bounce_purge", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_bounce_purge_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/bounce_purge", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_footer_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/footer", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_footer_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/footer", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_forward_bounce_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/forward_bounce", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_forward_bounce_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/forward_bounce", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_forward_spam_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/forward_spam", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_forward_spam_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/forward_spam", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_plain_content_patch()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/plain_content", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_plain_content_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/plain_content", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_spam_check_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/spam_check", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_spam_check_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/spam_check", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_template_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/template", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mail_settings_template_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/template", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_mailbox_providers_stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'mailbox_providers': 'test_string',
- 'offset': 1,
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mailbox_providers/stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_partner_settings_get()
- {
- string queryParams = @"{
- 'limit': 1,
- 'offset': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "partner_settings", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_partner_settings_new_relic_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "partner_settings/new_relic", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_partner_settings_new_relic_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "partner_settings/new_relic", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_scopes_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "scopes", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_senders_post()
- {
- string data = @"{
- 'address': '123 Elm St.',
- 'address_2': 'Apt. 456',
- 'city': 'Denver',
- 'country': 'United States',
- 'from': {
- 'email': 'from@example.com',
- 'name': 'Example INC'
- },
- 'nickname': 'My Sender ID',
- 'reply_to': {
- 'email': 'replyto@example.com',
- 'name': 'Example INC'
- },
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "senders", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_senders_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "senders", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_senders__sender_id__patch()
- {
- string data = @"{
- 'address': '123 Elm St.',
- 'address_2': 'Apt. 456',
- 'city': 'Denver',
- 'country': 'United States',
- 'from': {
- 'email': 'from@example.com',
- 'name': 'Example INC'
- },
- 'nickname': 'My Sender ID',
- 'reply_to': {
- 'email': 'replyto@example.com',
- 'name': 'Example INC'
- },
- '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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "senders/" + sender_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_senders__sender_id__get()
- {
- var sender_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "senders/" + sender_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_senders__sender_id__delete()
- {
- var sender_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "senders/" + sender_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_senders__sender_id__resend_verification_post()
- {
- var sender_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "senders/" + sender_id + "/resend_verification", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers_post()
- {
- string data = @"{
- 'email': 'John@example.com',
- 'ips': [
- '1.1.1.1',
- '2.2.2.2'
- ],
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "subusers", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers_get()
- {
- string queryParams = @"{
- 'limit': 1,
- 'offset': 1,
- 'username': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers_reputations_get()
- {
- string queryParams = @"{
- 'usernames': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/reputations", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers_stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 1,
- 'offset': 1,
- 'start_date': '2016-01-01',
- 'subusers': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers_stats_monthly_get()
- {
- string queryParams = @"{
- 'date': 'test_string',
- 'limit': 1,
- 'offset': 1,
- 'sort_by_direction': 'asc',
- 'sort_by_metric': 'test_string',
- 'subuser': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats/monthly", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async 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',
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats/sums", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers__subuser_name__patch()
- {
- 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();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "subusers/" + subuser_name, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_subusers__subuser_name__delete()
- {
- var subuser_name = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "subusers/" + subuser_name, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_subusers__subuser_name__ips_put()
- {
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "subusers/" + subuser_name + "/ips", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers__subuser_name__monitor_put()
- {
- string data = @"{
- '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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "subusers/" + subuser_name + "/monitor", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers__subuser_name__monitor_post()
- {
- string data = @"{
- '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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "subusers/" + subuser_name + "/monitor", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers__subuser_name__monitor_get()
- {
- var subuser_name = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/" + subuser_name + "/monitor", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_subusers__subuser_name__monitor_delete()
- {
- var subuser_name = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "subusers/" + subuser_name + "/monitor", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_subusers__subuser_name__stats_monthly_get()
- {
- string queryParams = @"{
- 'date': 'test_string',
- 'limit': 1,
- 'offset': 1,
- 'sort_by_direction': 'asc',
- 'sort_by_metric': 'test_string'
-}";
- var subuser_name = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/" + subuser_name + "/stats/monthly", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_suppression_blocks_get()
- {
- string queryParams = @"{
- 'end_time': 1,
- 'limit': 1,
- 'offset': 1,
- 'start_time': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/blocks", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_suppression_blocks_delete()
- {
- string data = @"{
- 'delete_all': false,
- 'emails': [
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/blocks", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_suppression_blocks__email__get()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/blocks/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_suppression_blocks__email__delete()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/blocks/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_suppression_bounces_get()
- {
- string queryParams = @"{
- 'end_time': 1,
- 'start_time': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/bounces", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_suppression_bounces_delete()
- {
- string data = @"{
- 'delete_all': true,
- 'emails': [
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/bounces", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_suppression_bounces__email__get()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/bounces/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_suppression_bounces__email__delete()
- {
- string queryParams = @"{
- 'email_address': 'example@example.com'
-}";
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/bounces/" + email, queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_suppression_invalid_emails_get()
- {
- string queryParams = @"{
- 'end_time': 1,
- 'limit': 1,
- 'offset': 1,
- 'start_time': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/invalid_emails", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_suppression_invalid_emails_delete()
- {
- string data = @"{
- 'delete_all': false,
- 'emails': [
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/invalid_emails", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_suppression_invalid_emails__email__get()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/invalid_emails/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_suppression_invalid_emails__email__delete()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/invalid_emails/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_suppression_spam_report__email__get()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/spam_report/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_suppression_spam_report__email__delete()
- {
- var email = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/spam_report/" + email, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_suppression_spam_reports_get()
- {
- string queryParams = @"{
- 'end_time': 1,
- 'limit': 1,
- 'offset': 1,
- 'start_time': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/spam_reports", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_suppression_spam_reports_delete()
- {
- string data = @"{
- 'delete_all': false,
- 'emails': [
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/spam_reports", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_suppression_unsubscribes_get()
- {
- string queryParams = @"{
- 'end_time': 1,
- 'limit': 1,
- 'offset': 1,
- 'start_time': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/unsubscribes", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_templates_post()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "templates", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_templates_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "templates", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_templates__template_id__patch()
- {
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "templates/" + template_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_templates__template_id__get()
- {
- var template_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "templates/" + template_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_templates__template_id__delete()
- {
- var template_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "templates/" + template_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_templates__template_id__versions_post()
- {
- string data = @"{
- '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();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "templates/" + template_id + "/versions", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_templates__template_id__versions__version_id__patch()
- {
- string data = @"{
- '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>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "templates/" + template_id + "/versions/" + version_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_templates__template_id__versions__version_id__get()
- {
- var template_id = "test_url_param";
- var version_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "templates/" + template_id + "/versions/" + version_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_templates__template_id__versions__version_id__delete()
- {
- var template_id = "test_url_param";
- var version_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "templates/" + template_id + "/versions/" + version_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_templates__template_id__versions__version_id__activate_post()
- {
- var template_id = "test_url_param";
- var version_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "templates/" + template_id + "/versions/" + version_id + "/activate", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_tracking_settings_get()
- {
- string queryParams = @"{
- 'limit': 1,
- 'offset': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_tracking_settings_click_patch()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/click", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_tracking_settings_click_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/click", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_tracking_settings_google_analytics_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/google_analytics", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_tracking_settings_google_analytics_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/google_analytics", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_tracking_settings_open_patch()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/open", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_tracking_settings_open_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/open", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async 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',
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/subscription", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_tracking_settings_subscription_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/subscription", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_account_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/account", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_credits_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/credits", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_email_put()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "user/email", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_email_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/email", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_password_put()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "user/password", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_profile_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/profile", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_profile_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/profile", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_scheduled_sends_post()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "user/scheduled_sends", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_user_scheduled_sends_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/scheduled_sends", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_scheduled_sends__batch_id__patch()
- {
- 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();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/scheduled_sends/" + batch_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_user_scheduled_sends__batch_id__get()
- {
- var batch_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/scheduled_sends/" + batch_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_scheduled_sends__batch_id__delete()
- {
- var batch_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "user/scheduled_sends/" + batch_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_user_settings_enforced_tls_patch()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/settings/enforced_tls", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_settings_enforced_tls_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/settings/enforced_tls", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_username_put()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "user/username", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_username_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/username", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async 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,
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/webhooks/event/settings", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_webhooks_event_settings_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/event/settings", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_webhooks_event_test_post()
- {
- 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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "user/webhooks/event/test", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_user_webhooks_parse_settings_post()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "user/webhooks/parse/settings", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_user_webhooks_parse_settings_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/settings", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_webhooks_parse_settings__hostname__patch()
- {
- string data = @"{
- '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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/webhooks/parse/settings/" + hostname, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_webhooks_parse_settings__hostname__get()
- {
- var hostname = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/settings/" + hostname, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_user_webhooks_parse_settings__hostname__delete()
- {
- var hostname = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "user/webhooks/parse/settings/" + hostname, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_user_webhooks_parse_stats_get()
- {
- string queryParams = @"{
- 'aggregated_by': 'day',
- 'end_date': '2016-04-01',
- 'limit': 'test_string',
- 'offset': 'test_string',
- 'start_date': '2016-01-01'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/stats", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_domains_post()
- {
- string data = @"{
- 'automatic_security': false,
- 'custom_spf': true,
- 'default': true,
- 'domain': 'example.com',
- 'ips': [
- '192.168.1.1',
- '192.168.1.2'
- ],
- 'subdomain': 'news',
- 'username': 'john@example.com'
-}";
- Object json = JsonConvert.DeserializeObject<Object>(data);
- data = json.ToString();
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_whitelabel_domains_get()
- {
- string queryParams = @"{
- 'domain': 'test_string',
- 'exclude_subusers': 'true',
- 'limit': 1,
- 'offset': 1,
- 'username': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_domains_default_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/default", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_domains_subuser_get()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/subuser", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_domains_subuser_delete()
- {
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/subuser", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_whitelabel_domains__domain_id__patch()
- {
- string data = @"{
- '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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "whitelabel/domains/" + domain_id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_domains__domain_id__get()
- {
- var domain_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/" + domain_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_domains__domain_id__delete()
- {
- var domain_id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/" + domain_id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_whitelabel_domains__domain_id__subuser_post()
- {
- 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();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + domain_id + "/subuser", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_whitelabel_domains__id__ips_post()
- {
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + id + "/ips", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_domains__id__ips__ip__delete()
- {
- var id = "test_url_param";
- var ip = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/" + id + "/ips/" + ip, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_domains__id__validate_post()
- {
- var id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + id + "/validate", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_ips_post()
- {
- string data = @"{
- '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");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/ips", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_whitelabel_ips_get()
- {
- string queryParams = @"{
- 'ip': 'test_string',
- 'limit': 1,
- 'offset': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/ips", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_ips__id__get()
- {
- var id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/ips/" + id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_ips__id__delete()
- {
- var id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/ips/" + id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_whitelabel_ips__id__validate_post()
- {
- var id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/ips/" + id + "/validate", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_links_post()
- {
- string data = @"{
- 'default': true,
- 'domain': 'example.com',
- 'subdomain': 'mail'
-}";
- Object json = JsonConvert.DeserializeObject<Object>(data);
- data = json.ToString();
- string queryParams = @"{
- 'limit': 1,
- 'offset': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "201");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links", requestBody: data, queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
- }
-
- [Test]
- public async void test_whitelabel_links_get()
- {
- string queryParams = @"{
- 'limit': 1
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_links_default_get()
- {
- string queryParams = @"{
- 'domain': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/default", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_links_subuser_get()
- {
- string queryParams = @"{
- 'username': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/subuser", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_links_subuser_delete()
- {
- string queryParams = @"{
- 'username': 'test_string'
-}";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/links/subuser", queryParams: queryParams, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_whitelabel_links__id__patch()
- {
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "whitelabel/links/" + id, requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_links__id__get()
- {
- var id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/" + id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_links__id__delete()
- {
- var id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "204");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/links/" + id, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
- }
-
- [Test]
- public async void test_whitelabel_links__id__validate_post()
- {
- var id = "test_url_param";
- Dictionary<String, String> headers = new Dictionary<String, String>();
- headers.Clear();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links/" + id + "/validate", requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [Test]
- public async void test_whitelabel_links__link_id__subuser_post()
- {
- 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();
- headers.Add("X-Mock", "200");
- Client client = new Client(apiKey, host);
- Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links/" + link_id + "/subuser", requestBody: data, requestHeaders: headers);
- Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
- }
-
- [TestFixtureTearDown]
- public void Dispose()
- {
- if (Environment.GetEnvironmentVariable("TRAVIS") != "true")
- {
- process.Kill();
- Trace.WriteLine("Sutting Down Prism");
- }
- }
-
- }
-}
+using System;
+using NUnit.Framework;
+using SendGrid;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+using System.Net;
+using Newtonsoft.Json;
+using System.Diagnostics;
+using System.Threading.Tasks;
+
+namespace UnitTest
+{
+
+ [TestFixture]
+ public class UnitTest
+ {
+ static string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
+ static string host = "http://localhost:4010";
+ public Client sg = new Client(apiKey, host);
+ Process process = new Process();
+
+ [OneTimeSetUp]
+ public void Init()
+ {
+ if (Environment.GetEnvironmentVariable("TRAVIS") != "true")
+ {
+ Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
+ Trace.WriteLine("Starting Prism (~20 seconds)");
+
+ ProcessStartInfo startInfo = new ProcessStartInfo();
+ startInfo.WindowStyle = ProcessWindowStyle.Hidden;
+ startInfo.FileName = "prism.exe";
+ startInfo.Arguments = "run -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(15000);
+ }
+ else
+ {
+ System.Threading.Thread.Sleep(15000);
+ }
+ }
+
+ // Base case for sending an email
+ [Test]
+ public void TestHelloEmail()
+ {
+ Mail mail = new Mail();
+
+ Email email = new Email();
+ email.Address = "test@example.com";
+ mail.From = email;
+
+ Personalization personalization = new Personalization();
+ email = new Email();
+ email.Address = "test@example.com";
+ personalization.AddTo(email);
+ mail.AddPersonalization(personalization);
+
+ mail.Subject = "Hello World from the SendGrid CSharp Library";
+
+ Content content = new Content();
+ content.Type = "text/plain";
+ content.Value = "Textual content";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/html";
+ content.Value = "<html><body>HTML content</body></html>";
+ mail.AddContent(content);
+
+ String ret = mail.Get();
+ String final = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ret),
+ Formatting.None,
+ new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore });
+ Assert.AreEqual(final, "{\"from\":{\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"email\":\"test@example.com\"}]}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"}]}");
+ }
+
+ // All paramaters available for sending an email
+ [Test]
+ public void TestKitchenSink()
+ {
+ Mail mail = new Mail();
+
+ Email email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ mail.From = email;
+
+ mail.Subject = "Hello World from the SendGrid CSharp Library";
+
+ Personalization personalization = new Personalization();
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddBcc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddBcc(email);
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Example User");
+ personalization.AddSubstitution("%city%", "Denver");
+ personalization.AddCustomArgs("marketing", "false");
+ personalization.AddCustomArgs("transactional", "true");
+ personalization.SendAt = 1461775051;
+ mail.AddPersonalization(personalization);
+
+ personalization = new Personalization();
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddBcc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ personalization.AddBcc(email);
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Example User");
+ personalization.AddSubstitution("%city%", "Denver");
+ personalization.AddCustomArgs("marketing", "false");
+ personalization.AddCustomArgs("transactional", "true");
+ personalization.SendAt = 1461775051;
+ mail.AddPersonalization(personalization);
+
+ Content content = new Content();
+ content.Type = "text/plain";
+ content.Value = "Textual content";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/html";
+ content.Value = "<html><body>HTML content</body></html>";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/calendar";
+ content.Value = "Party Time!!";
+ mail.AddContent(content);
+
+ Attachment attachment = new Attachment();
+ attachment.Content = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12";
+ attachment.Type = "application/pdf";
+ attachment.Filename = "balance_001.pdf";
+ attachment.Disposition = "attachment";
+ attachment.ContentId = "Balance Sheet";
+ mail.AddAttachment(attachment);
+
+ attachment = new Attachment();
+ attachment.Content = "BwdW";
+ attachment.Type = "image/png";
+ attachment.Filename = "banner.png";
+ attachment.Disposition = "inline";
+ attachment.ContentId = "Banner";
+ mail.AddAttachment(attachment);
+
+ mail.TemplateId = "13b8f94f-bcae-4ec6-b752-70d6cb59f932";
+
+ mail.AddHeader("X-Day", "Monday");
+ mail.AddHeader("X-Month", "January");
+
+ mail.AddSection("%section1", "Substitution for Section 1 Tag");
+ mail.AddSection("%section2", "Substitution for Section 2 Tag");
+
+ mail.AddCategory("customer");
+ mail.AddCategory("vip");
+
+ mail.AddCustomArgs("campaign", "welcome");
+ mail.AddCustomArgs("sequence", "2");
+
+ ASM asm = new ASM();
+ asm.GroupId = 3;
+ List<int> groups_to_display = new List<int>()
+ {
+ 1, 4, 5
+ };
+ asm.GroupsToDisplay = groups_to_display;
+ mail.Asm = asm;
+
+ mail.SendAt = 1461775051;
+
+ mail.SetIpPoolId = "23";
+
+ // This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)
+ // mail.BatchId = "some_batch_id";
+
+ MailSettings mailSettings = new MailSettings();
+ BCCSettings bccSettings = new BCCSettings();
+ bccSettings.Enable = true;
+ bccSettings.Email = "test@example.com";
+ mailSettings.BccSettings = bccSettings;
+ BypassListManagement bypassListManagement = new BypassListManagement();
+ bypassListManagement.Enable = true;
+ mailSettings.BypassListManagement = bypassListManagement;
+ FooterSettings footerSettings = new FooterSettings();
+ footerSettings.Enable = true;
+ footerSettings.Text = "Some Footer Text";
+ footerSettings.Html = "<bold>Some HTML Here</bold>";
+ mailSettings.FooterSettings = footerSettings;
+ SandboxMode sandboxMode = new SandboxMode();
+ sandboxMode.Enable = true;
+ mailSettings.SandboxMode = sandboxMode;
+ SpamCheck spamCheck = new SpamCheck();
+ spamCheck.Enable = true;
+ spamCheck.Threshold = 1;
+ spamCheck.PostToUrl = "https://gotchya.example.com";
+ mailSettings.SpamCheck = spamCheck;
+ mail.MailSettings = mailSettings;
+
+ TrackingSettings trackingSettings = new TrackingSettings();
+ ClickTracking clickTracking = new ClickTracking();
+ clickTracking.Enable = true;
+ clickTracking.EnableText = false;
+ trackingSettings.ClickTracking = clickTracking;
+ OpenTracking openTracking = new OpenTracking();
+ openTracking.Enable = true;
+ openTracking.SubstitutionTag = "Optional tag to replace with the open image in the body of the message";
+ trackingSettings.OpenTracking = openTracking;
+ SubscriptionTracking subscriptionTracking = new SubscriptionTracking();
+ subscriptionTracking.Enable = true;
+ subscriptionTracking.Text = "text to insert into the text/plain portion of the message";
+ subscriptionTracking.Html = "<bold>HTML to insert into the text/html portion of the message</bold>";
+ subscriptionTracking.SubstitutionTag = "text to insert into the text/plain portion of the message";
+ trackingSettings.SubscriptionTracking = subscriptionTracking;
+ Ganalytics ganalytics = new Ganalytics();
+ ganalytics.Enable = true;
+ ganalytics.UtmCampaign = "some campaign";
+ ganalytics.UtmContent = "some content";
+ ganalytics.UtmMedium = "some medium";
+ ganalytics.UtmSource = "some source";
+ ganalytics.UtmTerm = "some term";
+ trackingSettings.Ganalytics = ganalytics;
+ mail.TrackingSettings = trackingSettings;
+
+ email = new Email();
+ email.Address = "test@example.com";
+ mail.ReplyTo = email;
+
+ String ret = mail.Get();
+ String final = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ret),
+ Formatting.None,
+ new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore });
+ Assert.AreEqual(final, "{\"from\":{\"name\":\"Example User\",\"email\":\"test@example.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051},{\"to\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"cc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"bcc\":[{\"name\":\"Example User\",\"email\":\"test@example.com\"},{\"name\":\"Example User\",\"email\":\"test@example.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Example User\",\"%city%\":\"Denver\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"},{\"type\":\"text/calendar\",\"value\":\"Party Time!!\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"headers\":{\"X-Day\":\"Monday\",\"X-Month\":\"January\"},\"sections\":{\"%section1\":\"Substitution for Section 1 Tag\",\"%section2\":\"Substitution for Section 2 Tag\"},\"categories\":[\"customer\",\"vip\"],\"custom_args\":{\"campaign\":\"welcome\",\"sequence\":\"2\"},\"send_at\":1461775051,\"asm\":{\"group_id\":3,\"groups_to_display\":[1,4,5]},\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"test@example.com\"},\"bypass_list_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Some Footer Text\",\"html\":\"<bold>Some HTML Here</bold>\"},\"sandbox_mode\":{\"enable\":true},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://gotchya.example.com\"}},\"tracking_settings\":{\"click_tracking\":{\"enable\":true,\"enable_text\":false},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<bold>HTML to insert into the text/html portion of the message</bold>\",\"substitution_tag\":\"text to insert into the text/plain portion of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_medium\":\"some medium\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_campaign\":\"some campaign\"}},\"reply_to\":{\"email\":\"test@example.com\"}}");
+ }
+
+ [Test]
+ public async Task test_access_settings_activity_get()
+ {
+ string queryParams = @"{
+ 'limit': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/activity", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_access_settings_whitelist_post()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "access_settings/whitelist", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_access_settings_whitelist_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_access_settings_whitelist_delete()
+ {
+ string data = @"{
+ 'ids': [
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_access_settings_whitelist__rule_id__get()
+ {
+ var rule_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist/" + rule_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_access_settings_whitelist__rule_id__delete()
+ {
+ var rule_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist/" + rule_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_alerts_post()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "alerts", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_alerts_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "alerts", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_alerts__alert_id__patch()
+ {
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "alerts/" + alert_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_alerts__alert_id__get()
+ {
+ var alert_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "alerts/" + alert_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_alerts__alert_id__delete()
+ {
+ var alert_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "alerts/" + alert_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_api_keys_post()
+ {
+ string data = @"{
+ 'name': 'My API Key',
+ 'sample': 'data',
+ 'scopes': [
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "api_keys", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_api_keys_get()
+ {
+ string queryParams = @"{
+ 'limit': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_api_keys__api_key_id__put()
+ {
+ string data = @"{
+ 'name': 'A New Hope',
+ 'scopes': [
+ '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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PUT, urlPath: "api_keys/" + api_key_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_api_keys__api_key_id__patch()
+ {
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "api_keys/" + api_key_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_api_keys__api_key_id__get()
+ {
+ var api_key_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys/" + api_key_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_api_keys__api_key_id__delete()
+ {
+ var api_key_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "api_keys/" + api_key_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_asm_groups_post()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_asm_groups_get()
+ {
+ string queryParams = @"{
+ 'id': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_asm_groups__group_id__patch()
+ {
+ string data = @"{
+ '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();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "asm/groups/" + group_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_asm_groups__group_id__get()
+ {
+ var group_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups/" + group_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_asm_groups__group_id__delete()
+ {
+ var group_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/groups/" + group_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_asm_groups__group_id__suppressions_post()
+ {
+ string data = @"{
+ 'recipient_emails': [
+ '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();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups/" + group_id + "/suppressions", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_asm_groups__group_id__suppressions_get()
+ {
+ var group_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups/" + group_id + "/suppressions", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_asm_groups__group_id__suppressions_search_post()
+ {
+ string data = @"{
+ 'recipient_emails': [
+ '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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups/" + group_id + "/suppressions/search", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_asm_groups__group_id__suppressions__email__delete()
+ {
+ var group_id = "test_url_param";
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/groups/" + group_id + "/suppressions/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_asm_suppressions_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_asm_suppressions_global_post()
+ {
+ string data = @"{
+ 'recipient_emails': [
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "asm/suppressions/global", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_asm_suppressions_global__email__get()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions/global/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_asm_suppressions_global__email__delete()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/suppressions/global/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_asm_suppressions__email__get()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_browsers_stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'browsers': 'test_string',
+ 'end_date': '2016-04-01',
+ 'limit': 'test_string',
+ 'offset': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "browsers/stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_campaigns_post()
+ {
+ string data = @"{
+ 'categories': [
+ 'spring line'
+ ],
+ 'custom_unsubscribe_url': '',
+ 'html_content': '<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>',
+ 'ip_pool': 'marketing',
+ 'list_ids': [
+ 110,
+ 124
+ ],
+ 'plain_content': 'Check out our spring line!',
+ 'segment_ids': [
+ 110
+ ],
+ 'sender_id': 124451,
+ 'subject': 'New Products for Spring!',
+ 'suppression_group_id': 42,
+ 'title': 'March Newsletter'
+}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_campaigns_get()
+ {
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_campaigns__campaign_id__patch()
+ {
+ string data = @"{
+ 'categories': [
+ 'summer line'
+ ],
+ 'html_content': '<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>',
+ 'plain_content': 'Check out our summer line!',
+ 'subject': 'New Products for Summer!',
+ 'title': 'May Newsletter'
+}";
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "campaigns/" + campaign_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_campaigns__campaign_id__get()
+ {
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns/" + campaign_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_campaigns__campaign_id__delete()
+ {
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "campaigns/" + campaign_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_campaigns__campaign_id__schedules_patch()
+ {
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "campaigns/" + campaign_id + "/schedules", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_campaigns__campaign_id__schedules_post()
+ {
+ 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();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_campaigns__campaign_id__schedules_get()
+ {
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns/" + campaign_id + "/schedules", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_campaigns__campaign_id__schedules_delete()
+ {
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "campaigns/" + campaign_id + "/schedules", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_campaigns__campaign_id__schedules_now_post()
+ {
+ var campaign_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules/now", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_campaigns__campaign_id__schedules_test_post()
+ {
+ 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();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules/test", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_categories_get()
+ {
+ string queryParams = @"{
+ 'category': 'test_string',
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "categories", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_categories_stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'categories': 'test_string',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "categories/stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task 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',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "categories/stats/sums", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_clients_stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "clients/stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_clients__client_type__stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'start_date': '2016-01-01'
+}";
+ var client_type = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "clients/" + client_type + "/stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_custom_fields_post()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/custom_fields", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_contactdb_custom_fields_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/custom_fields", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_custom_fields__custom_field_id__get()
+ {
+ var custom_field_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/custom_fields/" + custom_field_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_custom_fields__custom_field_id__delete()
+ {
+ var custom_field_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "202");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/custom_fields/" + custom_field_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Accepted);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists_post()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists_delete()
+ {
+ string data = @"[
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists__list_id__patch()
+ {
+ string data = @"{
+ 'name': 'newlistname'
+}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
+ string queryParams = @"{
+ 'list_id': 1
+}";
+ var list_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/lists/" + list_id, requestBody: data, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists__list_id__get()
+ {
+ string queryParams = @"{
+ 'list_id': 1
+}";
+ var list_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists/" + list_id, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists__list_id__delete()
+ {
+ string queryParams = @"{
+ 'delete_contacts': 'true'
+}";
+ var list_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "202");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists/" + list_id, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Accepted);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists__list_id__recipients_post()
+ {
+ string data = @"[
+ '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();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists/" + list_id + "/recipients", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists__list_id__recipients_get()
+ {
+ string queryParams = @"{
+ 'list_id': 1,
+ 'page': 1,
+ 'page_size': 1
+}";
+ var list_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists/" + list_id + "/recipients", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists__list_id__recipients__recipient_id__post()
+ {
+ var list_id = "test_url_param";
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists/" + list_id + "/recipients/" + recipient_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_contactdb_lists__list_id__recipients__recipient_id__delete()
+ {
+ string queryParams = @"{
+ 'list_id': 1,
+ 'recipient_id': 1
+}";
+ var list_id = "test_url_param";
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists/" + list_id + "/recipients/" + recipient_id, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients_patch()
+ {
+ string data = @"[
+ {
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/recipients", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients_post()
+ {
+ string data = @"[
+ {
+ 'age': 25,
+ 'email': 'example@example.com',
+ 'first_name': '',
+ 'last_name': 'User'
+ },
+ {
+ 'age': 25,
+ 'email': 'example2@example.com',
+ 'first_name': 'Example',
+ 'last_name': 'User'
+ }
+]";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/recipients", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients_get()
+ {
+ string queryParams = @"{
+ 'page': 1,
+ 'page_size': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients_delete()
+ {
+ string data = @"[
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/recipients", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients_billable_count_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/billable_count", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients_count_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/count", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients_search_get()
+ {
+ string queryParams = @"{
+ '{field_name}': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/search", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients__recipient_id__get()
+ {
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/" + recipient_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients__recipient_id__delete()
+ {
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/recipients/" + recipient_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_contactdb_recipients__recipient_id__lists_get()
+ {
+ var recipient_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/" + recipient_id + "/lists", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_reserved_fields_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/reserved_fields", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_segments_post()
+ {
+ string data = @"{
+ 'conditions': [
+ {
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
+ 'value': 'Miller'
+ },
+ {
+ 'and_or': 'and',
+ 'field': 'last_clicked',
+ 'operator': 'gt',
+ 'value': '01/02/2015'
+ },
+ {
+ 'and_or': 'or',
+ 'field': 'clicks.campaign_identifier',
+ 'operator': 'eq',
+ 'value': '513'
+ }
+ ],
+ 'list_id': 4,
+ 'name': 'Last Name Miller'
+}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/segments", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_segments_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_segments__segment_id__patch()
+ {
+ string data = @"{
+ 'conditions': [
+ {
+ 'and_or': '',
+ 'field': 'last_name',
+ 'operator': 'eq',
+ 'value': 'Miller'
+ }
+ ],
+ 'list_id': 5,
+ 'name': 'The Millers'
+}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
+ string queryParams = @"{
+ 'segment_id': 'test_string'
+}";
+ var segment_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/segments/" + segment_id, requestBody: data, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_segments__segment_id__get()
+ {
+ string queryParams = @"{
+ 'segment_id': 1
+}";
+ var segment_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments/" + segment_id, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_contactdb_segments__segment_id__delete()
+ {
+ string queryParams = @"{
+ 'delete_contacts': 'true'
+}";
+ var segment_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/segments/" + segment_id, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_contactdb_segments__segment_id__recipients_get()
+ {
+ string queryParams = @"{
+ 'page': 1,
+ 'page_size': 1
+}";
+ var segment_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments/" + segment_id + "/recipients", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_devices_stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "devices/stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_geo_stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'country': 'US',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "geo/stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_get()
+ {
+ string queryParams = @"{
+ 'exclude_whitelabels': 'true',
+ 'ip': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'subuser': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "ips", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_assigned_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "ips/assigned", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_pools_post()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "ips/pools", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_pools_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "ips/pools", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_pools__pool_name__put()
+ {
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PUT, urlPath: "ips/pools/" + pool_name, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_pools__pool_name__get()
+ {
+ var pool_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "ips/pools/" + pool_name, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_pools__pool_name__delete()
+ {
+ var pool_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/pools/" + pool_name, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_ips_pools__pool_name__ips_post()
+ {
+ 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();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "ips/pools/" + pool_name + "/ips", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_ips_pools__pool_name__ips__ip__delete()
+ {
+ var pool_name = "test_url_param";
+ var ip = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/pools/" + pool_name + "/ips/" + ip, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_ips_warmup_post()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "ips/warmup", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_warmup_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "ips/warmup", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_warmup__ip_address__get()
+ {
+ var ip_address = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "ips/warmup/" + ip_address, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_ips_warmup__ip_address__delete()
+ {
+ var ip_address = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/warmup/" + ip_address, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_ips__ip_address__get()
+ {
+ var ip_address = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "ips/" + ip_address, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_batch_post()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "mail/batch", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_mail_batch__batch_id__get()
+ {
+ var batch_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail/batch/" + batch_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_send_post()
+ {
+ string data = @"{
+ 'asm': {
+ 'group_id': 1,
+ 'groups_to_display': [
+ 1,
+ 2,
+ 3
+ ]
+ },
+ 'attachments': [
+ {
+ 'content': '[BASE64 encoded content block here]',
+ 'content_id': 'ii_139db99fdb5c3704',
+ 'disposition': 'inline',
+ 'filename': 'file1.jpg',
+ 'name': 'file1',
+ 'type': 'jpg'
+ }
+ ],
+ 'batch_id': '[YOUR BATCH ID GOES HERE]',
+ 'categories': [
+ 'category1',
+ 'category2'
+ ],
+ 'content': [
+ {
+ 'type': 'text/html',
+ 'value': '<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>'
+ }
+ ],
+ 'custom_args': {
+ 'New Argument 1': 'New Value 1',
+ 'activationAttempt': '1',
+ 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
+ },
+ 'from': {
+ 'email': 'sam.smith@example.com',
+ 'name': 'Sam Smith'
+ },
+ 'headers': {},
+ 'ip_pool_name': '[YOUR POOL NAME GOES HERE]',
+ 'mail_settings': {
+ 'bcc': {
+ 'email': 'ben.doe@example.com',
+ 'enable': true
+ },
+ 'bypass_list_management': {
+ 'enable': true
+ },
+ 'footer': {
+ 'enable': true,
+ 'html': '<p>Thanks</br>The SendGrid Team</p>',
+ 'text': 'Thanks,/n The SendGrid Team'
+ },
+ 'sandbox_mode': {
+ 'enable': false
+ },
+ 'spam_check': {
+ 'enable': true,
+ 'post_to_url': 'http://example.com/compliance',
+ 'threshold': 3
+ }
+ },
+ 'personalizations': [
+ {
+ 'bcc': [
+ {
+ 'email': 'sam.doe@example.com',
+ 'name': 'Sam Doe'
+ }
+ ],
+ 'cc': [
+ {
+ 'email': 'jane.doe@example.com',
+ 'name': 'Jane Doe'
+ }
+ ],
+ 'custom_args': {
+ 'New Argument 1': 'New Value 1',
+ 'activationAttempt': '1',
+ 'customerAccountNumber': '[CUSTOMER ACCOUNT NUMBER GOES HERE]'
+ },
+ 'headers': {
+ 'X-Accept-Language': 'en',
+ 'X-Mailer': 'MyApp'
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
+ 'substitutions': {
+ 'id': 'substitutions',
+ 'type': 'object'
+ },
+ 'to': [
+ {
+ 'email': 'john.doe@example.com',
+ 'name': 'John Doe'
+ }
+ ]
+ }
+ ],
+ 'reply_to': {
+ 'email': 'sam.smith@example.com',
+ 'name': 'Sam Smith'
+ },
+ 'sections': {
+ 'section': {
+ ':sectionName1': 'section 1 text',
+ ':sectionName2': 'section 2 text'
+ }
+ },
+ 'send_at': 1409348513,
+ 'subject': 'Hello, World!',
+ 'template_id': '[YOUR TEMPLATE ID GOES HERE]',
+ 'tracking_settings': {
+ 'click_tracking': {
+ 'enable': true,
+ 'enable_text': true
+ },
+ 'ganalytics': {
+ 'enable': true,
+ 'utm_campaign': '[NAME OF YOUR REFERRER SOURCE]',
+ 'utm_content': '[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]',
+ 'utm_medium': '[NAME OF YOUR MARKETING MEDIUM e.g. email]',
+ 'utm_name': '[NAME OF YOUR CAMPAIGN]',
+ 'utm_term': '[IDENTIFY PAID KEYWORDS HERE]'
+ },
+ 'open_tracking': {
+ 'enable': true,
+ 'substitution_tag': '%opentrack'
+ },
+ 'subscription_tracking': {
+ 'enable': true,
+ 'html': 'If you would like to unsubscribe and stop receiving these emails <% clickhere %>.',
+ 'substitution_tag': '<%click here%>',
+ 'text': 'If you would like to unsubscribe and stop receiveing these emails <% click here %>.'
+ }
+ }
+}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "202");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "mail/send", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Accepted);
+ }
+
+ [Test]
+ public async Task test_mail_settings_get()
+ {
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_address_whitelist_patch()
+ {
+ string data = @"{
+ 'enabled': true,
+ 'list': [
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/address_whitelist", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_address_whitelist_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/address_whitelist", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_bcc_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/bcc", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_bcc_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/bcc", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_bounce_purge_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/bounce_purge", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_bounce_purge_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/bounce_purge", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_footer_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/footer", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_footer_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/footer", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_forward_bounce_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/forward_bounce", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_forward_bounce_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/forward_bounce", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_forward_spam_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/forward_spam", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_forward_spam_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/forward_spam", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_plain_content_patch()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/plain_content", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_plain_content_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/plain_content", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_spam_check_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/spam_check", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_spam_check_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/spam_check", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_template_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/template", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mail_settings_template_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/template", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_mailbox_providers_stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'mailbox_providers': 'test_string',
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "mailbox_providers/stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_partner_settings_get()
+ {
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "partner_settings", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_partner_settings_new_relic_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "partner_settings/new_relic", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_partner_settings_new_relic_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "partner_settings/new_relic", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_scopes_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "scopes", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_senders_post()
+ {
+ string data = @"{
+ 'address': '123 Elm St.',
+ 'address_2': 'Apt. 456',
+ 'city': 'Denver',
+ 'country': 'United States',
+ 'from': {
+ 'email': 'from@example.com',
+ 'name': 'Example INC'
+ },
+ 'nickname': 'My Sender ID',
+ 'reply_to': {
+ 'email': 'replyto@example.com',
+ 'name': 'Example INC'
+ },
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "senders", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_senders_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "senders", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_senders__sender_id__patch()
+ {
+ string data = @"{
+ 'address': '123 Elm St.',
+ 'address_2': 'Apt. 456',
+ 'city': 'Denver',
+ 'country': 'United States',
+ 'from': {
+ 'email': 'from@example.com',
+ 'name': 'Example INC'
+ },
+ 'nickname': 'My Sender ID',
+ 'reply_to': {
+ 'email': 'replyto@example.com',
+ 'name': 'Example INC'
+ },
+ '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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "senders/" + sender_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_senders__sender_id__get()
+ {
+ var sender_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "senders/" + sender_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_senders__sender_id__delete()
+ {
+ var sender_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "senders/" + sender_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_senders__sender_id__resend_verification_post()
+ {
+ var sender_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "senders/" + sender_id + "/resend_verification", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers_post()
+ {
+ string data = @"{
+ 'email': 'John@example.com',
+ 'ips': [
+ '1.1.1.1',
+ '2.2.2.2'
+ ],
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "subusers", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers_get()
+ {
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1,
+ 'username': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "subusers", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers_reputations_get()
+ {
+ string queryParams = @"{
+ 'usernames': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/reputations", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers_stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 1,
+ 'offset': 1,
+ 'start_date': '2016-01-01',
+ 'subusers': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers_stats_monthly_get()
+ {
+ string queryParams = @"{
+ 'date': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string',
+ 'subuser': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats/monthly", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task 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',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats/sums", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers__subuser_name__patch()
+ {
+ 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();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "subusers/" + subuser_name, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_subusers__subuser_name__delete()
+ {
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "subusers/" + subuser_name, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_subusers__subuser_name__ips_put()
+ {
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PUT, urlPath: "subusers/" + subuser_name + "/ips", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers__subuser_name__monitor_put()
+ {
+ string data = @"{
+ '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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PUT, urlPath: "subusers/" + subuser_name + "/monitor", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers__subuser_name__monitor_post()
+ {
+ string data = @"{
+ '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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "subusers/" + subuser_name + "/monitor", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers__subuser_name__monitor_get()
+ {
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/" + subuser_name + "/monitor", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_subusers__subuser_name__monitor_delete()
+ {
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "subusers/" + subuser_name + "/monitor", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_subusers__subuser_name__stats_monthly_get()
+ {
+ string queryParams = @"{
+ 'date': 'test_string',
+ 'limit': 1,
+ 'offset': 1,
+ 'sort_by_direction': 'asc',
+ 'sort_by_metric': 'test_string'
+}";
+ var subuser_name = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/" + subuser_name + "/stats/monthly", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_suppression_blocks_get()
+ {
+ string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/blocks", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_suppression_blocks_delete()
+ {
+ string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/blocks", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_suppression_blocks__email__get()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/blocks/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_suppression_blocks__email__delete()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/blocks/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_suppression_bounces_get()
+ {
+ string queryParams = @"{
+ 'end_time': 1,
+ 'start_time': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/bounces", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_suppression_bounces_delete()
+ {
+ string data = @"{
+ 'delete_all': true,
+ 'emails': [
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/bounces", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_suppression_bounces__email__get()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/bounces/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_suppression_bounces__email__delete()
+ {
+ string queryParams = @"{
+ 'email_address': 'example@example.com'
+}";
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/bounces/" + email, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_suppression_invalid_emails_get()
+ {
+ string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/invalid_emails", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_suppression_invalid_emails_delete()
+ {
+ string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/invalid_emails", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_suppression_invalid_emails__email__get()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/invalid_emails/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_suppression_invalid_emails__email__delete()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/invalid_emails/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_suppression_spam_report__email__get()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/spam_report/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_suppression_spam_report__email__delete()
+ {
+ var email = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/spam_report/" + email, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_suppression_spam_reports_get()
+ {
+ string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/spam_reports", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_suppression_spam_reports_delete()
+ {
+ string data = @"{
+ 'delete_all': false,
+ 'emails': [
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/spam_reports", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_suppression_unsubscribes_get()
+ {
+ string queryParams = @"{
+ 'end_time': 1,
+ 'limit': 1,
+ 'offset': 1,
+ 'start_time': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/unsubscribes", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_templates_post()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "templates", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_templates_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "templates", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_templates__template_id__patch()
+ {
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "templates/" + template_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_templates__template_id__get()
+ {
+ var template_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "templates/" + template_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_templates__template_id__delete()
+ {
+ var template_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "templates/" + template_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_templates__template_id__versions_post()
+ {
+ string data = @"{
+ '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();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "templates/" + template_id + "/versions", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_templates__template_id__versions__version_id__patch()
+ {
+ string data = @"{
+ '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>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "templates/" + template_id + "/versions/" + version_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_templates__template_id__versions__version_id__get()
+ {
+ var template_id = "test_url_param";
+ var version_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "templates/" + template_id + "/versions/" + version_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_templates__template_id__versions__version_id__delete()
+ {
+ var template_id = "test_url_param";
+ var version_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "templates/" + template_id + "/versions/" + version_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_templates__template_id__versions__version_id__activate_post()
+ {
+ var template_id = "test_url_param";
+ var version_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "templates/" + template_id + "/versions/" + version_id + "/activate", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_tracking_settings_get()
+ {
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_tracking_settings_click_patch()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/click", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_tracking_settings_click_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/click", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_tracking_settings_google_analytics_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/google_analytics", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_tracking_settings_google_analytics_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/google_analytics", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_tracking_settings_open_patch()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/open", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_tracking_settings_open_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/open", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_tracking_settings_subscription_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/subscription", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_tracking_settings_subscription_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/subscription", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_account_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/account", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_credits_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/credits", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_email_put()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PUT, urlPath: "user/email", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_email_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/email", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_password_put()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PUT, urlPath: "user/password", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_profile_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/profile", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_profile_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/profile", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_scheduled_sends_post()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "user/scheduled_sends", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_user_scheduled_sends_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/scheduled_sends", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_scheduled_sends__batch_id__patch()
+ {
+ 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();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/scheduled_sends/" + batch_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_user_scheduled_sends__batch_id__get()
+ {
+ var batch_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/scheduled_sends/" + batch_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_scheduled_sends__batch_id__delete()
+ {
+ var batch_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "user/scheduled_sends/" + batch_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_user_settings_enforced_tls_patch()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/settings/enforced_tls", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_settings_enforced_tls_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/settings/enforced_tls", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_username_put()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PUT, urlPath: "user/username", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_username_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/username", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task 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,
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/webhooks/event/settings", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_webhooks_event_settings_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/event/settings", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_webhooks_event_test_post()
+ {
+ 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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "user/webhooks/event/test", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_user_webhooks_parse_settings_post()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "user/webhooks/parse/settings", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_user_webhooks_parse_settings_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/settings", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_webhooks_parse_settings__hostname__patch()
+ {
+ string data = @"{
+ '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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/webhooks/parse/settings/" + hostname, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_webhooks_parse_settings__hostname__get()
+ {
+ var hostname = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/settings/" + hostname, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_user_webhooks_parse_settings__hostname__delete()
+ {
+ var hostname = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "user/webhooks/parse/settings/" + hostname, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_user_webhooks_parse_stats_get()
+ {
+ string queryParams = @"{
+ 'aggregated_by': 'day',
+ 'end_date': '2016-04-01',
+ 'limit': 'test_string',
+ 'offset': 'test_string',
+ 'start_date': '2016-01-01'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/stats", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains_post()
+ {
+ string data = @"{
+ 'automatic_security': false,
+ 'custom_spf': true,
+ 'default': true,
+ 'domain': 'example.com',
+ 'ips': [
+ '192.168.1.1',
+ '192.168.1.2'
+ ],
+ 'subdomain': 'news',
+ 'username': 'john@example.com'
+}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains_get()
+ {
+ string queryParams = @"{
+ 'domain': 'test_string',
+ 'exclude_subusers': 'true',
+ 'limit': 1,
+ 'offset': 1,
+ 'username': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains_default_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/default", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains_subuser_get()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/subuser", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains_subuser_delete()
+ {
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/subuser", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains__domain_id__patch()
+ {
+ string data = @"{
+ '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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "whitelabel/domains/" + domain_id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains__domain_id__get()
+ {
+ var domain_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/" + domain_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains__domain_id__delete()
+ {
+ var domain_id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/" + domain_id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains__domain_id__subuser_post()
+ {
+ 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();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + domain_id + "/subuser", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains__id__ips_post()
+ {
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + id + "/ips", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains__id__ips__ip__delete()
+ {
+ var id = "test_url_param";
+ var ip = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/" + id + "/ips/" + ip, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_domains__id__validate_post()
+ {
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + id + "/validate", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_ips_post()
+ {
+ string data = @"{
+ '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");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/ips", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_whitelabel_ips_get()
+ {
+ string queryParams = @"{
+ 'ip': 'test_string',
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/ips", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_ips__id__get()
+ {
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/ips/" + id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_ips__id__delete()
+ {
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/ips/" + id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_whitelabel_ips__id__validate_post()
+ {
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/ips/" + id + "/validate", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links_post()
+ {
+ string data = @"{
+ 'default': true,
+ 'domain': 'example.com',
+ 'subdomain': 'mail'
+}";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ data = json.ToString();
+ string queryParams = @"{
+ 'limit': 1,
+ 'offset': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "201");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links", requestBody: data, queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links_get()
+ {
+ string queryParams = @"{
+ 'limit': 1
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links_default_get()
+ {
+ string queryParams = @"{
+ 'domain': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/default", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links_subuser_get()
+ {
+ string queryParams = @"{
+ 'username': 'test_string'
+}";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/subuser", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links_subuser_delete()
+ {
+ string queryParams = @"{
+ 'username': 'test_string'
+}";
+ Dictionary<string, string> headers = new Dictionary<string, string>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/links/subuser", queryParams: queryParams, requestHeaders: headers);
+ Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links__id__patch()
+ {
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.PATCH, urlPath: "whitelabel/links/" + id, requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links__id__get()
+ {
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/" + id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links__id__delete()
+ {
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "204");
+ Response response = await sg.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/links/" + id, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links__id__validate_post()
+ {
+ var id = "test_url_param";
+ Dictionary<String, String> headers = new Dictionary<String, String>();
+ headers.Clear();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links/" + id + "/validate", requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [Test]
+ public async Task test_whitelabel_links__link_id__subuser_post()
+ {
+ 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();
+ headers.Add("X-Mock", "200");
+ Response response = await sg.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links/" + link_id + "/subuser", requestBody: data, requestHeaders: headers);
+ Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
+ }
+
+ [OneTimeTearDown]
+ public void Dispose()
+ {
+ if (Environment.GetEnvironmentVariable("TRAVIS") != "true")
+ {
+ process.Kill();
+ Trace.WriteLine("Sutting Down Prism");
+ }
+ }
+
+ }
+}
diff --git a/SendGrid/UnitTest/UnitTests.csproj b/UnitTest/UnitTest.csproj
index d0209e2..a7aee3b 100644
--- a/SendGrid/UnitTest/UnitTests.csproj
+++ b/UnitTest/UnitTest.csproj
@@ -3,12 +3,12 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{8A66032B-0D1C-4F24-B0E3-A250F31D09D8}</ProjectGuid>
+ <ProjectGuid>{084DCC9F-D8A3-4179-B966-5B1C72FFCA1F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTest</RootNamespace>
<AssemblyName>UnitTest</AssemblyName>
- <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
@@ -16,7 +16,6 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
- <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -28,48 +27,26 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>none</DebugType>
+ <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
<ItemGroup>
- <Reference Include="Microsoft.CSharp" />
<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'">
- <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="nunit.core.interfaces, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" Condition="'$(OS)' != 'Unix'">
- <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
+ <Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
+ <HintPath>..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
- <Reference Include="nunit.util, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" Condition="'$(OS)' != 'Unix'">
- <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="NUnit.VisualStudio.TestAdapter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4cb40d35494691ac, processorArchitecture=MSIL" Condition="'$(OS)' != 'Unix'">
- <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath>
- <Private>False</Private>
+ <Reference Include="SendGrid">
+ <HintPath>..\src\SendGrid\bin\Release\net452\SendGrid.dll</HintPath>
</Reference>
<Reference Include="System" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Web.Extensions" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@@ -77,24 +54,18 @@
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
- <Otherwise />
+ <Otherwise>
+ <ItemGroup>
+ <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
+ </ItemGroup>
+ </Otherwise>
</Choose>
<ItemGroup>
<Compile Include="UnitTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\SendGrid\SendGrid.csproj">
- <Project>{1c318867-440b-4eb9-99e3-c0cc2c556962}</Project>
- <Name>SendGrid</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config">
- <SubType>Designer</SubType>
- </None>
<None Include="packages.config" />
- <None Include="sendgrid-csharp.snk" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
@@ -116,7 +87,7 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
diff --git a/UnitTest/packages.config b/UnitTest/packages.config
new file mode 100644
index 0000000..e1d37b8
--- /dev/null
+++ b/UnitTest/packages.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
+ <package id="NUnit" version="3.5.0" targetFramework="net461" />
+ <package id="NUnit3TestAdapter" version="3.6.0" targetFramework="net461" />
+</packages> \ No newline at end of file
diff --git a/global.json b/global.json
new file mode 100644
index 0000000..1b6df39
--- /dev/null
+++ b/global.json
@@ -0,0 +1,6 @@
+{
+ "projects": [ "src", "test" ],
+ "sdk": {
+ "version": ""
+ }
+}
diff --git a/nuspec/SendGrid.nuspec b/nuspec/SendGrid.nuspec
new file mode 100644
index 0000000..6d2241c
--- /dev/null
+++ b/nuspec/SendGrid.nuspec
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+ <id>SendGridv9beta</id>
+ <title>SendGridv9beta</title>
+ <version>0.0.0</version>
+ <authors>Elmer Thomas</authors>
+ <owners>SendGrid</owners>
+ <description>v9beta .NET Core and .NET 4.5.X and up support</description>
+ <summary>v9beta .NET Core and .NET 4.5.X and up support</summary>
+ <licenseUrl>https://github.com/sendgrid/sendgrid-csharp/blob/master/LICENSE.txt</licenseUrl>
+ <projectUrl>https://github.com/sendgrid/sendgrid-csharp</projectUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <copyright>Copyright 2016 (c) SendGrid</copyright>
+ <language>en-US</language>
+ <tags>SendGrid</tags>
+ <dependencies>
+ <group targetFramework="net452">
+ <dependency id="Newtonsoft.Json" version="9.0.1" />
+ <dependency id="System.Net.Http" version="4.0.0" />
+ </group>
+ <group targetFramework=".NETStandard1.3">
+ <dependency id="NETStandard.Library" version="1.6.1" />
+ <dependency id="Newtonsoft.Json" version="9.0.1" />
+ <dependency id="System.ComponentModel.Primitives" version="4.1.0" />
+ <dependency id="System.Reflection.TypeExtensions" version="4.1.0" />
+ <dependency id="WinInsider.System.Net.Http.Formatting" version="1.0.1" />
+ </group>
+ </dependencies>
+ </metadata>
+ <files>
+ <file src="SendGrid/bin/Release/net452/SendGrid.dll" target="lib/net452" />
+ <file src="SendGrid/bin/Release/net452/SendGrid.pdb" target="lib/net452" />
+ <file src="SendGrid/bin/Release/net452/SendGrid.xml" target="lib/net452" />
+ <file src="SendGrid/bin/Release/netstandard1.3/SendGrid.dll" target="lib/netstandard1.3" />
+ <file src="SendGrid/bin/Release/netstandard1.3/SendGrid.pdb" target="lib/netstandard1.3" />
+ <file src="SendGrid/bin/Release/netstandard1.3/SendGrid.xml" target="lib/netstandard1.3" />
+ </files>
+</package> \ No newline at end of file
diff --git a/src/Example/ExampleCore.xproj b/src/Example/ExampleCore.xproj
new file mode 100644
index 0000000..4ef9c3c
--- /dev/null
+++ b/src/Example/ExampleCore.xproj
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+ </PropertyGroup>
+
+ <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>4bd07a97-8ad2-4134-848e-6a74eb992050</ProjectGuid>
+ <RootNamespace>Example</RootNamespace>
+ <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
+ <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
+ <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <SchemaVersion>2.0</SchemaVersion>
+ </PropertyGroup>
+ <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
+</Project>
diff --git a/src/Example/Program.cs b/src/Example/Program.cs
new file mode 100644
index 0000000..572ce7a
--- /dev/null
+++ b/src/Example/Program.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+using SendGrid;
+using SendGrid.Helpers.Mail;
+using System.Collections.Generic;
+
+namespace Example
+{
+ internal class Example
+ {
+ private static void Main()
+ {
+ Execute().Wait();
+ }
+
+ static async Task Execute()
+ {
+ string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
+ Client client = new Client(apiKey);
+
+ string data = @"{
+ 'personalizations': [
+ {
+ 'to': [
+ {
+ 'email': 'elmer@sendgrid.com'
+ }
+ ],
+ 'subject': 'Hello World from the SendGrid C# Library!'
+ }
+ ],
+ 'from': {
+ 'email': 'dx@sendgrid.com'
+ },
+ 'content': [
+ {
+ 'type': 'text/plain',
+ 'value': 'Hello, Email!'
+ }
+ ]
+ }";
+ Object json = JsonConvert.DeserializeObject<Object>(data);
+ Response response = await client.RequestAsync(Client.Methods.POST,
+ json.ToString(),
+ urlPath: "mail/send");
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers);
+ Console.ReadLine();
+
+ Email from = new Email("dx@sendgrid");
+ string subject = "Hello World from the SendGrid CSharp Library Helper!";
+ Email to = new Email("elmer@sendgrid.com");
+ Content content = new Content("text/plain", "Hello, Email from the helper!");
+ Mail mail = new Mail(from, subject, to, content);
+
+ response = await client.RequestAsync(Client.Methods.POST,
+ mail.Get(),
+ urlPath: "mail/send");
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers);
+ Console.ReadLine();
+
+ // GET Collection
+ string queryParams = @"{
+ 'limit': 100
+ }";
+ response = await client.RequestAsync(method: Client.Methods.GET,
+ urlPath: "asm/groups",
+ queryParams: queryParams);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+ Console.WriteLine("\n\nPress any key to continue to POST.");
+ Console.ReadLine();
+
+ // POST
+ string requestBody = @"{
+ 'description': 'Suggestions for products our users might like.',
+ 'is_default': false,
+ 'name': 'Magic Products'
+ }";
+ json = JsonConvert.DeserializeObject<object>(requestBody);
+ response = await client.RequestAsync(method: Client.Methods.POST,
+ urlPath: "asm/groups",
+ requestBody: json.ToString());
+ var ds_response = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(response.Body.ReadAsStringAsync().Result);
+ string group_id = ds_response["id"].ToString();
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+ Console.WriteLine("\n\nPress any key to continue to GET single.");
+ Console.ReadLine();
+
+ // GET Single
+ response = await client.RequestAsync(method: Client.Methods.GET,
+ urlPath: string.Format("asm/groups/{0}", group_id));
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+ Console.WriteLine("\n\nPress any key to continue to PATCH.");
+ Console.ReadLine();
+
+ // PATCH
+ requestBody = @"{
+ 'name': 'Cool Magic Products'
+ }";
+ json = JsonConvert.DeserializeObject<object>(requestBody);
+
+ response = await client.RequestAsync(method: Client.Methods.PATCH,
+ urlPath: string.Format("asm/groups/{0}", group_id),
+ requestBody: json.ToString());
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to PUT.");
+ Console.ReadLine();
+
+ // DELETE
+ response = await client.RequestAsync(method: Client.Methods.DELETE,
+ urlPath: string.Format("asm/groups/{0}", group_id));
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Headers.ToString());
+ Console.WriteLine("\n\nPress any key to exit.");
+ Console.ReadLine();
+ }
+ }
+}
diff --git a/src/Example/Properties/AssemblyInfo.cs b/src/Example/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..c798857
--- /dev/null
+++ b/src/Example/Properties/AssemblyInfo.cs
@@ -0,0 +1,19 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Example")]
+[assembly: AssemblyTrademark("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("4bd07a97-8ad2-4134-848e-6a74eb992050")]
diff --git a/src/Example/project.json b/src/Example/project.json
new file mode 100644
index 0000000..b39530d
--- /dev/null
+++ b/src/Example/project.json
@@ -0,0 +1,26 @@
+{
+ "version": "1.0.0-*",
+ "buildOptions": {
+ "emitEntryPoint": true
+ },
+
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "type": "platform",
+ "version": "1.0.1"
+ },
+ "SendGrid": "9.0.0-*"
+ },
+
+ "frameworks": {
+ "netcoreapp1.0": {
+ "imports": "dnxcore50",
+ "dependencies": {
+ "NETStandard.Library": "1.6.1",
+ "Newtonsoft.Json": "9.0.1",
+ "System.Net.Http": "4.3.0",
+ "WinInsider.System.Net.Http.Formatting": "1.0.1"
+ }
+ }
+ }
+}
diff --git a/src/SendGrid.nuspec b/src/SendGrid.nuspec
new file mode 100644
index 0000000..6d2241c
--- /dev/null
+++ b/src/SendGrid.nuspec
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+ <id>SendGridv9beta</id>
+ <title>SendGridv9beta</title>
+ <version>0.0.0</version>
+ <authors>Elmer Thomas</authors>
+ <owners>SendGrid</owners>
+ <description>v9beta .NET Core and .NET 4.5.X and up support</description>
+ <summary>v9beta .NET Core and .NET 4.5.X and up support</summary>
+ <licenseUrl>https://github.com/sendgrid/sendgrid-csharp/blob/master/LICENSE.txt</licenseUrl>
+ <projectUrl>https://github.com/sendgrid/sendgrid-csharp</projectUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <copyright>Copyright 2016 (c) SendGrid</copyright>
+ <language>en-US</language>
+ <tags>SendGrid</tags>
+ <dependencies>
+ <group targetFramework="net452">
+ <dependency id="Newtonsoft.Json" version="9.0.1" />
+ <dependency id="System.Net.Http" version="4.0.0" />
+ </group>
+ <group targetFramework=".NETStandard1.3">
+ <dependency id="NETStandard.Library" version="1.6.1" />
+ <dependency id="Newtonsoft.Json" version="9.0.1" />
+ <dependency id="System.ComponentModel.Primitives" version="4.1.0" />
+ <dependency id="System.Reflection.TypeExtensions" version="4.1.0" />
+ <dependency id="WinInsider.System.Net.Http.Formatting" version="1.0.1" />
+ </group>
+ </dependencies>
+ </metadata>
+ <files>
+ <file src="SendGrid/bin/Release/net452/SendGrid.dll" target="lib/net452" />
+ <file src="SendGrid/bin/Release/net452/SendGrid.pdb" target="lib/net452" />
+ <file src="SendGrid/bin/Release/net452/SendGrid.xml" target="lib/net452" />
+ <file src="SendGrid/bin/Release/netstandard1.3/SendGrid.dll" target="lib/netstandard1.3" />
+ <file src="SendGrid/bin/Release/netstandard1.3/SendGrid.pdb" target="lib/netstandard1.3" />
+ <file src="SendGrid/bin/Release/netstandard1.3/SendGrid.xml" target="lib/netstandard1.3" />
+ </files>
+</package> \ No newline at end of file
diff --git a/SendGrid/SendGrid/Client.cs b/src/SendGrid/Client.cs
index 3da0801..2cb20a0 100644
--- a/SendGrid/SendGrid/Client.cs
+++ b/src/SendGrid/Client.cs
@@ -64,7 +64,7 @@ namespace SendGrid
public string Version;
public string UrlPath;
public string MediaType;
- public WebProxy WebProxy;
+ public IWebProxy WebProxy;
public enum Methods
{
DELETE, GET, PATCH, POST, PUT
@@ -79,7 +79,7 @@ namespace SendGrid
/// <param name="version">API version, override AddVersion to customize</param>
/// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint)</param>
/// <returns>Interface to the SendGrid REST API</returns>
- public Client(WebProxy webProxy, string apiKey, string host = "https://api.sendgrid.com", Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
+ public Client(IWebProxy webProxy, string apiKey, string host = "https://api.sendgrid.com", Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
: this(apiKey, host, requestHeaders, version, urlPath)
{
WebProxy = webProxy;
@@ -96,7 +96,7 @@ namespace SendGrid
public Client(string apiKey, string host = "https://api.sendgrid.com", Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
{
Host = host;
- Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ this.GetType().GetTypeInfo().Assembly.GetName().Version.ToString();
Dictionary<string, string> defaultHeaders = new Dictionary<string, string>();
defaultHeaders.Add("Authorization", "Bearer " + apiKey);
defaultHeaders.Add("Content-Type", "application/json");
@@ -160,7 +160,7 @@ namespace SendGrid
if (queryParams != null)
{
var ds_query_params = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(queryParams);
- var query = new Uri(endpoint + "?" + string.Empty).ParseQueryString();
+ var query = new Dictionary<string, string>();
foreach (var pair in ds_query_params)
{
query[pair.Key] = pair.Value.ToString();
diff --git a/SendGrid/SendGrid/Helpers/Mail/ASM.cs b/src/SendGrid/Helpers/Mail/ASM.cs
index c12499d..f300780 100644
--- a/SendGrid/SendGrid/Helpers/Mail/ASM.cs
+++ b/src/SendGrid/Helpers/Mail/ASM.cs
@@ -1,14 +1,14 @@
-using System.Collections.Generic;
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class ASM
- {
- [JsonProperty(PropertyName = "group_id")]
- public int GroupId { get; set; }
-
- [JsonProperty(PropertyName = "groups_to_display")]
- public List<int> GroupsToDisplay { get; set; }
- }
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class ASM
+ {
+ [JsonProperty(PropertyName = "group_id")]
+ public int GroupId { get; set; }
+
+ [JsonProperty(PropertyName = "groups_to_display")]
+ public List<int> GroupsToDisplay { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/Attachment.cs b/src/SendGrid/Helpers/Mail/Attachment.cs
index 809b607..cc2bfd6 100644
--- a/SendGrid/SendGrid/Helpers/Mail/Attachment.cs
+++ b/src/SendGrid/Helpers/Mail/Attachment.cs
@@ -1,22 +1,22 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class Attachment
- {
- [JsonProperty(PropertyName = "content")]
- public string Content { get; set; }
-
- [JsonProperty(PropertyName = "type")]
- public string Type { get; set; }
-
- [JsonProperty(PropertyName = "filename")]
- public string Filename { get; set; }
-
- [JsonProperty(PropertyName = "disposition")]
- public string Disposition { get; set; }
-
- [JsonProperty(PropertyName = "content_id")]
- public string ContentId { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class Attachment
+ {
+ [JsonProperty(PropertyName = "content")]
+ public string Content { get; set; }
+
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ [JsonProperty(PropertyName = "filename")]
+ public string Filename { get; set; }
+
+ [JsonProperty(PropertyName = "disposition")]
+ public string Disposition { get; set; }
+
+ [JsonProperty(PropertyName = "content_id")]
+ public string ContentId { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/BCCSettings.cs b/src/SendGrid/Helpers/Mail/BCCSettings.cs
index 172bdec..79f989e 100644
--- a/SendGrid/SendGrid/Helpers/Mail/BCCSettings.cs
+++ b/src/SendGrid/Helpers/Mail/BCCSettings.cs
@@ -1,13 +1,13 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class BCCSettings
- {
- [JsonProperty(PropertyName = "enable")]
- public bool? Enable { get; set; }
-
- [JsonProperty(PropertyName = "email")]
- public string Email { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class BCCSettings
+ {
+ [JsonProperty(PropertyName = "enable")]
+ public bool? Enable { get; set; }
+
+ [JsonProperty(PropertyName = "email")]
+ public string Email { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/BypassListManagement.cs b/src/SendGrid/Helpers/Mail/BypassListManagement.cs
index 03e072c..cb4cfed 100644
--- a/SendGrid/SendGrid/Helpers/Mail/BypassListManagement.cs
+++ b/src/SendGrid/Helpers/Mail/BypassListManagement.cs
@@ -1,10 +1,10 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
public class BypassListManagement
{
[JsonProperty(PropertyName = "enable")]
public bool Enable { get; set; }
- }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/ClickTracking.cs b/src/SendGrid/Helpers/Mail/ClickTracking.cs
index 87f9e13..b8f82f5 100644
--- a/SendGrid/SendGrid/Helpers/Mail/ClickTracking.cs
+++ b/src/SendGrid/Helpers/Mail/ClickTracking.cs
@@ -1,13 +1,13 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class ClickTracking
- {
- [JsonProperty(PropertyName = "enable")]
- public bool? Enable { get; set; }
-
- [JsonProperty(PropertyName = "enable_text")]
- public bool? EnableText { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class ClickTracking
+ {
+ [JsonProperty(PropertyName = "enable")]
+ public bool? Enable { get; set; }
+
+ [JsonProperty(PropertyName = "enable_text")]
+ public bool? EnableText { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/Content.cs b/src/SendGrid/Helpers/Mail/Content.cs
index 9ba86b5..68b01d3 100644
--- a/SendGrid/SendGrid/Helpers/Mail/Content.cs
+++ b/src/SendGrid/Helpers/Mail/Content.cs
@@ -1,23 +1,23 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class Content
- {
- public Content()
- {
- }
-
- public Content(string type, string value)
- {
- this.Type = type;
- this.Value = value;
- }
-
- [JsonProperty(PropertyName = "type")]
- public string Type { get; set; }
-
- [JsonProperty(PropertyName = "value")]
- public string Value { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class Content
+ {
+ public Content()
+ {
+ }
+
+ public Content(string type, string value)
+ {
+ this.Type = type;
+ this.Value = value;
+ }
+
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ [JsonProperty(PropertyName = "value")]
+ public string Value { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/Email.cs b/src/SendGrid/Helpers/Mail/Email.cs
index bfca779..b4b4402 100644
--- a/SendGrid/SendGrid/Helpers/Mail/Email.cs
+++ b/src/SendGrid/Helpers/Mail/Email.cs
@@ -1,23 +1,23 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class Email
- {
- public Email()
- {
- }
-
- public Email(string email, string name = null)
- {
- this.Address = email;
- this.Name = name;
- }
-
- [JsonProperty(PropertyName = "name")]
- public string Name { get; set; }
-
- [JsonProperty(PropertyName = "email")]
- public string Address { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class Email
+ {
+ public Email()
+ {
+ }
+
+ public Email(string email, string name = null)
+ {
+ this.Address = email;
+ this.Name = name;
+ }
+
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ [JsonProperty(PropertyName = "email")]
+ public string Address { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/FooterSettings.cs b/src/SendGrid/Helpers/Mail/FooterSettings.cs
index 0b63580..5ef64f7 100644
--- a/SendGrid/SendGrid/Helpers/Mail/FooterSettings.cs
+++ b/src/SendGrid/Helpers/Mail/FooterSettings.cs
@@ -1,7 +1,7 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
public class FooterSettings
{
[JsonProperty(PropertyName = "enable")]
@@ -12,5 +12,5 @@ namespace SendGrid.Helpers.Mail
[JsonProperty(PropertyName = "html")]
public string Html { get; set; }
- }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/Ganalytics.cs b/src/SendGrid/Helpers/Mail/Ganalytics.cs
index 0609445..071da50 100644
--- a/SendGrid/SendGrid/Helpers/Mail/Ganalytics.cs
+++ b/src/SendGrid/Helpers/Mail/Ganalytics.cs
@@ -1,25 +1,25 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class Ganalytics
- {
- [JsonProperty(PropertyName = "enable")]
- public bool? Enable { get; set; }
-
- [JsonProperty(PropertyName = "utm_source")]
- public string UtmSource { get; set; }
-
- [JsonProperty(PropertyName = "utm_medium")]
- public string UtmMedium { get; set; }
-
- [JsonProperty(PropertyName = "utm_term")]
- public string UtmTerm { get; set; }
-
- [JsonProperty(PropertyName = "utm_content")]
- public string UtmContent { get; set; }
-
- [JsonProperty(PropertyName = "utm_campaign")]
- public string UtmCampaign { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class Ganalytics
+ {
+ [JsonProperty(PropertyName = "enable")]
+ public bool? Enable { get; set; }
+
+ [JsonProperty(PropertyName = "utm_source")]
+ public string UtmSource { get; set; }
+
+ [JsonProperty(PropertyName = "utm_medium")]
+ public string UtmMedium { get; set; }
+
+ [JsonProperty(PropertyName = "utm_term")]
+ public string UtmTerm { get; set; }
+
+ [JsonProperty(PropertyName = "utm_content")]
+ public string UtmContent { get; set; }
+
+ [JsonProperty(PropertyName = "utm_campaign")]
+ public string UtmCampaign { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/Mail.cs b/src/SendGrid/Helpers/Mail/Mail.cs
index 8fd618d..2aa1274 100644
--- a/SendGrid/SendGrid/Helpers/Mail/Mail.cs
+++ b/src/SendGrid/Helpers/Mail/Mail.cs
@@ -1,153 +1,153 @@
-using Newtonsoft.Json;
-using System.Collections.Generic;
-
-namespace SendGrid.Helpers.Mail
-{
- /// <summary>
- /// Class Mail builds an object that sends an email through SendGrid.
- /// </summary>
- public class Mail
- {
- public Mail()
- {
- }
-
- public Mail(Email from, string subject, Email to, Content content)
- {
- this.From = from;
-
- var personalization = new Personalization();
- personalization.AddTo(to);
- this.AddPersonalization(personalization);
-
- this.Subject = subject;
- this.AddContent(content);
- }
-
- [JsonProperty(PropertyName = "from")]
- public Email From { get; set; }
-
- [JsonProperty(PropertyName = "subject")]
- public string Subject { get; set; }
-
- [JsonProperty(PropertyName = "personalizations")]
- public List<Personalization> Personalization { get; set; }
-
- [JsonProperty(PropertyName = "content")]
- public List<Content> Contents { get; set; }
-
- [JsonProperty(PropertyName = "attachments")]
- public List<Attachment> Attachments { get; set; }
-
- [JsonProperty(PropertyName = "template_id")]
- public string TemplateId { get; set; }
-
- [JsonProperty(PropertyName = "headers")]
- public Dictionary<string, string> Headers { get; set; }
-
- [JsonProperty(PropertyName = "sections")]
- public Dictionary<string, string> Sections { get; set; }
-
- [JsonProperty(PropertyName = "categories")]
- public List<string> Categories { get; set; }
-
- [JsonProperty(PropertyName = "custom_args")]
- public Dictionary<string, string> CustomArgs { get; set; }
-
- [JsonProperty(PropertyName = "send_at")]
- public long? SendAt { get; set; }
-
- [JsonProperty(PropertyName = "asm")]
- public ASM Asm { get; set; }
-
- [JsonProperty(PropertyName = "batch_id")]
- public string BatchId { get; set; }
-
- [JsonProperty(PropertyName = "ip_pool_name")]
- public string SetIpPoolId { get; set; }
-
- [JsonProperty(PropertyName = "mail_settings")]
- public MailSettings MailSettings { get; set; }
-
- [JsonProperty(PropertyName = "tracking_settings")]
- public TrackingSettings TrackingSettings { get; set; }
-
- [JsonProperty(PropertyName = "reply_to")]
- public Email ReplyTo { get; set; }
-
- public void AddPersonalization(Personalization personalization)
- {
- if (Personalization == null)
- {
- Personalization = new List<Personalization>();
- }
- Personalization.Add(personalization);
- }
-
- public void AddContent(Content content)
- {
- if (Contents == null)
- {
- Contents = new List<Content>();
- }
- Contents.Add(content);
- }
-
- public void AddAttachment(Attachment attachment)
- {
- if (Attachments == null)
- {
- Attachments = new List<Attachment>();
- }
- Attachments.Add(attachment);
- }
-
- public void AddHeader(string key, string value)
- {
- if (Headers == null)
- {
- Headers = new Dictionary<string, string>();
- }
- Headers.Add(key, value);
- }
-
- public void AddSection(string key, string value)
- {
- if (Sections == null)
- {
- Sections = new Dictionary<string, string>();
- }
- Sections.Add(key, value);
- }
-
- public void AddCategory(string category)
- {
- if (Categories == null)
- {
- Categories = new List<string>();
- }
- Categories.Add(category);
- }
-
- public void AddCustomArgs(string key, string value)
- {
- if (CustomArgs == null)
- {
- CustomArgs = new Dictionary<string, string>();
- }
- CustomArgs.Add(key, value);
- }
-
- public string Get()
- {
- return JsonConvert.SerializeObject(this,
- Formatting.None,
- new JsonSerializerSettings
- {
- NullValueHandling = NullValueHandling.Ignore,
- DefaultValueHandling = DefaultValueHandling.Include,
- StringEscapeHandling = StringEscapeHandling.EscapeHtml
- });
- }
- }
+using Newtonsoft.Json;
+using System.Collections.Generic;
+
+namespace SendGrid.Helpers.Mail
+{
+ /// <summary>
+ /// Class Mail builds an object that sends an email through SendGrid.
+ /// </summary>
+ public class Mail
+ {
+ public Mail()
+ {
+ }
+
+ public Mail(Email from, string subject, Email to, Content content)
+ {
+ this.From = from;
+
+ var personalization = new Personalization();
+ personalization.AddTo(to);
+ this.AddPersonalization(personalization);
+
+ this.Subject = subject;
+ this.AddContent(content);
+ }
+
+ [JsonProperty(PropertyName = "from")]
+ public Email From { get; set; }
+
+ [JsonProperty(PropertyName = "subject")]
+ public string Subject { get; set; }
+
+ [JsonProperty(PropertyName = "personalizations")]
+ public List<Personalization> Personalization { get; set; }
+
+ [JsonProperty(PropertyName = "content")]
+ public List<Content> Contents { get; set; }
+
+ [JsonProperty(PropertyName = "attachments")]
+ public List<Attachment> Attachments { get; set; }
+
+ [JsonProperty(PropertyName = "template_id")]
+ public string TemplateId { get; set; }
+
+ [JsonProperty(PropertyName = "headers")]
+ public Dictionary<string, string> Headers { get; set; }
+
+ [JsonProperty(PropertyName = "sections")]
+ public Dictionary<string, string> Sections { get; set; }
+
+ [JsonProperty(PropertyName = "categories")]
+ public List<string> Categories { get; set; }
+
+ [JsonProperty(PropertyName = "custom_args")]
+ public Dictionary<string, string> CustomArgs { get; set; }
+
+ [JsonProperty(PropertyName = "send_at")]
+ public long? SendAt { get; set; }
+
+ [JsonProperty(PropertyName = "asm")]
+ public ASM Asm { get; set; }
+
+ [JsonProperty(PropertyName = "batch_id")]
+ public string BatchId { get; set; }
+
+ [JsonProperty(PropertyName = "ip_pool_name")]
+ public string SetIpPoolId { get; set; }
+
+ [JsonProperty(PropertyName = "mail_settings")]
+ public MailSettings MailSettings { get; set; }
+
+ [JsonProperty(PropertyName = "tracking_settings")]
+ public TrackingSettings TrackingSettings { get; set; }
+
+ [JsonProperty(PropertyName = "reply_to")]
+ public Email ReplyTo { get; set; }
+
+ public void AddPersonalization(Personalization personalization)
+ {
+ if (Personalization == null)
+ {
+ Personalization = new List<Personalization>();
+ }
+ Personalization.Add(personalization);
+ }
+
+ public void AddContent(Content content)
+ {
+ if (Contents == null)
+ {
+ Contents = new List<Content>();
+ }
+ Contents.Add(content);
+ }
+
+ public void AddAttachment(Attachment attachment)
+ {
+ if (Attachments == null)
+ {
+ Attachments = new List<Attachment>();
+ }
+ Attachments.Add(attachment);
+ }
+
+ public void AddHeader(string key, string value)
+ {
+ if (Headers == null)
+ {
+ Headers = new Dictionary<string, string>();
+ }
+ Headers.Add(key, value);
+ }
+
+ public void AddSection(string key, string value)
+ {
+ if (Sections == null)
+ {
+ Sections = new Dictionary<string, string>();
+ }
+ Sections.Add(key, value);
+ }
+
+ public void AddCategory(string category)
+ {
+ if (Categories == null)
+ {
+ Categories = new List<string>();
+ }
+ Categories.Add(category);
+ }
+
+ public void AddCustomArgs(string key, string value)
+ {
+ if (CustomArgs == null)
+ {
+ CustomArgs = new Dictionary<string, string>();
+ }
+ CustomArgs.Add(key, value);
+ }
+
+ public string Get()
+ {
+ return JsonConvert.SerializeObject(this,
+ Formatting.None,
+ new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore,
+ DefaultValueHandling = DefaultValueHandling.Include,
+ StringEscapeHandling = StringEscapeHandling.EscapeHtml
+ });
+ }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/MailSettings.cs b/src/SendGrid/Helpers/Mail/MailSettings.cs
index f4b2e70..1875603 100644
--- a/SendGrid/SendGrid/Helpers/Mail/MailSettings.cs
+++ b/src/SendGrid/Helpers/Mail/MailSettings.cs
@@ -1,7 +1,7 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
public class MailSettings
{
[JsonProperty(PropertyName = "bcc")]
@@ -18,5 +18,5 @@ namespace SendGrid.Helpers.Mail
[JsonProperty(PropertyName = "spam_check")]
public SpamCheck SpamCheck { get; set; }
- }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/OpenTracking.cs b/src/SendGrid/Helpers/Mail/OpenTracking.cs
index 93be8e3..b171a0b 100644
--- a/SendGrid/SendGrid/Helpers/Mail/OpenTracking.cs
+++ b/src/SendGrid/Helpers/Mail/OpenTracking.cs
@@ -1,13 +1,13 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class OpenTracking
- {
- [JsonProperty(PropertyName = "enable")]
- public bool? Enable { get; set; }
-
- [JsonProperty(PropertyName = "substitution_tag")]
- public string SubstitutionTag { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class OpenTracking
+ {
+ [JsonProperty(PropertyName = "enable")]
+ public bool? Enable { get; set; }
+
+ [JsonProperty(PropertyName = "substitution_tag")]
+ public string SubstitutionTag { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/Personalization.cs b/src/SendGrid/Helpers/Mail/Personalization.cs
index 9a642dd..47d0832 100644
--- a/SendGrid/SendGrid/Helpers/Mail/Personalization.cs
+++ b/src/SendGrid/Helpers/Mail/Personalization.cs
@@ -1,80 +1,80 @@
-using System.Collections.Generic;
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class Personalization
- {
- [JsonProperty(PropertyName = "to")]
- public List<Email> Tos { get; set; }
-
- [JsonProperty(PropertyName = "cc")]
- public List<Email> Ccs { get; set; }
-
- [JsonProperty(PropertyName = "bcc")]
- public List<Email> Bccs { get; set; }
-
- [JsonProperty(PropertyName = "subject")]
- public string Subject { get; set; }
-
- [JsonProperty(PropertyName = "headers")]
- public Dictionary<string, string> Headers { get; set; }
-
- [JsonProperty(PropertyName = "substitutions")]
- public Dictionary<string, string> Substitutions { get; set; }
-
- [JsonProperty(PropertyName = "custom_args")]
- public Dictionary<string, string> CustomArgs { get; set; }
-
- [JsonProperty(PropertyName = "send_at")]
- public long? SendAt { get; set; }
-
- public void AddTo(Email email)
- {
- if (Tos == null)
- Tos = new List<Email>();
-
- Tos.Add(email);
- }
-
- public void AddCc(Email email)
- {
- if (Ccs == null)
- Ccs = new List<Email>();
-
- Ccs.Add(email);
- }
-
- public void AddBcc(Email email)
- {
- if (Bccs == null)
- Bccs = new List<Email>();
-
- Bccs.Add(email);
- }
-
- public void AddHeader(string key, string value)
- {
- if (Headers == null)
- Headers = new Dictionary<string, string>();
-
- Headers.Add(key, value);
- }
-
- public void AddSubstitution(string key, string value)
- {
- if (Substitutions == null)
- Substitutions = new Dictionary<string, string>();
-
- Substitutions.Add(key, value);
- }
-
- public void AddCustomArgs(string key, string value)
- {
- if (CustomArgs == null)
- CustomArgs = new Dictionary<string, string>();
-
- CustomArgs.Add(key, value);
- }
- }
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class Personalization
+ {
+ [JsonProperty(PropertyName = "to")]
+ public List<Email> Tos { get; set; }
+
+ [JsonProperty(PropertyName = "cc")]
+ public List<Email> Ccs { get; set; }
+
+ [JsonProperty(PropertyName = "bcc")]
+ public List<Email> Bccs { get; set; }
+
+ [JsonProperty(PropertyName = "subject")]
+ public string Subject { get; set; }
+
+ [JsonProperty(PropertyName = "headers")]
+ public Dictionary<string, string> Headers { get; set; }
+
+ [JsonProperty(PropertyName = "substitutions")]
+ public Dictionary<string, string> Substitutions { get; set; }
+
+ [JsonProperty(PropertyName = "custom_args")]
+ public Dictionary<string, string> CustomArgs { get; set; }
+
+ [JsonProperty(PropertyName = "send_at")]
+ public long? SendAt { get; set; }
+
+ public void AddTo(Email email)
+ {
+ if (Tos == null)
+ Tos = new List<Email>();
+
+ Tos.Add(email);
+ }
+
+ public void AddCc(Email email)
+ {
+ if (Ccs == null)
+ Ccs = new List<Email>();
+
+ Ccs.Add(email);
+ }
+
+ public void AddBcc(Email email)
+ {
+ if (Bccs == null)
+ Bccs = new List<Email>();
+
+ Bccs.Add(email);
+ }
+
+ public void AddHeader(string key, string value)
+ {
+ if (Headers == null)
+ Headers = new Dictionary<string, string>();
+
+ Headers.Add(key, value);
+ }
+
+ public void AddSubstitution(string key, string value)
+ {
+ if (Substitutions == null)
+ Substitutions = new Dictionary<string, string>();
+
+ Substitutions.Add(key, value);
+ }
+
+ public void AddCustomArgs(string key, string value)
+ {
+ if (CustomArgs == null)
+ CustomArgs = new Dictionary<string, string>();
+
+ CustomArgs.Add(key, value);
+ }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/README.md b/src/SendGrid/Helpers/Mail/README.md
index 67c1933..67c1933 100644
--- a/SendGrid/SendGrid/Helpers/Mail/README.md
+++ b/src/SendGrid/Helpers/Mail/README.md
diff --git a/SendGrid/SendGrid/Helpers/Mail/SandboxMode.cs b/src/SendGrid/Helpers/Mail/SandboxMode.cs
index f3bf237..7dea93e 100644
--- a/SendGrid/SendGrid/Helpers/Mail/SandboxMode.cs
+++ b/src/SendGrid/Helpers/Mail/SandboxMode.cs
@@ -1,10 +1,10 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class SandboxMode
- {
- [JsonProperty(PropertyName = "enable")]
- public bool? Enable { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class SandboxMode
+ {
+ [JsonProperty(PropertyName = "enable")]
+ public bool? Enable { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/SpamCheck.cs b/src/SendGrid/Helpers/Mail/SpamCheck.cs
index abf39ca..8b1abf4 100644
--- a/SendGrid/SendGrid/Helpers/Mail/SpamCheck.cs
+++ b/src/SendGrid/Helpers/Mail/SpamCheck.cs
@@ -1,16 +1,16 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class SpamCheck
- {
- [JsonProperty(PropertyName = "enable")]
- public bool? Enable { get; set; }
-
- [JsonProperty(PropertyName = "threshold")]
- public int? Threshold { get; set; }
-
- [JsonProperty(PropertyName = "post_to_url")]
- public string PostToUrl { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class SpamCheck
+ {
+ [JsonProperty(PropertyName = "enable")]
+ public bool? Enable { get; set; }
+
+ [JsonProperty(PropertyName = "threshold")]
+ public int? Threshold { get; set; }
+
+ [JsonProperty(PropertyName = "post_to_url")]
+ public string PostToUrl { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/SubscriptionTracking.cs b/src/SendGrid/Helpers/Mail/SubscriptionTracking.cs
index c34e9c8..ce5704e 100644
--- a/SendGrid/SendGrid/Helpers/Mail/SubscriptionTracking.cs
+++ b/src/SendGrid/Helpers/Mail/SubscriptionTracking.cs
@@ -1,7 +1,7 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
public class SubscriptionTracking
{
[JsonProperty(PropertyName = "enable")]
@@ -15,5 +15,5 @@ namespace SendGrid.Helpers.Mail
[JsonProperty(PropertyName = "substitution_tag")]
public string SubstitutionTag { get; set; }
- }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Helpers/Mail/TrackingSettings.cs b/src/SendGrid/Helpers/Mail/TrackingSettings.cs
index 3a453f8..73f8056 100644
--- a/SendGrid/SendGrid/Helpers/Mail/TrackingSettings.cs
+++ b/src/SendGrid/Helpers/Mail/TrackingSettings.cs
@@ -1,19 +1,19 @@
-using Newtonsoft.Json;
-
-namespace SendGrid.Helpers.Mail
-{
- public class TrackingSettings
- {
- [JsonProperty(PropertyName = "click_tracking")]
- public ClickTracking ClickTracking { get; set; }
-
- [JsonProperty(PropertyName = "open_tracking")]
- public OpenTracking OpenTracking { get; set; }
-
- [JsonProperty(PropertyName = "subscription_tracking")]
- public SubscriptionTracking SubscriptionTracking { get; set; }
-
- [JsonProperty(PropertyName = "ganalytics")]
- public Ganalytics Ganalytics { get; set; }
- }
+using Newtonsoft.Json;
+
+namespace SendGrid.Helpers.Mail
+{
+ public class TrackingSettings
+ {
+ [JsonProperty(PropertyName = "click_tracking")]
+ public ClickTracking ClickTracking { get; set; }
+
+ [JsonProperty(PropertyName = "open_tracking")]
+ public OpenTracking OpenTracking { get; set; }
+
+ [JsonProperty(PropertyName = "subscription_tracking")]
+ public SubscriptionTracking SubscriptionTracking { get; set; }
+
+ [JsonProperty(PropertyName = "ganalytics")]
+ public Ganalytics Ganalytics { get; set; }
+ }
} \ No newline at end of file
diff --git a/SendGrid/SendGrid/Properties/AssemblyInfo.cs b/src/SendGrid/Properties/AssemblyInfo.cs
index 9ac512b..1b64038 100644
--- a/SendGrid/SendGrid/Properties/AssemblyInfo.cs
+++ b/src/SendGrid/Properties/AssemblyInfo.cs
@@ -5,14 +5,10 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("SendGrid")]
-[assembly: AssemblyDescription("A client library for SendGrid Web API v3 endpoints")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("SendGrid")]
+[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SendGrid")]
-[assembly: AssemblyCopyright("Copyright © SendGrid 2016")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
@@ -20,17 +16,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1c318867-440b-4eb9-99e3-c0cc2c556962")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("9.0.0")]
-[assembly: AssemblyFileVersion("9.0.0")]
+[assembly: Guid("377c20e4-2297-488f-933b-fb635c56d8fc")]
diff --git a/src/SendGrid/SendGrid.xproj b/src/SendGrid/SendGrid.xproj
new file mode 100644
index 0000000..c3a2b06
--- /dev/null
+++ b/src/SendGrid/SendGrid.xproj
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+ </PropertyGroup>
+
+ <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>377c20e4-2297-488f-933b-fb635c56d8fc</ProjectGuid>
+ <RootNamespace>SendGrid</RootNamespace>
+ <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
+ <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
+ <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <SchemaVersion>2.0</SchemaVersion>
+ </PropertyGroup>
+ <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
+</Project>
diff --git a/src/SendGrid/project.json b/src/SendGrid/project.json
new file mode 100644
index 0000000..3beab98
--- /dev/null
+++ b/src/SendGrid/project.json
@@ -0,0 +1,46 @@
+{
+ "buildOptions": {
+ "emitEntryPoint": false,
+ "keyFile": "../../tools/sendgrid-csharp.snk",
+ "xmlDoc": true,
+ "platform": "anycpu",
+ "compile": {
+ }
+ },
+ "configurations": {
+ "Release": {
+ "buildOptions": {
+ "warningsAsErrors": false
+ }
+ }
+ },
+ "dependencies": {
+ "Microsoft.AspNetCore.Http.Abstractions": "1.1.0"
+ },
+ "frameworks": {
+ "netstandard1.3": {
+ "buildOptions": {
+ "define": [ "NETSTANDARD" ]
+ },
+ "imports": "dnxcore50",
+ "dependencies": {
+ "NETStandard.Library": "1.6.1",
+ "Newtonsoft.Json": "9.0.1",
+ "System.Reflection.TypeExtensions": "4.1.0"
+ }
+ },
+ "net452": {
+ "buildOptions": {
+ "define": [ "NET452" ]
+ },
+ "dependencies": {
+ "Newtonsoft.Json": "9.0.1",
+ "System.Net.Http": "4.0.0"
+ },
+ "frameworkAssemblies": {
+ "System.Runtime.Serialization": "4.0.0"
+ }
+ }
+ },
+ "version": "9.0.0-*"
+}