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