Added Semantics to typings; Also adapted them to the most recent changes

This commit is contained in:
Alexander Cerutti
2019-04-04 22:49:51 +02:00
parent 43e687b2f4
commit 45b1c0dd16

202
index.d.ts vendored
View File

@@ -4,11 +4,11 @@ export declare class Pass {
constructor(options: Schema.Instance); constructor(options: Schema.Instance);
public transitType: "PKTransitTypeAir" | "PKTransitTypeBoat" | "PKTransitTypeBus" | "PKTransitTypeGeneric" | "PKTransitTypeTrain"; public transitType: "PKTransitTypeAir" | "PKTransitTypeBoat" | "PKTransitTypeBus" | "PKTransitTypeGeneric" | "PKTransitTypeTrain";
public headerFields: FieldContainer; public headerFields: Field[];
public primaryFields: FieldContainer; public primaryFields: Field[];
public secondaryFields: FieldContainer; public secondaryFields: Field[];
public auxiliaryFields: FieldContainer; public auxiliaryFields: (Field & { row: number })[];
public backFields: FieldContainer; public backFields: Field[];
/** /**
* Generates a Stream of a zip file using the infos passed through overrides or methods. * Generates a Stream of a zip file using the infos passed through overrides or methods.
@@ -67,11 +67,6 @@ export declare class Pass {
load(resource: string, name: string): this; load(resource: string, name: string): this;
} }
declare class FieldContainer {
push(...fields: Schema.Field[]): number;
pop(amount?: number): undefined | number;
}
interface BarcodeInterfaces extends BarcodeSuccessfulOperations { interface BarcodeInterfaces extends BarcodeSuccessfulOperations {
autocomplete: () => void | BarcodeSuccessfulOperations autocomplete: () => void | BarcodeSuccessfulOperations
} }
@@ -91,73 +86,170 @@ declare namespace Schema {
type NumberStyle = "PKNumberStyleDecimal" | "PKNumberStylePercent" | "PKNumberStyleScientific" | "PKNumberStyleSpellOut"; type NumberStyle = "PKNumberStyleDecimal" | "PKNumberStylePercent" | "PKNumberStyleScientific" | "PKNumberStyleSpellOut";
type BarcodeFormat = "PKBarcodeFormatQR" | "PKBarcodeFormatPDF417" | "PKBarcodeFormatAztec" | "PKBarcodeFormatCode128"; type BarcodeFormat = "PKBarcodeFormatQR" | "PKBarcodeFormatPDF417" | "PKBarcodeFormatAztec" | "PKBarcodeFormatCode128";
type RelevanceType = "beacons" | "locations" | "maxDistance" | "relevantDate"; type RelevanceType = "beacons" | "locations" | "maxDistance" | "relevantDate";
type SemanticsEventType = "PKEventTypeGeneric" | "PKEventTypeLivePerformance" | "PKEventTypeMovie" | "PKEventTypeSports" | "PKEventTypeConference" | "PKEventTypeConvention" | "PKEventTypeWorkshop" | "PKEventTypeSocialGathering";
interface Instance { interface Instance {
model: string, model: string;
certificates: { certificates: {
wwdr: string, wwdr: string;
signerCert: string, signerCert: string;
signerKey: { signerKey: {
keyFile: string, keyFile: string;
passphrase: string passphrase: string;
} }
}, };
overrides: SupportedOptions, overrides: SupportedOptions;
shouldOverwrite?: boolean shouldOverwrite?: boolean;
} }
interface SupportedOptions { interface SupportedOptions {
serialNumber?: string, serialNumber?: string;
description?: string, description?: string;
userInfo?: Object | any[], userInfo?: Object | any[];
webServiceURL?: string, webServiceURL?: string;
authenticationToken?: string, authenticationToken?: string;
backgroundColor?: string, backgroundColor?: string;
foregroundColor?: string, foregroundColor?: string;
labelColor?: string, labelColor?: string;
groupingIdentifier?: string, groupingIdentifier?: string;
suppressStripShine?: boolean suppressStripShine?: boolean;
} }
interface Field { interface Field {
attributedValue?: string, attributedValue?: string;
changeMessage?: string, changeMessage?: string;
dataDetectorType?: DataDetectorType[], dataDetectorType?: DataDetectorType[];
label?: string, label?: string;
textAlignment?: TextAlignment, textAlignment?: TextAlignment;
key: string, key: string;
value: string | number, value: string | number;
dateStyle?: DateTimeStyle, dateStyle?: DateTimeStyle;
ignoreTimeZone?: boolean, ignoreTimeZone?: boolean;
isRelative?: boolean, isRelative?: boolean;
timeStyle?: DateTimeStyle, timeStyle?: DateTimeStyle;
currencyCode?: string, currencyCode?: string;
numberStyle?: NumberStyle numberStyle?: NumberStyle;
semantics?: Semantics;
} }
interface Beacon { interface Beacon {
major?: number, major?: number;
minor?: number, minor?: number;
proximityUUID: string, proximityUUID: string;
relevantText?: string relevantText?: string;
} }
interface Location { interface Location {
altitude?: number, altitude?: number;
latitude: number, latitude: number;
longitude: number, longitude: number;
relevantText?: string relevantText?: string;
} }
interface NFC { interface NFC {
message: string, message: string;
encryptionPublicKey?: string encryptionPublicKey?: string;
} }
interface Barcode { interface Barcode {
altText?: string, altText?: string;
messageEncoding?: string, messageEncoding?: string;
format: BarcodeFormat, format: BarcodeFormat;
message: string message: string;
}
interface Semantics {
// All
totalPrice?: SemanticsCurrencyAmount;
// boarding Passes and Events
duration?: number;
seats?: Seat[];
silenceRequested?: boolean;
// all boarding passes
departureLocation?: SemanticsLocation;
destinationLocation?: SemanticsLocation;
destinationLocationDescription?: SemanticsLocation;
transitProvider?: string;
vehicleName?: string;
vehicleType?: string;
originalDepartureDate?: string;
currentDepartureDate?: string;
originalArrivalDate?: string;
currentArrivalDate?: string;
originalBoardingDate?: string;
currentBoardingDate?: string;
boardingGroup?: string;
boardingSequenceNumber?: string;
confirmationNumber?: string;
transitStatus?: string;
transitStatuReason?: string;
passengetName?: SemanticsPersonNameComponents;
membershipProgramName?: string;
membershipProgramNumber?: string;
priorityStatus?: string;
securityScreening?: string;
// Airline Boarding Passes
flightCode?: string;
airlineCode?: string;
flightNumber?: number;
departureAirportCode?: string;
departureAirportName?: string;
destinationTerminal?: string;
destinationGate?: string;
// Train and Other Rail Boarding Passes
departurePlatform?: string;
departureStationName?: string;
destinationPlatform?: string;
destinationStationName?: string;
carNumber?: string;
// All Event Tickets
eventName?: string;
venueName?: string;
venueLocation?: SemanticsLocation;
venueEntrance?: string;
venuePhoneNumber?: string;
venueRoom?: string;
eventType?: SemanticsEventType;
eventStartDate?: string;
eventEndDate?: string;
artistIDs?: string;
performerNames?: string[];
genre?: string;
// Sport Event Tickets
leagueName?: string;
leagueAbbreviation?: string;
homeTeamLocation?: string;
homeTeamName?: string;
homeTeamAbbreviation?: string;
awayTeamLocation?: string;
awayTeamName?: string;
awayTeamAbbreviation?: string;
sportName?: string;
// Store Card Passes
balance?: SemanticsCurrencyAmount;
};
interface SemanticsCurrencyAmount {
currencyCode: string;
amount: string;
};
interface SemanticsPersonNameComponents {
givenName: string;
familyName: string;
}
interface SemanticsSeat {
seatSection?: string;
seatRow?: string;
seatNumber?: string;
seatIdentifier?: string;
seatType?: string;
seatDescription?: string;
}
interface SemanticsLocation {
latitude: number;
longitude: number;
} }
} }