module TD.Query.GetChatHistory
(GetChatHistory(..)
, defaultGetChatHistory
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data GetChatHistory
= GetChatHistory
{ GetChatHistory -> Maybe Int
chat_id :: Maybe Int
, GetChatHistory -> Maybe Int
from_message_id :: Maybe Int
, GetChatHistory -> Maybe Int
offset :: Maybe Int
, GetChatHistory -> Maybe Int
limit :: Maybe Int
, GetChatHistory -> Maybe Bool
only_local :: Maybe Bool
}
deriving (GetChatHistory -> GetChatHistory -> Bool
(GetChatHistory -> GetChatHistory -> Bool)
-> (GetChatHistory -> GetChatHistory -> Bool) -> Eq GetChatHistory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatHistory -> GetChatHistory -> Bool
== :: GetChatHistory -> GetChatHistory -> Bool
$c/= :: GetChatHistory -> GetChatHistory -> Bool
/= :: GetChatHistory -> GetChatHistory -> Bool
Eq, Int -> GetChatHistory -> ShowS
[GetChatHistory] -> ShowS
GetChatHistory -> String
(Int -> GetChatHistory -> ShowS)
-> (GetChatHistory -> String)
-> ([GetChatHistory] -> ShowS)
-> Show GetChatHistory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatHistory -> ShowS
showsPrec :: Int -> GetChatHistory -> ShowS
$cshow :: GetChatHistory -> String
show :: GetChatHistory -> String
$cshowList :: [GetChatHistory] -> ShowS
showList :: [GetChatHistory] -> ShowS
Show)
instance I.ShortShow GetChatHistory where
shortShow :: GetChatHistory -> String
shortShow
GetChatHistory
{ chat_id :: GetChatHistory -> Maybe Int
chat_id = Maybe Int
chat_id_
, from_message_id :: GetChatHistory -> Maybe Int
from_message_id = Maybe Int
from_message_id_
, offset :: GetChatHistory -> Maybe Int
offset = Maybe Int
offset_
, limit :: GetChatHistory -> Maybe Int
limit = Maybe Int
limit_
, only_local :: GetChatHistory -> Maybe Bool
only_local = Maybe Bool
only_local_
}
= String
"GetChatHistory"
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
"from_message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
from_message_id_
, String
"offset" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
offset_
, String
"limit" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
, String
"only_local" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
only_local_
]
instance AT.ToJSON GetChatHistory where
toJSON :: GetChatHistory -> Value
toJSON
GetChatHistory
{ chat_id :: GetChatHistory -> Maybe Int
chat_id = Maybe Int
chat_id_
, from_message_id :: GetChatHistory -> Maybe Int
from_message_id = Maybe Int
from_message_id_
, offset :: GetChatHistory -> Maybe Int
offset = Maybe Int
offset_
, limit :: GetChatHistory -> Maybe Int
limit = Maybe Int
limit_
, only_local :: GetChatHistory -> Maybe Bool
only_local = Maybe Bool
only_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
"getChatHistory"
, 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
"from_message_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
from_message_id_
, Key
"offset" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
offset_
, Key
"limit" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
limit_
, Key
"only_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
only_local_
]
defaultGetChatHistory :: GetChatHistory
defaultGetChatHistory :: GetChatHistory
defaultGetChatHistory =
GetChatHistory
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, from_message_id :: Maybe Int
from_message_id = Maybe Int
forall a. Maybe a
Nothing
, offset :: Maybe Int
offset = Maybe Int
forall a. Maybe a
Nothing
, limit :: Maybe Int
limit = Maybe Int
forall a. Maybe a
Nothing
, only_local :: Maybe Bool
only_local = Maybe Bool
forall a. Maybe a
Nothing
}