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