Class: CherryPieClient

CherryPieClient

this is CherryPieClient class

Constructor

new CherryPieClient()

Source:

Methods

base64url(input) → {*}

Parameters:
Name Type Description
input
Source:
Returns:
Type
*

createCampaign(data, callback)

Create new campaign in cherry pie
Parameters:
Name Type Description
data object Object with campaigns contains these props: - name {string} (required) Your campaign’s unique identifier. The name must only contain letters, numbers or the underscore character. and cannot contain any spaces (e.g. Happy_birthday_2018). Please note, this identifier cannot be changed after the campaign is created. - passbookCertId {string} (required) This is the certificate ID that is generated by PassKit when you upload a certificate, you can check which certificates you have uploaded with the list certificates endpoint. Please note, the Certificate ID cannot be changed after the campaign is created. - status {string} The value must be either ACTIVE, FROZEN, or INVALID. Default is ACTIVE. The campaign status controls whether passes can be issued or not. ACTIVE - Enables passes to be issued.FROZEN - Passes cannot be issued, existing passes are not affected and this value can be changed back to ACTIVE. INVALID - Passes cannot be issued and all existing passes will be set to invalid. Once the INVALID value is set, it cannot be changed. - displayName {string} This is the human friendly version of your campaign name, this will be displayed to customers when they are looking to download their pass. - description {string} This is your campaign description. The description will be displayed when customers are downloading their pass. This value should detail the campaign offers and customer benefits. - startDate {ISO8601 datetime} (required) The campaign start date. Passes cannot be issued before this time and date. - meta {JSONObject} Metadata to store in campaign level. This data is invisiable to users. - endDate {ISO8601 datetime} The campaign end date. Passes cannot be issued after this date and time, and all existing passes will be set to voided. - maxIssue {integer}
callback function standart callback function(error,response);
Source:

createTemplate(data, callback)

create template for campaign
Parameters:
Name Type Description
data
callback function standart callback function(error,response);
Source:

doQuery(http_method, endpoint, req_data, http_options, callback)

Parameters:
Name Type Description
http_method
endpoint
req_data
http_options
callback
Source:

generateJWT(key, secret) → {string}

Generate token from pair key & secret
Parameters:
Name Type Description
key
secret
Source:
Returns:
Type
string

genTokenSign(token, secret) → {*}

generate token sign
Parameters:
Name Type Description
token
secret
Source:
Returns:
Type
*

get_default_options()

Function to retrive the default options
Source:

getAuthorization() → {string}

Returns value for Authorization header
Source:
Returns:
Type
string

getBaseUrl() → {string}

Prepare base url for API requests
Source:
Returns:
Type
string

getCampaign(campaigName, callback)

Return campaign
Parameters:
Name Type Description
campaigName string campaign name
callback function standart callback function(error,response);
Source:

getCampaigns(callback)

Return all campaigns in Cherry Pie
Parameters:
Name Type Description
callback function standart callback function(error,response);
Source:

getCampaignTemplates(campaigName, callback)

Return all templates for campaign with name
Parameters:
Name Type Description
campaigName string campaign name
callback function standart callback function(error,response);
Source:

getCetificates(callback)

Return all certificates for client
Parameters:
Name Type Description
callback function standart callback function(error,response);
Source:

setOptions()

Function to initialize options on Client
Source:

updateCampaign(campaigName, data, callback)

Update campaign
Parameters:
Name Type Description
campaigName string campaign name
data object
callback function standart callback function(error,response);
Source:

uploadImage(image, callback)

Parameters:
Name Type Description
image string (required) Your campaign’s unique identifier. The name must only contain letters, numbers or the underscore character. and cannot contain any spaces (e.g. Happy_birthday_2018). Please note, this identifier cannot be changed after the campaign is created.
callback function standart callback function(error,response);
Source:

urlConvertBase64(input) → {XML|string|void|*}

Converts url to Base64
Parameters:
Name Type Description
input
Source:
Returns:
Type
XML | string | void | *