LCOV - code coverage report
Current view: top level - lib/matrix_api_lite/model/auth - authentication_three_pid_creds.dart (source / functions) Hit Total Coverage
Test: merged.info Lines: 0 21 0.0 %
Date: 2024-09-04 20:26:16 Functions: 0 0 -

          Line data    Source code
       1             : /* MIT License
       2             : * 
       3             : * Copyright (C) 2019, 2020, 2021 Famedly GmbH
       4             : * 
       5             : * Permission is hereby granted, free of charge, to any person obtaining a copy
       6             : * of this software and associated documentation files (the "Software"), to deal
       7             : * in the Software without restriction, including without limitation the rights
       8             : * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       9             : * copies of the Software, and to permit persons to whom the Software is
      10             : * furnished to do so, subject to the following conditions:
      11             : * 
      12             : * The above copyright notice and this permission notice shall be included in all
      13             : * copies or substantial portions of the Software.
      14             : * 
      15             : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      16             : * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      17             : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      18             : * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      19             : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      20             : * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      21             : * SOFTWARE.
      22             : */
      23             : 
      24             : import 'package:matrix/matrix_api_lite/model/auth/authentication_data.dart';
      25             : 
      26             : /// For email based identity:
      27             : /// https://matrix.org/docs/spec/client_server/r0.6.1#email-based-identity-homeserver
      28             : /// Or phone number based identity:
      29             : /// https://matrix.org/docs/spec/client_server/r0.6.1#phone-number-msisdn-based-identity-homeserver
      30             : class AuthenticationThreePidCreds extends AuthenticationData {
      31             :   late ThreepidCreds threepidCreds;
      32             : 
      33           0 :   AuthenticationThreePidCreds(
      34             :       {super.session, required String super.type, required this.threepidCreds});
      35             : 
      36           0 :   AuthenticationThreePidCreds.fromJson(Map<String, Object?> json)
      37           0 :       : super.fromJson(json) {
      38           0 :     final creds = json['threepid_creds'];
      39           0 :     if (creds is Map<String, Object?>) {
      40           0 :       threepidCreds = ThreepidCreds.fromJson(creds);
      41             :     }
      42             :   }
      43             : 
      44           0 :   @override
      45             :   Map<String, Object?> toJson() {
      46           0 :     final data = super.toJson();
      47           0 :     data['threepid_creds'] = threepidCreds.toJson();
      48             :     return data;
      49             :   }
      50             : }
      51             : 
      52             : class ThreepidCreds {
      53             :   String sid;
      54             :   String clientSecret;
      55             :   String? idServer;
      56             :   String? idAccessToken;
      57             : 
      58           0 :   ThreepidCreds(
      59             :       {required this.sid,
      60             :       required this.clientSecret,
      61             :       this.idServer,
      62             :       this.idAccessToken});
      63             : 
      64           0 :   ThreepidCreds.fromJson(Map<String, Object?> json)
      65           0 :       : sid = json['sid'] as String,
      66           0 :         clientSecret = json['client_secret'] as String,
      67           0 :         idServer = json['id_server'] as String?,
      68           0 :         idAccessToken = json['id_access_token'] as String?;
      69             : 
      70           0 :   Map<String, Object?> toJson() {
      71           0 :     final data = <String, Object?>{};
      72           0 :     data['sid'] = sid;
      73           0 :     data['client_secret'] = clientSecret;
      74           0 :     if (idServer != null) data['id_server'] = idServer;
      75           0 :     if (idAccessToken != null) data['id_access_token'] = idAccessToken;
      76             :     return data;
      77             :   }
      78             : }

Generated by: LCOV version 1.14