Safe Haskell | None |
---|
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.
- data PassValue
- data PassField = PassField {}
- data PassType
- data PassContent = PassContent {
- headerFields :: [PassField]
- primaryFields :: [PassField]
- secondaryFields :: [PassField]
- auxiliaryFields :: [PassField]
- backFields :: [PassField]
- data Pass = Pass {
- description :: Text
- organizationName :: Text
- passTypeIdentifier :: Text
- serialNumber :: Text
- teamIdentifier :: Text
- associatedStoreIdentifiers :: [Text]
- locations :: [Location]
- relevantDate :: Maybe RelevantDate
- barcode :: Maybe Barcode
- backgroundColor :: Maybe RGBColor
- foregroundColor :: Maybe RGBColor
- labelColor :: Maybe Text
- logoText :: Maybe Text
- suppressStripShine :: Maybe Bool
- webService :: Maybe WebService
- passContent :: PassType
- newtype RelevantDate = RelevantDate UTCTime
- data Location = Location {}
- data RGBColor
- data BarcodeFormat
- data Barcode = Barcode {
- altText :: Maybe Text
- format :: BarcodeFormat
- message :: Text
- messageEncoding :: Text
- data Alignment
- = LeftAlign
- | Center
- | RightAlign
- | Natural
- data DateTimeStyle
- data NumberStyle
- = Decimal
- | Percent
- | Scientific
- | SpellOut
- data TransitType
- = Air
- | Boat
- | Bus
- | Train
- | GenericTransit
- data WebService = WebService {}
- data Manifest = Manifest [(Text, Text)]
- rgb :: (Int, Int, Int) -> Maybe RGBColor
- mkBarcode :: Text -> BarcodeFormat -> Barcode
- mkSimpleField :: Text -> PassValue -> Maybe Text -> PassField
Passbook types
Auxiliary type to ensure that field values are rendered correctly
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.
PassField | |
|
The type of a pass including its fields
data PassContent Source
The fields within a pass
PassContent | |
|
A complete pass
Pass | |
|
Passbook field types
newtype RelevantDate Source
A location field
Location | |
|
data BarcodeFormat Source
Barcode is constructed by a Barcode format, an encoding type and the Barcode message.
A pass barcode. In most cases the helper function mkBarcode
should be sufficient.
Barcode | |
|
Pass field alignment
data DateTimeStyle Source
Pass field date/time display style
data NumberStyle Source
Pass field number display style
data TransitType Source
BoardingPass transit type. Only necessary for Boarding Passes.
data WebService Source
WebService | |
|
Auxiliary functions
rgb :: (Int, Int, Int) -> Maybe RGBColorSource
Creates a Just RGBColor
if all supplied numbers are between 0 and 255.
mkBarcode :: Text -> BarcodeFormat -> BarcodeSource
This function takes a Text
and a BarcodeFormat
and uses the text
for both the barcode message and the alternative text.