11import 'dart:js_interop' ;
22
3+ import '../models/emails.dart' ;
34import 'response.dart' ;
45
5- // TODO: fix the extension type
6- // - String? time
7- // - Emails? emails
8- // - String? UID -> fix the JS annotation
9-
10- /// The static interop class for the Gigya Reset Password API response.
6+ /// The extension type for the Gigya Reset Password API response.
117///
128/// See also: https://help.sap.com/docs/SAP_CUSTOMER_DATA_CLOUD/8b8d6fffe113457094a17701f63e3d6a/c21d4e0445b84a779af1ad4868902c21.html#response-data
139@JS ()
1410@anonymous
1511@staticInterop
16- class ResetPasswordResponse extends Response {}
17-
18- /// This extension defines the static interop definition
19- /// for the [ResetPasswordResponse] class.
20- extension ResetPasswordResponseExtension on ResetPasswordResponse {
21- @JS ('emails' )
22- external Object ? get _emails;
23-
12+ extension type ResetPasswordResponse (Response baseResponse) {
2413 /// The email addresses belonging to the user.
25- Map <String , dynamic > get emails {
26- if (_emails.isUndefinedOrNull) {
27- return const < String , dynamic > {};
28- }
29-
30- return (dartify (_emails) as Map <Object ?, Object ?>).cast <String , dynamic >();
31- }
14+ external Emails ? get emails;
3215
3316 /// The token that should be used for the password reset in the password reset email.
3417 ///
35- /// This is null if the email is sent by the Gigya SDK .
18+ /// This is null if `ResetPasswordParameters.sendEmail` was `false` .
3619 external String ? get passwordResetToken;
3720
21+ /// The time of the response, in ISO 8601 format,
22+ /// i.e. 2021-02-06T22:05:47.706Z.
23+ external String ? get time;
24+
3825 /// The secret question for the password reset.
3926 ///
4027 /// This is null if there is no security verification failure.
@@ -43,6 +30,16 @@ extension ResetPasswordResponseExtension on ResetPasswordResponse {
4330 /// The UID of the user whose password was changed.
4431 ///
4532 /// This is null if the password was not changed yet.
46- @JS ('UID' )
47- external String ? get uid;
33+ external String ? get UID ; // ignore: non_constant_identifier_names
34+
35+ /// Convert this response to a [Map] .
36+ Map <String , dynamic > toMap () {
37+ return < String , dynamic > {
38+ 'emails' : emails? .toMap (),
39+ 'passwordResetToken' : passwordResetToken,
40+ 'time' : time,
41+ 'secretQuestion' : secretQuestion,
42+ 'UID' : UID ,
43+ };
44+ }
4845}
0 commit comments