module TD.Query.GetChatMessageCount
(GetChatMessageCount(..)
, defaultGetChatMessageCount
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.SearchMessagesFilter as SearchMessagesFilter
data GetChatMessageCount
= GetChatMessageCount
{ GetChatMessageCount -> Maybe Int
chat_id :: Maybe Int
, GetChatMessageCount -> Maybe SearchMessagesFilter
_filter :: Maybe SearchMessagesFilter.SearchMessagesFilter
, GetChatMessageCount -> Maybe Int
saved_messages_topic_id :: Maybe Int
, GetChatMessageCount -> Maybe Bool
return_local :: Maybe Bool
}
deriving (GetChatMessageCount -> GetChatMessageCount -> Bool
(GetChatMessageCount -> GetChatMessageCount -> Bool)
-> (GetChatMessageCount -> GetChatMessageCount -> Bool)
-> Eq GetChatMessageCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatMessageCount -> GetChatMessageCount -> Bool
== :: GetChatMessageCount -> GetChatMessageCount -> Bool
$c/= :: GetChatMessageCount -> GetChatMessageCount -> Bool
/= :: GetChatMessageCount -> GetChatMessageCount -> Bool
Eq, Int -> GetChatMessageCount -> ShowS
[GetChatMessageCount] -> ShowS
GetChatMessageCount -> String
(Int -> GetChatMessageCount -> ShowS)
-> (GetChatMessageCount -> String)
-> ([GetChatMessageCount] -> ShowS)
-> Show GetChatMessageCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatMessageCount -> ShowS
showsPrec :: Int -> GetChatMessageCount -> ShowS
$cshow :: GetChatMessageCount -> String
show :: GetChatMessageCount -> String
$cshowList :: [GetChatMessageCount] -> ShowS
showList :: [GetChatMessageCount] -> ShowS
Show)
instance I.ShortShow GetChatMessageCount where
shortShow :: GetChatMessageCount -> String
shortShow
GetChatMessageCount
{ chat_id :: GetChatMessageCount -> Maybe Int
chat_id = Maybe Int
chat_id_
, _filter :: GetChatMessageCount -> Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
_filter_
, saved_messages_topic_id :: GetChatMessageCount -> Maybe Int
saved_messages_topic_id = Maybe Int
saved_messages_topic_id_
, return_local :: GetChatMessageCount -> Maybe Bool
return_local = Maybe Bool
return_local_
}
= String
"GetChatMessageCount"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
, String
"_filter" String -> Maybe SearchMessagesFilter -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe SearchMessagesFilter
_filter_
, String
"saved_messages_topic_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
saved_messages_topic_id_
, String
"return_local" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
return_local_
]
instance AT.ToJSON GetChatMessageCount where
toJSON :: GetChatMessageCount -> Value
toJSON
GetChatMessageCount
{ chat_id :: GetChatMessageCount -> Maybe Int
chat_id = Maybe Int
chat_id_
, _filter :: GetChatMessageCount -> Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
_filter_
, saved_messages_topic_id :: GetChatMessageCount -> Maybe Int
saved_messages_topic_id = Maybe Int
saved_messages_topic_id_
, return_local :: GetChatMessageCount -> Maybe Bool
return_local = Maybe Bool
return_local_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"getChatMessageCount"
, Key
"chat_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
, Key
"filter" Key -> Maybe SearchMessagesFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe SearchMessagesFilter
_filter_
, Key
"saved_messages_topic_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
saved_messages_topic_id_
, Key
"return_local" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
return_local_
]
defaultGetChatMessageCount :: GetChatMessageCount
defaultGetChatMessageCount :: GetChatMessageCount
defaultGetChatMessageCount =
GetChatMessageCount
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, _filter :: Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
forall a. Maybe a
Nothing
, saved_messages_topic_id :: Maybe Int
saved_messages_topic_id = Maybe Int
forall a. Maybe a
Nothing
, return_local :: Maybe Bool
return_local = Maybe Bool
forall a. Maybe a
Nothing
}