forked from alexandercerutti/passkit-generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.d.ts
More file actions
255 lines (228 loc) · 7.72 KB
/
index.d.ts
File metadata and controls
255 lines (228 loc) · 7.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
import { Stream } from "stream";
export declare class Pass {
constructor(options: Schema.Instance);
public transitType: "PKTransitTypeAir" | "PKTransitTypeBoat" | "PKTransitTypeBus" | "PKTransitTypeGeneric" | "PKTransitTypeTrain";
public headerFields: Schema.Field[];
public primaryFields: Schema.Field[];
public secondaryFields: Schema.Field[];
public auxiliaryFields: (Schema.Field & { row: number })[];
public backFields: Schema.Field[];
/**
* Generates a Stream of a zip file using the infos passed through overrides or methods.
* (MIME: `application/vnd.apple.pkpass`)
*/
generate(): Promise<Stream>;
/**
* Generates pass.strings translation files in the specified language
* @param lang - lang in ISO 3166 alpha-2 format (e.g. `en` or `en-US`);
* @param translations - Object in format `{ "placeholder" : "translated-text" }`
* @see https://apple.co/2KOv0OW
*/
localize(lang: string, translations: Object): this;
/**
* Sets pass expiration date
* @param date - A date in the format you want (see "format")
* @param format - A custom date format. If `undefined`, the date will be parsed in the following formats: `MM-DD-YYYY`, `MM-DD-YYYY hh:mm:ss`, `DD-MM-YYYY`, `DD-MM-YYYY hh:mm:ss`.
*/
expiration(date: string, format?: string | string[]): this;
/** Generates a voided pass. Useful for backend pass updates. */
void(): this;
/**
* Sets relevance for pass (conditions to appear in the lockscren).
* @param type - must be `beacons`, `locations`, `maxDistance` or `relevantDate`
* @param data - if object, will be treated as one-element array
* @param relevanceDateFormat - custom format to be used in case of "relevatDate" as type. Otherwise the date will be parsed in the following formats: `MM-DD-YYYY`, `MM-DD-YYYY hh:mm:ss`, `DD-MM-YYYY`, `DD-MM-YYYY hh:mm:ss`.
*/
relevance(type: Schema.RelevanceType, data: string | Schema.Location | Schema.Location[] | Schema.Beacon | Schema.Beacon[], relevanceDateFormat?: string): SuccessfulOperations;
/**
* Adds barcode to the pass. If data is an Object, will be treated as one-element array.
* @param data - data to be used to generate a barcode. If string, Barcode will contain structures for all the supported types and `data` will be used message and altText.
* @see https://apple.co/2C74kbm
*/
barcode(data: Schema.Barcode | Schema.Barcode[] | string): BarcodeInterfaces;
/**
* Sets nfc infos for the pass
* @param data - NFC data
* @see https://apple.co/2wTxiaC
*/
nfc(...data: Schema.NFC[]): this;
/**
* Sets resources to be downloaded right inside
* the pass archive.
* @param resource - url
* @param name - name (or path) to be used inside the archive
* @returns this;
*/
load(resource: string, name: string): this;
}
interface BarcodeInterfaces extends BarcodeSuccessfulOperations {
autocomplete: () => void | BarcodeSuccessfulOperations
}
interface BarcodeSuccessfulOperations extends SuccessfulOperations {
backward: (format: null | string) => void | ThisType<Pass>
}
interface SuccessfulOperations extends ThisType<Pass> {
length: number
}
declare namespace Schema {
type DataDetectorType = "PKDataDetectorTypePhoneNumber" | "PKDataDetectorTypeLink" | "PKDataDetectorTypeAddress" | "PKDataDetectorTypeCalendarEvent";
type TextAlignment = "PKTextAlignmentLeft" | "PKTextAlignmentCenter" | "PKTextAlignmentRight" | "PKTextAlignmentNatural";
type DateTimeStyle = "PKDateStyleNone" | "PKDateStyleShort" | "PKDateStyleMedium" | "PKDateStyleLong" | "PKDateStyleFull";
type NumberStyle = "PKNumberStyleDecimal" | "PKNumberStylePercent" | "PKNumberStyleScientific" | "PKNumberStyleSpellOut";
type BarcodeFormat = "PKBarcodeFormatQR" | "PKBarcodeFormatPDF417" | "PKBarcodeFormatAztec" | "PKBarcodeFormatCode128";
type RelevanceType = "beacons" | "locations" | "maxDistance" | "relevantDate";
type SemanticsEventType = "PKEventTypeGeneric" | "PKEventTypeLivePerformance" | "PKEventTypeMovie" | "PKEventTypeSports" | "PKEventTypeConference" | "PKEventTypeConvention" | "PKEventTypeWorkshop" | "PKEventTypeSocialGathering";
interface Instance {
model: string;
certificates: {
wwdr: string;
signerCert: string;
signerKey: {
keyFile: string;
passphrase: string;
}
};
overrides: SupportedOptions;
shouldOverwrite?: boolean;
}
interface SupportedOptions {
serialNumber?: string;
description?: string;
userInfo?: Object | any[];
webServiceURL?: string;
authenticationToken?: string;
backgroundColor?: string;
foregroundColor?: string;
labelColor?: string;
groupingIdentifier?: string;
suppressStripShine?: boolean;
}
interface Field {
attributedValue?: string;
changeMessage?: string;
dataDetectorType?: DataDetectorType[];
label?: string;
textAlignment?: TextAlignment;
key: string;
value: string | number;
dateStyle?: DateTimeStyle;
ignoreTimeZone?: boolean;
isRelative?: boolean;
timeStyle?: DateTimeStyle;
currencyCode?: string;
numberStyle?: NumberStyle;
semantics?: Semantics;
}
interface Beacon {
major?: number;
minor?: number;
proximityUUID: string;
relevantText?: string;
}
interface Location {
altitude?: number;
latitude: number;
longitude: number;
relevantText?: string;
}
interface NFC {
message: string;
encryptionPublicKey?: string;
}
interface Barcode {
altText?: string;
messageEncoding?: string;
format: BarcodeFormat;
message: string;
}
interface Semantics {
// All
totalPrice?: SemanticsCurrencyAmount;
// boarding Passes and Events
duration?: number;
seats?: SemanticsSeat[];
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;
}
}