LCOV - code coverage report
Current view: top level - lib\data\remote\requests\chatwoot_action_data.dart - chatwoot_action_data.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 6 14 42.9 %
Date: Tue Jul 13 13:39:38 2021 Functions: 0 0 -

          Line data    Source code
       1             : 
       2             : 
       3             : import 'package:json_annotation/json_annotation.dart';
       4             : 
       5             : part 'chatwoot_action_data.g.dart';
       6             : 
       7             : @JsonSerializable(explicitToJson: true)
       8             : class ChatwootActionData{
       9             :   @JsonKey(
      10             :     toJson: actionTypeToJson,
      11             :     fromJson: actionTypeFromJson
      12             :   )
      13             :   final ChatwootActionType action;
      14             : 
      15           1 :   ChatwootActionData({required this.action});
      16             : 
      17           0 :   factory ChatwootActionData.fromJson(Map<String, dynamic> json) => _$ChatwootActionDataFromJson(json);
      18             : 
      19           2 :   Map<String, dynamic> toJson() => _$ChatwootActionDataToJson(this);
      20             : }
      21             : 
      22          15 : enum ChatwootActionType{
      23             :   subscribe, update_presence, conversation_typing_on, conversation_typing_off
      24             : }
      25             : 
      26           1 : String actionTypeToJson(ChatwootActionType actionType){
      27             :   switch(actionType){
      28           1 :     case ChatwootActionType.conversation_typing_off:
      29             :       return "conversation.typing_off";
      30           1 :     case ChatwootActionType.conversation_typing_on:
      31             :       return "conversation.typing_on";
      32           0 :     case ChatwootActionType.update_presence:
      33             :       return "update_presence";
      34           0 :     case ChatwootActionType.subscribe:
      35             :       return "subscribe";
      36             :   }
      37             : }
      38             : 
      39           0 : ChatwootActionType actionTypeFromJson(String? value){
      40             :   switch(value){
      41           0 :     case "conversation.typing_on":
      42             :       return ChatwootActionType.conversation_typing_on;
      43           0 :     case "conversation.typing_off":
      44             :       return ChatwootActionType.conversation_typing_on;
      45           0 :     case "update_presence":
      46             :       return ChatwootActionType.update_presence;
      47           0 :     case "subscribe":
      48             :       return ChatwootActionType.subscribe;
      49             :     default:
      50             :       return ChatwootActionType.update_presence;
      51             :   }
      52             : }

Generated by: LCOV version 1.15.alpha0w