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