Skip to content

Commit b1f6f17

Browse files
committed
adding updated lib files
1 parent e433aec commit b1f6f17

File tree

101 files changed

+13554
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+13554
-0
lines changed
52.5 KB
Binary file not shown.

Pepipost/.vs/ProjectSettings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"CurrentProjectSetting": null
3+
}

Pepipost/.vs/VSWorkspaceState.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"ExpandedNodes": [
3+
"",
4+
"\\Http\\Client",
5+
"\\Http\\Request",
6+
"\\Http\\Response"
7+
],
8+
"PreviewInSolutionExplorer": false
9+
}

Pepipost/.vs/slnx.sqlite

196 KB
Binary file not shown.

Pepipost/Configuration.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Pepipost.Models;
2+
namespace Pepipost
3+
{
4+
public partial class Configuration
5+
{
6+
7+
8+
//The base Uri for API calls
9+
public static string BaseUri = "https://api.pepipost.com/v5";
10+
11+
//Your Pepipost API Key. You will find the api key in the Pepipost application in Integrations.
12+
//TODO: Replace the ApiKey with an appropriate value
13+
public static string ApiKey = "";
14+
15+
}
16+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Pepipost
3+
*
4+
* This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
5+
*/
6+
using System;
7+
using Pepipost;
8+
using Pepipost.Utilities;
9+
using Pepipost.Http.Client;
10+
using Pepipost.Http.Response;
11+
using Pepipost.Exceptions;
12+
13+
namespace Pepipost.Controllers
14+
{
15+
public partial class BaseController
16+
{
17+
#region shared http client instance
18+
private static object syncObject = new object();
19+
private static IHttpClient clientInstance = null;
20+
21+
public static IHttpClient ClientInstance
22+
{
23+
get
24+
{
25+
lock(syncObject)
26+
{
27+
if(null == clientInstance)
28+
{
29+
clientInstance = new HTTPClient()
30+
;
31+
}
32+
return clientInstance;
33+
}
34+
}
35+
set
36+
{
37+
lock (syncObject)
38+
{
39+
if (value is IHttpClient)
40+
{
41+
clientInstance = value;
42+
}
43+
}
44+
}
45+
}
46+
#endregion shared http client instance
47+
48+
internal ArrayDeserialization ArrayDeserializationFormat = ArrayDeserialization.Indexed;
49+
internal static char ParameterSeparator = '&';
50+
51+
/// <summary>
52+
/// Validates the response against HTTP errors defined at the API level
53+
/// </summary>
54+
/// <param name="_response">The response recieved</param>
55+
/// <param name="_context">Context of the request and the recieved response</param>
56+
internal void ValidateResponse(HttpResponse _response, HttpContext _context)
57+
{
58+
if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200,208] = HTTP OK
59+
throw new APIException(@"HTTP Response Not OK", _context);
60+
}
61+
}
62+
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/*
2+
* Pepipost
3+
*
4+
* This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
5+
*/
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Dynamic;
9+
using System.Globalization;
10+
using System.IO;
11+
using System.Linq;
12+
using System.Text;
13+
using System.Threading.Tasks;
14+
using Newtonsoft.Json.Converters;
15+
using Pepipost;
16+
using Pepipost.Utilities;
17+
using Pepipost.Http.Request;
18+
using Pepipost.Http.Response;
19+
using Pepipost.Http.Client;
20+
using Pepipost.Exceptions;
21+
22+
namespace Pepipost.Controllers
23+
{
24+
public partial class DomainController: BaseController
25+
{
26+
#region Singleton Pattern
27+
28+
//private static variables for the singleton pattern
29+
private static object syncObject = new object();
30+
private static DomainController instance = null;
31+
32+
/// <summary>
33+
/// Singleton pattern implementation
34+
/// </summary>
35+
internal static DomainController Instance
36+
{
37+
get
38+
{
39+
lock (syncObject)
40+
{
41+
if (null == instance)
42+
{
43+
instance = new DomainController();
44+
}
45+
}
46+
return instance;
47+
}
48+
}
49+
50+
#endregion Singleton Pattern
51+
52+
/// <summary>
53+
/// This endpoint enables you to add a sending domain which is one of the pre-requisites for sending emails.
54+
/// </summary>
55+
/// <param name="body">Required parameter: Add new domain</param>
56+
/// <return>Returns the object response from the API call</return>
57+
public object AddDomain(Models.DomainStruct body)
58+
{
59+
Task<object> t = AddDomainAsync(body);
60+
APIHelper.RunTaskSynchronously(t);
61+
return t.Result;
62+
}
63+
64+
/// <summary>
65+
/// This endpoint enables you to add a sending domain which is one of the pre-requisites for sending emails.
66+
/// </summary>
67+
/// <param name="body">Required parameter: Add new domain</param>
68+
/// <return>Returns the object response from the API call</return>
69+
public async Task<object> AddDomainAsync(Models.DomainStruct body)
70+
{
71+
//the base uri for api requests
72+
string _baseUri = Configuration.BaseUri;
73+
74+
//prepare query string for API call
75+
StringBuilder _queryBuilder = new StringBuilder(_baseUri);
76+
_queryBuilder.Append("/domain");
77+
78+
79+
//validate and preprocess url
80+
string _queryUrl = APIHelper.CleanUrl(_queryBuilder);
81+
82+
//append request with appropriate headers and parameters
83+
var _headers = new Dictionary<string,string>()
84+
{
85+
{ "user-agent", "APIMATIC 2.0" },
86+
{ "content-type", "application/json; charset=utf-8" }
87+
};
88+
_headers.Add("api_key", Configuration.ApiKey);
89+
90+
//append body params
91+
var _body = APIHelper.JsonSerialize(body);
92+
93+
//prepare the API call request to fetch the response
94+
HttpRequest _request = ClientInstance.PostBody(_queryUrl, _headers, _body);
95+
96+
//invoke request and get response
97+
HttpStringResponse _response = (HttpStringResponse) await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);
98+
HttpContext _context = new HttpContext(_request,_response);
99+
100+
//Error handling using HTTP status codes
101+
if (_response.StatusCode == 400)
102+
throw new APIException(@"API Response", _context);
103+
104+
if (_response.StatusCode == 401)
105+
throw new APIException(@"API Response", _context);
106+
107+
if (_response.StatusCode == 403)
108+
throw new APIException(@"API Response", _context);
109+
110+
if (_response.StatusCode == 405)
111+
throw new APIException(@"Invalid input", _context);
112+
113+
//handle errors defined at the API level
114+
base.ValidateResponse(_response, _context);
115+
116+
try
117+
{
118+
return _response.Body;
119+
}
120+
catch (Exception _ex)
121+
{
122+
throw new APIException("Failed to parse the response: " + _ex.Message, _context);
123+
}
124+
}
125+
126+
}
127+
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/*
2+
* Pepipost
3+
*
4+
* This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
5+
*/
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Dynamic;
9+
using System.Globalization;
10+
using System.IO;
11+
using System.Linq;
12+
using System.Text;
13+
using System.Threading.Tasks;
14+
using Newtonsoft.Json.Converters;
15+
using Pepipost;
16+
using Pepipost.Utilities;
17+
using Pepipost.Http.Request;
18+
using Pepipost.Http.Response;
19+
using Pepipost.Http.Client;
20+
using Pepipost.Exceptions;
21+
22+
namespace Pepipost.Controllers
23+
{
24+
public partial class DomainDeleteController: BaseController
25+
{
26+
#region Singleton Pattern
27+
28+
//private static variables for the singleton pattern
29+
private static object syncObject = new object();
30+
private static DomainDeleteController instance = null;
31+
32+
/// <summary>
33+
/// Singleton pattern implementation
34+
/// </summary>
35+
internal static DomainDeleteController Instance
36+
{
37+
get
38+
{
39+
lock (syncObject)
40+
{
41+
if (null == instance)
42+
{
43+
instance = new DomainDeleteController();
44+
}
45+
}
46+
return instance;
47+
}
48+
}
49+
50+
#endregion Singleton Pattern
51+
52+
/// <summary>
53+
/// This endpoint allows you to delete a domain from your Pepipost account.
54+
/// </summary>
55+
/// <param name="body">Required parameter: delete domain</param>
56+
/// <return>Returns the object response from the API call</return>
57+
public object DeleteDomain(Models.DeleteDomain body)
58+
{
59+
Task<object> t = DeleteDomainAsync(body);
60+
APIHelper.RunTaskSynchronously(t);
61+
return t.Result;
62+
}
63+
64+
/// <summary>
65+
/// This endpoint allows you to delete a domain from your Pepipost account.
66+
/// </summary>
67+
/// <param name="body">Required parameter: delete domain</param>
68+
/// <return>Returns the object response from the API call</return>
69+
public async Task<object> DeleteDomainAsync(Models.DeleteDomain body)
70+
{
71+
//the base uri for api requests
72+
string _baseUri = Configuration.BaseUri;
73+
74+
//prepare query string for API call
75+
StringBuilder _queryBuilder = new StringBuilder(_baseUri);
76+
_queryBuilder.Append("/domain/delete");
77+
78+
79+
//validate and preprocess url
80+
string _queryUrl = APIHelper.CleanUrl(_queryBuilder);
81+
82+
//append request with appropriate headers and parameters
83+
var _headers = new Dictionary<string,string>()
84+
{
85+
{ "user-agent", "APIMATIC 2.0" },
86+
{ "content-type", "application/json; charset=utf-8" }
87+
};
88+
_headers.Add("api_key", Configuration.ApiKey);
89+
90+
//append body params
91+
var _body = APIHelper.JsonSerialize(body);
92+
93+
//prepare the API call request to fetch the response
94+
HttpRequest _request = ClientInstance.DeleteBody(_queryUrl, _headers, _body);
95+
96+
//invoke request and get response
97+
HttpStringResponse _response = (HttpStringResponse) await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);
98+
HttpContext _context = new HttpContext(_request,_response);
99+
100+
//Error handling using HTTP status codes
101+
if (_response.StatusCode == 400)
102+
throw new APIException(@"API Response", _context);
103+
104+
if (_response.StatusCode == 401)
105+
throw new APIException(@"API Response", _context);
106+
107+
if (_response.StatusCode == 403)
108+
throw new APIException(@"API Response", _context);
109+
110+
if (_response.StatusCode == 405)
111+
throw new APIException(@"Invalid input", _context);
112+
113+
//handle errors defined at the API level
114+
base.ValidateResponse(_response, _context);
115+
116+
try
117+
{
118+
return _response.Body;
119+
}
120+
catch (Exception _ex)
121+
{
122+
throw new APIException("Failed to parse the response: " + _ex.Message, _context);
123+
}
124+
}
125+
126+
}
127+
}

0 commit comments

Comments
 (0)