module TD.Query.SearchPublicChat
(SearchPublicChat(..)
) 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 SearchPublicChat
= SearchPublicChat
{ SearchPublicChat -> Maybe Text
username :: Maybe T.Text
}
deriving (SearchPublicChat -> SearchPublicChat -> Bool
(SearchPublicChat -> SearchPublicChat -> Bool)
-> (SearchPublicChat -> SearchPublicChat -> Bool)
-> Eq SearchPublicChat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SearchPublicChat -> SearchPublicChat -> Bool
== :: SearchPublicChat -> SearchPublicChat -> Bool
$c/= :: SearchPublicChat -> SearchPublicChat -> Bool
/= :: SearchPublicChat -> SearchPublicChat -> Bool
Eq, Int -> SearchPublicChat -> ShowS
[SearchPublicChat] -> ShowS
SearchPublicChat -> String
(Int -> SearchPublicChat -> ShowS)
-> (SearchPublicChat -> String)
-> ([SearchPublicChat] -> ShowS)
-> Show SearchPublicChat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SearchPublicChat -> ShowS
showsPrec :: Int -> SearchPublicChat -> ShowS
$cshow :: SearchPublicChat -> String
show :: SearchPublicChat -> String
$cshowList :: [SearchPublicChat] -> ShowS
showList :: [SearchPublicChat] -> ShowS
Show)
instance I.ShortShow SearchPublicChat where
shortShow :: SearchPublicChat -> String
shortShow
SearchPublicChat
{ username :: SearchPublicChat -> Maybe Text
username = Maybe Text
username_
}
= String
"SearchPublicChat"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"username" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
username_
]
instance AT.ToJSON SearchPublicChat where
toJSON :: SearchPublicChat -> Value
toJSON
SearchPublicChat
{ username :: SearchPublicChat -> Maybe Text
username = Maybe Text
username_
}
= [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
"searchPublicChat"
, Key
"username" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
username_
]