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