-
Notifications
You must be signed in to change notification settings - Fork 17
/
token_details.dart
53 lines (47 loc) · 1.65 KB
/
token_details.dart
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
/// Response to a `requestToken` request
///
/// https://docs.ably.com/client-lib-development-guide/features/#TD1
class TokenDetails {
/// https://docs.ably.com/client-lib-development-guide/features/#TD2
String? token;
/// Token expiry time in milliseconds
///
/// https://docs.ably.com/client-lib-development-guide/features/#TD3
int? expires;
/// the time the token was issued in milliseconds
///
/// https://docs.ably.com/client-lib-development-guide/features/#TD4
int? issued;
/// stringified capabilities JSON
///
/// https://docs.ably.com/client-lib-development-guide/features/#TD5
String? capability;
/// Client ID assigned to the token.
///
/// If [clientId] is not set (i.e. null), then the token is prohibited
/// from assuming a clientId in any operations, however if clientId
/// is a wildcard string '*', then the token is permitted to assume
/// any clientId. Any other string value for clientId implies that the
/// clientId is both enforced and assumed for all operations for this token
///
/// https://docs.ably.com/client-lib-development-guide/features/#TD6
String? clientId;
/// instantiates a [TokenDetails] with provided values
TokenDetails(
this.token, {
this.expires,
this.issued,
this.capability,
this.clientId,
});
/// Creates an instance from the map
///
/// https://docs.ably.com/client-lib-development-guide/features/#TD7
TokenDetails.fromMap(Map<String, dynamic> map) {
token = map['token'] as String?;
expires = map['expires'] as int?;
issued = map['issued'] as int?;
capability = map['capability'] as String?;
clientId = map['clientId'] as String?;
}
}