module TD.Query.GetChatMessagePosition
(GetChatMessagePosition(..)
, defaultGetChatMessagePosition
) 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 GetChatMessagePosition
= GetChatMessagePosition
{ GetChatMessagePosition -> Maybe Int
chat_id :: Maybe Int
, GetChatMessagePosition -> Maybe Int
message_id :: Maybe Int
, GetChatMessagePosition -> Maybe SearchMessagesFilter
_filter :: Maybe SearchMessagesFilter.SearchMessagesFilter
, GetChatMessagePosition -> Maybe Int
message_thread_id :: Maybe Int
, GetChatMessagePosition -> Maybe Int
saved_messages_topic_id :: Maybe Int
}
deriving (GetChatMessagePosition -> GetChatMessagePosition -> Bool
(GetChatMessagePosition -> GetChatMessagePosition -> Bool)
-> (GetChatMessagePosition -> GetChatMessagePosition -> Bool)
-> Eq GetChatMessagePosition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatMessagePosition -> GetChatMessagePosition -> Bool
== :: GetChatMessagePosition -> GetChatMessagePosition -> Bool
$c/= :: GetChatMessagePosition -> GetChatMessagePosition -> Bool
/= :: GetChatMessagePosition -> GetChatMessagePosition -> Bool
Eq, Int -> GetChatMessagePosition -> ShowS
[GetChatMessagePosition] -> ShowS
GetChatMessagePosition -> String
(Int -> GetChatMessagePosition -> ShowS)
-> (GetChatMessagePosition -> String)
-> ([GetChatMessagePosition] -> ShowS)
-> Show GetChatMessagePosition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatMessagePosition -> ShowS
showsPrec :: Int -> GetChatMessagePosition -> ShowS
$cshow :: GetChatMessagePosition -> String
show :: GetChatMessagePosition -> String
$cshowList :: [GetChatMessagePosition] -> ShowS
showList :: [GetChatMessagePosition] -> ShowS
Show)
instance I.ShortShow GetChatMessagePosition where
shortShow :: GetChatMessagePosition -> String
shortShow
GetChatMessagePosition
{ chat_id :: GetChatMessagePosition -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: GetChatMessagePosition -> Maybe Int
message_id = Maybe Int
message_id_
, _filter :: GetChatMessagePosition -> Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
_filter_
, message_thread_id :: GetChatMessagePosition -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, saved_messages_topic_id :: GetChatMessagePosition -> Maybe Int
saved_messages_topic_id = Maybe Int
saved_messages_topic_id_
}
= String
"GetChatMessagePosition"
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
"message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
, String
"_filter" String -> Maybe SearchMessagesFilter -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe SearchMessagesFilter
_filter_
, String
"message_thread_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_thread_id_
, 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_
]
instance AT.ToJSON GetChatMessagePosition where
toJSON :: GetChatMessagePosition -> Value
toJSON
GetChatMessagePosition
{ chat_id :: GetChatMessagePosition -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: GetChatMessagePosition -> Maybe Int
message_id = Maybe Int
message_id_
, _filter :: GetChatMessagePosition -> Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
_filter_
, message_thread_id :: GetChatMessagePosition -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, saved_messages_topic_id :: GetChatMessagePosition -> Maybe Int
saved_messages_topic_id = Maybe Int
saved_messages_topic_id_
}
= [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
"getChatMessagePosition"
, 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
"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
message_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
"message_thread_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
message_thread_id_
, 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_
]
defaultGetChatMessagePosition :: GetChatMessagePosition
defaultGetChatMessagePosition :: GetChatMessagePosition
defaultGetChatMessagePosition =
GetChatMessagePosition
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, message_id :: Maybe Int
message_id = Maybe Int
forall a. Maybe a
Nothing
, _filter :: Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
forall a. Maybe a
Nothing
, message_thread_id :: Maybe Int
message_thread_id = Maybe Int
forall a. Maybe a
Nothing
, saved_messages_topic_id :: Maybe Int
saved_messages_topic_id = Maybe Int
forall a. Maybe a
Nothing
}