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