hs-pkpass-0.6: A library for Passbook pass creation & signing
Safe HaskellNone
LanguageHaskell2010

Passbook.Types

Description

This module provides types and functions for type-safe generation of PassBook's pass.json files.

This is a complete implementation of the Passbook Package Format Reference, available at https://developer.apple.com/library/ios/#documentation/UserExperience/Reference/PassKit_Bundle/Chapters/Introduction.html.

It ensures that passes are created correctly wherever possible. Currently, NSBundle localization is not supported.

Synopsis

Passbook types

data PassValue Source #

Auxiliary type to ensure that field values are rendered correctly

data PassField Source #

A single pass field. The type PassValue holds the fields value and ensures that the JSON output is compatible with Passbook. To create a very simple key/value field containing text you can use the mkSimpleField function.

Constructors

PassField 

Fields

data PassType Source #

The type of a pass including its fields

data PassContent Source #

The fields within a pass

Constructors

PassContent 

Fields

data Pass Source #

A complete pass

Constructors

Pass 

Fields

Instances

Instances details
FromJSON Pass Source # 
Instance details

Defined in Passbook.Types

ToJSON Pass Source # 
Instance details

Defined in Passbook.Types

Read Pass Source # 
Instance details

Defined in Passbook.Types

Show Pass Source # 
Instance details

Defined in Passbook.Types

Methods

showsPrec :: Int -> Pass -> ShowS #

show :: Pass -> String #

showList :: [Pass] -> ShowS #

Eq Pass Source # 
Instance details

Defined in Passbook.Types

Methods

(==) :: Pass -> Pass -> Bool #

(/=) :: Pass -> Pass -> Bool #

Ord Pass Source # 
Instance details

Defined in Passbook.Types

Methods

compare :: Pass -> Pass -> Ordering #

(<) :: Pass -> Pass -> Bool #

(<=) :: Pass -> Pass -> Bool #

(>) :: Pass -> Pass -> Bool #

(>=) :: Pass -> Pass -> Bool #

max :: Pass -> Pass -> Pass #

min :: Pass -> Pass -> Pass #

Passbook field types

newtype RelevantDate Source #

Constructors

RelevantDate UTCTime 

Instances

Instances details
FromJSON RelevantDate Source # 
Instance details

Defined in Passbook.Types

ToJSON RelevantDate Source # 
Instance details

Defined in Passbook.Types

Read RelevantDate Source # 
Instance details

Defined in Passbook.Types

Show RelevantDate Source # 
Instance details

Defined in Passbook.Types

Eq RelevantDate Source # 
Instance details

Defined in Passbook.Types

Ord RelevantDate Source # 
Instance details

Defined in Passbook.Types

data Location Source #

A location field

Constructors

Location 

Fields

data RGBColor Source #

A simple RGB color value. In combination with the rgb function this can be written just like in CSS, e.g. rgb(43, 53, 65). The rgb function also ensures that the provided values are valid.

data BarcodeFormat Source #

Barcode is constructed by a Barcode format, an encoding type and the Barcode message.

Constructors

QRCode 
PDF417 
Aztec 

Instances

Instances details
FromJSON BarcodeFormat Source # 
Instance details

Defined in Passbook.Types

ToJSON BarcodeFormat Source # 
Instance details

Defined in Passbook.Types

Read BarcodeFormat Source # 
Instance details

Defined in Passbook.Types

Show BarcodeFormat Source # 
Instance details

Defined in Passbook.Types

Eq BarcodeFormat Source # 
Instance details

Defined in Passbook.Types

Ord BarcodeFormat Source # 
Instance details

Defined in Passbook.Types

data Barcode Source #

A pass barcode. In most cases the helper function mkBarcode should be sufficient.

Constructors

Barcode 

Fields

Instances

Instances details
FromJSON Barcode Source # 
Instance details

Defined in Passbook.Types

ToJSON Barcode Source # 
Instance details

Defined in Passbook.Types

Read Barcode Source # 
Instance details

Defined in Passbook.Types

Show Barcode Source # 
Instance details

Defined in Passbook.Types

Eq Barcode Source # 
Instance details

Defined in Passbook.Types

Methods

(==) :: Barcode -> Barcode -> Bool #

(/=) :: Barcode -> Barcode -> Bool #

Ord Barcode Source # 
Instance details

Defined in Passbook.Types

data DateTimeStyle Source #

Pass field date/time display style

Constructors

None

Corresponds to PKDateStyleNone

Short

Corresponds to PKDateStyleShort

Medium

Corresponds to PKDateStyleMedium

Long

Corresponds to PKDateStyleLong

Full

Corresponds to PKDateStyleFull

Instances

Instances details
FromJSON DateTimeStyle Source # 
Instance details

Defined in Passbook.Types

ToJSON DateTimeStyle Source # 
Instance details

Defined in Passbook.Types

Read DateTimeStyle Source # 
Instance details

Defined in Passbook.Types

Show DateTimeStyle Source # 
Instance details

Defined in Passbook.Types

Eq DateTimeStyle Source # 
Instance details

Defined in Passbook.Types

Ord DateTimeStyle Source # 
Instance details

Defined in Passbook.Types

data NumberStyle Source #

Pass field number display style

data TransitType Source #

BoardingPass transit type. Only necessary for Boarding Passes.

Constructors

Air 
Boat 
Bus 
Train 
GenericTransit 

data WebService Source #

Constructors

WebService 

Fields

  • authenticationToken :: Text

    Authentication token for use with the web service. Must be 16 characters or longer (optional)

  • webServiceURL :: Text

    The URL of a web service that conforms to the API described in the Passbook Web Service Reference (optional)

data Manifest Source #

The manifest.json file

Constructors

Manifest [(Text, Text)]

(Filename, Hash)

Instances

Instances details
ToJSON Manifest Source # 
Instance details

Defined in Passbook.Types

Auxiliary functions

rgb :: (Int, Int, Int) -> Maybe RGBColor Source #

Creates a Just RGBColor if all supplied numbers are between 0 and 255.

mkBarcode :: Text -> BarcodeFormat -> Barcode Source #

This function takes a Text and a BarcodeFormat and uses the text for both the barcode message and the alternative text.

mkSimpleField Source #

Arguments

:: Text

Key

-> PassValue

Value

-> Maybe Text

Label

-> PassField 

Creates a simple PassField with just a key, a value and an optional label. All the other optional fields are set to Nothing.