Skip to content

Commit

Permalink
Committing with Success removing old files
Browse files Browse the repository at this point in the history
  • Loading branch information
hellovikram committed Aug 29, 2018
1 parent 101f3f8 commit ed5a1b5
Show file tree
Hide file tree
Showing 109 changed files with 1,068 additions and 91,264 deletions.
122 changes: 122 additions & 0 deletions Mono-installation-SDK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Steps to install C# SDK with Mono-Develop IDE using Git (without Nuget/Package Manager)

If you are using Mono for development and want to integrated with Pepipost directly by using Git, then below steps will help you in integrating this Pepipost C# code library in our IDE.


## Prerequisites

* [dotnet SDK](https://www.microsoft.com/net/download/dotnet-core/2.0) (> 2.0)
* [mono devel](https://www.mono-project.com/download/stable/)
* [Mono-develop IDE](https://www.monodevelop.com/download/)
* [NETStandard.Library](https://www.nuget.org/packages/NETStandard.Library/)(>= 1.6.1)
* [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/)
* A free account on [Pepipost](https://app.pepipost.com/index.php/signup/registeruser).If you don't have a one, click here to sign-up and get 30,000 emails free every month.

## How to Build

1. Download [Pepipost SDK](https://github.com/pepipost/pepipost-sdk-csharp/archive/master.zip)

Unzip the SDK on any Location of your choice (we will unzipped in directory named testSDK)

OR ```git clone https://github.com/pepipost/pepipost-sdk-csharp.git```

![mygit](http://app1.falconide.com/integration_imgs/csharp-mono/1.png)


2. Start Mono-Develop IDE

Click **open**

![monoide](http://app1.falconide.com/integration_imgs/csharp-mono/2.png)


3. Select **Pepipost.sln** from unzipped folder

**Open** the Solution once you have selected the sln file

![mono](http://app1.falconide.com/integration_imgs/csharp-mono/3.png)


4. Once you have opened the solution the few files will appear with respective SDK:

Add new project to the main directory as shown below

![monoaddpro](http://app1.falconide.com/integration_imgs/csharp-mono/4.png)


5. Choose template for new project will be prompted

Select **App -> Console Application -> next**

![appconsole](http://app1.falconide.com/integration_imgs/csharp-mono/5.png)


6. Configure new project

Give a desired name to your project (testConsole recommended)

![makeconsole](http://app1.falconide.com/integration_imgs/csharp-mono/6.png)


7. Resolving dependencies

a. Adding reference

![dep1](http://app1.falconide.com/integration_imgs/csharp-mono/7.png)

Select **Edit Reference**

![dep2](http://app1.falconide.com/integration_imgs/csharp-mono/8.png)

Select **Pepipost -> OK**

![dep3](http://app1.falconide.com/integration_imgs/csharp-mono/9.png)

b. Adding packages

![dep4](http://app1.falconide.com/integration_imgs/csharp-mono/10.png)

search **NewtonSoft.json -> Add packages**

![dep5](http://app1.falconide.com/integration_imgs/csharp-mono/11.png)


8. Once all the packages are installed successfully

Just copy and paste the [simpleUsage.md](https://github.com/hellovikram/pepipost-csharp/blob/master/simpleUsage.md) in your program.cs file present in your project.

Build the project as shown below OR by just hit **F8** to build

![monol8](http://app1.falconide.com/integration_imgs/csharp-mono/l8.png)


9. Update the api_key and FromEmail parameters:

* apikey: This will be available under: Login to your Pepipost account -> Settings -> Integration
* FromEmail: If your fromemail address is e.g. info@mydomain.com, then the Sending Domain mydomain need to be verified and active under your Pepipost account. You can manage the Sending Domain under: Login to Pepipost -> Settings -> Sending Domains


10. Change apiKey and FromEmail in your script:

```string apiKey = "XXXXX-your-api-key-XXXX" ``` (near by line no 25 if your have copy the simpleUsage.md)

```body_personalizations_0.Recipient = "your recipient emailid here"``` (near by line no 31)

```body.From.FromEmail = "info@ your-verified-domain"``` (near by line no 37)


11. Build the project to finally send your first test email Run the project.

Run the project by hiting **Ctrl + F5**

If your apikey and sending domain is proper, then response message will be success.

![monol9](http://app1.falconide.com/integration_imgs/csharp-mono/l9.png)

Hope, you have received your first test email 😃

If there is some problem related with config, then you will receive error message as shown below:

![mono10](http://app1.falconide.com/integration_imgs/csharp-mono/l10.png)

84 changes: 84 additions & 0 deletions Mono-installation-nuget.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Step to install C# Library using Mono-Develop IDE

If you are using Mono for development, then below steps will help you in integrating this Pepipost C# code library in our IDE.

## Prerequisites

* [dotnet SDK](https://www.microsoft.com/net/download/dotnet-core/2.0) (> 2.0)
* [mono devel](https://www.mono-project.com/download/stable/)
* [Mono-develop IDE](https://www.monodevelop.com/download/)
* [NETStandard.Library](https://www.nuget.org/packages/NETStandard.Library/)(>= 1.6.1)
* [Pepipost](https://www.nuget.org/packages/Pepipost/)
* A free account on [Pepipost](https://app.pepipost.com/index.php/signup/registeruser). If you don't have a one, click here to sign-up and get 30,000 emails free every month.

## How to build

1. Start mono-develop IDE

![Monol1](http://app1.falconide.com/integration_imgs/csharp-mono/l1.png)


2. Select **File -> New Solution** Or Simply **Ctrl+shift+N**

Template for new project prompt will appear **App -> console application -> Next**

![monol2](http://app1.falconide.com/integration_imgs/csharp-mono/l2.png)


3. Give a name to your project

```testConsole```

Once you have named your project simply click create

![monol3](http://app1.falconide.com/integration_imgs/csharp-mono/l3.png)


4. After Project is successfully created

![monol4](http://app1.falconide.com/integration_imgs/csharp-mono/l4.png)


5. Let's add Nuget package dependencies as described earlier

![mono15](http://app1.falconide.com/integration_imgs/csharp-mono/l5.png)

Select **official C# library Pepipost**

![monol7](https://app1.falconide.com/integration_imgs/csharp-mono/l7.png)


6. Once all the packages are installed successfully, just copy and paste the [simpleUsage.md](https://github.com/hellovikram/pepipost-csharp/blob/master/simpleUsage.md) in your program.cs file present in your project.

Build the project as shown below OR by simply hit **F8**

![monol8](http://app1.falconide.com/integration_imgs/csharp-mono/l8.png)

7. Update the api_key and FromEmail parameters:

* apikey: This will be available under: Login to your Pepipost account -> Settings -> Integration
* FromEmail: If your fromemail address is e.g. info@mydomain.com, then the Sending Domain mydomain need to be verified and active under your Pepipost account. You can manage the Sending Domain under: Login to Pepipost -> Settings -> Sending Domains

8. Change apiKey and FromEmail in your script:

```string apiKey = "XXXXX-your-api-key-XXXX" ``` (near by line no 25 if your have copy the simpleUsage.md)

```body_personalizations_0.Recipient = "your recipient emailid here"``` (near by line no 31)

```body.From.FromEmail = "info@ your-verified-domain"``` (near by line no 37)

9. Build the project to finally send your first test email Run the project.

Run the project by hiting **Ctrl + F5**

If your apikey and sending domain is proper, then response message will be success.

![monol9](http://app1.falconide.com/integration_imgs/csharp-mono/l9.png)

Hope, you have received your first test email 😃

If there is some problem related with config, then you will receive error message as shown below:

![mono10](http://app1.falconide.com/integration_imgs/csharp-mono/l10.png)


22 changes: 22 additions & 0 deletions Pepipost.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pepipost", "Pepipost\Pepipost.csproj", "{539D99FD-F8E5-4C12-8F62-26EF7585CB94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{539D99FD-F8E5-4C12-8F62-26EF7585CB94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{539D99FD-F8E5-4C12-8F62-26EF7585CB94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{539D99FD-F8E5-4C12-8F62-26EF7585CB94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{539D99FD-F8E5-4C12-8F62-26EF7585CB94}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using PepipostAPI.Standard.Models;
namespace PepipostAPI.Standard
using Pepipost.Models;
namespace Pepipost
{
public partial class Configuration
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* PepipostAPI.Standard
* Pepipost
*
* This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io )
* This file was semi-automatically generated by APIMATIC v2.0 ( https://apimatic.io )
*/
using System;
using PepipostAPI.Standard;
using PepipostAPI.Standard.Utilities;
using PepipostAPI.Standard.Http.Client;
using PepipostAPI.Standard.Http.Response;
using PepipostAPI.Standard.Exceptions;
using Pepipost;
using Pepipost.Utilities;
using Pepipost.Http.Client;
using Pepipost.Http.Response;
using Pepipost.Exceptions;

namespace PepipostAPI.Standard.Controllers
namespace Pepipost.Controllers
{
public partial class BaseController
{
Expand Down Expand Up @@ -55,8 +55,8 @@ public static IHttpClient ClientInstance
/// <param name="_context">Context of the request and the recieved response</param>
internal void ValidateResponse(HttpResponse _response, HttpContext _context)
{
if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200,208] = HTTP OK
throw new APIException(@"HTTP Response Not OK", _context);
// if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200,208] = HTTP OK
// throw new APIException(@"HTTP Response Not OK", _context);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* PepipostAPI.Standard
* Pepipost
*
* This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io )
* This file was semi-automatically generated by APIMATIC v2.0 ( https://apimatic.io )
*/
using System;
using System.Collections.Generic;
Expand All @@ -12,14 +12,14 @@
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Converters;
using PepipostAPI.Standard;
using PepipostAPI.Standard.Utilities;
using PepipostAPI.Standard.Http.Request;
using PepipostAPI.Standard.Http.Response;
using PepipostAPI.Standard.Http.Client;
using PepipostAPI.Standard.Exceptions;

namespace PepipostAPI.Standard.Controllers
using Pepipost;
using Pepipost.Utilities;
using Pepipost.Http.Request;
using Pepipost.Http.Response;
using Pepipost.Http.Client;
using Pepipost.Exceptions;

namespace Pepipost.Controllers
{
public partial class EmailController: BaseController
{
Expand Down Expand Up @@ -99,6 +99,11 @@ public Models.SendEmailResponse CreateSendEmail(string apiKey = null, Models.Ema
//invoke request and get response
HttpStringResponse _response = (HttpStringResponse) await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);
HttpContext _context = new HttpContext(_request,_response);

//Error handling using HTTP status codes
if (_response.StatusCode == 405)
throw new APIException(@"Method not allowed", _context);

//handle errors defined at the API level
base.ValidateResponse(_response, _context);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* PepipostAPI.Standard
* Pepipost
*
* This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io )
* This file was semi-automatically generated by APIMATIC v2.0 ( https://apimatic.io )
*/
using System;
using System.IO;
using Newtonsoft.Json;
using PepipostAPI.Standard.Http.Client;
using Pepipost.Http.Client;

namespace PepipostAPI.Standard.Exceptions
namespace Pepipost.Exceptions
{
[JsonObject]
public class APIException : Exception
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.IO;

namespace PepipostAPI.Standard.Http.Client
namespace Pepipost.Http.Client
{
/// <summary>
/// An DTO class to capture information for file uploads
Expand Down
Loading

0 comments on commit ed5a1b5

Please sign in to comment.