mirror of
https://gitlab.com/TheOneWithTheBraid/dart_pkpass.git
synced 2025-07-06 13:28:48 +00:00
chore: add high level classes
Signed-off-by: The one with the braid <the-one@with-the-braid.cf>
This commit is contained in:
parent
165226bee1
commit
78f88305ec
13 changed files with 678 additions and 316 deletions
31
lib/src/models/pass_web_service.dart
Normal file
31
lib/src/models/pass_web_service.dart
Normal file
|
@ -0,0 +1,31 @@
|
|||
/// TODO: implement PassKit Web Service Reference
|
||||
///
|
||||
/// Metadata required for Pass Web Service
|
||||
///
|
||||
/// https://developer.apple.com/library/archive/documentation/PassKit/Reference/PassKit_WebService/WebService.html#//apple_ref/doc/uid/TP40011988
|
||||
class PassWebService {
|
||||
/// The authentication token to use with the web service.
|
||||
/// The token must be 16 characters or longer.
|
||||
final String authenticationToken;
|
||||
|
||||
/// The URL of a web service that conforms to the API described in PassKit Web Service Reference.
|
||||
final Uri webServiceURL;
|
||||
|
||||
const PassWebService({
|
||||
required this.authenticationToken,
|
||||
required this.webServiceURL,
|
||||
});
|
||||
|
||||
static PassWebService? maybe({
|
||||
String? authenticationToken,
|
||||
String? webServiceURL,
|
||||
}) {
|
||||
if (authenticationToken == null || webServiceURL == null) return null;
|
||||
final uri = Uri.tryParse(webServiceURL);
|
||||
if (uri == null || uri.scheme != 'https') return null;
|
||||
return PassWebService(
|
||||
authenticationToken: authenticationToken,
|
||||
webServiceURL: uri,
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue