@@ -7,13 +7,13 @@ import '../models/profile.dart';
77import '../models/validation_error.dart' ;
88import 'response.dart' ;
99
10- // TODO: preferences, subscriptions should be in `AccountResponse `
10+ // TODO: preferences, subscriptions should be in `GetAccountResponse `
1111
12- /// The extension type for the account response.
12+ /// The extension type for the get account response.
1313@JS ()
1414@anonymous
1515@staticInterop
16- extension type AccountResponse (Response baseResponse) {
16+ extension type GetAccountResponse (Response baseResponse) {
1717 /// The timestamp of the creation of the user.
1818 external String ? get created;
1919
@@ -23,6 +23,11 @@ extension type AccountResponse(Response baseResponse) {
2323 /// The verified and unverified email addresses of the user.
2424 external Emails ? get emails;
2525
26+ /// Whether this account is currently in transition.
27+ ///
28+ /// An account that is in transition cannot be modified.
29+ external bool ? get inTransition;
30+
2631 /// Whether the user is active.
2732 external bool ? get isActive;
2833
@@ -80,12 +85,17 @@ extension type AccountResponse(Response baseResponse) {
8085 /// The timestamp when the user was verified.
8186 external String ? get verified;
8287
88+ // TODO: add lockedUntil when DateTime static interop is fixed.
89+ // Currently it is not supported, so add a static interop type for the date class
90+ // See: https://github.com/dart-lang/sdk/issues/52021
91+
8392 /// Convert this response to a [Map] .
8493 Map <String , dynamic > toMap () {
8594 return < String , dynamic > {
8695 'created' : created,
8796 'data' : data.dartify (),
8897 'emails' : emails? .toMap (),
98+ 'inTransition' : inTransition,
8999 'isActive' : isActive,
90100 'isRegistered' : isRegistered,
91101 'isVerified' : isVerified,
@@ -105,29 +115,6 @@ extension type AccountResponse(Response baseResponse) {
105115 'UIDSignature' : UIDSignature ,
106116 'verified' : verified,
107117 };
108- }
109- }
110-
111- /// The extension type for the get account response.
112- @JS ()
113- @anonymous
114- @staticInterop
115- extension type GetAccountResponse (AccountResponse accountResponse) {
116- /// Whether this account is currently in transition.
117- ///
118- /// An account that is in transition cannot be modified.
119- external bool ? get inTransition;
120-
121- // TODO: add lockedUntil when DateTime static interop is fixed.
122- // Currently it is not supported, so add a static interop type for the date class
123- // See: https://github.com/dart-lang/sdk/issues/52021
124-
125- /// Convert this response to a [Map] .
126- Map <String , dynamic > toMap () {
127- return < String , dynamic > {
128- ...accountResponse.toMap (),
129- 'inTransition' : inTransition,
130- };
131118 }
132119}
133120
0 commit comments