C# Class PassKitAPIWrapper.PassKit

Main PassKit API wrapper class
Mostrar archivo Open project: PassKit/PassKitSDK Class Usage Examples

Public Methods

Method Description
GetImageData ( string imageId ) : PassKitResponse

Method returns information about the image with imageId.

GetPassDetails ( string passId ) : PassKitResponse

Gets the details for a pass identified by the given unique pass-id. Returns the details for one unique pass only. More info

GetPassDetails ( string templateName, string serialNumber ) : PassKitResponse

Gets the details for a pass identified by the given template name and serial number. Serial number is not unique in case the user decided to use the same serial for multiple passes in the pass designer. In that case the response can contain information for multiple passes. More info

GetPasses ( string templateName ) : PassKitResponse

Gets the passes for a given template. More info

GetTemplateFieldNames ( string templateName, bool full = false ) : PassKitResponse

This method returns the field names that can be used with the Issue Pass and Update Pass methods for a particular template. It returns the names of all dynamic fields in the template, plus other variables such as barcode content, serial number or thumbnail image that can be set or updated. More info

GetTemplates ( ) : PassKitResponse

Requests a list of templates for the current API account. More info

InvalidatePass ( string passId, string>.Dictionary fields ) : PassKitResponse

This method is used for invalidating a pass. It accepts the parameters returned by the Get Template Field Names method, plus relevance fields for date and for up to 10 locations. Invalidating a pass, performs two functions in a single call. Firstly, it serves as a update, allowing you to change the content of an invalidated pass and secondly, it removes the pass from circulation, preventing it from being updated or manually refreshed.

InvalidatePass ( string templateName, string serialNumber, string>.Dictionary fields ) : PassKitResponse

This method is used for invalidating a pass. It accepts the parameters returned by the Get Template Field Names method, plus relevance fields for date and for up to 10 locations. Invalidating a pass, performs two functions in a single call. Firstly, it serves as a update, allowing you to change the content of an invalidated pass and secondly, it removes the pass from circulation, preventing it from being updated or manually refreshed.

IssuePass ( string templateName, string>.Dictionary fields ) : PassKitResponse

Issues a new PassKit pass for template with 'templateName', with the data provided in the 'fields' dictionary. The 'fields' dictionary uses the field-names as 'key' and the values as 'value'. More info

PassKit ( string account, string secret ) : System

Constructor for the PassKit class. All API methods return a PassKitResponse object that always contains: 1. HTTP Response Code; 2. Response object. The first parameter on success is: success (bool), or error (string) on error;

ResetTemplate ( string templateName, bool push = true ) : PassKitResponse

This method resets each pass record to the default values. This only affects values that the user cannot edit. The method also removes all data-fields from each pass record. More info

UpdatePass ( string passId, string>.Dictionary fields, bool push = true ) : PassKitResponse

Updates the fields for pass identified by 'passId'. 'passId' is unique, so method will update one pass. More info

UpdatePass ( string templateName, string serialNumber, string>.Dictionary fields, bool push = true ) : PassKitResponse

Updates the fields for pass identified by 'templateName' and 'serialNumber'. Method can update multiple passes at once in case the user decided to use the same serial for multiple passes in the pass designer. More info

UpdateTemplate ( string templateName, string>.Dictionary fields, bool push = true ) : PassKitResponse

Updates the template. Causes all the passes of the template to be updated as well. More info

UploadImage ( string pathToLocalFile, PassKitImageType imageType ) : PassKitResponse

This method allows you to upload images for use with other methods such as template methods and pass methods. Each image that is uploaded is assigned a unique ID, and is processed for use with Passbook, according to the imageType selected.

Private Methods

Method Description
Execute ( RestRequest request ) : PassKitResponse

The execute method. Used for all calls to the API.

Method Details

GetImageData() public method

Method returns information about the image with imageId.
public GetImageData ( string imageId ) : PassKitResponse
imageId string The unique ID of the image
return PassKitResponse

GetPassDetails() public method

Gets the details for a pass identified by the given unique pass-id. Returns the details for one unique pass only. More info
public GetPassDetails ( string passId ) : PassKitResponse
passId string The unique pass id for the pass
return PassKitResponse

GetPassDetails() public method

Gets the details for a pass identified by the given template name and serial number. Serial number is not unique in case the user decided to use the same serial for multiple passes in the pass designer. In that case the response can contain information for multiple passes. More info
public GetPassDetails ( string templateName, string serialNumber ) : PassKitResponse
templateName string The template name of the pass
serialNumber string The serial number pf the pass
return PassKitResponse

GetPasses() public method

Gets the passes for a given template. More info
public GetPasses ( string templateName ) : PassKitResponse
templateName string The template name
return PassKitResponse

GetTemplateFieldNames() public method

This method returns the field names that can be used with the Issue Pass and Update Pass methods for a particular template. It returns the names of all dynamic fields in the template, plus other variables such as barcode content, serial number or thumbnail image that can be set or updated. More info
public GetTemplateFieldNames ( string templateName, bool full = false ) : PassKitResponse
templateName string The name of the template
full bool Boolean, if true the method will also return information re. the fields on the back of the template
return PassKitResponse

GetTemplates() public method

Requests a list of templates for the current API account. More info
public GetTemplates ( ) : PassKitResponse
return PassKitResponse

InvalidatePass() public method

This method is used for invalidating a pass. It accepts the parameters returned by the Get Template Field Names method, plus relevance fields for date and for up to 10 locations. Invalidating a pass, performs two functions in a single call. Firstly, it serves as a update, allowing you to change the content of an invalidated pass and secondly, it removes the pass from circulation, preventing it from being updated or manually refreshed.
public InvalidatePass ( string passId, string>.Dictionary fields ) : PassKitResponse
passId string The unique pass id
fields string>.Dictionary A dictionary of field-names and their values
return PassKitResponse

InvalidatePass() public method

This method is used for invalidating a pass. It accepts the parameters returned by the Get Template Field Names method, plus relevance fields for date and for up to 10 locations. Invalidating a pass, performs two functions in a single call. Firstly, it serves as a update, allowing you to change the content of an invalidated pass and secondly, it removes the pass from circulation, preventing it from being updated or manually refreshed.
public InvalidatePass ( string templateName, string serialNumber, string>.Dictionary fields ) : PassKitResponse
templateName string The template name of the pass
serialNumber string The serial number pf the pass
fields string>.Dictionary A dictionary of field-names and their values
return PassKitResponse

IssuePass() public method

Issues a new PassKit pass for template with 'templateName', with the data provided in the 'fields' dictionary. The 'fields' dictionary uses the field-names as 'key' and the values as 'value'. More info
public IssuePass ( string templateName, string>.Dictionary fields ) : PassKitResponse
templateName string The name of the template to issue the pass for
fields string>.Dictionary A dictionary of field-names and their values
return PassKitResponse

PassKit() public method

Constructor for the PassKit class. All API methods return a PassKitResponse object that always contains: 1. HTTP Response Code; 2. Response object. The first parameter on success is: success (bool), or error (string) on error;
public PassKit ( string account, string secret ) : System
account string The PassKit API account key: a 32 character Hexadecimal string or a 20 character base62 string
secret string The PassKit API secret: a base64 string
return System

ResetTemplate() public method

This method resets each pass record to the default values. This only affects values that the user cannot edit. The method also removes all data-fields from each pass record. More info
public ResetTemplate ( string templateName, bool push = true ) : PassKitResponse
templateName string The name of the template
push bool Indicates if the update should be pushed to all devices with an active pass
return PassKitResponse

UpdatePass() public method

Updates the fields for pass identified by 'passId'. 'passId' is unique, so method will update one pass. More info
public UpdatePass ( string passId, string>.Dictionary fields, bool push = true ) : PassKitResponse
passId string The unique pass id
fields string>.Dictionary A dictionary of field-names and their values
push bool Indicates if the update should be pushed to all devices with an active pass
return PassKitResponse

UpdatePass() public method

Updates the fields for pass identified by 'templateName' and 'serialNumber'. Method can update multiple passes at once in case the user decided to use the same serial for multiple passes in the pass designer. More info
public UpdatePass ( string templateName, string serialNumber, string>.Dictionary fields, bool push = true ) : PassKitResponse
templateName string The template name of the pass
serialNumber string The serial number of the pass
fields string>.Dictionary A dictionary of field-names and their values
push bool Indicates if the update should be pushed to all devices with an active pass
return PassKitResponse

UpdateTemplate() public method

Updates the template. Causes all the passes of the template to be updated as well. More info
public UpdateTemplate ( string templateName, string>.Dictionary fields, bool push = true ) : PassKitResponse
templateName string The template name
fields string>.Dictionary A dictionary of field-names and their values
push bool Indicates if the update should be pushed to all devices with an active pass
return PassKitResponse

UploadImage() public method

This method allows you to upload images for use with other methods such as template methods and pass methods. Each image that is uploaded is assigned a unique ID, and is processed for use with Passbook, according to the imageType selected.
public UploadImage ( string pathToLocalFile, PassKitImageType imageType ) : PassKitResponse
pathToLocalFile string The path to the local filename (make sure that you have read access to the file)
imageType PassKitImageType The image type of the file (according to PassKitImageType enum)
return PassKitResponse