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