module TD.Query.SearchMessages
(SearchMessages(..)
, defaultSearchMessages
) 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.ChatList as ChatList
import qualified Data.Text as T
import qualified TD.Data.SearchMessagesFilter as SearchMessagesFilter
import qualified TD.Data.SearchMessagesChatTypeFilter as SearchMessagesChatTypeFilter
data SearchMessages
= SearchMessages
{ SearchMessages -> Maybe ChatList
chat_list :: Maybe ChatList.ChatList
, SearchMessages -> Maybe Text
query :: Maybe T.Text
, SearchMessages -> Maybe Text
offset :: Maybe T.Text
, SearchMessages -> Maybe Int
limit :: Maybe Int
, SearchMessages -> Maybe SearchMessagesFilter
_filter :: Maybe SearchMessagesFilter.SearchMessagesFilter
, SearchMessages -> Maybe SearchMessagesChatTypeFilter
chat_type_filter :: Maybe SearchMessagesChatTypeFilter.SearchMessagesChatTypeFilter
, SearchMessages -> Maybe Int
min_date :: Maybe Int
, SearchMessages -> Maybe Int
max_date :: Maybe Int
}
deriving (SearchMessages -> SearchMessages -> Bool
(SearchMessages -> SearchMessages -> Bool)
-> (SearchMessages -> SearchMessages -> Bool) -> Eq SearchMessages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SearchMessages -> SearchMessages -> Bool
== :: SearchMessages -> SearchMessages -> Bool
$c/= :: SearchMessages -> SearchMessages -> Bool
/= :: SearchMessages -> SearchMessages -> Bool
Eq, Int -> SearchMessages -> ShowS
[SearchMessages] -> ShowS
SearchMessages -> String
(Int -> SearchMessages -> ShowS)
-> (SearchMessages -> String)
-> ([SearchMessages] -> ShowS)
-> Show SearchMessages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SearchMessages -> ShowS
showsPrec :: Int -> SearchMessages -> ShowS
$cshow :: SearchMessages -> String
show :: SearchMessages -> String
$cshowList :: [SearchMessages] -> ShowS
showList :: [SearchMessages] -> ShowS
Show)
instance I.ShortShow SearchMessages where
shortShow :: SearchMessages -> String
shortShow
SearchMessages
{ chat_list :: SearchMessages -> Maybe ChatList
chat_list = Maybe ChatList
chat_list_
, query :: SearchMessages -> Maybe Text
query = Maybe Text
query_
, offset :: SearchMessages -> Maybe Text
offset = Maybe Text
offset_
, limit :: SearchMessages -> Maybe Int
limit = Maybe Int
limit_
, _filter :: SearchMessages -> Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
_filter_
, chat_type_filter :: SearchMessages -> Maybe SearchMessagesChatTypeFilter
chat_type_filter = Maybe SearchMessagesChatTypeFilter
chat_type_filter_
, min_date :: SearchMessages -> Maybe Int
min_date = Maybe Int
min_date_
, max_date :: SearchMessages -> Maybe Int
max_date = Maybe Int
max_date_
}
= String
"SearchMessages"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"chat_list" String -> Maybe ChatList -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatList
chat_list_
, String
"query" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
query_
, String
"offset" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
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
"chat_type_filter" String -> Maybe SearchMessagesChatTypeFilter -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe SearchMessagesChatTypeFilter
chat_type_filter_
, String
"min_date" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
min_date_
, String
"max_date" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
max_date_
]
instance AT.ToJSON SearchMessages where
toJSON :: SearchMessages -> Value
toJSON
SearchMessages
{ chat_list :: SearchMessages -> Maybe ChatList
chat_list = Maybe ChatList
chat_list_
, query :: SearchMessages -> Maybe Text
query = Maybe Text
query_
, offset :: SearchMessages -> Maybe Text
offset = Maybe Text
offset_
, limit :: SearchMessages -> Maybe Int
limit = Maybe Int
limit_
, _filter :: SearchMessages -> Maybe SearchMessagesFilter
_filter = Maybe SearchMessagesFilter
_filter_
, chat_type_filter :: SearchMessages -> Maybe SearchMessagesChatTypeFilter
chat_type_filter = Maybe SearchMessagesChatTypeFilter
chat_type_filter_
, min_date :: SearchMessages -> Maybe Int
min_date = Maybe Int
min_date_
, max_date :: SearchMessages -> Maybe Int
max_date = Maybe Int
max_date_
}
= [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
"searchMessages"
, Key
"chat_list" Key -> Maybe ChatList -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ChatList
chat_list_
, 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
"offset" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
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
"chat_type_filter" Key -> Maybe SearchMessagesChatTypeFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe SearchMessagesChatTypeFilter
chat_type_filter_
, Key
"min_date" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
min_date_
, Key
"max_date" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
max_date_
]
defaultSearchMessages :: SearchMessages
defaultSearchMessages :: SearchMessages
defaultSearchMessages =
SearchMessages
{ chat_list :: Maybe ChatList
chat_list = Maybe ChatList
forall a. Maybe a
Nothing
, query :: Maybe Text
query = Maybe Text
forall a. Maybe a
Nothing
, offset :: Maybe Text
offset = Maybe Text
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
, chat_type_filter :: Maybe SearchMessagesChatTypeFilter
chat_type_filter = Maybe SearchMessagesChatTypeFilter
forall a. Maybe a
Nothing
, min_date :: Maybe Int
min_date = Maybe Int
forall a. Maybe a
Nothing
, max_date :: Maybe Int
max_date = Maybe Int
forall a. Maybe a
Nothing
}