Skip to main content

Template

Struct Template 

Source
pub struct Template {
Show 31 fields pub app_launch_url: Option<String>, pub associated_store_identifiers: Option<Vec<f64>>, pub authentication_token: Option<String>, pub background_color: Option<String>, pub barcode: Option<Barcode>, pub barcodes: Option<Vec<Barcode>>, pub beacons: Option<Vec<Beacon>>, pub boarding_pass: Option<BoardingPass>, pub coupon: Option<Details>, pub description: String, pub event_ticket: Option<Details>, pub expiration_date: Option<String>, pub foreground_color: Option<String>, pub format_version: Option<Value>, pub generic: Option<Details>, pub grouping_identifier: Option<String>, pub label_color: Option<String>, pub locations: Option<Vec<Location>>, pub logo_text: Option<String>, pub max_distance: Option<f64>, pub nfc: Option<Nfc>, pub organization_name: String, pub pass_type_identifier: String, pub relevant_date: Option<String>, pub serial_number: String, pub store_card: Option<Details>, pub suppress_strip_shine: Option<bool>, pub team_identifier: Option<String>, pub user_info: Option<HashMap<String, Option<Value>>>, pub voided: Option<bool>, pub web_service_url: Option<String>,
}
Expand description

Apple Wallet pass with localizations, NFC and web service push updates support.

Fields§

§app_launch_url: Option<String>

A URL to be passed to the associated app when launching it. The app receives this URL in the application:didFinishLaunchingWithOptions: and application:openURL:options: methods of its app delegate.

§associated_store_identifiers: Option<Vec<f64>>

A list of iTunes Store item identifiers for the associated apps. Only one item in the list is used—the first item identifier for an app compatible with the current device. If the app is not installed, the link opens the App Store and shows the app. If the app is already installed, the link launches the app.

§authentication_token: Option<String>

The authentication token to use with the web service.

§background_color: Option<String>

Background color of the pass, specified as an CSS-style RGB triple.

§barcode: Option<Barcode>

Information specific to the pass’s barcode. Deprecated in iOS 9.0 and later; use barcodes instead.

§barcodes: Option<Vec<Barcode>>

Information specific to the pass’s barcode. The system uses the first valid barcode dictionary in the array. Additional dictionaries can be added as fallbacks. Available only in iOS 9.0 and later.

§beacons: Option<Vec<Beacon>>

Beacons marking locations where the pass is relevant. Available in iOS 7.0.

§boarding_pass: Option<BoardingPass>

Information specific to a boarding pass.

§coupon: Option<Details>

Information specific to a coupon.

§description: String

Brief description of the pass, used by the iOS accessibility technologies. Don’t try to include all of the data on the pass in its description, just include enough detail to distinguish passes of the same type. Localizable.

§event_ticket: Option<Details>

Information specific to an event ticket.

§expiration_date: Option<String>

Date and time when the pass expires. Available in iOS 7.0.

§foreground_color: Option<String>

Foreground color of the pass, specified as a CSS-style RGB triple

§format_version: Option<Value>

Version of the file format.

§generic: Option<Details>

Information specific to a generic pass.

§grouping_identifier: Option<String>

Identifier used to group related passes. If a grouping identifier is specified, passes with the same style, pass type identifier, and grouping identifier are displayed as a group. Otherwise, passes are grouped automatically. Use this to group passes that are tightly related, such as the boarding passes for different connections of the same trip. Available in iOS 7.0.

§label_color: Option<String>

olor of the label text, specified as a CSS-style RGB triple. If omitted, the label color is determined automatically.

§locations: Option<Vec<Location>>

Locations where the pass is relevant. For example, the location of your store.

§logo_text: Option<String>

Text displayed next to the logo on the pass. Localizable.

§max_distance: Option<f64>

Maximum distance in meters from a relevant latitude and longitude that the pass is relevant. This number is compared to the pass’s default distance and the smaller value is used. Available in iOS 7.0.

§nfc: Option<Nfc>

Information used for Value Added Service Protocol transactions. Available in iOS 9.0.

§organization_name: String

Display name of the organization that originated and signed the pass. Localizable.

§pass_type_identifier: String

Pass type identifier, as issued by Apple. The value must correspond with your signing certificate.

§relevant_date: Option<String>

Date and time when the pass becomes relevant. For example, the start time of a movie. Recommended for event tickets and boarding passes.

§serial_number: String

Serial number that uniquely identifies the pass. No two passes with the same pass type identifier may have the same serial number.

§store_card: Option<Details>

Information specific to a store card.

§suppress_strip_shine: Option<bool>

If true, the strip image is displayed without a shine effect. The default value prior to iOS 7.0 is false. In iOS 7.0, a shine effect is never applied, and this key is deprecated.

§team_identifier: Option<String>

Team identifier of the organization that originated and signed the pass, as issued by Apple.

§user_info: Option<HashMap<String, Option<Value>>>

Custom information for companion apps. This data is not displayed to the user. For example, a pass for a cafe could include information about the user’s favorite drink and sandwich in a machine-readable form for the companion app to read, making it easy to place an order for “the usual” from the app. Available in iOS 7.0.

§voided: Option<bool>

Indicates that the pass is void—for example, a one time use coupon that has been redeemed. Available in iOS 7.0.

§web_service_url: Option<String>

The URL of a web service that conforms to the API described in PassKit Web Service Reference. The web service must use the HTTPS protocol; the leading https:// is included in the value of this key. On devices configured for development, there is UI in Settings to allow HTTP web services.

Implementations§

Source§

impl Template

Source

pub fn new( description: &str, organization_name: &str, pass_type_identifier: &str, serial_number: &str, ) -> Self

Create a new Instance

Source

pub fn app_launch_url(&mut self, app_launch_url: &str)

A URL to be passed to the associated app when launching it. The app receives this URL in the application:didFinishLaunchingWithOptions: and application:openURL:options: methods of its app delegate.

Source

pub fn add_associated_store_identifiers( &mut self, associated_store_identifier: f64, )

A list of iTunes Store item identifiers for the associated apps. Only one item in the list is used—the first item identifier for an app compatible with the current device. If the app is not installed, the link opens the App Store and shows the app. If the app is already installed, the link launches the app.

Source

pub fn clear_associated_store_identifiers(&mut self)

A list of iTunes Store item identifiers for the associated apps. Only one item in the list is used—the first item identifier for an app compatible with the current device. If the app is not installed, the link opens the App Store and shows the app. If the app is already installed, the link launches the app.

Source

pub fn authentication_token(&mut self, authentication_token: &str)

The authentication token to use with the web service.

Source

pub fn background_color(&mut self, background_color: &str)

Background color of the pass, specified as an CSS-style RGB triple.

Source

pub fn barcode(&mut self, barcode: Barcode)

Information specific to the pass’s barcode. Deprecated in iOS 9.0 and later; use barcodes instead.

Source

pub fn add_barcodes(&mut self, barcode: Barcode)

Information specific to the pass’s barcode. The system uses the first valid barcode dictionary in the array. Additional dictionaries can be added as fallbacks. Available only in iOS 9.0 and later.

Source

pub fn clear_barcodes(&mut self)

Information specific to the pass’s barcode. The system uses the first valid barcode dictionary in the array. Additional dictionaries can be added as fallbacks. Available only in iOS 9.0 and later.

Source

pub fn add_beacon(&mut self, beacon: Beacon)

Beacons marking locations where the pass is relevant. Available in iOS 7.0.

Source

pub fn clear_beacons(&mut self)

Beacons marking locations where the pass is relevant. Available in iOS 7.0.

Source

pub fn boarding_pass(&mut self, boarding_pass: BoardingPass)

Information specific to a boarding pass.

Source

pub fn coupon(&mut self, coupon: Details)

Information specific to a coupon.

Source

pub fn description(&mut self, description: &str)

Brief description of the pass, used by the iOS accessibility technologies. Don’t try to include all of the data on the pass in its description, just include enough detail to distinguish passes of the same type. Localizable.

Source

pub fn event_ticket(&mut self, event_ticket: Details)

Information specific to an event ticket.

Source

pub fn expiration_date(&mut self, expiration_date: &str)

Date and time when the pass expires. Available in iOS 7.0.

Source

pub fn foreground_color(&mut self, foreground_color: &str)

Foreground color of the pass, specified as a CSS-style RGB triple

Source

pub fn format_version(&mut self, format_version: Value)

Version of the file format.

Source

pub fn generic(&mut self, generic: Details)

Information specific to a generic pass.

Source

pub fn grouping_identifier(&mut self, grouping_identifier: &str)

Identifier used to group related passes. If a grouping identifier is specified, passes with the same style, pass type identifier, and grouping identifier are displayed as a group. Otherwise, passes are grouped automatically. Use this to group passes that are tightly related, such as the boarding passes for different connections of the same trip. Available in iOS 7.0.

Source

pub fn label_color(&mut self, label_color: &str)

olor of the label text, specified as a CSS-style RGB triple. If omitted, the label color is determined automatically.

Source

pub fn add_location(&mut self, location: Location)

Locations where the pass is relevant. For example, the location of your store.

Source

pub fn clear_locations(&mut self)

Locations where the pass is relevant. For example, the location of your store.

Source

pub fn logo_text(&mut self, logo_text: &str)

Text displayed next to the logo on the pass. Localizable.

Source

pub fn max_distance(&mut self, max_distance: f64)

Maximum distance in meters from a relevant latitude and longitude that the pass is relevant. This number is compared to the pass’s default distance and the smaller value is used. Available in iOS 7.0.

Source

pub fn nfc(&mut self, nfc: Nfc)

Information used for Value Added Service Protocol transactions. Available in iOS 9.0.

Source

pub fn organization_name(&mut self, organization_name: &str)

Display name of the organization that originated and signed the pass. Localizable.

Source

pub fn pass_type_identifier(&mut self, pass_type_identifier: &str)

Pass type identifier, as issued by Apple. The value must correspond with your signing certificate.

Source

pub fn relevant_date(&mut self, relevant_date: &str)

Date and time when the pass becomes relevant. For example, the start time of a movie. Recommended for event tickets and boarding passes.

Source

pub fn serial_number(&mut self, serial_number: &str)

Serial number that uniquely identifies the pass. No two passes with the same pass type identifier may have the same serial number.

Source

pub fn store_card(&mut self, store_card: Details)

Information specific to a store card.

Source

pub fn suppress_strip_shine(&mut self, suppress_strip_shine: bool)

If true, the strip image is displayed without a shine effect. The default value prior to iOS 7.0 is false. In iOS 7.0, a shine effect is never applied, and this key is deprecated.

Source

pub fn team_identifier(&mut self, team_identifier: &str)

Team identifier of the organization that originated and signed the pass, as issued by Apple.

Source

pub fn add_user_info(&mut self, key: &str, value: Value)

Custom information for companion apps. This data is not displayed to the user. For example, a pass for a cafe could include information about the user’s favorite drink and sandwich in a machine-readable form for the companion app to read, making it easy to place an order for “the usual” from the app. Available in iOS 7.0.

Source

pub fn clear_user_info(&mut self)

Custom information for companion apps. This data is not displayed to the user. For example, a pass for a cafe could include information about the user’s favorite drink and sandwich in a machine-readable form for the companion app to read, making it easy to place an order for “the usual” from the app. Available in iOS 7.0.

Source

pub fn voided(&mut self, voided: bool)

Indicates that the pass is void—for example, a one time use coupon that has been redeemed. Available in iOS 7.0.

Source

pub fn web_service_url(&mut self, web_service_url: &str)

The URL of a web service that conforms to the API described in PassKit Web Service Reference. The web service must use the HTTPS protocol; the leading https:// is included in the value of this key. On devices configured for development, there is UI in Settings to allow HTTP web services.

Trait Implementations§

Source§

impl Clone for Template

Source§

fn clone(&self) -> Template

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Template

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Template

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Template

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.