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