module TD.Query.SearchChats
(SearchChats(..)
, defaultSearchChats
) 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
data SearchChats
= SearchChats
{ SearchChats -> Maybe Text
query :: Maybe T.Text
, SearchChats -> Maybe Int
limit :: Maybe Int
}
deriving (SearchChats -> SearchChats -> Bool
(SearchChats -> SearchChats -> Bool)
-> (SearchChats -> SearchChats -> Bool) -> Eq SearchChats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SearchChats -> SearchChats -> Bool
== :: SearchChats -> SearchChats -> Bool
$c/= :: SearchChats -> SearchChats -> Bool
/= :: SearchChats -> SearchChats -> Bool
Eq, Int -> SearchChats -> ShowS
[SearchChats] -> ShowS
SearchChats -> String
(Int -> SearchChats -> ShowS)
-> (SearchChats -> String)
-> ([SearchChats] -> ShowS)
-> Show SearchChats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SearchChats -> ShowS
showsPrec :: Int -> SearchChats -> ShowS
$cshow :: SearchChats -> String
show :: SearchChats -> String
$cshowList :: [SearchChats] -> ShowS
showList :: [SearchChats] -> ShowS
Show)
instance I.ShortShow SearchChats where
shortShow :: SearchChats -> String
shortShow
SearchChats
{ query :: SearchChats -> Maybe Text
query = Maybe Text
query_
, limit :: SearchChats -> Maybe Int
limit = Maybe Int
limit_
}
= String
"SearchChats"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"query" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
query_
, String
"limit" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
]
instance AT.ToJSON SearchChats where
toJSON :: SearchChats -> Value
toJSON
SearchChats
{ query :: SearchChats -> Maybe Text
query = Maybe Text
query_
, limit :: SearchChats -> Maybe Int
limit = Maybe Int
limit_
}
= [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
"searchChats"
, 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
"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_
]
defaultSearchChats :: SearchChats
defaultSearchChats :: SearchChats
defaultSearchChats =
SearchChats
{ query :: Maybe Text
query = Maybe Text
forall a. Maybe a
Nothing
, limit :: Maybe Int
limit = Maybe Int
forall a. Maybe a
Nothing
}