module TD.Query.SearchChatMessages
(SearchChatMessages(..)
, defaultSearchChatMessages
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
import qualified TD.Data.MessageSender as MessageSender
import qualified TD.Data.SearchMessagesFilter as SearchMessagesFilter
data SearchChatMessages
= SearchChatMessages
{ SearchChatMessages -> Maybe Int
chat_id :: Maybe Int
, SearchChatMessages -> Maybe Text
query :: Maybe T.Text
, SearchChatMessages -> Maybe MessageSender
sender_id :: Maybe MessageSender.MessageSender
, SearchChatMessages -> Maybe Int
from_message_id :: Maybe Int
, SearchChatMessages -> Maybe Int
offset :: Maybe Int
, SearchChatMessages -> Maybe Int
limit :: Maybe Int
, SearchChatMessages -> Maybe SearchMessagesFilter
_filter :: Maybe SearchMessagesFilter.SearchMessagesFilter
, SearchChatMessages -> Maybe Int
message_thread_id :: Maybe Int
, SearchChatMessages -> Maybe Int
saved_messages_topic_id :: Maybe Int
}
deriving (SearchChatMessages -> SearchChatMessages -> Bool
(SearchChatMessages -> SearchChatMessages -> Bool)
-> (SearchChatMessages -> SearchChatMessages -> Bool)
-> Eq SearchChatMessages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SearchChatMessages -> SearchChatMessages -> Bool
== :: SearchChatMessages -> SearchChatMessages -> Bool
$c/= :: SearchChatMessages -> SearchChatMessages -> Bool
/= :: SearchChatMessages -> SearchChatMessages -> Bool
Eq, Int -> SearchChatMessages -> ShowS
[SearchChatMessages] -> ShowS
SearchChatMessages -> String
(Int -> SearchChatMessages -> ShowS)
-> (SearchChatMessages -> String)
-> ([SearchChatMessages] -> ShowS)
-> Show SearchChatMessages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SearchChatMessages -> ShowS
showsPrec :: Int -> SearchChatMessages -> ShowS
$cshow :: SearchChatMessages -> String
show :: SearchChatMessages -> String
$cshowList :: [SearchChatMessages] -> ShowS
showList :: [SearchChatMessages] -> ShowS
Show)
instance I.ShortShow SearchChatMessages where
shortShow :: SearchChatMessages -> String
shortShow
SearchChatMessages
{ chat_id :: SearchChatMessages -> Maybe Int
chat_id = Maybe Int
chat_id_
, query :: SearchChatMessages -> Maybe Text
query = Maybe Text
query_
, sender_id :: SearchChatMessages -> Maybe MessageSender
sender_id = Maybe MessageSender
sender_id_
, from_message_id :: SearchChatMessages -> Maybe Int
from_message_id = Maybe Int
from_message_id_
, offset :: SearchChatMessages -> Maybe Int
offset = Maybe Int
offset_
, limit :: SearchChatMessages -> Maybe Int
limit = Maybe Int
limit_
, _filter :: SearchChatMessages -> Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
_filter_
, message_thread_id :: SearchChatMessages -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, saved_messages_topic_id :: SearchChatMessages -> Maybe Int
saved_messages_topic_id = Maybe Int
saved_messages_topic_id_
}
= String
"SearchChatMessages"
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
"query" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
query_
, String
"sender_id" String -> Maybe MessageSender -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSender
sender_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
"_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 SearchChatMessages where
toJSON :: SearchChatMessages -> Value
toJSON
SearchChatMessages
{ chat_id :: SearchChatMessages -> Maybe Int
chat_id = Maybe Int
chat_id_
, query :: SearchChatMessages -> Maybe Text
query = Maybe Text
query_
, sender_id :: SearchChatMessages -> Maybe MessageSender
sender_id = Maybe MessageSender
sender_id_
, from_message_id :: SearchChatMessages -> Maybe Int
from_message_id = Maybe Int
from_message_id_
, offset :: SearchChatMessages -> Maybe Int
offset = Maybe Int
offset_
, limit :: SearchChatMessages -> Maybe Int
limit = Maybe Int
limit_
, _filter :: SearchChatMessages -> Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
_filter_
, message_thread_id :: SearchChatMessages -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, saved_messages_topic_id :: SearchChatMessages -> 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
"searchChatMessages"
, 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
"query" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
query_
, Key
"sender_id" Key -> Maybe MessageSender -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSender
sender_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
"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_
]
defaultSearchChatMessages :: SearchChatMessages
defaultSearchChatMessages :: SearchChatMessages
defaultSearchChatMessages =
SearchChatMessages
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, query :: Maybe Text
query = Maybe Text
forall a. Maybe a
Nothing
, sender_id :: Maybe MessageSender
sender_id = Maybe MessageSender
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
, _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
}