| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
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
- data PassValue
- data PassField = PassField {}
- data PassType
- data PassContent = PassContent {
- headerFields :: [PassField]
- primaryFields :: [PassField]
- secondaryFields :: [PassField]
- auxiliaryFields :: [PassField]
- backFields :: [PassField]
- data Pass = Pass {
- expirationDate :: Maybe Text
- voided :: Maybe Bool
- 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
Instances
| FromJSON PassValue Source # | |
Defined in Passbook.Types | |
| ToJSON PassValue Source # | |
| Read PassValue Source # | |
| Show PassValue Source # | |
| Eq PassValue Source # | |
| Ord PassValue 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
| |
Instances
| FromJSON PassField Source # | |
Defined in Passbook.Types | |
| ToJSON PassField Source # | |
| Read PassField Source # | |
| Show PassField Source # | |
| Eq PassField Source # | |
| Ord PassField Source # | |
The type of a pass including its fields
Constructors
| BoardingPass TransitType PassContent | |
| Coupon PassContent | |
| Event PassContent | |
| GenericPass PassContent | |
| StoreCard PassContent |
data PassContent Source #
The fields within a pass
Constructors
| PassContent | |
Fields
| |
Instances
A complete pass
Constructors
| Pass | |
Fields
| |
Passbook field types
newtype RelevantDate Source #
Constructors
| RelevantDate UTCTime |
Instances
A location field
Constructors
| Location | |
Fields
| |
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.
Instances
A pass barcode. In most cases the helper function mkBarcode should be sufficient.
Constructors
| Barcode | |
Fields
| |
Pass field alignment
Constructors
| LeftAlign | |
| Center | |
| RightAlign | |
| Natural |
Instances
| FromJSON Alignment Source # | |
Defined in Passbook.Types | |
| ToJSON Alignment Source # | |
| Read Alignment Source # | |
| Show Alignment Source # | |
| Eq Alignment Source # | |
| Ord Alignment Source # | |
data DateTimeStyle Source #
Pass field date/time display style
Constructors
| None | Corresponds to |
| Short | Corresponds to |
| Medium | Corresponds to |
| Long | Corresponds to |
| Full | Corresponds to |
Instances
data NumberStyle Source #
Pass field number display style
Constructors
| Decimal | |
| Percent | |
| Scientific | |
| SpellOut |
Instances
data TransitType Source #
BoardingPass transit type. Only necessary for Boarding Passes.
Constructors
| Air | |
| Boat | |
| Bus | |
| Train | |
| GenericTransit |
Instances
data WebService Source #
Constructors
| WebService | |
Fields
| |
Instances
| Read WebService Source # | |
Defined in Passbook.Types Methods readsPrec :: Int -> ReadS WebService # readList :: ReadS [WebService] # readPrec :: ReadPrec WebService # readListPrec :: ReadPrec [WebService] # | |
| Show WebService Source # | |
Defined in Passbook.Types Methods showsPrec :: Int -> WebService -> ShowS # show :: WebService -> String # showList :: [WebService] -> ShowS # | |
| Eq WebService Source # | |
Defined in Passbook.Types | |
| Ord WebService Source # | |
Defined in Passbook.Types Methods compare :: WebService -> WebService -> Ordering # (<) :: WebService -> WebService -> Bool # (<=) :: WebService -> WebService -> Bool # (>) :: WebService -> WebService -> Bool # (>=) :: WebService -> WebService -> Bool # max :: WebService -> WebService -> WebService # min :: WebService -> WebService -> WebService # | |
The manifest.json file
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.