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