module TD.Query.ParseTextEntities
(ParseTextEntities(..)
, defaultParseTextEntities
) 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
import qualified TD.Data.TextParseMode as TextParseMode
data ParseTextEntities
= ParseTextEntities
{ ParseTextEntities -> Maybe Text
text :: Maybe T.Text
, ParseTextEntities -> Maybe TextParseMode
parse_mode :: Maybe TextParseMode.TextParseMode
}
deriving (ParseTextEntities -> ParseTextEntities -> Bool
(ParseTextEntities -> ParseTextEntities -> Bool)
-> (ParseTextEntities -> ParseTextEntities -> Bool)
-> Eq ParseTextEntities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ParseTextEntities -> ParseTextEntities -> Bool
== :: ParseTextEntities -> ParseTextEntities -> Bool
$c/= :: ParseTextEntities -> ParseTextEntities -> Bool
/= :: ParseTextEntities -> ParseTextEntities -> Bool
Eq, Int -> ParseTextEntities -> ShowS
[ParseTextEntities] -> ShowS
ParseTextEntities -> String
(Int -> ParseTextEntities -> ShowS)
-> (ParseTextEntities -> String)
-> ([ParseTextEntities] -> ShowS)
-> Show ParseTextEntities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ParseTextEntities -> ShowS
showsPrec :: Int -> ParseTextEntities -> ShowS
$cshow :: ParseTextEntities -> String
show :: ParseTextEntities -> String
$cshowList :: [ParseTextEntities] -> ShowS
showList :: [ParseTextEntities] -> ShowS
Show)
instance I.ShortShow ParseTextEntities where
shortShow :: ParseTextEntities -> String
shortShow
ParseTextEntities
{ text :: ParseTextEntities -> Maybe Text
text = Maybe Text
text_
, parse_mode :: ParseTextEntities -> Maybe TextParseMode
parse_mode = Maybe TextParseMode
parse_mode_
}
= String
"ParseTextEntities"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"text" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
text_
, String
"parse_mode" String -> Maybe TextParseMode -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TextParseMode
parse_mode_
]
instance AT.ToJSON ParseTextEntities where
toJSON :: ParseTextEntities -> Value
toJSON
ParseTextEntities
{ text :: ParseTextEntities -> Maybe Text
text = Maybe Text
text_
, parse_mode :: ParseTextEntities -> Maybe TextParseMode
parse_mode = Maybe TextParseMode
parse_mode_
}
= [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
"parseTextEntities"
, Key
"text" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
text_
, Key
"parse_mode" Key -> Maybe TextParseMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe TextParseMode
parse_mode_
]
defaultParseTextEntities :: ParseTextEntities
defaultParseTextEntities :: ParseTextEntities
defaultParseTextEntities =
ParseTextEntities
{ text :: Maybe Text
text = Maybe Text
forall a. Maybe a
Nothing
, parse_mode :: Maybe TextParseMode
parse_mode = Maybe TextParseMode
forall a. Maybe a
Nothing
}