diff options
author | Elmer Thomas <elmer@ThinkingSerious.com> | 2016-11-30 14:42:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-30 14:42:04 -0800 |
commit | 3131327a73273df4485a26de5ad4ec645918f8b3 (patch) | |
tree | daac1edeadeb95ea51aa40d78896f5bc02890e62 | |
parent | 9a5dbe23a2ccd57316cb8f8d57c7c51d67cc7ca3 (diff) | |
parent | 89f5252c13026a4ae8ab1da62be6b743a01bf665 (diff) | |
download | sendgrid-csharp-3131327a73273df4485a26de5ad4ec645918f8b3.zip sendgrid-csharp-3131327a73273df4485a26de5ad4ec645918f8b3.tar.gz sendgrid-csharp-3131327a73273df4485a26de5ad4ec645918f8b3.tar.bz2 |
Merge pull request #356 from sendgrid/remove-dynamic
Initial removal of dynamic with some Client refactoring
35 files changed, 1182 insertions, 1217 deletions
@@ -30,7 +30,7 @@ We appreciate your continued support, thank you! ## Prerequisites -- .NET version 4.5.2 +- .NET version 4.5 and above - The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-csharp) ## Setup Environment Variables @@ -51,14 +51,13 @@ For a sample implementation, check the [Example](https://github.com/sendgrid/sen Add the following namespaces to use the library: ```csharp using System; -using System.Web.Script.Serialization; using SendGrid; -using SendGrid.Helpers.Mail; // Include if you want to use the Mail Helper +using SendGrid.Helpers.Mail; // If you are using the Mail Helper +using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer ``` ## Dependencies -- [SendGrid.CSharp.HTTP.Client](https://github.com/sendgrid/csharp-http-client) - [Newtonsoft.Json](http://www.newtonsoft.com/json) <a name="quick_start"></a> @@ -72,9 +71,11 @@ The following is the minimum needed code to send an email with the [/mail/send H ```csharp using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer using SendGrid; using SendGrid.Helpers.Mail; -using System.Threading.Tasks; namespace Example { @@ -82,13 +83,13 @@ namespace Example { private static void Main() { - Execute().Wait(); + Execute().Wait(); } static async Task Execute() { string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGridAPIClient(apiKey); + Client client = new Client(apiKey); Email from = new Email("test@example.com"); string subject = "Hello World from the SendGrid CSharp Library!"; @@ -96,7 +97,9 @@ namespace Example Content content = new Content("text/plain", "Hello, Email!"); Mail mail = new Mail(from, subject, to, content); - dynamic response = await sg.client.mail.send.post(requestBody: mail.Get()); + Response response = await client.RequestAsync(method: Client.Methods.POST, + requestBody: mail.Get(), + urlPath: "mail/send"); } } } @@ -110,9 +113,10 @@ The following is the minimum needed code to send an email without the /mail/send ```csharp using System; -using SendGrid; -using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer +using System.Collections.Generic; using System.Threading.Tasks; +using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer +using SendGrid; namespace Example { @@ -120,13 +124,13 @@ namespace Example { private static void Main() { - Execute().Wait(); + Execute().Wait(); } static async Task Execute() { - String apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGridAPIClient(apiKey); + string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); + Client client = new Client(apiKey); string data = @"{ 'personalizations': [ @@ -150,39 +154,15 @@ namespace Example ] }"; Object json = JsonConvert.DeserializeObject<Object>(data); - dynamic response = await sg.client.mail.send.post(requestBody: json.ToString()); - } - } -} -``` - -## General v3 Web API Usage (With Fluent Interface) - -```csharp -using System; -using SendGrid; -using System.Threading.Tasks; - -namespace Example -{ - internal class Example - { - private static void Main() - { - Execute().Wait(); + Response response = await client.RequestAsync(method: Client.Methods.POST, + requestBody: json.ToString(), + urlPath: "mail/send"); } - - static async Task Execute() - { - string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGrid.SendGridAPIClient(apiKey); - dynamic response = await sg.client.suppression.bounces.get(); - } } } ``` -## General v3 Web API Usage (Without Fluent Interface) +## General v3 Web API Usage ```csharp using System; @@ -200,10 +180,12 @@ namespace Example static async Task Execute() { - string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGrid.SendGridAPIClient(apiKey); - dynamic response = await sg.client._("suppression/bounces").get(); - } + string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); + Client client = new Client(apiKey); + Response response = await client.RequestAsync(method: Client.Methods.GET, + requestBody: json.ToString(), + urlPath: "suppression/bounces"); + } } } ``` diff --git a/SendGrid/Example/Example.cs b/SendGrid/Example/Example.cs index 2011a06..0f6c8a3 100644 --- a/SendGrid/Example/Example.cs +++ b/SendGrid/Example/Example.cs @@ -1,9 +1,9 @@ using System;
using System.Collections.Generic;
-using System.Web.Script.Serialization;
-using SendGrid.Helpers.Mail;
-using Newtonsoft.Json;
using System.Threading.Tasks;
+using Newtonsoft.Json;
+using SendGrid;
+using SendGrid.Helpers.Mail;
namespace Example
{
@@ -12,28 +12,28 @@ namespace Example private static void Main()
{
// v3 Mail Helper
- HelloEmail().Wait(); // this will actually send an email
- KitchenSink().Wait(); // this will only send an email if you set SandBox Mode to false
+ //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
- TemplateWithHelper().Wait();
+ //TemplateWithHelperAsync().Wait();
// v3 Template Example without Mail Helper
- TemplateWithoutHelper().Wait();
+ //TemplateWithoutHelperAsync().Wait();
// v3 Web API
- ApiKeys().Wait();
-
+ ASMGroupsAsync().Wait();
}
- private static async Task TemplateWithHelper()
+ private static async Task TemplateWithHelperAsync()
{
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+ string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY",
+ EnvironmentVariableTarget.User);
+ Client client = new Client(apiKey: apiKey);
- Email from = new Email("dx@sendgrid.com");
- String subject = "I'm replacing the subject tag";
- Email to = new Email("elmer@sendgrid.com");
+ 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);
@@ -41,26 +41,26 @@ namespace Example mail.Personalization[0].AddSubstitution("-name-", "Example User");
mail.Personalization[0].AddSubstitution("-city-", "Denver");
- dynamic response = await sg.client.mail.send.post(requestBody: mail.Get());
+ 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 TemplateWithoutHelper()
+ private static async Task TemplateWithoutHelperAsync()
{
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+ string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ Client client = new Client(apiKey);
string data = @"{
'personalizations': [
{
'to': [
{
- 'email': 'elmer@sendgrid.com'
+ 'email': 'test@example.com'
}
],
'substitutions': {
@@ -71,7 +71,7 @@ namespace Example }
],
'from': {
- 'email': 'dx@sendgrid.com'
+ 'email': 'test@example.com'
},
'content': [
{
@@ -82,44 +82,43 @@ namespace Example 'template_id': '13b8f94f-bcae-4ec6-b752-70d6cb59f932'
}";
//test @example.com
- Object json = JsonConvert.DeserializeObject<Object>(data);
- dynamic response = await sg.client.mail.send.post(requestBody: json.ToString());
+ 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 HelloEmail()
+ private static async Task HelloEmailAsync()
{
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+ 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";
+ 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);
- dynamic response = await sg.client.mail.send.post(requestBody: mail.Get());
+ 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.WriteLine(mail.Get());
Console.ReadLine();
-
}
- private static async Task KitchenSink()
+ private static async Task KitchenSinkAsync()
{
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+ string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ Client client = new Client(apiKey);
Mail mail = new Mail();
@@ -303,96 +302,81 @@ namespace Example email.Address = "test@example.com";
mail.ReplyTo = email;
- dynamic response = await sg.client.mail.send.post(requestBody: mail.Get());
+ 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.WriteLine(mail.Get());
Console.ReadLine();
}
- private static async Task ApiKeys()
+ private static async Task ASMGroupsAsync()
{
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+ string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ Client client = new Client(apiKey);
+ // GET Collection
string queryParams = @"{
'limit': 100
}";
- dynamic response = await sg.client.api_keys.get(queryParams: queryParams);
+ 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 = @"{
- 'name': 'My API Key 5',
- 'scopes': [
- 'mail.send',
- 'alerts.create',
- 'alerts.read'
- ]
+ 'description': 'Suggestions for products our users might like.',
+ 'is_default': false,
+ 'name': 'Magic Products'
}";
- Object json = JsonConvert.DeserializeObject<Object>(requestBody);
- response = await sg.client.api_keys.post(requestBody: json.ToString());
+ 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());
- JavaScriptSerializer jss = new JavaScriptSerializer();
- var ds_response = jss.Deserialize<Dictionary<string, dynamic>>(response.Body.ReadAsStringAsync().Result);
- string api_key_id = ds_response["api_key_id"];
-
Console.WriteLine("\n\nPress any key to continue to GET single.");
Console.ReadLine();
// GET Single
- response = await sg.client.api_keys._(api_key_id).get();
+ 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': 'A New Hope'
+ 'name': 'Cool Magic Products'
}";
- json = JsonConvert.DeserializeObject<Object>(requestBody);
- response = await sg.client.api_keys._(api_key_id).patch(requestBody: json.ToString());
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Body.ReadAsStringAsync().Result);
- Console.WriteLine(response.Headers.ToString());
+ json = JsonConvert.DeserializeObject<object>(requestBody);
- Console.WriteLine("\n\nPress any key to continue to PUT.");
- Console.ReadLine();
-
- // PUT
- requestBody = @"{
- 'name': 'A New Hope',
- 'scopes': [
- ' user.profile.read',
- ' user.profile.update'
- ]
- }";
- json = JsonConvert.DeserializeObject<Object>(requestBody);
- response = await sg.client.api_keys._(api_key_id).put(requestBody: json.ToString());
+ 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 DELETE.");
+ Console.WriteLine("\n\nPress any key to continue to PUT.");
Console.ReadLine();
// DELETE
- response = await sg.client.api_keys._(api_key_id).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/SendGrid/Example/Properties/AssemblyInfo.cs index d380c76..13b7c8a 100644 --- a/SendGrid/Example/Properties/AssemblyInfo.cs +++ b/SendGrid/Example/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Example")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyCopyright("Copyright © SendGrid 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -34,6 +34,5 @@ using System.Runtime.InteropServices; // 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("8.0.4")]
-[assembly: AssemblyFileVersion("8.0.4")]
+[assembly: AssemblyVersion("9.0.0")]
+[assembly: AssemblyFileVersion("9.0.0")]
diff --git a/SendGrid/SendGrid/Client.cs b/SendGrid/SendGrid/Client.cs index e4e4d8c..3da0801 100644 --- a/SendGrid/SendGrid/Client.cs +++ b/SendGrid/SendGrid/Client.cs @@ -1,48 +1,16 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; -using System.Dynamic; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; +using System.Reflection; using System.Text; using System.Threading.Tasks; -using System.Web.Script.Serialization; -using System.Web; -using System.Reflection; namespace SendGrid { - public class SendGridAPIClient - { - private string _apiKey; - public string Version; - public dynamic client; - private Uri _baseUri; - private enum Methods - { - GET, POST, PATCH, DELETE - } - - /// <summary> - /// Create a client that connects to the SendGrid Web API - /// </summary> - /// <param name="apiKey">Your SendGrid API Key</param> - /// <param name="baseUri">Base SendGrid API Uri</param> - public SendGridAPIClient(string apiKey, String baseUri = "https://api.sendgrid.com", String version = "v3") - { - _baseUri = new Uri(baseUri); - _apiKey = apiKey; - Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); - Dictionary<String, String> requestHeaders = new Dictionary<String, String>(); - requestHeaders.Add("Authorization", "Bearer " + apiKey); - requestHeaders.Add("Content-Type", "application/json"); - requestHeaders.Add("User-Agent", "sendgrid/" + Version + " csharp"); - requestHeaders.Add("Accept", "application/json"); - client = new Client(host: baseUri, requestHeaders: requestHeaders, version: version); - } - } - public class Response { public HttpStatusCode StatusCode; @@ -69,8 +37,7 @@ namespace SendGrid /// <returns>Dictionary object representation of HttpContent</returns> public virtual Dictionary<string, dynamic> DeserializeResponseBody(HttpContent content) { - JavaScriptSerializer jss = new JavaScriptSerializer(); - var dsContent = jss.Deserialize<Dictionary<string, dynamic>>(content.ReadAsStringAsync().Result); + var dsContent = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(content.ReadAsStringAsync().Result); return dsContent; } @@ -90,7 +57,7 @@ namespace SendGrid } } - public class Client : DynamicObject + public class Client { public string Host; public Dictionary<string, string> RequestHeaders; @@ -111,9 +78,9 @@ namespace SendGrid /// <param name="requestHeaders">A dictionary of request headers</param> /// <param name="version">API version, override AddVersion to customize</param> /// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint)</param> - /// <returns>Fluent interface to a REST API</returns> - public Client(WebProxy webProxy, string host, Dictionary<string, string> requestHeaders = null, string version = null, string urlPath = null) - : this(host, requestHeaders, version, urlPath) + /// <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) + : this(apiKey, host, requestHeaders, version, urlPath) { WebProxy = webProxy; } @@ -125,16 +92,23 @@ namespace SendGrid /// <param name="requestHeaders">A dictionary of request headers</param> /// <param name="version">API version, override AddVersion to customize</param> /// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint)</param> - /// <returns>Fluent interface to a REST API</returns> - public Client(string host, Dictionary<string, string> requestHeaders = null, string version = null, string urlPath = null) + /// <returns>Interface to the SendGrid REST API</returns> + 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(); + Dictionary<string, string> defaultHeaders = new Dictionary<string, string>(); + defaultHeaders.Add("Authorization", "Bearer " + apiKey); + defaultHeaders.Add("Content-Type", "application/json"); + defaultHeaders.Add("User-Agent", "sendgrid/" + Version + " csharp"); + defaultHeaders.Add("Accept", "application/json"); + AddRequestHeader(defaultHeaders); if (requestHeaders != null) { AddRequestHeader(requestHeaders); } - Version = (version != null) ? version : null; - UrlPath = (urlPath != null) ? urlPath : null; + SetVersion(version); + SetUrlPath(urlPath); } /// <summary> @@ -148,6 +122,24 @@ namespace SendGrid } /// <summary> + /// Set or update the UrlPath + /// </summary> + /// <param name="urlPath">The endpoint without a leading or trailing slash</param> + public void SetUrlPath(string urlPath) + { + UrlPath = urlPath; + } + + /// <summary> + /// Get the urlPath to the API endpoint + /// </summary> + /// <returns>Url path to the API endpoint</returns> + public string GetUrlPath() + { + return UrlPath; + } + + /// <summary> /// Build the final URL /// </summary> /// <param name="queryParams">A string of JSON formatted query parameters (e.g {'param': 'param_value'})</param> @@ -156,9 +148,9 @@ namespace SendGrid { string endpoint = null; - if (Version != null) + if (GetVersion() != null) { - endpoint = Host + "/" + Version + UrlPath; + endpoint = Host + "/" + GetVersion() + "/" + UrlPath; } else { @@ -167,9 +159,8 @@ namespace SendGrid if (queryParams != null) { - JavaScriptSerializer jss = new JavaScriptSerializer(); - var ds_query_params = jss.Deserialize<Dictionary<string, dynamic>>(queryParams); - var query = HttpUtility.ParseQueryString(string.Empty); + var ds_query_params = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(queryParams); + var query = new Uri(endpoint + "?" + string.Empty).ParseQueryString(); foreach (var pair in ds_query_params) { query[pair.Key] = pair.Value.ToString(); @@ -182,29 +173,6 @@ namespace SendGrid } /// <summary> - /// Create a new Client object for method chaining - /// </summary> - /// <param name="name">Name of url segment to add to the URL</param> - /// <returns>A new client object with "name" added to the URL</returns> - private Client BuildClient(string name = null) - { - string endpoint; - - if (name != null) - { - endpoint = UrlPath + "/" + name; - } - else - { - endpoint = UrlPath; - } - - UrlPath = null; // Reset the current object's state before we return a new one - return new Client(Host, RequestHeaders, Version, endpoint); - - } - - /// <summary> /// Factory method to return the right HttpClient settings. /// </summary> /// <returns>Instance of HttpClient</returns> @@ -241,83 +209,18 @@ namespace SendGrid /// Add the version of the API, override to customize /// </summary> /// <param name="version">Version string to add to the URL</param> - public virtual void AddVersion(string version) + public void SetVersion(string version) { Version = version; } /// <summary> - /// Deal with special cases and URL parameters + /// Get the version of the API, override to customize /// </summary> - /// <param name="name">Name of URL segment</param> - /// <returns>A new client object with "name" added to the URL</returns> - public Client _(string name) + /// <returns>Version of the API</param> + public string GetVersion() { - return BuildClient(name); - } - - /// <summary> - /// Reflection. We capture undefined variable access here - /// </summary> - /// <param name="binder">The calling object properties</param> - /// <param name="result">The callback</param> - /// <returns>The callback returns a new client object with "name" added to the URL</returns> - public override bool TryGetMember(GetMemberBinder binder, out object result) - { - result = BuildClient(binder.Name); - return true; - } - - /// <summary> - /// Reflection. We capture the final method call here - /// </summary> - /// <param name="binder">The calling object properties</param> - /// <param name="args">The calling object's arguements</param> - /// <param name="result">If "version", returns new client with version attached - /// If "method", returns a Response object</param> - /// <returns>The callback is described in "result"</returns> - public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) - { - if (binder.Name == "version") - { - AddVersion(args[0].ToString()); - result = BuildClient(); - return true; - } - - if (Enum.IsDefined(typeof(Methods), binder.Name.ToUpper())) - { - string queryParams = null; - string requestBody = null; - int i = 0; - - foreach (object obj in args) - { - string name = binder.CallInfo.ArgumentNames.Count > i ? - binder.CallInfo.ArgumentNames[i] : null; - if (name == "queryParams") - { - queryParams = obj.ToString(); - } - else if (name == "requestBody") - { - requestBody = obj.ToString(); - } - else if (name == "requestHeaders") - { - AddRequestHeader((Dictionary<string, string>)obj); - } - i++; - } - result = RequestAsync(binder.Name.ToUpper(), requestBody: requestBody, queryParams: queryParams).ConfigureAwait(false); - return true; - } - else - { - result = null; - return false; - } - + return Version; } /// <summary> @@ -337,9 +240,13 @@ namespace SendGrid /// </summary> /// <param name="method">HTTP verb</param> /// <param name="requestBody">JSON formatted string</param> - /// <param name="queryParams">JSON formatted queary paramaters</param> + /// <param name="queryParams">JSON formatted query paramaters</param> /// <returns>Response object</returns> - private async Task<Response> RequestAsync(string method, string requestBody = null, string queryParams = null) + public async Task<Response> RequestAsync(Client.Methods method, + string requestBody = null, + Dictionary<string, string> requestHeaders = null, + string queryParams = null, + string urlPath = null) { using (var client = BuildHttpClient()) { @@ -347,9 +254,17 @@ namespace SendGrid { // Build the URL client.BaseAddress = new Uri(Host); + if (urlPath != null) + { + SetUrlPath(urlPath); + } string endpoint = BuildUrl(queryParams); // Build the request headers + if (requestHeaders != null) + { + AddRequestHeader(requestHeaders); + } client.DefaultRequestHeaders.Accept.Clear(); if (RequestHeaders != null) { @@ -381,7 +296,7 @@ namespace SendGrid // Build the final request HttpRequestMessage request = new HttpRequestMessage { - Method = new HttpMethod(method), + Method = new HttpMethod(method.ToString()), RequestUri = new Uri(endpoint), Content = content }; diff --git a/SendGrid/SendGrid/Properties/AssemblyInfo.cs b/SendGrid/SendGrid/Properties/AssemblyInfo.cs index bc6a5fa..9ac512b 100644 --- a/SendGrid/SendGrid/Properties/AssemblyInfo.cs +++ b/SendGrid/SendGrid/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("SendGrid")] [assembly: AssemblyProduct("SendGrid")] -[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyCopyright("Copyright © SendGrid 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 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("8.0.4")] -[assembly: AssemblyFileVersion("8.0.4")] +[assembly: AssemblyVersion("9.0.0")] +[assembly: AssemblyFileVersion("9.0.0")] diff --git a/SendGrid/UnitTest/Properties/AssemblyInfo.cs b/SendGrid/UnitTest/Properties/AssemblyInfo.cs index 4e1a953..211a7d5 100644 --- a/SendGrid/UnitTest/Properties/AssemblyInfo.cs +++ b/SendGrid/UnitTest/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UnitTest")] -[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyCopyright("Copyright © SendGrid 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 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("8.0.4")] -[assembly: AssemblyFileVersion("8.0.4")] +[assembly: AssemblyVersion("9.0.0")] +[assembly: AssemblyFileVersion("9.0.0")] diff --git a/SendGrid/UnitTest/UnitTest.cs b/SendGrid/UnitTest/UnitTest.cs index ecf6f1c..3bc1da4 100644 --- a/SendGrid/UnitTest/UnitTest.cs +++ b/SendGrid/UnitTest/UnitTest.cs @@ -1,5 +1,6 @@ using System;
using NUnit.Framework;
+using SendGrid;
using SendGrid.Helpers.Mail;
using System.Collections.Generic;
using System.Net;
@@ -12,9 +13,8 @@ namespace UnitTest [TestFixture]
public class UnitTests
{
- static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
+ static string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
static string host = "http://localhost:4010";
- public dynamic sg = new SendGrid.SendGridAPIClient(_apiKey, host);
Process process = new Process();
[TestFixtureSetUp]
@@ -69,7 +69,7 @@ namespace UnitTest String ret = mail.Get();
String final = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ret),
Formatting.None,
- new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Include });
+ 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>\"}]}");
}
@@ -262,186 +262,8 @@ namespace UnitTest String ret = mail.Get();
String final = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ret),
Formatting.None,
- new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Include });
- 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\"}}");
- }
-
- // All paramaters available for sending an email
- [Test]
- public void TestKitchenSinkInverse()
- {
- 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 = false;
- mailSettings.BccSettings = bccSettings;
- BypassListManagement bypassListManagement = new BypassListManagement();
- bypassListManagement.Enable = false;
- mailSettings.BypassListManagement = bypassListManagement;
- FooterSettings footerSettings = new FooterSettings();
- footerSettings.Enable = false;
- mailSettings.FooterSettings = footerSettings;
- SandboxMode sandboxMode = new SandboxMode();
- sandboxMode.Enable = false;
- mailSettings.SandboxMode = sandboxMode;
- SpamCheck spamCheck = new SpamCheck();
- spamCheck.Enable = false;
- mailSettings.SpamCheck = spamCheck;
- mail.MailSettings = mailSettings;
-
- TrackingSettings trackingSettings = new TrackingSettings();
- ClickTracking clickTracking = new ClickTracking();
- clickTracking.Enable = false;
- trackingSettings.ClickTracking = clickTracking;
- OpenTracking openTracking = new OpenTracking();
- openTracking.Enable = false;
- trackingSettings.OpenTracking = openTracking;
- SubscriptionTracking subscriptionTracking = new SubscriptionTracking();
- subscriptionTracking.Enable = false;
- trackingSettings.SubscriptionTracking = subscriptionTracking;
- Ganalytics ganalytics = new Ganalytics();
- ganalytics.Enable = false;
- 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\":false},\"bypass_list_management\":{\"enable\":false},\"footer\":{\"enable\":false},\"sandbox_mode\":{\"enable\":false},\"spam_check\":{\"enable\":false}},\"tracking_settings\":{\"click_tracking\":{\"enable\":false},\"open_tracking\":{\"enable\":false},\"subscription_tracking\":{\"enable\":false},\"ganalytics\":{\"enable\":false}},\"reply_to\":{\"email\":\"test@example.com\"}}");
+ 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]
@@ -453,7 +275,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.access_settings.activity.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -478,7 +301,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.access_settings.whitelist.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -488,7 +312,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.access_settings.whitelist.get(requestHeaders: headers);
+ 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);
}
@@ -507,7 +332,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.access_settings.whitelist.delete(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -518,7 +344,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.access_settings.whitelist._(rule_id).get(requestHeaders: headers);
+ 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);
}
@@ -529,7 +356,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.access_settings.whitelist._(rule_id).delete(requestHeaders: headers);
+ 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);
}
@@ -546,7 +374,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.alerts.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -556,7 +385,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.alerts.get(requestHeaders: headers);
+ 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);
}
@@ -572,7 +402,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.alerts._(alert_id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -583,7 +414,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.alerts._(alert_id).get(requestHeaders: headers);
+ 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);
}
@@ -594,7 +426,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.alerts._(alert_id).delete(requestHeaders: headers);
+ 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);
}
@@ -615,7 +448,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.api_keys.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -628,7 +462,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.api_keys.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -648,7 +483,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.api_keys._(api_key_id).put(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -664,7 +500,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.api_keys._(api_key_id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -675,7 +512,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.api_keys._(api_key_id).get(requestHeaders: headers);
+ 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);
}
@@ -686,7 +524,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.api_keys._(api_key_id).delete(requestHeaders: headers);
+ 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);
}
@@ -703,7 +542,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.asm.groups.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -716,7 +556,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.asm.groups.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -734,7 +575,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.asm.groups._(group_id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -745,7 +587,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.asm.groups._(group_id).get(requestHeaders: headers);
+ 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);
}
@@ -756,7 +599,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.asm.groups._(group_id).delete(requestHeaders: headers);
+ 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);
}
@@ -775,7 +619,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.asm.groups._(group_id).suppressions.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -786,7 +631,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.asm.groups._(group_id).suppressions.get(requestHeaders: headers);
+ 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);
}
@@ -806,7 +652,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.asm.groups._(group_id).suppressions.search.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -818,7 +665,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.asm.groups._(group_id).suppressions._(email).delete(requestHeaders: headers);
+ 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);
}
@@ -828,7 +676,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.asm.suppressions.get(requestHeaders: headers);
+ 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);
}
@@ -846,7 +695,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.asm.suppressions.global.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -857,7 +707,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.asm.suppressions.global._(email).get(requestHeaders: headers);
+ 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);
}
@@ -868,7 +719,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.asm.suppressions.global._(email).delete(requestHeaders: headers);
+ 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);
}
@@ -879,7 +731,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.asm.suppressions._(email).get(requestHeaders: headers);
+ 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);
}
@@ -897,7 +750,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.browsers.stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -929,7 +783,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.campaigns.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -943,7 +798,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.campaigns.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -965,7 +821,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.campaigns._(campaign_id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -976,7 +833,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.campaigns._(campaign_id).get(requestHeaders: headers);
+ 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);
}
@@ -987,7 +845,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.campaigns._(campaign_id).delete(requestHeaders: headers);
+ 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);
}
@@ -1003,7 +862,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.campaigns._(campaign_id).schedules.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1019,7 +879,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.campaigns._(campaign_id).schedules.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1030,7 +891,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.campaigns._(campaign_id).schedules.get(requestHeaders: headers);
+ 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);
}
@@ -1041,7 +903,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.campaigns._(campaign_id).schedules.delete(requestHeaders: headers);
+ 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);
}
@@ -1052,7 +915,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.campaigns._(campaign_id).schedules.now.post(requestHeaders: headers);
+ 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);
}
@@ -1068,7 +932,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.campaigns._(campaign_id).schedules.test.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1083,7 +948,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.categories.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1101,7 +967,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.categories.stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1120,7 +987,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.categories.stats.sums.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1135,7 +1003,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.clients.stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1151,7 +1020,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.clients._(client_type).stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1167,7 +1037,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.contactdb.custom_fields.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1177,7 +1048,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.custom_fields.get(requestHeaders: headers);
+ 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);
}
@@ -1188,7 +1060,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.custom_fields._(custom_field_id).get(requestHeaders: headers);
+ 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);
}
@@ -1199,7 +1072,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "202");
- dynamic response = await sg.client.contactdb.custom_fields._(custom_field_id).delete(requestHeaders: headers);
+ 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);
}
@@ -1214,7 +1088,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.contactdb.lists.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1224,7 +1099,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.lists.get(requestHeaders: headers);
+ 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);
}
@@ -1242,7 +1118,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.contactdb.lists.delete(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1261,7 +1138,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.lists._(list_id).patch(requestBody: data, queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1275,7 +1153,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.lists._(list_id).get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1289,7 +1168,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "202");
- dynamic response = await sg.client.contactdb.lists._(list_id).delete(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1306,7 +1186,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.contactdb.lists._(list_id).recipients.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1322,7 +1203,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.lists._(list_id).recipients.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1334,7 +1216,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post(requestHeaders: headers);
+ 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);
}
@@ -1350,7 +1233,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1369,7 +1253,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.contactdb.recipients.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1395,7 +1280,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.contactdb.recipients.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1409,7 +1295,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.recipients.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1425,7 +1312,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.recipients.delete(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1435,7 +1323,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.recipients.billable_count.get(requestHeaders: headers);
+ 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);
}
@@ -1445,7 +1334,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.recipients.count.get(requestHeaders: headers);
+ 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);
}
@@ -1458,7 +1348,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.recipients.search.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1469,7 +1360,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.recipients._(recipient_id).get(requestHeaders: headers);
+ 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);
}
@@ -1480,7 +1372,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.contactdb.recipients._(recipient_id).delete(requestHeaders: headers);
+ 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);
}
@@ -1491,7 +1384,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.recipients._(recipient_id).lists.get(requestHeaders: headers);
+ 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);
}
@@ -1501,7 +1395,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.reserved_fields.get(requestHeaders: headers);
+ 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);
}
@@ -1537,7 +1432,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.segments.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1547,7 +1443,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.segments.get(requestHeaders: headers);
+ 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);
}
@@ -1575,7 +1472,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.segments._(segment_id).patch(requestBody: data, queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1589,7 +1487,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.segments._(segment_id).get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1603,7 +1502,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.contactdb.segments._(segment_id).delete(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1618,7 +1518,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.contactdb.segments._(segment_id).recipients.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1635,7 +1536,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.devices.stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1653,7 +1555,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.geo.stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1670,7 +1573,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -1680,7 +1584,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips.assigned.get(requestHeaders: headers);
+ 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);
}
@@ -1695,7 +1600,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips.pools.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1705,7 +1611,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips.pools.get(requestHeaders: headers);
+ 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);
}
@@ -1721,7 +1628,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips.pools._(pool_name).put(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1732,7 +1640,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips.pools._(pool_name).get(requestHeaders: headers);
+ 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);
}
@@ -1743,7 +1652,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.ips.pools._(pool_name).delete(requestHeaders: headers);
+ 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);
}
@@ -1759,7 +1669,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.ips.pools._(pool_name).ips.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1771,7 +1682,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.ips.pools._(pool_name).ips._(ip).delete(requestHeaders: headers);
+ 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);
}
@@ -1786,7 +1698,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips.warmup.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -1796,7 +1709,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips.warmup.get(requestHeaders: headers);
+ 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);
}
@@ -1807,7 +1721,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips.warmup._(ip_address).get(requestHeaders: headers);
+ 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);
}
@@ -1818,7 +1733,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.ips.warmup._(ip_address).delete(requestHeaders: headers);
+ 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);
}
@@ -1829,7 +1745,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.ips._(ip_address).get(requestHeaders: headers);
+ 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);
}
@@ -1839,7 +1756,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.mail.batch.post(requestHeaders: headers);
+ 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);
}
@@ -1850,7 +1768,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail.batch._(batch_id).get(requestHeaders: headers);
+ 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);
}
@@ -2000,7 +1919,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "202");
- dynamic response = await sg.client.mail.send.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2014,7 +1934,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2033,7 +1954,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.address_whitelist.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2043,7 +1965,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.address_whitelist.get(requestHeaders: headers);
+ 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);
}
@@ -2059,7 +1982,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.bcc.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2069,7 +1993,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.bcc.get(requestHeaders: headers);
+ 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);
}
@@ -2086,7 +2011,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.bounce_purge.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2096,7 +2022,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.bounce_purge.get(requestHeaders: headers);
+ 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);
}
@@ -2113,7 +2040,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.footer.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2123,7 +2051,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.footer.get(requestHeaders: headers);
+ 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);
}
@@ -2139,7 +2068,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.forward_bounce.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2149,7 +2079,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.forward_bounce.get(requestHeaders: headers);
+ 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);
}
@@ -2165,7 +2096,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.forward_spam.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2175,7 +2107,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.forward_spam.get(requestHeaders: headers);
+ 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);
}
@@ -2190,7 +2123,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.plain_content.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2200,7 +2134,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.plain_content.get(requestHeaders: headers);
+ 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);
}
@@ -2217,7 +2152,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.spam_check.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2227,7 +2163,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.spam_check.get(requestHeaders: headers);
+ 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);
}
@@ -2243,7 +2180,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.template.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2253,7 +2191,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mail_settings.template.get(requestHeaders: headers);
+ 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);
}
@@ -2271,7 +2210,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.mailbox_providers.stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2285,7 +2225,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.partner_settings.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2302,7 +2243,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.partner_settings.new_relic.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2312,7 +2254,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.partner_settings.new_relic.get(requestHeaders: headers);
+ 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);
}
@@ -2322,7 +2265,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.scopes.get(requestHeaders: headers);
+ 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);
}
@@ -2351,7 +2295,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.senders.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2361,7 +2306,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.senders.get(requestHeaders: headers);
+ 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);
}
@@ -2391,7 +2337,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.senders._(sender_id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2402,7 +2349,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.senders._(sender_id).get(requestHeaders: headers);
+ 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);
}
@@ -2413,7 +2361,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.senders._(sender_id).delete(requestHeaders: headers);
+ 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);
}
@@ -2424,7 +2373,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.senders._(sender_id).resend_verification.post(requestHeaders: headers);
+ 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);
}
@@ -2441,7 +2391,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2462,7 +2413,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2477,7 +2429,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2490,7 +2443,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers.reputations.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2508,7 +2462,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers.stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2526,7 +2481,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers.stats.monthly.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2545,7 +2501,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers.stats.sums.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2561,7 +2518,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.subusers._(subuser_name).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2572,7 +2530,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.subusers._(subuser_name).delete(requestHeaders: headers);
+ 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);
}
@@ -2588,7 +2547,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers._(subuser_name).ips.put(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2605,7 +2565,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers._(subuser_name).monitor.put(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2622,7 +2583,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers._(subuser_name).monitor.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2633,7 +2595,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers._(subuser_name).monitor.get(requestHeaders: headers);
+ 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);
}
@@ -2644,7 +2607,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.subusers._(subuser_name).monitor.delete(requestHeaders: headers);
+ 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);
}
@@ -2662,7 +2626,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.subusers._(subuser_name).stats.monthly.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2678,7 +2643,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.suppression.blocks.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2697,7 +2663,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.suppression.blocks.delete(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2708,7 +2675,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.suppression.blocks._(email).get(requestHeaders: headers);
+ 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);
}
@@ -2719,7 +2687,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.suppression.blocks._(email).delete(requestHeaders: headers);
+ 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);
}
@@ -2733,7 +2702,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.suppression.bounces.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2752,7 +2722,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.suppression.bounces.delete(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2763,7 +2734,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.suppression.bounces._(email).get(requestHeaders: headers);
+ 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);
}
@@ -2777,7 +2749,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.suppression.bounces._(email).delete(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2793,7 +2766,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.suppression.invalid_emails.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2812,7 +2786,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.suppression.invalid_emails.delete(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2823,7 +2798,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.suppression.invalid_emails._(email).get(requestHeaders: headers);
+ 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);
}
@@ -2834,7 +2810,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.suppression.invalid_emails._(email).delete(requestHeaders: headers);
+ 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);
}
@@ -2845,7 +2822,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.suppression.spam_report._(email).get(requestHeaders: headers);
+ 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);
}
@@ -2856,7 +2834,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.suppression.spam_report._(email).delete(requestHeaders: headers);
+ 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);
}
@@ -2872,7 +2851,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.suppression.spam_reports.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2891,7 +2871,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.suppression.spam_reports.delete(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2907,7 +2888,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.suppression.unsubscribes.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -2922,7 +2904,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.templates.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2932,7 +2915,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.templates.get(requestHeaders: headers);
+ 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);
}
@@ -2948,7 +2932,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.templates._(template_id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -2959,7 +2944,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.templates._(template_id).get(requestHeaders: headers);
+ 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);
}
@@ -2970,7 +2956,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.templates._(template_id).delete(requestHeaders: headers);
+ 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);
}
@@ -2991,7 +2978,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.templates._(template_id).versions.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3012,7 +3000,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.templates._(template_id).versions._(version_id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3024,7 +3013,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.templates._(template_id).versions._(version_id).get(requestHeaders: headers);
+ 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);
}
@@ -3036,7 +3026,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.templates._(template_id).versions._(version_id).delete(requestHeaders: headers);
+ 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);
}
@@ -3048,7 +3039,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.templates._(template_id).versions._(version_id).activate.post(requestHeaders: headers);
+ 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);
}
@@ -3062,7 +3054,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.tracking_settings.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -3077,7 +3070,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.tracking_settings.click.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3087,7 +3081,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.tracking_settings.click.get(requestHeaders: headers);
+ 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);
}
@@ -3107,7 +3102,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.tracking_settings.google_analytics.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3117,7 +3113,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.tracking_settings.google_analytics.get(requestHeaders: headers);
+ 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);
}
@@ -3132,7 +3129,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.tracking_settings.open.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3142,7 +3140,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.tracking_settings.open.get(requestHeaders: headers);
+ 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);
}
@@ -3162,7 +3161,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.tracking_settings.subscription.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3172,7 +3172,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.tracking_settings.subscription.get(requestHeaders: headers);
+ 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);
}
@@ -3182,7 +3183,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.account.get(requestHeaders: headers);
+ 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);
}
@@ -3192,7 +3194,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.credits.get(requestHeaders: headers);
+ 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);
}
@@ -3207,7 +3210,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.email.put(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3217,7 +3221,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.email.get(requestHeaders: headers);
+ 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);
}
@@ -3233,7 +3238,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.password.put(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3250,7 +3256,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.profile.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3260,7 +3267,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.profile.get(requestHeaders: headers);
+ 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);
}
@@ -3276,7 +3284,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.user.scheduled_sends.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3286,7 +3295,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.scheduled_sends.get(requestHeaders: headers);
+ 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);
}
@@ -3302,7 +3312,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.user.scheduled_sends._(batch_id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3313,7 +3324,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.scheduled_sends._(batch_id).get(requestHeaders: headers);
+ 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);
}
@@ -3324,7 +3336,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.user.scheduled_sends._(batch_id).delete(requestHeaders: headers);
+ 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);
}
@@ -3340,7 +3353,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.settings.enforced_tls.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3350,7 +3364,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.settings.enforced_tls.get(requestHeaders: headers);
+ 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);
}
@@ -3365,7 +3380,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.username.put(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3375,7 +3391,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.username.get(requestHeaders: headers);
+ 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);
}
@@ -3402,7 +3419,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.webhooks._("event").settings.patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3412,7 +3430,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.webhooks._("event").settings.get(requestHeaders: headers);
+ 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);
}
@@ -3427,7 +3446,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.user.webhooks._("event").test.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3445,7 +3465,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.user.webhooks.parse.settings.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3455,7 +3476,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.webhooks.parse.settings.get(requestHeaders: headers);
+ 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);
}
@@ -3473,7 +3495,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.webhooks.parse.settings._(hostname).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3484,7 +3507,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.webhooks.parse.settings._(hostname).get(requestHeaders: headers);
+ 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);
}
@@ -3495,7 +3519,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.user.webhooks.parse.settings._(hostname).delete(requestHeaders: headers);
+ 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);
}
@@ -3512,7 +3537,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.user.webhooks.parse.stats.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -3536,7 +3562,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.whitelabel.domains.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3553,7 +3580,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.domains.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -3563,7 +3591,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.domains._("default").get(requestHeaders: headers);
+ 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);
}
@@ -3573,7 +3602,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.domains.subuser.get(requestHeaders: headers);
+ 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);
}
@@ -3583,7 +3613,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.whitelabel.domains.subuser.delete(requestHeaders: headers);
+ 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);
}
@@ -3600,7 +3631,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.domains._(domain_id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3611,7 +3643,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.domains._(domain_id).get(requestHeaders: headers);
+ 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);
}
@@ -3622,7 +3655,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.whitelabel.domains._(domain_id).delete(requestHeaders: headers);
+ 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);
}
@@ -3638,7 +3672,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.whitelabel.domains._(domain_id).subuser.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3654,7 +3689,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.domains._(id).ips.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3666,7 +3702,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.domains._(id).ips._(ip).delete(requestHeaders: headers);
+ 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);
}
@@ -3677,7 +3714,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.domains._(id).validate.post(requestHeaders: headers);
+ 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);
}
@@ -3694,7 +3732,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.whitelabel.ips.post(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3709,7 +3748,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.ips.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -3720,7 +3760,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.ips._(id).get(requestHeaders: headers);
+ 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);
}
@@ -3731,7 +3772,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.whitelabel.ips._(id).delete(requestHeaders: headers);
+ 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);
}
@@ -3742,7 +3784,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.ips._(id).validate.post(requestHeaders: headers);
+ 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);
}
@@ -3763,7 +3806,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
- dynamic response = await sg.client.whitelabel.links.post(requestBody: data, queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -3776,7 +3820,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.links.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -3789,7 +3834,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.links._("default").get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -3802,7 +3848,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.links.subuser.get(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -3815,7 +3862,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.whitelabel.links.subuser.delete(queryParams: queryParams, requestHeaders: headers);
+ 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);
}
@@ -3831,7 +3879,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.links._(id).patch(requestBody: data, requestHeaders: headers);
+ 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);
}
@@ -3842,7 +3891,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.links._(id).get(requestHeaders: headers);
+ 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);
}
@@ -3853,7 +3903,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
- dynamic response = await sg.client.whitelabel.links._(id).delete(requestHeaders: headers);
+ 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);
}
@@ -3864,7 +3915,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.links._(id).validate.post(requestHeaders: headers);
+ 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);
}
@@ -3880,7 +3932,8 @@ namespace UnitTest Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
- dynamic response = await sg.client.whitelabel.links._(link_id).subuser.post(requestBody: data, requestHeaders: headers);
+ 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);
}
diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index e4414be..d820a6e 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -1,4 +1,4 @@ -If you have a non-library SendGrid issue, please contact our [support team](https://support.sendgrid.com). +If you have a non-library SendGrid issue, please contact our [support team](https://support.sendgrid.com). If you can't find a solution below, please open an [issue](https://github.com/sendgrid/sendgrid-csharp/issues). @@ -59,9 +59,11 @@ If you are using ASP.NET Core, please [upvote this issue](https://github.com/sen To read the error message returned by SendGrid's API: ```csharp -dynamic response = await sg.client.mail.send.post(requestBody: mail.Get()); +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.Body.ReadAsStringAsync().Result); // The message will be here Console.WriteLine(response.Headers.ToString()); ``` @@ -4,11 +4,12 @@ This documentation is based on our [OAI specification](https://github.com/sendgr ```csharp using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); ``` # Table of Contents @@ -58,7 +59,7 @@ For more information, please see our [User Guide](http://sendgrid.com/docs/User_ string queryParams = @"{ 'limit': 1 }"; -dynamic response = await sg.client.access_settings.activity.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/activity", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -94,7 +95,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.access_settings.whitelist.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "access_settings/whitelist", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -113,7 +114,7 @@ For more information, please see our [User Guide](http://sendgrid.com/docs/User_ ```csharp -dynamic response = await sg.client.access_settings.whitelist.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -143,7 +144,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.access_settings.whitelist.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -165,7 +166,7 @@ For more information, please see our [User Guide](http://sendgrid.com/docs/User_ ```csharp var rule_id = "test_url_param"; -dynamic response = await sg.client.access_settings.whitelist._(rule_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist/" + rule_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -187,7 +188,7 @@ For more information, please see our [User Guide](http://sendgrid.com/docs/User_ ```csharp var rule_id = "test_url_param"; -dynamic response = await sg.client.access_settings.whitelist._(rule_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist/" + rule_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -218,7 +219,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.alerts.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "alerts", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -239,7 +240,7 @@ For more information about alerts, please see our [User Guide](https://sendgrid. ```csharp -dynamic response = await sg.client.alerts.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "alerts"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -266,7 +267,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var alert_id = "test_url_param"; -dynamic response = await sg.client.alerts._(alert_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "alerts/" + alert_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -288,7 +289,7 @@ For more information about alerts, please see our [User Guide](https://sendgrid. ```csharp var alert_id = "test_url_param"; -dynamic response = await sg.client.alerts._(alert_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "alerts/" + alert_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -310,7 +311,7 @@ For more information about alerts, please see our [User Guide](https://sendgrid. ```csharp var alert_id = "test_url_param"; -dynamic response = await sg.client.alerts._(alert_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "alerts/" + alert_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -347,7 +348,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.api_keys.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "api_keys", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -367,7 +368,7 @@ The API Keys feature allows customers to be able to generate an API Key credenti string queryParams = @"{ 'limit': 1 }"; -dynamic response = await sg.client.api_keys.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -398,7 +399,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var api_key_id = "test_url_param"; -dynamic response = await sg.client.api_keys._(api_key_id).put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "api_keys/" + api_key_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -429,7 +430,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var api_key_id = "test_url_param"; -dynamic response = await sg.client.api_keys._(api_key_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "api_keys/" + api_key_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -447,7 +448,7 @@ If the API Key ID does not exist an HTTP 404 will be returned. ```csharp var api_key_id = "test_url_param"; -dynamic response = await sg.client.api_keys._(api_key_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys/" + api_key_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -473,7 +474,7 @@ The API Keys feature allows customers to be able to generate an API Key credenti ```csharp var api_key_id = "test_url_param"; -dynamic response = await sg.client.api_keys._(api_key_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "api_keys/" + api_key_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -504,7 +505,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.asm.groups.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -528,7 +529,7 @@ Suppression groups, or [unsubscribe groups](https://sendgrid.com/docs/API_Refere string queryParams = @"{ 'id': 1 }"; -dynamic response = await sg.client.asm.groups.get(queryParams: queryParams); +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()); @@ -557,7 +558,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "asm/groups/" + group_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -579,7 +580,7 @@ Each user can create up to 25 different suppression groups. ```csharp var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups/" + group_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -603,7 +604,7 @@ Each user can create up to 25 different suppression groups. ```csharp var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/groups/" + group_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -631,7 +632,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).suppressions.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups/" + group_id + "/suppressions", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -649,7 +650,7 @@ Suppressions are recipient email addresses that are added to [unsubscribe groups ```csharp var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).suppressions.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups/" + group_id + "/suppressions"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -678,7 +679,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).suppressions.search.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups/" + group_id + "/suppressions/search", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -697,7 +698,7 @@ Suppressions are recipient email addresses that are added to [unsubscribe groups ```csharp var group_id = "test_url_param"; var email = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).suppressions._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/groups/" + group_id + "/suppressions/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -714,7 +715,7 @@ Suppressions are a list of email addresses that will not receive content sent un ```csharp -dynamic response = await sg.client.asm.suppressions.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -739,7 +740,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.asm.suppressions.global.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/suppressions/global", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -759,7 +760,7 @@ A global suppression (or global unsubscribe) is an email address of a recipient ```csharp var email = "test_url_param"; -dynamic response = await sg.client.asm.suppressions.global._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions/global/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -777,7 +778,7 @@ A global suppression (or global unsubscribe) is an email address of a recipient ```csharp var email = "test_url_param"; -dynamic response = await sg.client.asm.suppressions.global._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/suppressions/global/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -795,7 +796,7 @@ Suppressions are a list of email addresses that will not receive content sent un ```csharp var email = "test_url_param"; -dynamic response = await sg.client.asm.suppressions._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -825,7 +826,7 @@ string queryParams = @"{ 'offset': 'test_string', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.browsers.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "browsers/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -873,7 +874,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.campaigns.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -900,7 +901,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.campaigns.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -931,7 +932,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "campaigns/" + campaign_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -953,7 +954,7 @@ For more information: ```csharp var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns/" + campaign_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -975,7 +976,7 @@ For more information: ```csharp var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "campaigns/" + campaign_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1000,7 +1001,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "campaigns/" + campaign_id + "/schedules", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1025,7 +1026,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1045,7 +1046,7 @@ For more information: ```csharp var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns/" + campaign_id + "/schedules"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1068,7 +1069,7 @@ For more information: ```csharp var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "campaigns/" + campaign_id + "/schedules"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1090,7 +1091,7 @@ For more information: ```csharp var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.now.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules/now"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1117,7 +1118,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.test.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules/test", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1142,7 +1143,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.categories.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "categories", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1169,7 +1170,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.categories.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "categories/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1197,7 +1198,7 @@ string queryParams = @"{ 'sort_by_metric': 'test_string', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.categories.stats.sums.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "categories/stats/sums", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1224,7 +1225,7 @@ string queryParams = @"{ 'end_date': '2016-04-01', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.clients.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "clients/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1255,7 +1256,7 @@ string queryParams = @"{ 'start_date': '2016-01-01' }"; var client_type = "test_url_param"; -dynamic response = await sg.client.clients._(client_type).stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "clients/" + client_type + "/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1281,7 +1282,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.custom_fields.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/custom_fields", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1298,7 +1299,7 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns]( ```csharp -dynamic response = await sg.client.contactdb.custom_fields.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/custom_fields"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1316,7 +1317,7 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns]( ```csharp var custom_field_id = "test_url_param"; -dynamic response = await sg.client.contactdb.custom_fields._(custom_field_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/custom_fields/" + custom_field_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1334,7 +1335,7 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns]( ```csharp var custom_field_id = "test_url_param"; -dynamic response = await sg.client.contactdb.custom_fields._(custom_field_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/custom_fields/" + custom_field_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1356,7 +1357,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.lists.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1373,7 +1374,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co ```csharp -dynamic response = await sg.client.contactdb.lists.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1398,7 +1399,7 @@ string data = @"[ ]"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.lists.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1425,7 +1426,7 @@ string queryParams = @"{ 'list_id': 1 }"; var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).patch(requestBody: data, queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/lists/" + list_id, requestBody: data, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1446,7 +1447,7 @@ string queryParams = @"{ 'list_id': 1 }"; var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists/" + list_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1467,7 +1468,7 @@ string queryParams = @"{ 'delete_contacts': 'true' }"; var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists/" + list_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1493,7 +1494,7 @@ string data = @"[ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).recipients.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists/" + list_id + "/recipients", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1516,7 +1517,7 @@ string queryParams = @"{ 'page_size': 1 }"; var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).recipients.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists/" + list_id + "/recipients", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1535,7 +1536,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co ```csharp var list_id = "test_url_param"; var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists/" + list_id + "/recipients/" + recipient_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1558,7 +1559,7 @@ string queryParams = @"{ }"; var list_id = "test_url_param"; var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists/" + list_id + "/recipients/" + recipient_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1588,7 +1589,7 @@ string data = @"[ ]"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.recipients.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/recipients", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1623,7 +1624,7 @@ string data = @"[ ]"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.recipients.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/recipients", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1647,7 +1648,7 @@ string queryParams = @"{ 'page': 1, 'page_size': 1 }"; -dynamic response = await sg.client.contactdb.recipients.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1672,7 +1673,7 @@ string data = @"[ ]"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.recipients.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/recipients", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1691,7 +1692,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co ```csharp -dynamic response = await sg.client.contactdb.recipients.billable_count.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/billable_count"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1708,7 +1709,7 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns]( ```csharp -dynamic response = await sg.client.contactdb.recipients.count.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/count"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1737,7 +1738,7 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns]( string queryParams = @"{ '{field_name}': 'test_string' }"; -dynamic response = await sg.client.contactdb.recipients.search.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/search", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1755,7 +1756,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co ```csharp var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.recipients._(recipient_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/" + recipient_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1773,7 +1774,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co ```csharp var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.recipients._(recipient_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/recipients/" + recipient_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1793,7 +1794,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co ```csharp var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.recipients._(recipient_id).lists.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/" + recipient_id + "/lists"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1810,7 +1811,7 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns]( ```csharp -dynamic response = await sg.client.contactdb.reserved_fields.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/reserved_fields"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1873,7 +1874,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.segments.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/segments", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1892,7 +1893,7 @@ For more information about segments in Marketing Campaigns, please see our [User ```csharp -dynamic response = await sg.client.contactdb.segments.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1929,7 +1930,7 @@ string queryParams = @"{ 'segment_id': 'test_string' }"; var segment_id = "test_url_param"; -dynamic response = await sg.client.contactdb.segments._(segment_id).patch(requestBody: data, queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/segments/" + segment_id, requestBody: data, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1952,7 +1953,7 @@ string queryParams = @"{ 'segment_id': 1 }"; var segment_id = "test_url_param"; -dynamic response = await sg.client.contactdb.segments._(segment_id).get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments/" + segment_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -1977,7 +1978,7 @@ string queryParams = @"{ 'delete_contacts': 'true' }"; var segment_id = "test_url_param"; -dynamic response = await sg.client.contactdb.segments._(segment_id).delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/segments/" + segment_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2001,7 +2002,7 @@ string queryParams = @"{ 'page_size': 1 }"; var segment_id = "test_url_param"; -dynamic response = await sg.client.contactdb.segments._(segment_id).recipients.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments/" + segment_id + "/recipients", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2039,7 +2040,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.devices.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "devices/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2069,7 +2070,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.geo.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "geo/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2098,7 +2099,7 @@ string queryParams = @"{ 'offset': 1, 'subuser': 'test_string' }"; -dynamic response = await sg.client.ips.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2115,7 +2116,7 @@ A single IP address or a range of IP addresses may be dedicated to an account in ```csharp -dynamic response = await sg.client.ips.assigned.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/assigned"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2143,7 +2144,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.ips.pools.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "ips/pools", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2164,7 +2165,7 @@ If an IP pool is NOT specified for an email, it will use any IP available, inclu ```csharp -dynamic response = await sg.client.ips.pools.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/pools"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2191,7 +2192,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var pool_name = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "ips/pools/" + pool_name, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2213,7 +2214,7 @@ If an IP pool is NOT specified for an email, it will use any IP available, inclu ```csharp var pool_name = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/pools/" + pool_name); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2235,7 +2236,7 @@ If an IP pool is NOT specified for an email, it will use any IP available, inclu ```csharp var pool_name = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/pools/" + pool_name); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2260,7 +2261,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var pool_name = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).ips.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "ips/pools/" + pool_name + "/ips", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2281,7 +2282,7 @@ A single IP address or a range of IP addresses may be dedicated to an account in ```csharp var pool_name = "test_url_param"; var ip = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).ips._(ip).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/pools/" + pool_name + "/ips/" + ip); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2305,7 +2306,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.ips.warmup.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "ips/warmup", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2324,7 +2325,7 @@ For more general information about warming up IPs, please see our [Classroom](ht ```csharp -dynamic response = await sg.client.ips.warmup.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/warmup"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2344,7 +2345,7 @@ For more general information about warming up IPs, please see our [Classroom](ht ```csharp var ip_address = "test_url_param"; -dynamic response = await sg.client.ips.warmup._(ip_address).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/warmup/" + ip_address); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2364,7 +2365,7 @@ For more general information about warming up IPs, please see our [Classroom](ht ```csharp var ip_address = "test_url_param"; -dynamic response = await sg.client.ips.warmup._(ip_address).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/warmup/" + ip_address); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2384,7 +2385,7 @@ A single IP address or a range of IP addresses may be dedicated to an account in ```csharp var ip_address = "test_url_param"; -dynamic response = await sg.client.ips._(ip_address).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/" + ip_address); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2408,7 +2409,7 @@ More Information: ```csharp -dynamic response = await sg.client.mail.batch.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "mail/batch"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2430,7 +2431,7 @@ More Information: ```csharp var batch_id = "test_url_param"; -dynamic response = await sg.client.mail.batch._(batch_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail/batch/" + batch_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2593,7 +2594,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail.send.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "mail/send", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2617,7 +2618,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.mail_settings.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2645,7 +2646,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.address_whitelist.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/address_whitelist", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2664,7 +2665,7 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```csharp -dynamic response = await sg.client.mail_settings.address_whitelist.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/address_whitelist"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2689,7 +2690,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.bcc.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/bcc", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2708,7 +2709,7 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```csharp -dynamic response = await sg.client.mail_settings.bcc.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/bcc"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2734,7 +2735,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.bounce_purge.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/bounce_purge", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2753,7 +2754,7 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```csharp -dynamic response = await sg.client.mail_settings.bounce_purge.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/bounce_purge"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2779,7 +2780,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.footer.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/footer", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2798,7 +2799,7 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```csharp -dynamic response = await sg.client.mail_settings.footer.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/footer"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2823,7 +2824,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.forward_bounce.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/forward_bounce", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2842,7 +2843,7 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```csharp -dynamic response = await sg.client.mail_settings.forward_bounce.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/forward_bounce"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2867,7 +2868,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.forward_spam.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/forward_spam", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2886,7 +2887,7 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```csharp -dynamic response = await sg.client.mail_settings.forward_spam.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/forward_spam"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2910,7 +2911,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.plain_content.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/plain_content", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2929,7 +2930,7 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```csharp -dynamic response = await sg.client.mail_settings.plain_content.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/plain_content"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2955,7 +2956,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.spam_check.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/spam_check", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -2974,7 +2975,7 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```csharp -dynamic response = await sg.client.mail_settings.spam_check.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/spam_check"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3001,7 +3002,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.template.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/template", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3022,7 +3023,7 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```csharp -dynamic response = await sg.client.mail_settings.template.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/template"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3052,7 +3053,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.mailbox_providers.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mailbox_providers/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3076,7 +3077,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.partner_settings.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "partner_settings", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3102,7 +3103,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.partner_settings.new_relic.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "partner_settings/new_relic", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3121,7 +3122,7 @@ By integrating with New Relic, you can send your SendGrid email statistics to yo ```csharp -dynamic response = await sg.client.partner_settings.new_relic.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "partner_settings/new_relic"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3141,7 +3142,7 @@ API Keys can be used to authenticate the use of [SendGrids v3 Web API](https://s ```csharp -dynamic response = await sg.client.scopes.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "scopes"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3182,7 +3183,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.senders.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "senders", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3199,7 +3200,7 @@ Sender Identities are required to be verified before use. If your domain has bee ```csharp -dynamic response = await sg.client.senders.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "senders"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3238,7 +3239,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var sender_id = "test_url_param"; -dynamic response = await sg.client.senders._(sender_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "senders/" + sender_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3256,7 +3257,7 @@ Sender Identities are required to be verified before use. If your domain has bee ```csharp var sender_id = "test_url_param"; -dynamic response = await sg.client.senders._(sender_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "senders/" + sender_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3274,7 +3275,7 @@ Sender Identities are required to be verified before use. If your domain has bee ```csharp var sender_id = "test_url_param"; -dynamic response = await sg.client.senders._(sender_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "senders/" + sender_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3292,7 +3293,7 @@ Sender Identities are required to be verified before use. If your domain has bee ```csharp var sender_id = "test_url_param"; -dynamic response = await sg.client.senders._(sender_id).resend_verification.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "senders/" + sender_id + "/resend_verification"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3319,7 +3320,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3353,7 +3354,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.subusers.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "subusers", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3378,7 +3379,7 @@ string queryParams = @"{ 'offset': 1, 'username': 'test_string' }"; -dynamic response = await sg.client.subusers.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3398,7 +3399,7 @@ This endpoint allows you to request the reputations for your subusers. string queryParams = @"{ 'usernames': 'test_string' }"; -dynamic response = await sg.client.subusers.reputations.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/reputations", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3427,7 +3428,7 @@ string queryParams = @"{ 'start_date': '2016-01-01', 'subusers': 'test_string' }"; -dynamic response = await sg.client.subusers.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3457,7 +3458,7 @@ string queryParams = @"{ 'sort_by_metric': 'test_string', 'subuser': 'test_string' }"; -dynamic response = await sg.client.subusers.stats.monthly.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats/monthly", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3486,7 +3487,7 @@ string queryParams = @"{ 'sort_by_metric': 'test_string', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.subusers.stats.sums.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats/sums", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3512,7 +3513,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "subusers/" + subuser_name, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3533,7 +3534,7 @@ For more information about Subusers: ```csharp var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "subusers/" + subuser_name); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3559,7 +3560,7 @@ string data = @"[ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).ips.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "subusers/" + subuser_name + "/ips", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3581,7 +3582,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).monitor.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "subusers/" + subuser_name + "/monitor", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3603,7 +3604,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).monitor.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "subusers/" + subuser_name + "/monitor", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3619,7 +3620,7 @@ Subuser monitor settings allow you to receive a sample of an outgoing message by ```csharp var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).monitor.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/" + subuser_name + "/monitor"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3635,7 +3636,7 @@ Subuser monitor settings allow you to receive a sample of an outgoing message by ```csharp var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).monitor.delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "subusers/" + subuser_name + "/monitor"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3665,7 +3666,7 @@ string queryParams = @"{ 'sort_by_metric': 'test_string' }"; var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).stats.monthly.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/" + subuser_name + "/stats/monthly", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3693,7 +3694,7 @@ string queryParams = @"{ 'offset': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.blocks.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/blocks", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3726,7 +3727,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.suppression.blocks.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/blocks", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3746,7 +3747,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/User ```csharp var email = "test_url_param"; -dynamic response = await sg.client.suppression.blocks._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/blocks/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3766,7 +3767,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/User ```csharp var email = "test_url_param"; -dynamic response = await sg.client.suppression.blocks._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/blocks/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3792,7 +3793,7 @@ string queryParams = @"{ 'end_time': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.bounces.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/bounces", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3826,7 +3827,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.suppression.bounces.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/bounces", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3850,7 +3851,7 @@ For more information see: ```csharp var email = "test_url_param"; -dynamic response = await sg.client.suppression.bounces._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/bounces/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3877,7 +3878,7 @@ string queryParams = @"{ 'email_address': 'example@example.com' }"; var email = "test_url_param"; -dynamic response = await sg.client.suppression.bounces._(email).delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/bounces/" + email, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3904,7 +3905,7 @@ string queryParams = @"{ 'offset': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.invalid_emails.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/invalid_emails", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3939,7 +3940,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.suppression.invalid_emails.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/invalid_emails", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3961,7 +3962,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/User ```csharp var email = "test_url_param"; -dynamic response = await sg.client.suppression.invalid_emails._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/invalid_emails/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -3983,7 +3984,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/User ```csharp var email = "test_url_param"; -dynamic response = await sg.client.suppression.invalid_emails._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/invalid_emails/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4003,7 +4004,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/User ```csharp var email = "test_url_param"; -dynamic response = await sg.client.suppression.spam_report._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/spam_report/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4023,7 +4024,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/User ```csharp var email = "test_url_param"; -dynamic response = await sg.client.suppression.spam_report._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/spam_report/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4048,7 +4049,7 @@ string queryParams = @"{ 'offset': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.spam_reports.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/spam_reports", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4081,7 +4082,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.suppression.spam_reports.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/spam_reports", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4104,7 +4105,7 @@ string queryParams = @"{ 'offset': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.unsubscribes.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/unsubscribes", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4131,7 +4132,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.templates.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "templates", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4150,7 +4151,7 @@ Transactional templates are templates created specifically for transactional ema ```csharp -dynamic response = await sg.client.templates.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "templates"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4176,7 +4177,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var template_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "templates/" + template_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4197,7 +4198,7 @@ Transactional templates are templates created specifically for transactional ema ```csharp var template_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "templates/" + template_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4218,7 +4219,7 @@ Transactional templates are templates created specifically for transactional ema ```csharp var template_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "templates/" + template_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4249,7 +4250,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var template_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "templates/" + template_id + "/versions", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4285,7 +4286,7 @@ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var template_id = "test_url_param"; var version_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions._(version_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "templates/" + template_id + "/versions/" + version_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4312,7 +4313,7 @@ For more information about transactional templates, please see our [User Guide]( ```csharp var template_id = "test_url_param"; var version_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions._(version_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "templates/" + template_id + "/versions/" + version_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4339,7 +4340,7 @@ For more information about transactional templates, please see our [User Guide]( ```csharp var template_id = "test_url_param"; var version_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions._(version_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "templates/" + template_id + "/versions/" + version_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4367,7 +4368,7 @@ For more information about transactional templates, please see our [User Guide]( ```csharp var template_id = "test_url_param"; var version_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions._(version_id).activate.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "templates/" + template_id + "/versions/" + version_id + "/activate"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4393,7 +4394,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.tracking_settings.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4417,7 +4418,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.tracking_settings.click.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/click", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4436,7 +4437,7 @@ For more information about tracking, please see our [User Guide](https://sendgri ```csharp -dynamic response = await sg.client.tracking_settings.click.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/click"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4469,7 +4470,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.tracking_settings.google_analytics.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/google_analytics", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4492,7 +4493,7 @@ For more information about tracking, please see our [User Guide](https://sendgri ```csharp -dynamic response = await sg.client.tracking_settings.google_analytics.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/google_analytics"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4518,7 +4519,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.tracking_settings.open.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/open", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4539,7 +4540,7 @@ For more information about tracking, please see our [User Guide](https://sendgri ```csharp -dynamic response = await sg.client.tracking_settings.open.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/open"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4570,7 +4571,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.tracking_settings.subscription.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/subscription", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4591,7 +4592,7 @@ For more information about tracking, please see our [User Guide](https://sendgri ```csharp -dynamic response = await sg.client.tracking_settings.subscription.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/subscription"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4617,7 +4618,7 @@ For more information about your user profile: ```csharp -dynamic response = await sg.client.user.account.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/account"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4634,7 +4635,7 @@ Your monthly credit allotment limits the number of emails you may send before in ```csharp -dynamic response = await sg.client.user.credits.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/credits"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4660,7 +4661,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.email.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "user/email", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4681,7 +4682,7 @@ For more information about your user profile: ```csharp -dynamic response = await sg.client.user.email.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/email"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4708,7 +4709,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.password.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "user/password", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4738,7 +4739,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.profile.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/profile", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4757,7 +4758,7 @@ For more information about your user profile: ```csharp -dynamic response = await sg.client.user.profile.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/profile"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4783,7 +4784,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.scheduled_sends.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "user/scheduled_sends", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4800,7 +4801,7 @@ The Cancel Scheduled Sends feature allows the customer to cancel a scheduled sen ```csharp -dynamic response = await sg.client.user.scheduled_sends.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/scheduled_sends"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4823,7 +4824,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var batch_id = "test_url_param"; -dynamic response = await sg.client.user.scheduled_sends._(batch_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/scheduled_sends/" + batch_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4841,7 +4842,7 @@ The Cancel Scheduled Sends feature allows the customer to cancel a scheduled sen ```csharp var batch_id = "test_url_param"; -dynamic response = await sg.client.user.scheduled_sends._(batch_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/scheduled_sends/" + batch_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4859,7 +4860,7 @@ The Cancel Scheduled Sends feature allows the customer to cancel a scheduled sen ```csharp var batch_id = "test_url_param"; -dynamic response = await sg.client.user.scheduled_sends._(batch_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "user/scheduled_sends/" + batch_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4884,7 +4885,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.settings.enforced_tls.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/settings/enforced_tls", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4903,7 +4904,7 @@ The Enforced TLS settings specify whether or not the recipient is required to su ```csharp -dynamic response = await sg.client.user.settings.enforced_tls.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/settings/enforced_tls"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4929,7 +4930,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.username.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "user/username", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4950,7 +4951,7 @@ For more information about your user profile: ```csharp -dynamic response = await sg.client.user.username.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/username"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -4988,7 +4989,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.webhooks._("_("event")").settings.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/webhooks/event/settings", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5009,7 +5010,7 @@ Common uses of this data are to remove unsubscribes, react to spam reports, dete ```csharp -dynamic response = await sg.client.user.webhooks._("_("event")").settings.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/event/settings"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5033,7 +5034,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.webhooks._("_("event")").test.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "user/webhooks/event/test", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5058,7 +5059,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.webhooks.parse.settings.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "user/webhooks/parse/settings", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5075,7 +5076,7 @@ The inbound parse webhook allows you to have incoming emails parsed, extracting ```csharp -dynamic response = await sg.client.user.webhooks.parse.settings.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/settings"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5100,7 +5101,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var hostname = "test_url_param"; -dynamic response = await sg.client.user.webhooks.parse.settings._(hostname).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/webhooks/parse/settings/" + hostname, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5118,7 +5119,7 @@ The inbound parse webhook allows you to have incoming emails parsed, extracting ```csharp var hostname = "test_url_param"; -dynamic response = await sg.client.user.webhooks.parse.settings._(hostname).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/settings/" + hostname); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5136,7 +5137,7 @@ The inbound parse webhook allows you to have incoming emails parsed, extracting ```csharp var hostname = "test_url_param"; -dynamic response = await sg.client.user.webhooks.parse.settings._(hostname).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "user/webhooks/parse/settings/" + hostname); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5162,7 +5163,7 @@ string queryParams = @"{ 'offset': 'test_string', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.user.webhooks.parse.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5202,7 +5203,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.whitelabel.domains.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5229,7 +5230,7 @@ string queryParams = @"{ 'offset': 1, 'username': 'test_string' }"; -dynamic response = await sg.client.whitelabel.domains.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5253,7 +5254,7 @@ For more information on whitelabeling, please see our [User Guide](https://sendg ```csharp -dynamic response = await sg.client.whitelabel.domains._("_("default")").get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/default"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5279,7 +5280,7 @@ For more information on whitelabeling, please see our [User Guide](https://sendg ```csharp -dynamic response = await sg.client.whitelabel.domains.subuser.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/subuser"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5305,7 +5306,7 @@ For more information on whitelabeling, please see our [User Guide](https://sendg ```csharp -dynamic response = await sg.client.whitelabel.domains.subuser.delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/subuser"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5331,7 +5332,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var domain_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(domain_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "whitelabel/domains/" + domain_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5352,7 +5353,7 @@ For more information on whitelabeling, please see our [User Guide](https://sendg ```csharp var domain_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(domain_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/" + domain_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5372,7 +5373,7 @@ For more information on whitelabeling, please see our [User Guide](https://sendg ```csharp var domain_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(domain_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/" + domain_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5404,7 +5405,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var domain_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(domain_id).subuser.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + domain_id + "/subuser", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5434,7 +5435,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(id).ips.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + id + "/ips", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5461,7 +5462,7 @@ For more information on whitelabeling, please see our [User Guide](https://sendg ```csharp var id = "test_url_param"; var ip = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(id).ips._(ip).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/" + id + "/ips/" + ip); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5486,7 +5487,7 @@ For more information on whitelabeling, please see our [User Guide](https://sendg ```csharp var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(id).validate.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + id + "/validate"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5514,7 +5515,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.whitelabel.ips.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/ips", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5540,7 +5541,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.whitelabel.ips.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/ips", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5560,7 +5561,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ ```csharp var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.ips._(id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/ips/" + id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5580,7 +5581,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ ```csharp var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.ips._(id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/ips/" + id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5600,7 +5601,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ ```csharp var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.ips._(id).validate.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/ips/" + id + "/validate"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5630,7 +5631,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.whitelabel.links.post(requestBody: data, queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links", requestBody: data, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5652,7 +5653,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ string queryParams = @"{ 'limit': 1 }"; -dynamic response = await sg.client.whitelabel.links.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5681,7 +5682,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ string queryParams = @"{ 'domain': 'test_string' }"; -dynamic response = await sg.client.whitelabel.links._("_("default")").get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/default", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5707,7 +5708,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ string queryParams = @"{ 'username': 'test_string' }"; -dynamic response = await sg.client.whitelabel.links.subuser.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/subuser", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5733,7 +5734,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ string queryParams = @"{ 'username': 'test_string' }"; -dynamic response = await sg.client.whitelabel.links.subuser.delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/links/subuser", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5758,7 +5759,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "whitelabel/links/" + id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5778,7 +5779,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ ```csharp var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/" + id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5798,7 +5799,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ ```csharp var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/links/" + id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5818,7 +5819,7 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/API_ ```csharp var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(id).validate.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links/" + id + "/validate"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -5847,7 +5848,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var link_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(link_id).subuser.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links/" + link_id + "/subuser", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/USE_CASES.md b/USE_CASES.md index 15aa2a8..6336ccd 100644 --- a/USE_CASES.md +++ b/USE_CASES.md @@ -61,7 +61,7 @@ namespace Example static async Task Execute() { string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGridAPIClient(apiKey); + Client = new Client(apiKey); Email from = new Email("test@example.com"); String subject = "I'm replacing the subject tag"; @@ -73,7 +73,9 @@ namespace Example mail.Personalization[0].AddSubstitution("-name-", "Example User"); mail.Personalization[0].AddSubstitution("-city-", "Denver"); - dynamic response = await sg.client.mail.send.post(requestBody: mail.Get()); + Response response = await client.RequestAsync(method: Client.Methods.POST, + requestBody: mail.Get(), + urlPath: "mail/send"); } } } @@ -99,7 +101,7 @@ namespace Example static async Task Execute() { String apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGridAPIClient(apiKey); + Client client = new Client(apiKey); string data = @"{ 'personalizations': [ @@ -128,7 +130,9 @@ namespace Example 'template_id': '13b8f94f-bcae-4ec6-b752-70d6cb59f932' }"; Object json = JsonConvert.DeserializeObject<Object>(data); - dynamic response = await sg.client.mail.send.post(requestBody: json.ToString()); + Response response = await client.RequestAsync(method: Client.Methods.POST, + requestBody: json.ToString(), + urlPath: "mail/send"); } } } diff --git a/examples/accesssettings/accesssettings.cs b/examples/accesssettings/accesssettings.cs index e30d41a..452bb88 100644 --- a/examples/accesssettings/accesssettings.cs +++ b/examples/accesssettings/accesssettings.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve all recent access attempts @@ -12,7 +13,7 @@ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); string queryParams = @"{ 'limit': 1 }"; -dynamic response = await sg.client.access_settings.activity.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/activity", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -37,7 +38,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.access_settings.whitelist.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "access_settings/whitelist", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -47,7 +48,7 @@ Console.ReadLine(); // Retrieve a list of currently whitelisted IPs // GET /access_settings/whitelist -dynamic response = await sg.client.access_settings.whitelist.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -66,7 +67,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.access_settings.whitelist.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -77,7 +78,7 @@ Console.ReadLine(); // GET /access_settings/whitelist/{rule_id} var rule_id = "test_url_param"; -dynamic response = await sg.client.access_settings.whitelist._(rule_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "access_settings/whitelist/" + rule_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -88,7 +89,7 @@ Console.ReadLine(); // DELETE /access_settings/whitelist/{rule_id} var rule_id = "test_url_param"; -dynamic response = await sg.client.access_settings.whitelist._(rule_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "access_settings/whitelist/" + rule_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/alerts/alerts.cs b/examples/alerts/alerts.cs index d0e5429..43ebb71 100644 --- a/examples/alerts/alerts.cs +++ b/examples/alerts/alerts.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create a new Alert @@ -16,7 +17,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.alerts.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "alerts", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -26,7 +27,7 @@ Console.ReadLine(); // Retrieve all alerts // GET /alerts -dynamic response = await sg.client.alerts.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "alerts"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -42,7 +43,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var alert_id = "test_url_param"; -dynamic response = await sg.client.alerts._(alert_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "alerts/" + alert_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -53,7 +54,7 @@ Console.ReadLine(); // GET /alerts/{alert_id} var alert_id = "test_url_param"; -dynamic response = await sg.client.alerts._(alert_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "alerts/" + alert_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -64,7 +65,7 @@ Console.ReadLine(); // DELETE /alerts/{alert_id} var alert_id = "test_url_param"; -dynamic response = await sg.client.alerts._(alert_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "alerts/" + alert_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/apikeys/apikeys.cs b/examples/apikeys/apikeys.cs index d548bc6..bc09070 100644 --- a/examples/apikeys/apikeys.cs +++ b/examples/apikeys/apikeys.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create API keys @@ -20,7 +21,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.api_keys.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "api_keys", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -33,7 +34,7 @@ Console.ReadLine(); string queryParams = @"{ 'limit': 1 }"; -dynamic response = await sg.client.api_keys.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -53,7 +54,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var api_key_id = "test_url_param"; -dynamic response = await sg.client.api_keys._(api_key_id).put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "api_keys/" + api_key_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -69,7 +70,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var api_key_id = "test_url_param"; -dynamic response = await sg.client.api_keys._(api_key_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "api_keys/" + api_key_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -80,7 +81,7 @@ Console.ReadLine(); // GET /api_keys/{api_key_id} var api_key_id = "test_url_param"; -dynamic response = await sg.client.api_keys._(api_key_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "api_keys/" + api_key_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -91,7 +92,7 @@ Console.ReadLine(); // DELETE /api_keys/{api_key_id} var api_key_id = "test_url_param"; -dynamic response = await sg.client.api_keys._(api_key_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "api_keys/" + api_key_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/asm/asm.cs b/examples/asm/asm.cs index cc8251e..cdbf93e 100644 --- a/examples/asm/asm.cs +++ b/examples/asm/asm.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create a new suppression group @@ -16,7 +17,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.asm.groups.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -29,7 +30,7 @@ Console.ReadLine(); string queryParams = @"{ 'id': 1 }"; -dynamic response = await sg.client.asm.groups.get(queryParams: queryParams); +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()); @@ -47,7 +48,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "asm/groups/" + group_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -58,7 +59,7 @@ Console.ReadLine(); // GET /asm/groups/{group_id} var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups/" + group_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -69,7 +70,7 @@ Console.ReadLine(); // DELETE /asm/groups/{group_id} var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/groups/" + group_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -88,7 +89,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).suppressions.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups/" + group_id + "/suppressions", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -99,7 +100,7 @@ Console.ReadLine(); // GET /asm/groups/{group_id}/suppressions var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).suppressions.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/groups/" + group_id + "/suppressions"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -119,7 +120,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var group_id = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).suppressions.search.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/groups/" + group_id + "/suppressions/search", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -131,7 +132,7 @@ Console.ReadLine(); var group_id = "test_url_param"; var email = "test_url_param"; -dynamic response = await sg.client.asm.groups._(group_id).suppressions._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/groups/" + group_id + "/suppressions/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -141,7 +142,7 @@ Console.ReadLine(); // Retrieve all suppressions // GET /asm/suppressions -dynamic response = await sg.client.asm.suppressions.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -159,7 +160,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.asm.suppressions.global.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "asm/suppressions/global", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -170,7 +171,7 @@ Console.ReadLine(); // GET /asm/suppressions/global/{email} var email = "test_url_param"; -dynamic response = await sg.client.asm.suppressions.global._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions/global/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -181,7 +182,7 @@ Console.ReadLine(); // DELETE /asm/suppressions/global/{email} var email = "test_url_param"; -dynamic response = await sg.client.asm.suppressions.global._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "asm/suppressions/global/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -192,7 +193,7 @@ Console.ReadLine(); // GET /asm/suppressions/{email} var email = "test_url_param"; -dynamic response = await sg.client.asm.suppressions._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "asm/suppressions/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/browsers/browsers.cs b/examples/browsers/browsers.cs index e47ac92..5356c48 100644 --- a/examples/browsers/browsers.cs +++ b/examples/browsers/browsers.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve email statistics by browser. @@ -17,7 +18,7 @@ string queryParams = @"{ 'offset': 'test_string', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.browsers.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "browsers/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/campaigns/campaigns.cs b/examples/campaigns/campaigns.cs index 845647b..3e22a07 100644 --- a/examples/campaigns/campaigns.cs +++ b/examples/campaigns/campaigns.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create a Campaign @@ -31,7 +32,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.campaigns.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -45,7 +46,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.campaigns.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -67,7 +68,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "campaigns/" + campaign_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -78,7 +79,7 @@ Console.ReadLine(); // GET /campaigns/{campaign_id} var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns/" + campaign_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -89,7 +90,7 @@ Console.ReadLine(); // DELETE /campaigns/{campaign_id} var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "campaigns/" + campaign_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -105,7 +106,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "campaigns/" + campaign_id + "/schedules", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -121,7 +122,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -132,7 +133,7 @@ Console.ReadLine(); // GET /campaigns/{campaign_id}/schedules var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "campaigns/" + campaign_id + "/schedules"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -143,7 +144,7 @@ Console.ReadLine(); // DELETE /campaigns/{campaign_id}/schedules var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "campaigns/" + campaign_id + "/schedules"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -154,7 +155,7 @@ Console.ReadLine(); // POST /campaigns/{campaign_id}/schedules/now var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.now.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules/now"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -170,7 +171,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var campaign_id = "test_url_param"; -dynamic response = await sg.client.campaigns._(campaign_id).schedules.test.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "campaigns/" + campaign_id + "/schedules/test", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/categories/categories.cs b/examples/categories/categories.cs index 603092b..1cc4004 100644 --- a/examples/categories/categories.cs +++ b/examples/categories/categories.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve all categories @@ -14,7 +15,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.categories.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "categories", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -32,7 +33,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.categories.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "categories/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -51,7 +52,7 @@ string queryParams = @"{ 'sort_by_metric': 'test_string', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.categories.stats.sums.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "categories/stats/sums", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/clients/clients.cs b/examples/clients/clients.cs index ceb50e1..e0a5974 100644 --- a/examples/clients/clients.cs +++ b/examples/clients/clients.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve email statistics by client type. @@ -14,7 +15,7 @@ string queryParams = @"{ 'end_date': '2016-04-01', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.clients.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "clients/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -30,7 +31,7 @@ string queryParams = @"{ 'start_date': '2016-01-01' }"; var client_type = "test_url_param"; -dynamic response = await sg.client.clients._(client_type).stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "clients/" + client_type + "/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/contactdb/contactdb.cs b/examples/contactdb/contactdb.cs index 233bc5f..3c0c6b9 100644 --- a/examples/contactdb/contactdb.cs +++ b/examples/contactdb/contactdb.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create a Custom Field @@ -15,7 +16,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.custom_fields.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/custom_fields", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -25,7 +26,7 @@ Console.ReadLine(); // Retrieve all custom fields // GET /contactdb/custom_fields -dynamic response = await sg.client.contactdb.custom_fields.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/custom_fields"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -36,7 +37,7 @@ Console.ReadLine(); // GET /contactdb/custom_fields/{custom_field_id} var custom_field_id = "test_url_param"; -dynamic response = await sg.client.contactdb.custom_fields._(custom_field_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/custom_fields/" + custom_field_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -47,7 +48,7 @@ Console.ReadLine(); // DELETE /contactdb/custom_fields/{custom_field_id} var custom_field_id = "test_url_param"; -dynamic response = await sg.client.contactdb.custom_fields._(custom_field_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/custom_fields/" + custom_field_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -62,7 +63,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.lists.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -72,7 +73,7 @@ Console.ReadLine(); // Retrieve all lists // GET /contactdb/lists -dynamic response = await sg.client.contactdb.lists.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -90,7 +91,7 @@ string data = @"[ ]"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.lists.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -109,7 +110,7 @@ string queryParams = @"{ 'list_id': 1 }"; var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).patch(requestBody: data, queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/lists/" + list_id, requestBody: data, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -123,7 +124,7 @@ string queryParams = @"{ 'list_id': 1 }"; var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists/" + list_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -137,7 +138,7 @@ string queryParams = @"{ 'delete_contacts': 'true' }"; var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists/" + list_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -154,7 +155,7 @@ string data = @"[ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).recipients.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists/" + list_id + "/recipients", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -170,7 +171,7 @@ string queryParams = @"{ 'page_size': 1 }"; var list_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).recipients.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/lists/" + list_id + "/recipients", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -182,7 +183,7 @@ Console.ReadLine(); var list_id = "test_url_param"; var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/lists/" + list_id + "/recipients/" + recipient_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -198,7 +199,7 @@ string queryParams = @"{ }"; var list_id = "test_url_param"; var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/lists/" + list_id + "/recipients/" + recipient_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -217,7 +218,7 @@ string data = @"[ ]"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.recipients.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/recipients", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -243,7 +244,7 @@ string data = @"[ ]"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.recipients.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/recipients", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -257,7 +258,7 @@ string queryParams = @"{ 'page': 1, 'page_size': 1 }"; -dynamic response = await sg.client.contactdb.recipients.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -273,7 +274,7 @@ string data = @"[ ]"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.recipients.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/recipients", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -283,7 +284,7 @@ Console.ReadLine(); // Retrieve the count of billable recipients // GET /contactdb/recipients/billable_count -dynamic response = await sg.client.contactdb.recipients.billable_count.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/billable_count"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -293,7 +294,7 @@ Console.ReadLine(); // Retrieve a Count of Recipients // GET /contactdb/recipients/count -dynamic response = await sg.client.contactdb.recipients.count.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/count"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -306,7 +307,7 @@ Console.ReadLine(); string queryParams = @"{ '{field_name}': 'test_string' }"; -dynamic response = await sg.client.contactdb.recipients.search.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/search", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -317,7 +318,7 @@ Console.ReadLine(); // GET /contactdb/recipients/{recipient_id} var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.recipients._(recipient_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/" + recipient_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -328,7 +329,7 @@ Console.ReadLine(); // DELETE /contactdb/recipients/{recipient_id} var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.recipients._(recipient_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/recipients/" + recipient_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -339,7 +340,7 @@ Console.ReadLine(); // GET /contactdb/recipients/{recipient_id}/lists var recipient_id = "test_url_param"; -dynamic response = await sg.client.contactdb.recipients._(recipient_id).lists.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/recipients/" + recipient_id + "/lists"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -349,7 +350,7 @@ Console.ReadLine(); // Retrieve reserved fields // GET /contactdb/reserved_fields -dynamic response = await sg.client.contactdb.reserved_fields.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/reserved_fields"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -385,7 +386,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.contactdb.segments.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "contactdb/segments", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -395,7 +396,7 @@ Console.ReadLine(); // Retrieve all segments // GET /contactdb/segments -dynamic response = await sg.client.contactdb.segments.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -423,7 +424,7 @@ string queryParams = @"{ 'segment_id': 'test_string' }"; var segment_id = "test_url_param"; -dynamic response = await sg.client.contactdb.segments._(segment_id).patch(requestBody: data, queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "contactdb/segments/" + segment_id, requestBody: data, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -437,7 +438,7 @@ string queryParams = @"{ 'segment_id': 1 }"; var segment_id = "test_url_param"; -dynamic response = await sg.client.contactdb.segments._(segment_id).get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments/" + segment_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -451,7 +452,7 @@ string queryParams = @"{ 'delete_contacts': 'true' }"; var segment_id = "test_url_param"; -dynamic response = await sg.client.contactdb.segments._(segment_id).delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "contactdb/segments/" + segment_id, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -466,7 +467,7 @@ string queryParams = @"{ 'page_size': 1 }"; var segment_id = "test_url_param"; -dynamic response = await sg.client.contactdb.segments._(segment_id).recipients.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "contactdb/segments/" + segment_id + "/recipients", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/devices/devices.cs b/examples/devices/devices.cs index 679cde8..47f46d3 100644 --- a/examples/devices/devices.cs +++ b/examples/devices/devices.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve email statistics by device type. @@ -16,7 +17,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.devices.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "devices/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/geo/geo.cs b/examples/geo/geo.cs index 386c514..dc413c9 100644 --- a/examples/geo/geo.cs +++ b/examples/geo/geo.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve email statistics by country and state/province. @@ -17,7 +18,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.geo.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "geo/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/ips/ips.cs b/examples/ips/ips.cs index 6b67116..4094453 100644 --- a/examples/ips/ips.cs +++ b/examples/ips/ips.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve all IP addresses @@ -16,7 +17,7 @@ string queryParams = @"{ 'offset': 1, 'subuser': 'test_string' }"; -dynamic response = await sg.client.ips.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -26,7 +27,7 @@ Console.ReadLine(); // Retrieve all assigned IPs // GET /ips/assigned -dynamic response = await sg.client.ips.assigned.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/assigned"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -41,7 +42,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.ips.pools.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "ips/pools", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -51,7 +52,7 @@ Console.ReadLine(); // Retrieve all IP pools. // GET /ips/pools -dynamic response = await sg.client.ips.pools.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/pools"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -67,7 +68,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var pool_name = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "ips/pools/" + pool_name, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -78,7 +79,7 @@ Console.ReadLine(); // GET /ips/pools/{pool_name} var pool_name = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/pools/" + pool_name); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -89,7 +90,7 @@ Console.ReadLine(); // DELETE /ips/pools/{pool_name} var pool_name = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/pools/" + pool_name); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -105,7 +106,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var pool_name = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).ips.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "ips/pools/" + pool_name + "/ips", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -117,7 +118,7 @@ Console.ReadLine(); var pool_name = "test_url_param"; var ip = "test_url_param"; -dynamic response = await sg.client.ips.pools._(pool_name).ips._(ip).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/pools/" + pool_name + "/ips/" + ip); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -132,7 +133,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.ips.warmup.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "ips/warmup", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -142,7 +143,7 @@ Console.ReadLine(); // Retrieve all IPs currently in warmup // GET /ips/warmup -dynamic response = await sg.client.ips.warmup.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/warmup"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -153,7 +154,7 @@ Console.ReadLine(); // GET /ips/warmup/{ip_address} var ip_address = "test_url_param"; -dynamic response = await sg.client.ips.warmup._(ip_address).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/warmup/" + ip_address); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -164,7 +165,7 @@ Console.ReadLine(); // DELETE /ips/warmup/{ip_address} var ip_address = "test_url_param"; -dynamic response = await sg.client.ips.warmup._(ip_address).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "ips/warmup/" + ip_address); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -175,7 +176,7 @@ Console.ReadLine(); // GET /ips/{ip_address} var ip_address = "test_url_param"; -dynamic response = await sg.client.ips._(ip_address).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "ips/" + ip_address); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/mail/mail.cs b/examples/mail/mail.cs index cad9aa3..3a3eb68 100644 --- a/examples/mail/mail.cs +++ b/examples/mail/mail.cs @@ -1,15 +1,16 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create a batch ID // POST /mail/batch -dynamic response = await sg.client.mail.batch.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "mail/batch"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -20,7 +21,7 @@ Console.ReadLine(); // GET /mail/batch/{batch_id} var batch_id = "test_url_param"; -dynamic response = await sg.client.mail.batch._(batch_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail/batch/" + batch_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -171,7 +172,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail.send.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "mail/send", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/mailboxproviders/mailboxproviders.cs b/examples/mailboxproviders/mailboxproviders.cs index 5906d1d..4d9ebca 100644 --- a/examples/mailboxproviders/mailboxproviders.cs +++ b/examples/mailboxproviders/mailboxproviders.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve email statistics by mailbox provider. @@ -17,7 +18,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.mailbox_providers.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mailbox_providers/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/mailsettings/mailsettings.cs b/examples/mailsettings/mailsettings.cs index f859baa..dd85803 100644 --- a/examples/mailsettings/mailsettings.cs +++ b/examples/mailsettings/mailsettings.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve all mail settings @@ -13,7 +14,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.mail_settings.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -32,7 +33,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.address_whitelist.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/address_whitelist", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -42,7 +43,7 @@ Console.ReadLine(); // Retrieve address whitelist mail settings // GET /mail_settings/address_whitelist -dynamic response = await sg.client.mail_settings.address_whitelist.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/address_whitelist"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -58,7 +59,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.bcc.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/bcc", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -68,7 +69,7 @@ Console.ReadLine(); // Retrieve all BCC mail settings // GET /mail_settings/bcc -dynamic response = await sg.client.mail_settings.bcc.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/bcc"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -85,7 +86,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.bounce_purge.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/bounce_purge", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -95,7 +96,7 @@ Console.ReadLine(); // Retrieve bounce purge mail settings // GET /mail_settings/bounce_purge -dynamic response = await sg.client.mail_settings.bounce_purge.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/bounce_purge"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -112,7 +113,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.footer.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/footer", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -122,7 +123,7 @@ Console.ReadLine(); // Retrieve footer mail settings // GET /mail_settings/footer -dynamic response = await sg.client.mail_settings.footer.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/footer"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -138,7 +139,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.forward_bounce.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/forward_bounce", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -148,7 +149,7 @@ Console.ReadLine(); // Retrieve forward bounce mail settings // GET /mail_settings/forward_bounce -dynamic response = await sg.client.mail_settings.forward_bounce.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/forward_bounce"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -164,7 +165,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.forward_spam.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/forward_spam", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -174,7 +175,7 @@ Console.ReadLine(); // Retrieve forward spam mail settings // GET /mail_settings/forward_spam -dynamic response = await sg.client.mail_settings.forward_spam.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/forward_spam"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -189,7 +190,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.plain_content.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/plain_content", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -199,7 +200,7 @@ Console.ReadLine(); // Retrieve plain content mail settings // GET /mail_settings/plain_content -dynamic response = await sg.client.mail_settings.plain_content.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/plain_content"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -216,7 +217,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.spam_check.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/spam_check", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -226,7 +227,7 @@ Console.ReadLine(); // Retrieve spam check mail settings // GET /mail_settings/spam_check -dynamic response = await sg.client.mail_settings.spam_check.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/spam_check"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -242,7 +243,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.mail_settings.template.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "mail_settings/template", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -252,7 +253,7 @@ Console.ReadLine(); // Retrieve legacy template mail settings // GET /mail_settings/template -dynamic response = await sg.client.mail_settings.template.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "mail_settings/template"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/partnersettings/partnersettings.cs b/examples/partnersettings/partnersettings.cs index 76a3bd6..99f6bde 100644 --- a/examples/partnersettings/partnersettings.cs +++ b/examples/partnersettings/partnersettings.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Returns a list of all partner settings. @@ -13,7 +14,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.partner_settings.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "partner_settings", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -30,7 +31,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.partner_settings.new_relic.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "partner_settings/new_relic", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -40,7 +41,7 @@ Console.ReadLine(); // Returns all New Relic partner settings. // GET /partner_settings/new_relic -dynamic response = await sg.client.partner_settings.new_relic.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "partner_settings/new_relic"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/scopes/scopes.cs b/examples/scopes/scopes.cs index b58b785..ac1c40e 100644 --- a/examples/scopes/scopes.cs +++ b/examples/scopes/scopes.cs @@ -1,15 +1,16 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve a list of scopes for which this user has access. // GET /scopes -dynamic response = await sg.client.scopes.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "scopes"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/senders/senders.cs b/examples/senders/senders.cs index 283af1f..3b19573 100644 --- a/examples/senders/senders.cs +++ b/examples/senders/senders.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create a Sender Identity @@ -28,7 +29,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.senders.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "senders", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -38,7 +39,7 @@ Console.ReadLine(); // Get all Sender Identities // GET /senders -dynamic response = await sg.client.senders.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "senders"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -68,7 +69,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var sender_id = "test_url_param"; -dynamic response = await sg.client.senders._(sender_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "senders/" + sender_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -79,7 +80,7 @@ Console.ReadLine(); // GET /senders/{sender_id} var sender_id = "test_url_param"; -dynamic response = await sg.client.senders._(sender_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "senders/" + sender_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -90,7 +91,7 @@ Console.ReadLine(); // DELETE /senders/{sender_id} var sender_id = "test_url_param"; -dynamic response = await sg.client.senders._(sender_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "senders/" + sender_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -101,7 +102,7 @@ Console.ReadLine(); // POST /senders/{sender_id}/resend_verification var sender_id = "test_url_param"; -dynamic response = await sg.client.senders._(sender_id).resend_verification.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "senders/" + sender_id + "/resend_verification"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/stats/stats.cs b/examples/stats/stats.cs index c79d53c..6442c58 100644 --- a/examples/stats/stats.cs +++ b/examples/stats/stats.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve global email statistics @@ -16,7 +17,7 @@ string queryParams = @"{ 'offset': 1, 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/subusers/subusers.cs b/examples/subusers/subusers.cs index 9caf84c..74a571c 100644 --- a/examples/subusers/subusers.cs +++ b/examples/subusers/subusers.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create Subuser @@ -20,7 +21,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.subusers.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "subusers", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -35,7 +36,7 @@ string queryParams = @"{ 'offset': 1, 'username': 'test_string' }"; -dynamic response = await sg.client.subusers.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -48,7 +49,7 @@ Console.ReadLine(); string queryParams = @"{ 'usernames': 'test_string' }"; -dynamic response = await sg.client.subusers.reputations.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/reputations", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -66,7 +67,7 @@ string queryParams = @"{ 'start_date': '2016-01-01', 'subusers': 'test_string' }"; -dynamic response = await sg.client.subusers.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -84,7 +85,7 @@ string queryParams = @"{ 'sort_by_metric': 'test_string', 'subuser': 'test_string' }"; -dynamic response = await sg.client.subusers.stats.monthly.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats/monthly", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -103,7 +104,7 @@ string queryParams = @"{ 'sort_by_metric': 'test_string', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.subusers.stats.sums.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/stats/sums", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -119,7 +120,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "subusers/" + subuser_name, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -130,7 +131,7 @@ Console.ReadLine(); // DELETE /subusers/{subuser_name} var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "subusers/" + subuser_name); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -146,7 +147,7 @@ string data = @"[ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).ips.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "subusers/" + subuser_name + "/ips", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -163,7 +164,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).monitor.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "subusers/" + subuser_name + "/monitor", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -180,7 +181,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).monitor.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "subusers/" + subuser_name + "/monitor", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -191,7 +192,7 @@ Console.ReadLine(); // GET /subusers/{subuser_name}/monitor var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).monitor.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/" + subuser_name + "/monitor"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -202,7 +203,7 @@ Console.ReadLine(); // DELETE /subusers/{subuser_name}/monitor var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).monitor.delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "subusers/" + subuser_name + "/monitor"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -220,7 +221,7 @@ string queryParams = @"{ 'sort_by_metric': 'test_string' }"; var subuser_name = "test_url_param"; -dynamic response = await sg.client.subusers._(subuser_name).stats.monthly.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "subusers/" + subuser_name + "/stats/monthly", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/suppression/suppression.cs b/examples/suppression/suppression.cs index 0b0a9af..295da02 100644 --- a/examples/suppression/suppression.cs +++ b/examples/suppression/suppression.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve all blocks @@ -15,7 +16,7 @@ string queryParams = @"{ 'offset': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.blocks.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/blocks", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -34,7 +35,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.suppression.blocks.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/blocks", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -45,7 +46,7 @@ Console.ReadLine(); // GET /suppression/blocks/{email} var email = "test_url_param"; -dynamic response = await sg.client.suppression.blocks._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/blocks/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -56,7 +57,7 @@ Console.ReadLine(); // DELETE /suppression/blocks/{email} var email = "test_url_param"; -dynamic response = await sg.client.suppression.blocks._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/blocks/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -70,7 +71,7 @@ string queryParams = @"{ 'end_time': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.bounces.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/bounces", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -89,7 +90,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.suppression.bounces.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/bounces", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -100,7 +101,7 @@ Console.ReadLine(); // GET /suppression/bounces/{email} var email = "test_url_param"; -dynamic response = await sg.client.suppression.bounces._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/bounces/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -114,7 +115,7 @@ string queryParams = @"{ 'email_address': 'example@example.com' }"; var email = "test_url_param"; -dynamic response = await sg.client.suppression.bounces._(email).delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/bounces/" + email, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -130,7 +131,7 @@ string queryParams = @"{ 'offset': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.invalid_emails.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/invalid_emails", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -149,7 +150,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.suppression.invalid_emails.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/invalid_emails", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -160,7 +161,7 @@ Console.ReadLine(); // GET /suppression/invalid_emails/{email} var email = "test_url_param"; -dynamic response = await sg.client.suppression.invalid_emails._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/invalid_emails/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -171,7 +172,7 @@ Console.ReadLine(); // DELETE /suppression/invalid_emails/{email} var email = "test_url_param"; -dynamic response = await sg.client.suppression.invalid_emails._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/invalid_emails/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -182,7 +183,7 @@ Console.ReadLine(); // GET /suppression/spam_report/{email} var email = "test_url_param"; -dynamic response = await sg.client.suppression.spam_report._(email).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/spam_report/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -193,7 +194,7 @@ Console.ReadLine(); // DELETE /suppression/spam_report/{email} var email = "test_url_param"; -dynamic response = await sg.client.suppression.spam_report._(email).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/spam_report/" + email); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -209,7 +210,7 @@ string queryParams = @"{ 'offset': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.spam_reports.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/spam_reports", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -228,7 +229,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.suppression.spam_reports.delete(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "suppression/spam_reports", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -244,7 +245,7 @@ string queryParams = @"{ 'offset': 1, 'start_time': 1 }"; -dynamic response = await sg.client.suppression.unsubscribes.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "suppression/unsubscribes", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/templates/templates.cs b/examples/templates/templates.cs index 288ed22..2fda191 100644 --- a/examples/templates/templates.cs +++ b/examples/templates/templates.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create a transactional template. @@ -14,7 +15,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.templates.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "templates", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -24,7 +25,7 @@ Console.ReadLine(); // Retrieve all transactional templates. // GET /templates -dynamic response = await sg.client.templates.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "templates"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -40,7 +41,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var template_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "templates/" + template_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -51,7 +52,7 @@ Console.ReadLine(); // GET /templates/{template_id} var template_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "templates/" + template_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -62,7 +63,7 @@ Console.ReadLine(); // DELETE /templates/{template_id} var template_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "templates/" + template_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -83,7 +84,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var template_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "templates/" + template_id + "/versions", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -104,7 +105,7 @@ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var template_id = "test_url_param"; var version_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions._(version_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "templates/" + template_id + "/versions/" + version_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -116,7 +117,7 @@ Console.ReadLine(); var template_id = "test_url_param"; var version_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions._(version_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "templates/" + template_id + "/versions/" + version_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -128,7 +129,7 @@ Console.ReadLine(); var template_id = "test_url_param"; var version_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions._(version_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "templates/" + template_id + "/versions/" + version_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -140,7 +141,7 @@ Console.ReadLine(); var template_id = "test_url_param"; var version_id = "test_url_param"; -dynamic response = await sg.client.templates._(template_id).versions._(version_id).activate.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "templates/" + template_id + "/versions/" + version_id + "/activate"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/trackingsettings/trackingsettings.cs b/examples/trackingsettings/trackingsettings.cs index d21675e..1298c99 100644 --- a/examples/trackingsettings/trackingsettings.cs +++ b/examples/trackingsettings/trackingsettings.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Retrieve Tracking Settings @@ -13,7 +14,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.tracking_settings.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -28,7 +29,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.tracking_settings.click.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/click", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -38,7 +39,7 @@ Console.ReadLine(); // Retrieve Click Track Settings // GET /tracking_settings/click -dynamic response = await sg.client.tracking_settings.click.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/click"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -58,7 +59,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.tracking_settings.google_analytics.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/google_analytics", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -68,7 +69,7 @@ Console.ReadLine(); // Retrieve Google Analytics Settings // GET /tracking_settings/google_analytics -dynamic response = await sg.client.tracking_settings.google_analytics.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/google_analytics"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -83,7 +84,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.tracking_settings.open.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/open", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -93,7 +94,7 @@ Console.ReadLine(); // Get Open Tracking Settings // GET /tracking_settings/open -dynamic response = await sg.client.tracking_settings.open.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/open"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -113,7 +114,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.tracking_settings.subscription.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "tracking_settings/subscription", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -123,7 +124,7 @@ Console.ReadLine(); // Retrieve Subscription Tracking Settings // GET /tracking_settings/subscription -dynamic response = await sg.client.tracking_settings.subscription.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "tracking_settings/subscription"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/user/user.cs b/examples/user/user.cs index 2bb2c5c..3dda74e 100644 --- a/examples/user/user.cs +++ b/examples/user/user.cs @@ -1,15 +1,16 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Get a user's account information. // GET /user/account -dynamic response = await sg.client.user.account.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/account"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -19,7 +20,7 @@ Console.ReadLine(); // Retrieve your credit balance // GET /user/credits -dynamic response = await sg.client.user.credits.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/credits"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -34,7 +35,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.email.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "user/email", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -44,7 +45,7 @@ Console.ReadLine(); // Retrieve your account email address // GET /user/email -dynamic response = await sg.client.user.email.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/email"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -60,7 +61,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.password.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "user/password", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -77,7 +78,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.profile.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/profile", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -87,7 +88,7 @@ Console.ReadLine(); // Get a user's profile // GET /user/profile -dynamic response = await sg.client.user.profile.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/profile"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -103,7 +104,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.scheduled_sends.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "user/scheduled_sends", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -113,7 +114,7 @@ Console.ReadLine(); // Retrieve all scheduled sends // GET /user/scheduled_sends -dynamic response = await sg.client.user.scheduled_sends.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/scheduled_sends"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -129,7 +130,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var batch_id = "test_url_param"; -dynamic response = await sg.client.user.scheduled_sends._(batch_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/scheduled_sends/" + batch_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -140,7 +141,7 @@ Console.ReadLine(); // GET /user/scheduled_sends/{batch_id} var batch_id = "test_url_param"; -dynamic response = await sg.client.user.scheduled_sends._(batch_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/scheduled_sends/" + batch_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -151,7 +152,7 @@ Console.ReadLine(); // DELETE /user/scheduled_sends/{batch_id} var batch_id = "test_url_param"; -dynamic response = await sg.client.user.scheduled_sends._(batch_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "user/scheduled_sends/" + batch_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -167,7 +168,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.settings.enforced_tls.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/settings/enforced_tls", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -177,7 +178,7 @@ Console.ReadLine(); // Retrieve current Enforced TLS settings. // GET /user/settings/enforced_tls -dynamic response = await sg.client.user.settings.enforced_tls.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/settings/enforced_tls"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -192,7 +193,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.username.put(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PUT, urlPath: "user/username", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -202,7 +203,7 @@ Console.ReadLine(); // Retrieve your username // GET /user/username -dynamic response = await sg.client.user.username.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/username"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -229,7 +230,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.webhooks._("_("event")").settings.patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/webhooks/_("event")/settings", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -239,7 +240,7 @@ Console.ReadLine(); // Retrieve Event Webhook settings // GET /user/webhooks/event/settings -dynamic response = await sg.client.user.webhooks._("_("event")").settings.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/_("event")/settings"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -254,7 +255,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.webhooks._("_("event")").test.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "user/webhooks/_("event")/test", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -272,7 +273,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.user.webhooks.parse.settings.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "user/webhooks/parse/settings", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -282,7 +283,7 @@ Console.ReadLine(); // Retrieve all parse settings // GET /user/webhooks/parse/settings -dynamic response = await sg.client.user.webhooks.parse.settings.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/settings"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -300,7 +301,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var hostname = "test_url_param"; -dynamic response = await sg.client.user.webhooks.parse.settings._(hostname).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "user/webhooks/parse/settings/" + hostname, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -311,7 +312,7 @@ Console.ReadLine(); // GET /user/webhooks/parse/settings/{hostname} var hostname = "test_url_param"; -dynamic response = await sg.client.user.webhooks.parse.settings._(hostname).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/settings/" + hostname); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -322,7 +323,7 @@ Console.ReadLine(); // DELETE /user/webhooks/parse/settings/{hostname} var hostname = "test_url_param"; -dynamic response = await sg.client.user.webhooks.parse.settings._(hostname).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "user/webhooks/parse/settings/" + hostname); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -339,7 +340,7 @@ string queryParams = @"{ 'offset': 'test_string', 'start_date': '2016-01-01' }"; -dynamic response = await sg.client.user.webhooks.parse.stats.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "user/webhooks/parse/stats", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); diff --git a/examples/whitelabel/whitelabel.cs b/examples/whitelabel/whitelabel.cs index dfa7c68..673229f 100644 --- a/examples/whitelabel/whitelabel.cs +++ b/examples/whitelabel/whitelabel.cs @@ -1,9 +1,10 @@ using System; +using SendGrid; using SendGrid.Helpers.Mail; // If you are using the Mail Helper using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer -string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); -dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); +string apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +Client client = new Client(apiKey); //////////////////////////////////////////////////////// // Create a domain whitelabel. @@ -23,7 +24,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.whitelabel.domains.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -40,7 +41,7 @@ string queryParams = @"{ 'offset': 1, 'username': 'test_string' }"; -dynamic response = await sg.client.whitelabel.domains.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -50,7 +51,7 @@ Console.ReadLine(); // Get the default domain whitelabel. // GET /whitelabel/domains/default -dynamic response = await sg.client.whitelabel.domains._("_("default")").get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/_("default")"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -60,7 +61,7 @@ Console.ReadLine(); // List the domain whitelabel associated with the given user. // GET /whitelabel/domains/subuser -dynamic response = await sg.client.whitelabel.domains.subuser.get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/subuser"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -70,7 +71,7 @@ Console.ReadLine(); // Disassociate a domain whitelabel from a given user. // DELETE /whitelabel/domains/subuser -dynamic response = await sg.client.whitelabel.domains.subuser.delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/subuser"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -87,7 +88,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var domain_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(domain_id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "whitelabel/domains/" + domain_id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -98,7 +99,7 @@ Console.ReadLine(); // GET /whitelabel/domains/{domain_id} var domain_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(domain_id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/domains/" + domain_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -109,7 +110,7 @@ Console.ReadLine(); // DELETE /whitelabel/domains/{domain_id} var domain_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(domain_id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/" + domain_id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -125,7 +126,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var domain_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(domain_id).subuser.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + domain_id + "/subuser", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -141,7 +142,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(id).ips.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + id + "/ips", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -153,7 +154,7 @@ Console.ReadLine(); var id = "test_url_param"; var ip = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(id).ips._(ip).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/domains/" + id + "/ips/" + ip); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -164,7 +165,7 @@ Console.ReadLine(); // POST /whitelabel/domains/{id}/validate var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.domains._(id).validate.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/domains/" + id + "/validate"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -181,7 +182,7 @@ string data = @"{ }"; Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); -dynamic response = await sg.client.whitelabel.ips.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/ips", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -196,7 +197,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.whitelabel.ips.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/ips", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -207,7 +208,7 @@ Console.ReadLine(); // GET /whitelabel/ips/{id} var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.ips._(id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/ips/" + id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -218,7 +219,7 @@ Console.ReadLine(); // DELETE /whitelabel/ips/{id} var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.ips._(id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/ips/" + id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -229,7 +230,7 @@ Console.ReadLine(); // POST /whitelabel/ips/{id}/validate var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.ips._(id).validate.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/ips/" + id + "/validate"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -250,7 +251,7 @@ string queryParams = @"{ 'limit': 1, 'offset': 1 }"; -dynamic response = await sg.client.whitelabel.links.post(requestBody: data, queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links", requestBody: data, queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -263,7 +264,7 @@ Console.ReadLine(); string queryParams = @"{ 'limit': 1 }"; -dynamic response = await sg.client.whitelabel.links.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -276,7 +277,7 @@ Console.ReadLine(); string queryParams = @"{ 'domain': 'test_string' }"; -dynamic response = await sg.client.whitelabel.links._("_("default")").get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/_("default")", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -289,7 +290,7 @@ Console.ReadLine(); string queryParams = @"{ 'username': 'test_string' }"; -dynamic response = await sg.client.whitelabel.links.subuser.get(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/subuser", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -302,7 +303,7 @@ Console.ReadLine(); string queryParams = @"{ 'username': 'test_string' }"; -dynamic response = await sg.client.whitelabel.links.subuser.delete(queryParams: queryParams); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/links/subuser", queryParams: queryParams); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -318,7 +319,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(id).patch(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.PATCH, urlPath: "whitelabel/links/" + id, requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -329,7 +330,7 @@ Console.ReadLine(); // GET /whitelabel/links/{id} var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(id).get(); +Response response = await client.RequestAsync(method: Client.Methods.GET, urlPath: "whitelabel/links/" + id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -340,7 +341,7 @@ Console.ReadLine(); // DELETE /whitelabel/links/{id} var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(id).delete(); +Response response = await client.RequestAsync(method: Client.Methods.DELETE, urlPath: "whitelabel/links/" + id); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -351,7 +352,7 @@ Console.ReadLine(); // POST /whitelabel/links/{id}/validate var id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(id).validate.post(); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links/" + id + "/validate"); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); @@ -367,7 +368,7 @@ string data = @"{ Object json = JsonConvert.DeserializeObject<Object>(data); data = json.ToString(); var link_id = "test_url_param"; -dynamic response = await sg.client.whitelabel.links._(link_id).subuser.post(requestBody: data); +Response response = await client.RequestAsync(method: Client.Methods.POST, urlPath: "whitelabel/links/" + link_id + "/subuser", requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); Console.WriteLine(response.Headers.ToString()); |