Skip to content

flomio/passninja-cs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

passninja-cs

Use passninja-cs as an .Net module.

Contents

Installation

Install via Package Manager:

Install-Package passninja.dll -Version 1.0.0

Usage

PassNinjaClient

This function returns a newly created PassNinjaClient object. Make sure to pass your user credentials to make any authenticated requests.

using passninja;

private const string AccountId = "90f0629f-2960-4c20-ac8d-d6e6e389ac73";
private const string ApiKey = "PEMsFSPv2H3O9e8iPW4oO96mqpSChzek7omQGjdY";

PassNinjaClient passNinjaClient = new PassNinjaClient(AccountId, ApiKey);

We've placed our demo user API credentials in this example. Replace it with your actual API credentials to test this code through your PassNinja account and don't hesitate to contact PassNinja with our built in chat system if you'd like to subscribe and create your own custom pass type(s).

For more information on how to use passninja-cs once it loads, please refer to the PassNinja JS API reference

PassNinjaClientMethods

This library currently supports methods for creating, getting, updating, and deleting passes via the PassNinja api. The methods are outlined below. Note that each method returns a promise.

Create

  var createResponse = passNinjaClient.CreatePass("demo.coupon", new PassData()
  {
    discount = "50%",
    memberName = "Test User1"
  });

  Console.WriteLine("Create Pass response");
  Console.WriteLine(createResponse.url);
  Console.WriteLine(createResponse.passType);
  Console.WriteLine(createResponse.serialNumber);

Get

var getResponse = passNinjaClient.GetPass("demo.coupon", "ed669b28-9b87-485b-8df6-8b04158d53c1");

Console.WriteLine(getResponse.url);             
Console.WriteLine(getResponse.passType);
Console.WriteLine(getResponse.serialNumber);

Update

var putResponse = passNinjaClient.PutPass("demo.coupon", "ed669b28-9b87-485b-8df6-8b04158d53c1", new PassData()
{
    discount = "50%",
    memberName = "Test User2"
});

Delete

var deleteResponse = passNinjaClient.DeletePass("demo.coupon", "e56b4857-5bf6-4829-a6c3-951aee5d3a15");  

Console.WriteLine("Delete Pass response");

About

A PassNinja API helper library for C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages