module TD.Data.ChatStatisticsAdministratorActionsInfo
(ChatStatisticsAdministratorActionsInfo(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data ChatStatisticsAdministratorActionsInfo
= ChatStatisticsAdministratorActionsInfo
{ ChatStatisticsAdministratorActionsInfo -> Maybe Int
user_id :: Maybe Int
, ChatStatisticsAdministratorActionsInfo -> Maybe Int
deleted_message_count :: Maybe Int
, ChatStatisticsAdministratorActionsInfo -> Maybe Int
banned_user_count :: Maybe Int
, ChatStatisticsAdministratorActionsInfo -> Maybe Int
restricted_user_count :: Maybe Int
}
deriving (ChatStatisticsAdministratorActionsInfo
-> ChatStatisticsAdministratorActionsInfo -> Bool
(ChatStatisticsAdministratorActionsInfo
-> ChatStatisticsAdministratorActionsInfo -> Bool)
-> (ChatStatisticsAdministratorActionsInfo
-> ChatStatisticsAdministratorActionsInfo -> Bool)
-> Eq ChatStatisticsAdministratorActionsInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ChatStatisticsAdministratorActionsInfo
-> ChatStatisticsAdministratorActionsInfo -> Bool
== :: ChatStatisticsAdministratorActionsInfo
-> ChatStatisticsAdministratorActionsInfo -> Bool
$c/= :: ChatStatisticsAdministratorActionsInfo
-> ChatStatisticsAdministratorActionsInfo -> Bool
/= :: ChatStatisticsAdministratorActionsInfo
-> ChatStatisticsAdministratorActionsInfo -> Bool
Eq, Int -> ChatStatisticsAdministratorActionsInfo -> ShowS
[ChatStatisticsAdministratorActionsInfo] -> ShowS
ChatStatisticsAdministratorActionsInfo -> String
(Int -> ChatStatisticsAdministratorActionsInfo -> ShowS)
-> (ChatStatisticsAdministratorActionsInfo -> String)
-> ([ChatStatisticsAdministratorActionsInfo] -> ShowS)
-> Show ChatStatisticsAdministratorActionsInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatStatisticsAdministratorActionsInfo -> ShowS
showsPrec :: Int -> ChatStatisticsAdministratorActionsInfo -> ShowS
$cshow :: ChatStatisticsAdministratorActionsInfo -> String
show :: ChatStatisticsAdministratorActionsInfo -> String
$cshowList :: [ChatStatisticsAdministratorActionsInfo] -> ShowS
showList :: [ChatStatisticsAdministratorActionsInfo] -> ShowS
Show)
instance I.ShortShow ChatStatisticsAdministratorActionsInfo where
shortShow :: ChatStatisticsAdministratorActionsInfo -> String
shortShow ChatStatisticsAdministratorActionsInfo
{ user_id :: ChatStatisticsAdministratorActionsInfo -> Maybe Int
user_id = Maybe Int
user_id_
, deleted_message_count :: ChatStatisticsAdministratorActionsInfo -> Maybe Int
deleted_message_count = Maybe Int
deleted_message_count_
, banned_user_count :: ChatStatisticsAdministratorActionsInfo -> Maybe Int
banned_user_count = Maybe Int
banned_user_count_
, restricted_user_count :: ChatStatisticsAdministratorActionsInfo -> Maybe Int
restricted_user_count = Maybe Int
restricted_user_count_
}
= String
"ChatStatisticsAdministratorActionsInfo"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
, String
"deleted_message_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
deleted_message_count_
, String
"banned_user_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
banned_user_count_
, String
"restricted_user_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
restricted_user_count_
]
instance AT.FromJSON ChatStatisticsAdministratorActionsInfo where
parseJSON :: Value -> Parser ChatStatisticsAdministratorActionsInfo
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"chatStatisticsAdministratorActionsInfo" -> Value -> Parser ChatStatisticsAdministratorActionsInfo
parseChatStatisticsAdministratorActionsInfo Value
v
String
_ -> Parser ChatStatisticsAdministratorActionsInfo
forall a. Monoid a => a
mempty
where
parseChatStatisticsAdministratorActionsInfo :: A.Value -> AT.Parser ChatStatisticsAdministratorActionsInfo
parseChatStatisticsAdministratorActionsInfo :: Value -> Parser ChatStatisticsAdministratorActionsInfo
parseChatStatisticsAdministratorActionsInfo = String
-> (Object -> Parser ChatStatisticsAdministratorActionsInfo)
-> Value
-> Parser ChatStatisticsAdministratorActionsInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"ChatStatisticsAdministratorActionsInfo" ((Object -> Parser ChatStatisticsAdministratorActionsInfo)
-> Value -> Parser ChatStatisticsAdministratorActionsInfo)
-> (Object -> Parser ChatStatisticsAdministratorActionsInfo)
-> Value
-> Parser ChatStatisticsAdministratorActionsInfo
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"user_id"
Maybe Int
deleted_message_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"deleted_message_count"
Maybe Int
banned_user_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"banned_user_count"
Maybe Int
restricted_user_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"restricted_user_count"
ChatStatisticsAdministratorActionsInfo
-> Parser ChatStatisticsAdministratorActionsInfo
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ChatStatisticsAdministratorActionsInfo
-> Parser ChatStatisticsAdministratorActionsInfo)
-> ChatStatisticsAdministratorActionsInfo
-> Parser ChatStatisticsAdministratorActionsInfo
forall a b. (a -> b) -> a -> b
$ ChatStatisticsAdministratorActionsInfo
{ user_id :: Maybe Int
user_id = Maybe Int
user_id_
, deleted_message_count :: Maybe Int
deleted_message_count = Maybe Int
deleted_message_count_
, banned_user_count :: Maybe Int
banned_user_count = Maybe Int
banned_user_count_
, restricted_user_count :: Maybe Int
restricted_user_count = Maybe Int
restricted_user_count_
}
parseJSON Value
_ = Parser ChatStatisticsAdministratorActionsInfo
forall a. Monoid a => a
mempty