### Pass Installation Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Methods for requesting the installation of a pass. ```APIDOC ## REQUEST PASS INSTALLATION ### Description Requests the installation of a pass into the user's wallet. ### Method POST ### Endpoint /passslot/passes/install ### Parameters #### Request Body - **pass** (object) - Required - The pass object to install. - **inViewController** (UIViewController) - Required - The view controller to present the installation prompt from. - **completion** (block) - Optional - A completion handler block to be executed after the installation attempt. ### Request Example ```json { "pass": { ... }, "inViewController": "" } ``` ### Response #### Success Response (200) Indicates that the installation prompt was presented. #### Response Example ```json { "status": "success", "message": "Pass installation prompt presented." } ``` ``` -------------------------------- ### Create Pass Without Immediate Installation Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Create a pass and receive it in a callback block for further processing before deciding to install. The pass object can be accessed and its properties logged. Installation can be requested later using [PassSlot requestPassInstallation:]. ```objective-c #import NSDictionary *values = @{ @"storeName": @"Coffee Shop", @"customerName": @"Alice", @"points": @"150" }; [PassSlot passFromTemplateWithName:@"Loyalty Card" withValues:values pass:^(PSPass *pass) { // Access pass properties NSLog(@"Created pass with serial: %@", [pass serialNumber]); NSLog(@"Pass type identifier: %@", [pass passTypeIdentifier]); NSLog(@"Pass values: %@", [pass values]); // Store pass reference for later use self.currentPass = pass; // Optionally install later [PassSlot requestPassInstallation:pass inViewController:self completion:^{ NSLog(@"Pass installed successfully!"); }]; }]; ``` -------------------------------- ### PassSlot Initialization Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Methods for starting and configuring the PassSlot SDK. ```APIDOC ## START PASS SLOT ### Description Starts the PassSlot engine with your application key. ### Method POST ### Endpoint /passslot/start ### Parameters #### Query Parameters - **appKey** (string) - Required - Your unique application key for PassSlot. ### Request Example ``` [PassSlot start:@""]; ``` ### Response #### Success Response (200) Indicates successful initialization. #### Response Example ```json { "status": "success", "message": "PassSlot initialized successfully." } ``` ## GET APP KEY ### Description Retrieves the current application key configured for PassSlot. ### Method GET ### Endpoint /passslot/appKey ### Response #### Success Response (200) - **appKey** (string) - The current application key. #### Response Example ```json { "appKey": "" } ``` ``` -------------------------------- ### Initialize PassSlot Engine Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Starts the PassSlot engine. Obtain your app key by signing up at passslot.com. ```Objective-C + (void)startEngineWithAppKey:(NSString *)_appKey_; ``` -------------------------------- ### Create Pass From Template Name With Installation Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Create a pass from a template name, populate placeholder values, and immediately present the pass installation dialog to the user. The completion block is called upon successful addition to Passbook. ```objective-c #import - (IBAction)createMemberCard:(id)sender { // Define placeholder values that match your template NSDictionary *values = @{ @"firstName": @"John", @"lastName": @"Doe", @"memberSince": @"2013", @"memberNumber": @"12345678" }; // Create pass and request installation in one call [PassSlot createPassFromTemplateWithName:@"Member Card" withValues:values andRequestInstallation:self completion:^{ NSLog(@"Pass was successfully added to Passbook!"); }]; } ``` -------------------------------- ### Pass Installation and Management Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Methods for installing passes to Passbook and updating existing pass content. ```APIDOC ## requestPassInstallation:inViewController:completion: ### Description Add an existing pass to Passbook. ### Parameters - **pass** (PSPass) - Required - PSPass which should be added - **viewController** (UIViewController) - Required - The UIViewController that will be used to present the PKAddPassesViewController - **completion** (PSCompletion) - Required - A block object to be executed when the pass was added to passbook ## setValues:forPass:updatedPass: ### Description Update the values of an existing pass. ## setImages:forPass:updatedPass: ### Description Update the images of an existing pass. ``` -------------------------------- ### Initialize and Create Pass with PassSlot Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Initializes the PassSlot engine with an app key and demonstrates creating a pass from a template with custom values and triggering installation. ```objective-c [PassSlot start:@""]; NSDictionary *values = [NSDictionary dictionaryWithObjectsAndKeys: @"John", @"firstName" , @"Doe", @"lastName", @"2013", @"memberSince", nil]; [PassSlot createPassFromTemplateWithName:@"Member Card" withValues:values andRequestInstallation:self completion:^{ NSLog(@"PassSlot is SO EASY!"); }]; ``` -------------------------------- ### createPassFromTemplateWithName:withValues:andRequestInstallation:completion: Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Creates a pass from a template name and requests the installation of the pass. ```APIDOC ## createPassFromTemplateWithName:withValues:andRequestInstallation:completion: ### Description Create a pass from a template name and request the installation of the pass. ### Parameters - **templateName** (NSString) - Required - PassTemplate that is used to create the pass - **values** (NSDictionary) - Required - Placeholder values that will be filled in - **viewController** (UIViewController) - Required - The UIViewController that will be used to present the PKAddPassesViewController. - **completion** (PSCompletion) - Required - A block object to be executed when the pass was added to passbook. ``` -------------------------------- ### createPassFromTemplateWithName:withValues:withImages:andRequestInstallation:completion: Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Creates a pass from a template name with specific images and requests the installation of the pass. ```APIDOC ## createPassFromTemplateWithName:withValues:withImages:andRequestInstallation:completion: ### Description Create a pass from a template name and request the installation of the pass. ### Parameters - **templateName** (NSString) - Required - PassTemplate that is used to create the pass - **values** (NSDictionary) - Required - Placeholder values that will be filled in - **images** (NSArray) - Required - Array of PSImage for the pass - **viewController** (UIViewController) - Required - The UIViewController that will be used to present the PKAddPassesViewController. - **completion** (PSCompletion) - Required - A block object to be executed when the pass was added to passbook. ``` -------------------------------- ### GET /listTemplates Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Retrieves a list of all available pass templates configured for the application. ```APIDOC ## GET /listTemplates ### Description List all available pass templates. ### Method GET ### Response #### Success Response (200) - **templates** (Array) - List of available pass templates ``` -------------------------------- ### POST /createPassFromTemplate Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Creates a new pass from a specified template and automatically requests installation into the user's Passbook/Wallet. ```APIDOC ## POST /createPassFromTemplate ### Description Creates a pass from a template and requests the installation of the pass into the user's Passbook. ### Method POST ### Parameters #### Request Body - **template** (PSPassTemplate) - Required - PassTemplate that is used to create the pass - **values** (NSDictionary) - Required - Placeholder values that will be filled in - **viewController** (UIViewController) - Required - The UIViewController used to present the PKAddPassesViewController - **completion** (PSCompletion) - Required - A block object to be executed when the pass was added to passbook ### Request Example { "template": "template_object", "values": {"key": "value"}, "viewController": "self", "completion": "completion_block" } ``` -------------------------------- ### GET /appKey Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Retrieves the current application key used for authentication with the PassSlot service. ```APIDOC ## GET /appKey ### Description Gets the current app key. ### Method GET ### Response #### Success Response (200) - **appKey** (NSString) - The current application key ``` -------------------------------- ### Get image type Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSImage.html Returns the defined type of the PSImage instance. ```objective-c - (PSImageType)type ``` -------------------------------- ### Retrieve Pass Values Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Gets the values of an existing pass. The completion block is executed when values are retrieved. ```Objective-C + (void)valuesForPass:(PSPass *)_pass_ pass:(PSPassBlock)_passBlock_; ``` -------------------------------- ### SDK Configuration Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Methods for initializing the SDK and setting global error handlers. ```APIDOC ## start: ### Description Starts the PassSlot engine. ### Parameters - **appKey** (NSString) - Required - Your App Key ## setErrorHandler: ### Description Sets the error handler. ### Parameters - **errorHandler** (PSErrorBlock) - Required - A block object that handles errors ``` -------------------------------- ### Create PSImage from file Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSImage.html Creates a PSImage instance by loading image files from the application bundle. ```objective-c + (PSImage *)imageNamed:(NSString *)name ofType:(PSImageType)type ``` -------------------------------- ### PSImage Class Methods Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSImage.html Methods for creating and initializing PSImage objects. ```APIDOC ## POST /api/users ### Description Creates and returns an image containing image data. ### Method POST ### Endpoint /api/users ### Parameters #### Path Parameters - **param1** (type) - Required/Optional - Description #### Query Parameters - **param1** (type) - Required/Optional - Description #### Request Body - **field1** (type) - Required/Optional - Description ### Request Example { "example": "request body" } ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example { "example": "response body" } ``` ```APIDOC ## POST /api/users ### Description Creates and returns an empty image. ### Method POST ### Endpoint /api/users ### Parameters #### Path Parameters - **param1** (type) - Required/Optional - Description #### Query Parameters - **param1** (type) - Required/Optional - Description #### Request Body - **field1** (type) - Required/Optional - Description ### Request Example { "example": "request body" } ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example { "example": "response body" } ``` -------------------------------- ### Initialize PassSlot SDK Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Initialize the PassSlot SDK with your app key in the application delegate. This must be called before any other PassSlot operations. You can retrieve the current app key using [PassSlot appKey]. ```objective-c #import - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Initialize PassSlot with your app key from passslot.com [PassSlot start:@"your-app-key-from-passslot-dashboard"]; return YES; } // Retrieve the current app key if needed NSString *currentKey = [PassSlot appKey]; NSLog(@"Current app key: %@", currentKey); ``` -------------------------------- ### Create empty PSImage Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSImage.html Initializes a new empty PSImage instance for a specified type. ```objective-c + (PSImage *)imageOfType:(PSImageType)type ``` -------------------------------- ### PSPassTemplate Class Reference Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSPassTemplate.html Reference documentation for the PSPassTemplate class, including its instance methods. ```APIDOC ## PSPassTemplate Class Reference ### Description This class represents a Pass Template. ### Instance Methods #### `passTemplateId` Returns the pass template id. - **Method**: `- (NSNumber *)passTemplateId` - **Return Value**: The pass template id. - **Discussion**: Returns the pass template id. - **Declared In**: `PSPassTemplate.h` #### `placeholder` Returns the pass template placeholder. - **Method**: `- (NSArray *)placeholder` - **Return Value**: A NSArray containing all placeholder names as NSString. - **Discussion**: Returns the pass template placeholder. - **Declared In**: `PSPassTemplate.h` ``` -------------------------------- ### PassSlot SDK Class Overview Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/index.html Overview of the primary classes available in the PassSlot iOS SDK for integration. ```APIDOC ## PassSlot SDK Classes ### Description The PassSlot SDK provides a set of classes to interact with the PassSlot service, allowing developers to manage passes and templates within their iOS applications. ### Classes - **PSImage** - Handles image resources for passes. - **PSPass** - Represents a pass object. - **PSPassTemplate** - Represents a template used for creating passes. - **PassSlot** - The main entry point for the SDK. ``` -------------------------------- ### listTemplates: Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Lists all available pass templates. ```APIDOC ## listTemplates: ### Description List all available pass templates. ### Parameters - **templates** (PSTemplateListBlock) - Required - A block object to be executed when the pass templates were retrieved. ``` -------------------------------- ### Persist PSPass with NSCoding Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Demonstrates archiving and unarchiving PSPass objects for local persistence using NSCoding. ```objective-c #import // Archive a pass for persistence - (void)savePass:(PSPass *)pass { NSData *passData = [NSKeyedArchiver archivedDataWithRootObject:pass]; [[NSUserDefaults standardUserDefaults] setObject:passData forKey:@"savedPass"]; [[NSUserDefaults standardUserDefaults] synchronize]; } // Unarchive a previously saved pass - (PSPass *)loadSavedPass { NSData *passData = [[NSUserDefaults standardUserDefaults] objectForKey:@"savedPass"]; if (passData) { PSPass *pass = [NSKeyedUnarchiver unarchiveObjectWithData:passData]; NSLog(@"Restored pass: %@ / %@", [pass passTypeIdentifier], [pass serialNumber]); return pass; } return nil; } ``` -------------------------------- ### Create Pass with Custom Images Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Create a new pass from a template, providing custom values and images for various elements like logo, icon, and background. Ensure all required image types are provided. ```Objective-C #import // Create custom images from bundle resources PSImage *logoImage = [PSImage imageNamed:@"company_logo" ofType:PSImageTypeLogo]; PSImage *iconImage = [PSImage imageNamed:@"pass_icon" ofType:PSImageTypeIcon]; PSImage *stripImage = [PSImage imageNamed:@"banner_strip" ofType:PSImageTypeStrip]; // Or create images programmatically PSImage *backgroundImage = [PSImage imageOfType:PSImageTypeBackground]; [backgroundImage setImage:[UIImage imageNamed:@"bg.png"] forResolution:PSImageResolutionNormal]; [backgroundImage setImage:[UIImage imageNamed:@"bg@2x.png"] forResolution:PSImageResolutionHigh]; NSArray *images = @[logoImage, iconImage, stripImage, backgroundImage]; NSDictionary *values = @{ @"eventName": @"Summer Festival", @"date": @"July 15, 2024", @"venue": @"Central Park" }; [PassSlot createPassFromTemplateWithName:@"Event Ticket" withValues:values withImages:images andRequestInstallation:self completion:^{ NSLog(@"Custom image pass created!"); }]; ``` -------------------------------- ### Pass Creation Methods Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Methods for creating passes using templates or template names, with optional image support. ```APIDOC ## passFromTemplate:withValues:withImages:pass: ### Description Create a pass from a template. ### Parameters - **template** (PSPassTemplate) - Required - PassTemplate that is used to create the pass - **values** (NSDictionary) - Required - Placeholder values that will be filled in - **images** (NSArray) - Optional - Array of PSImage for the pass - **passBlock** (PSPassBlock) - Required - A block object to be executed when the pass was created. ## passFromTemplateWithName:withValues:withImages:pass: ### Description Create a pass from a template name. ### Parameters - **templateName** (NSString) - Required - PassTemplate that is used to create the pass - **values** (NSDictionary) - Required - Placeholder values that will be filled in - **images** (NSArray) - Optional - Array of PSImage for the pass - **passBlock** (PSPassBlock) - Required - A block object to be executed when the pass was created. ``` -------------------------------- ### PSImage Instance Methods Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSImage.html Methods for accessing and modifying image data within a PSImage object. ```APIDOC ## POST /api/users ### Description Get image data of the image. ### Method POST ### Endpoint /api/users ### Parameters #### Path Parameters - **param1** (type) - Required/Optional - Description #### Query Parameters - **param1** (type) - Required/Optional - Description #### Request Body - **field1** (type) - Required/Optional - Description ### Request Example { "example": "request body" } ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example { "example": "response body" } ``` ```APIDOC ## POST /api/users ### Description Sets image data for the image. ### Method POST ### Endpoint /api/users ### Parameters #### Path Parameters - **param1** (type) - Required/Optional - Description #### Query Parameters - **param1** (type) - Required/Optional - Description #### Request Body - **field1** (type) - Required/Optional - Description ### Request Example { "example": "request body" } ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example { "example": "response body" } ``` ```APIDOC ## POST /api/users ### Description Returns the image type. ### Method POST ### Endpoint /api/users ### Parameters #### Path Parameters - **param1** (type) - Required/Optional - Description #### Query Parameters - **param1** (type) - Required/Optional - Description #### Request Body - **field1** (type) - Required/Optional - Description ### Request Example { "example": "request body" } ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example { "example": "response body" } ``` -------------------------------- ### Download Pass and Access Raw Data Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Downloads the .pkpass file and provides access to raw data or the PKPass object for integration with PassKit. ```APIDOC ## [METHOD] [PassSlot downloadPass:pass pass:] ### Description Downloads the complete .pkpass file and allows access to the raw data or the PKPass object for custom handling. ### Parameters - **pass** (PSPass) - Required - The pass object containing passType and serialNumber. - **completion** (block) - Required - Callback block receiving the downloaded PSPass object. ### Response - **downloadedPass** (PSPass) - The object containing the raw data and PKPass representation. ``` -------------------------------- ### downloadPass:pass: Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Downloads an existing pass. ```APIDOC ## downloadPass:pass: ### Description Download an existing pass. ### Parameters - **pass** (PSPass) - Required - PSPass which should be downloaded - **passBlock** (PSPassBlock) - Required - A block object to be executed when the pass file was downloaded. ``` -------------------------------- ### List Available Templates Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Retrieves all pass templates associated with the account for use in UI components. ```objective-c #import [PassSlot listTemplates:^(NSArray *templateList) { NSLog(@"Found %lu templates", (unsigned long)[templateList count]); for (PSPassTemplate *template in templateList) { NSLog(@"Template ID: %@", [template passTemplateId]); NSLog(@"Placeholders: %@", [template placeholder]); NSLog(@"---"); } // Store templates for later use in UI picker self.availableTemplates = templateList; [self.templatePicker reloadAllComponents]; }]; ``` -------------------------------- ### Template Management Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Methods for listing available pass templates. ```APIDOC ## LIST TEMPLATES ### Description Retrieves a list of all available pass templates. ### Method GET ### Endpoint /passslot/templates ### Response #### Success Response (200) - **templates** (NSArray) - An array of template names. #### Response Example ```json { "templates": ["Member Card", "Event Ticket", "Coupon"] } ``` ``` -------------------------------- ### List Available Templates Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Retrieves all pass templates associated with the PassSlot account. ```APIDOC ## [METHOD] [PassSlot listTemplates:] ### Description Retrieves all pass templates available in the account. ### Parameters - **completion** (block) - Required - Callback block receiving an array of PSPassTemplate objects. ### Response - **templateList** (NSArray) - A list of available PSPassTemplate objects. ``` -------------------------------- ### JavaScript Navigation and TOC Utilities Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Utility functions for handling page navigation via hash changes, toggling the table of contents visibility, and managing entry expansion/collapse. These are typically used in web-based documentation. ```JavaScript function jumpToChange() { window.location.hash = this.options[this.selectedIndex].value; } ``` ```JavaScript function toggleTOC() { var contents = document.getElementById('contents'); var tocContainer = document.getElementById('tocContainer'); if (this.getAttribute('class') == 'open') { this.setAttribute('class', ''); contents.setAttribute('class', ''); tocContainer.setAttribute('class', ''); window.name = "hideTOC"; } else { this.setAttribute('class', 'open'); contents.setAttribute('class', 'isShowingTOC'); tocContainer.setAttribute('class', 'isShowingTOC'); window.name = ""; } return false; } ``` ```JavaScript function toggleTOCEntryChildren(e) { e.stopPropagation(); var currentClass = this.getAttribute('class'); if (currentClass == 'children') { this.setAttribute('class', 'children open'); } else if (currentClass == 'children open') { this.setAttribute('class', 'children'); } return false; } ``` ```JavaScript function tocEntryClick(e) { e.stopPropagation(); return true; } ``` ```JavaScript function init() { var selectElement = document.getElementById('jumpTo'); selectElement.addEventListener('change', jumpToChange, false); var tocButton = document.getElementById('table_of_contents'); tocButton.addEventListener('click', toggleTOC, false); var taskTreeItem = document.getElementById('task_treeitem'); if (taskTreeItem.getElementsByTagName('li').length > 0) { taskTreeItem.setAttribute('class', 'children'); taskTreeItem.firstChild.setAttribute('class', 'disclosure'); } var tocList = document.getElementById('toc'); var tocEntries = tocList.getElementsByTagName('li'); for (var i = 0; i < tocEntries.length; i++) { tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false); } var tocLinks = tocList.getElementsByTagName('a'); for (var i = 0; i < tocLinks.length; i++) { tocLinks[i].addEventListener('click', tocEntryClick, false); } if (window.name == "hideTOC") { toggleTOC.call(tocButton); } } ``` ```JavaScript window.onload = init; // If showing in Xcode, hide the TOC and Header if (navigator.userAgent.match(/xcode/i)) { document.getElementById("contents").className = "hideInXcode" document.getElementById("tocContainer").className = "hideInXcode" document.getElementById("top_header").className = "hideInXcode" } ``` -------------------------------- ### Pass Creation Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Methods for creating new passes from templates, with options for providing values and images. ```APIDOC ## CREATE PASS FROM TEMPLATE ### Description Creates a pass from a specified template with provided values and an option to request installation. This method includes images. ### Method POST ### Endpoint /passslot/passes/create/template ### Parameters #### Request Body - **templateName** (string) - Required - The name of the template to use. - **values** (NSDictionary) - Required - A dictionary of values to populate the pass fields. - **images** (NSDictionary) - Optional - A dictionary of images to include in the pass. - **requestInstallation** (boolean) - Optional - Whether to request installation of the pass. - **completion** (block) - Optional - A completion handler block to be executed after the pass is created. ### Request Example ```json { "templateName": "Member Card", "values": { "firstName": "John", "lastName": "Doe", "memberSince": "2013" }, "images": {}, "requestInstallation": true } ``` ### Response #### Success Response (200) - **pass** (object) - The created pass object. #### Response Example ```json { "status": "success", "pass": { "serialNumber": "12345", "templateName": "Member Card", "values": { "firstName": "John", "lastName": "Doe", "memberSince": "2013" } } } ``` ## CREATE PASS FROM TEMPLATE WITH NAME ### Description Creates a pass from a template identified by its name, using provided values and an option to request installation. This method does not include images. ### Method POST ### Endpoint /passslot/passes/create/template/name ### Parameters #### Request Body - **templateName** (string) - Required - The name of the template to use. - **values** (NSDictionary) - Required - A dictionary of values to populate the pass fields. - **requestInstallation** (boolean) - Optional - Whether to request installation of the pass. - **completion** (block) - Optional - A completion handler block to be executed after the pass is created. ### Request Example ```json { "templateName": "Member Card", "values": { "firstName": "John", "lastName": "Doe", "memberSince": "2013" }, "requestInstallation": true } ``` ### Response #### Success Response (200) - **pass** (object) - The created pass object. #### Response Example ```json { "status": "success", "pass": { "serialNumber": "12345", "templateName": "Member Card", "values": { "firstName": "John", "lastName": "Doe", "memberSince": "2013" } } } ``` ``` -------------------------------- ### Download Pass and Access Raw Data Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Downloads a .pkpass file and provides access to raw NSData or a PKPass object for integration with PassKit. ```objective-c #import #import PSPass *pass = [PSPass passWithPassType:@"pass.com.company.coupon" serialNumber:@"COUPON123"]; [PassSlot downloadPass:pass pass:^(PSPass *downloadedPass) { // Access raw pass data (useful for saving or sharing) NSData *passData = [downloadedPass data]; NSLog(@"Pass file size: %lu bytes", (unsigned long)[passData length]); // Save to documents directory NSString *documentsPath = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES)[0]; NSString *passPath = [documentsPath stringByAppendingPathComponent:@"coupon.pkpass"]; [passData writeToFile:passPath atomically:YES]; // Access as PKPass for PassKit integration PKPass *pkPass = [downloadedPass pkPass]; NSLog(@"Organization: %@", pkPass.organizationName); NSLog(@"Description: %@", pkPass.localizedDescription); NSLog(@"Relevant date: %@", pkPass.relevantDate); }]; ``` -------------------------------- ### valuesForPass:pass: Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Retrieves the values of an existing pass. You can obtain your app key by signing up at passslot.com. ```APIDOC ## valuesForPass:pass: ### Description Get the values of an existing pass. ### Method Objective-C Class Method ### Endpoint N/A (This is an SDK method, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```objectivec // Assuming you have a PSPass object named 'myPass' [PassSlot valuesForPass:myPass pass:^(PSPass *retrievedPass) { // Handle the retrieved pass values here }]; ``` ### Response #### Success Response This method does not return a value directly. Instead, it uses a block to provide the retrieved pass values. - **retrievedPass** (PSPass) - The PSPass object containing the retrieved values. #### Response Example ```objectivec // Inside the block: // retrievedPass will contain the updated pass values NSLog(@"Pass values retrieved: %@", retrievedPass); ``` ``` -------------------------------- ### PassSlotSDK Class Hierarchy Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/hierarchy.html This documentation outlines the class structure of the PassSlot iOS SDK, inheriting from NSObject. ```APIDOC ## PassSlotSDK Class Hierarchy ### Description The PassSlotSDK provides a structured hierarchy for interacting with pass data and images. All classes inherit from NSObject. ### Classes - **PSImage** - Handles image resources for passes. - **PSPass** - Represents the pass object data. - **PSPassTemplate** - Defines the template structure for passes. - **PassSlot** - The primary controller class for the SDK. ``` -------------------------------- ### Instance Methods: Accessing Pass Attributes Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSPass.html Methods to retrieve specific attributes of a PSPass instance, such as raw data, images, JSON, and the PKPass object. ```APIDOC ## Instance Methods ### data Returns the raw pass data (NSData). Requires prior download from the server. ### images Returns an NSArray of PSImage objects. Requires prior retrieval from the server. ### json Returns the NSDictionary representing the pass JSON. Requires prior retrieval from the server. ### passTypeIdentifier Returns the NSString pass type identifier. ### serialNumber Returns the NSString serial number. ### pkPass Returns the PKPass object. ``` -------------------------------- ### Retrieve Pass Values Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Fetch the current placeholder values from an existing pass on the server. The retrieved values can be accessed via the `values` property of the returned `PSPass` object. ```Objective-C #import PSPass *pass = [PSPass passWithPassType:@"pass.com.company.membership" serialNumber:@"MEM456789"]; // Retrieve values [PassSlot valuesForPass:pass pass:^(PSPass *passWithValues) { NSDictionary *values = [passWithValues values]; NSLog(@"Member name: %@", values[@"memberName"]); NSLog(@"Points balance: %@", values[@"points"]); NSLog(@"Membership level: %@", values[@"level"]); }]; ``` -------------------------------- ### Create Pass From Template Object Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Create a pass using a PSPassTemplate object for more control over template selection. This involves first listing available templates, then selecting the desired one, and finally creating the pass with specified values. ```objective-c #import // First retrieve available templates [PassSlot listTemplates:^(NSArray *templateList) { // Find the desired template PSPassTemplate *memberTemplate = nil; for (PSPassTemplate *template in templateList) { NSLog(@"Template ID: %@, Placeholders: %@", [template passTemplateId], [template placeholder]); // Select your template based on criteria if ([[template passTemplateId] intValue] == 123) { memberTemplate = template; break; } } if (memberTemplate) { NSDictionary *values = @{ @"eventName": @"Tech Conference 2024", @"attendeeName": @"Jane Smith", @"seatNumber": @"A-42" }; [PassSlot createPassFromTemplate:memberTemplate withValues:values andRequestInstallation:self completion:^{ NSLog(@"Event ticket added to Passbook!"); }]; } }]; ``` -------------------------------- ### Retrieve Pass Images Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Fetch the current images from an existing pass on the server. The retrieved images can be iterated through and accessed by resolution. ```Objective-C #import PSPass *pass = [PSPass passWithPassType:@"pass.com.company.membership" serialNumber:@"MEM456789"]; // Retrieve images [PassSlot imagesForPass:pass pass:^(PSPass *passWithImages) { NSArray *images = [passWithImages images]; for (PSImage *image in images) { UIImage *normalRes = [image image:PSImageResolutionNormal]; UIImage *highRes = [image image:PSImageResolutionHigh]; NSLog(@"Image type %lu: normal=%@, retina=%@", (unsigned long)[image type], normalRes, highRes); } }]; ``` -------------------------------- ### Error Handling Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Configures a global error handler to catch and process errors occurring within the PassSlot SDK. ```APIDOC ## [METHOD] [PassSlot setErrorHandler:] ### Description Sets a global error handler to catch and handle PassSlot errors. ### Parameters - **handler** (block) - Required - A block that receives an NSError object. ``` -------------------------------- ### Class Method: passWithPassType:serialNumber: Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSPass.html Creates and returns a PSPass instance with the specified pass type identifier and serial number. ```APIDOC ## + passWithPassType:serialNumber: ### Description Creates and returns a pass with the given pass type and serial number. The pass must already exist on the server. ### Method Class Method ### Parameters #### Path Parameters - **passTypeIdentifier** (NSString) - Required - An existing Pass Type ID - **serialNumber** (NSString) - Required - An existing pass serial number ### Response #### Success Response - **PSPass** (Object) - A PSPass instance with the given pass type and serial number ``` -------------------------------- ### Error Handling Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Method for setting a custom error handler. ```APIDOC ## SET ERROR HANDLER ### Description Sets a custom error handler block to be called when errors occur within the PassSlot SDK. ### Method POST ### Endpoint /passslot/errors/handler ### Parameters #### Request Body - **errorHandler** (block) - Required - A block that accepts an error object and handles it. ### Request Example ```json { "errorHandler": "" } ``` ### Response #### Success Response (200) Indicates that the error handler was set successfully. #### Response Example ```json { "status": "success", "message": "Error handler set successfully." } ``` ``` -------------------------------- ### Set image data Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSImage.html Assigns image data to the PSImage instance for a given resolution. ```objective-c - (void)setImage:(UIImage *)image forResolution:(PSImageResolution)resolution ``` -------------------------------- ### PSPass Methods Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSPass.html Methods for accessing pass data, serial numbers, and placeholder values from a PSPass object. ```APIDOC ## PSPass Methods ### Description Methods to retrieve information from a PSPass instance. Note that some methods require prior data retrieval from the server. ### Methods - **pass**: Returns the PKPass object. Requires prior call to [PassSlot downloadPass:pass:]. - **serialNumber**: Returns the serial number of the pass. - **values**: Returns the placeholder values for the pass. Requires prior call to [PassSlot valuesForPass:pass:]. ### Response #### Success Response (200) - **pass** (PKPass) - The pass object or nil if not retrieved. - **serialNumber** (NSString) - The serial number of the pass. - **values** (NSDictionary) - The placeholder values or nil if not retrieved. ``` -------------------------------- ### Pass Management Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Methods for downloading, retrieving images, and converting passes to JSON format. ```APIDOC ## DOWNLOAD PASS ### Description Downloads a pass. This method is used to obtain the pass data for distribution or storage. ### Method GET ### Endpoint /passslot/passes/download ### Parameters #### Query Parameters - **pass** (object) - Required - The pass object to download. ### Response #### Success Response (200) - **data** (binary) - The binary data of the pass. #### Response Example (Binary data of the pass) ## IMAGES FOR PASS ### Description Retrieves the images associated with a given pass. ### Method GET ### Endpoint /passslot/passes/images ### Parameters #### Query Parameters - **pass** (object) - Required - The pass object for which to retrieve images. ### Response #### Success Response (200) - **images** (NSDictionary) - A dictionary containing the images for the pass. #### Response Example ```json { "icon": "base64_encoded_icon_data", "logo": "base64_encoded_logo_data" } ``` ## JSON FOR PASS ### Description Converts a pass object into its JSON representation. ### Method GET ### Endpoint /passslot/passes/json ### Parameters #### Query Parameters - **pass** (object) - Required - The pass object to convert. ### Response #### Success Response (200) - **json** (string) - The JSON string representation of the pass. #### Response Example ```json { "json": "{\"serialNumber\": \"12345\", \"templateName\": \"Member Card\"}" } ``` ``` -------------------------------- ### Set Global Error Handler Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Configures a global error handler to catch and process SDK errors, typically during app initialization. ```objective-c #import // Set up error handling during app initialization [PassSlot setErrorHandler:^(NSError *error) { NSLog(@"PassSlot Error: %@", error.localizedDescription); NSLog(@"Error code: %ld", (long)error.code); NSLog(@"Error domain: %@", error.domain); // Handle specific error types dispatch_async(dispatch_get_main_queue(), ^{ UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Pass Error" message:error.localizedDescription preferredStyle:UIAlertControllerStyleAlert]; [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]]; [self.window.rootViewController presentViewController:alert animated:YES completion:nil]; }); }]; ``` -------------------------------- ### Retrieve image data Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PSImage.html Fetches the UIImage data associated with a specific resolution. ```objective-c - (UIImage *)image:(PSImageResolution)resolution ``` -------------------------------- ### Pass Modification Source: https://github.com/passslot/passslot-ios-sdk/blob/master/sdk/com.passslot.sdk.PassSlotSDK.docset/Contents/Resources/Documents/Classes/PassSlot.html Methods for creating a pass instance from a template and updating its values or images. ```APIDOC ## PASS FROM TEMPLATE ### Description Creates a pass instance from a template with specified values. This method includes images. ### Method POST ### Endpoint /passslot/passes/from/template ### Parameters #### Request Body - **template** (object) - Required - The template object to use. - **values** (NSDictionary) - Required - A dictionary of values to populate the pass fields. - **images** (NSDictionary) - Optional - A dictionary of images to include in the pass. - **pass** (object) - Required - An existing pass object to update. ### Request Example ```json { "template": { ... }, "values": { "points": "100" }, "images": {}, "pass": { ... } } ``` ### Response #### Success Response (200) - **updatedPass** (object) - The modified pass object. #### Response Example ```json { "status": "success", "updatedPass": { "serialNumber": "12345", "values": { "points": "100" } } } ``` ## SET VALUES FOR PASS ### Description Updates the values of an existing pass instance. ### Method PUT ### Endpoint /passslot/passes/values ### Parameters #### Request Body - **values** (NSDictionary) - Required - A dictionary of new values to set for the pass. - **pass** (object) - Required - The pass object to update. - **updatedPass** (object) - Required - The updated pass object after modification. ### Request Example ```json { "values": { "status": "Activated" }, "pass": { ... }, "updatedPass": { ... } } ``` ### Response #### Success Response (200) Indicates successful update. #### Response Example ```json { "status": "success", "message": "Pass values updated successfully." } ``` ## SET IMAGES FOR PASS ### Description Updates the images of an existing pass instance. ### Method PUT ### Endpoint /passslot/passes/images ### Parameters #### Request Body - **images** (NSDictionary) - Required - A dictionary of new images to set for the pass. - **pass** (object) - Required - The pass object to update. - **updatedPass** (object) - Required - The updated pass object after modification. ### Request Example ```json { "images": { "heroImage": "base64_encoded_image_data" }, "pass": { ... }, "updatedPass": { ... } } ``` ### Response #### Success Response (200) Indicates successful update. #### Response Example ```json { "status": "success", "message": "Pass images updated successfully." } ``` ``` -------------------------------- ### Update Pass Images Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Update images on an existing pass. This includes creating new images programmatically or from bundle resources and associating them with the pass. ```Objective-C #import PSPass *existingPass = [PSPass passWithPassType:@"pass.com.company.event" serialNumber:@"EVENT789"]; // Create new images PSImage *newThumbnail = [PSImage imageNamed:@"new_thumbnail" ofType:PSImageTypeThumbnail]; PSImage *newStrip = [PSImage imageOfType:PSImageTypeStrip]; [newStrip setImage:self.dynamicStripImage forResolution:PSImageResolutionNormal]; [newStrip setImage:self.dynamicStripImage2x forResolution:PSImageResolutionHigh]; NSArray *newImages = @[newThumbnail, newStrip]; [PassSlot setImages:newImages forPass:existingPass updatedPass:^(PSPass *updatedPass) { NSLog(@"Pass images updated!"); NSLog(@"Updated images: %@", [updatedPass images]); }]; ``` -------------------------------- ### Retrieve Pass JSON Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Fetches the complete JSON representation of a pass for inspection or debugging purposes. ```APIDOC ## [METHOD] [PassSlot jsonForPass:pass pass:] ### Description Retrieves the complete JSON representation of a pass. ### Parameters - **pass** (PSPass) - Required - The pass object to retrieve JSON for. - **completion** (block) - Required - Callback block receiving the PSPass object containing the JSON data. ### Response - **passWithJson** (PSPass) - The object containing the parsed JSON dictionary. ``` -------------------------------- ### Retrieve Pass JSON Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Fetches the JSON representation of a pass for debugging or inspecting field values. ```objective-c #import PSPass *pass = [PSPass passWithPassType:@"pass.com.company.ticket" serialNumber:@"TKT789012"]; [PassSlot jsonForPass:pass pass:^(PSPass *passWithJson) { NSDictionary *json = [passWithJson json]; NSLog(@"Pass JSON: %@", json); NSLog(@"Format version: %@", json[@"formatVersion"]); NSLog(@"Pass type: %@", json[@"passTypeIdentifier"]); NSLog(@"Team identifier: %@", json[@"teamIdentifier"]); NSLog(@"Barcode: %@", json[@"barcode"]); // Access field values NSDictionary *eventTicket = json[@"eventTicket"]; NSArray *primaryFields = eventTicket[@"primaryFields"]; for (NSDictionary *field in primaryFields) { NSLog(@"Field %@: %@", field[@"key"], field[@"value"]); } }]; ``` -------------------------------- ### Update Pass Values Source: https://context7.com/passslot/passslot-ios-sdk/llms.txt Update placeholder values on an existing pass. This operation updates the pass on the server and can trigger push notifications to the user's device. ```Objective-C #import // Reference an existing pass PSPass *existingPass = [PSPass passWithPassType:@"pass.com.company.loyalty" serialNumber:@"ABC123456"]; // Update values NSDictionary *newValues = @{ @"points": @"200", @"tier": @"Gold", @"lastVisit": @"2024-01-15" }; [PassSlot setValues:newValues forPass:existingPass updatedPass:^(PSPass *updatedPass) { NSLog(@"Pass updated successfully!"); NSLog(@"New values: %@", [updatedPass values]); }]; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.