module TD.Query.OptimizeStorage
(OptimizeStorage(..)
, defaultOptimizeStorage
) 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.FileType as FileType
data OptimizeStorage
= OptimizeStorage
{ OptimizeStorage -> Maybe Int
size :: Maybe Int
, OptimizeStorage -> Maybe Int
ttl :: Maybe Int
, OptimizeStorage -> Maybe Int
count :: Maybe Int
, OptimizeStorage -> Maybe Int
immunity_delay :: Maybe Int
, OptimizeStorage -> Maybe [FileType]
file_types :: Maybe [FileType.FileType]
, OptimizeStorage -> Maybe [Int]
chat_ids :: Maybe [Int]
, OptimizeStorage -> Maybe [Int]
exclude_chat_ids :: Maybe [Int]
, OptimizeStorage -> Maybe Bool
return_deleted_file_statistics :: Maybe Bool
, OptimizeStorage -> Maybe Int
chat_limit :: Maybe Int
}
deriving (OptimizeStorage -> OptimizeStorage -> Bool
(OptimizeStorage -> OptimizeStorage -> Bool)
-> (OptimizeStorage -> OptimizeStorage -> Bool)
-> Eq OptimizeStorage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OptimizeStorage -> OptimizeStorage -> Bool
== :: OptimizeStorage -> OptimizeStorage -> Bool
$c/= :: OptimizeStorage -> OptimizeStorage -> Bool
/= :: OptimizeStorage -> OptimizeStorage -> Bool
Eq, Int -> OptimizeStorage -> ShowS
[OptimizeStorage] -> ShowS
OptimizeStorage -> String
(Int -> OptimizeStorage -> ShowS)
-> (OptimizeStorage -> String)
-> ([OptimizeStorage] -> ShowS)
-> Show OptimizeStorage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OptimizeStorage -> ShowS
showsPrec :: Int -> OptimizeStorage -> ShowS
$cshow :: OptimizeStorage -> String
show :: OptimizeStorage -> String
$cshowList :: [OptimizeStorage] -> ShowS
showList :: [OptimizeStorage] -> ShowS
Show)
instance I.ShortShow OptimizeStorage where
shortShow :: OptimizeStorage -> String
shortShow
OptimizeStorage
{ size :: OptimizeStorage -> Maybe Int
size = Maybe Int
size_
, ttl :: OptimizeStorage -> Maybe Int
ttl = Maybe Int
ttl_
, count :: OptimizeStorage -> Maybe Int
count = Maybe Int
count_
, immunity_delay :: OptimizeStorage -> Maybe Int
immunity_delay = Maybe Int
immunity_delay_
, file_types :: OptimizeStorage -> Maybe [FileType]
file_types = Maybe [FileType]
file_types_
, chat_ids :: OptimizeStorage -> Maybe [Int]
chat_ids = Maybe [Int]
chat_ids_
, exclude_chat_ids :: OptimizeStorage -> Maybe [Int]
exclude_chat_ids = Maybe [Int]
exclude_chat_ids_
, return_deleted_file_statistics :: OptimizeStorage -> Maybe Bool
return_deleted_file_statistics = Maybe Bool
return_deleted_file_statistics_
, chat_limit :: OptimizeStorage -> Maybe Int
chat_limit = Maybe Int
chat_limit_
}
= String
"OptimizeStorage"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"size" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
size_
, String
"ttl" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
ttl_
, String
"count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
count_
, String
"immunity_delay" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
immunity_delay_
, String
"file_types" String -> Maybe [FileType] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [FileType]
file_types_
, String
"chat_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
chat_ids_
, String
"exclude_chat_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
exclude_chat_ids_
, String
"return_deleted_file_statistics" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
return_deleted_file_statistics_
, String
"chat_limit" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_limit_
]
instance AT.ToJSON OptimizeStorage where
toJSON :: OptimizeStorage -> Value
toJSON
OptimizeStorage
{ size :: OptimizeStorage -> Maybe Int
size = Maybe Int
size_
, ttl :: OptimizeStorage -> Maybe Int
ttl = Maybe Int
ttl_
, count :: OptimizeStorage -> Maybe Int
count = Maybe Int
count_
, immunity_delay :: OptimizeStorage -> Maybe Int
immunity_delay = Maybe Int
immunity_delay_
, file_types :: OptimizeStorage -> Maybe [FileType]
file_types = Maybe [FileType]
file_types_
, chat_ids :: OptimizeStorage -> Maybe [Int]
chat_ids = Maybe [Int]
chat_ids_
, exclude_chat_ids :: OptimizeStorage -> Maybe [Int]
exclude_chat_ids = Maybe [Int]
exclude_chat_ids_
, return_deleted_file_statistics :: OptimizeStorage -> Maybe Bool
return_deleted_file_statistics = Maybe Bool
return_deleted_file_statistics_
, chat_limit :: OptimizeStorage -> Maybe Int
chat_limit = Maybe Int
chat_limit_
}
= [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
"optimizeStorage"
, Key
"size" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
size_
, Key
"ttl" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
ttl_
, 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_
, Key
"immunity_delay" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
immunity_delay_
, Key
"file_types" Key -> Maybe [FileType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [FileType]
file_types_
, Key
"chat_ids" Key -> Maybe [Int] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Int]
chat_ids_
, Key
"exclude_chat_ids" Key -> Maybe [Int] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Int]
exclude_chat_ids_
, Key
"return_deleted_file_statistics" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
return_deleted_file_statistics_
, Key
"chat_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
chat_limit_
]
defaultOptimizeStorage :: OptimizeStorage
defaultOptimizeStorage :: OptimizeStorage
defaultOptimizeStorage =
OptimizeStorage
{ size :: Maybe Int
size = Maybe Int
forall a. Maybe a
Nothing
, ttl :: Maybe Int
ttl = Maybe Int
forall a. Maybe a
Nothing
, count :: Maybe Int
count = Maybe Int
forall a. Maybe a
Nothing
, immunity_delay :: Maybe Int
immunity_delay = Maybe Int
forall a. Maybe a
Nothing
, file_types :: Maybe [FileType]
file_types = Maybe [FileType]
forall a. Maybe a
Nothing
, chat_ids :: Maybe [Int]
chat_ids = Maybe [Int]
forall a. Maybe a
Nothing
, exclude_chat_ids :: Maybe [Int]
exclude_chat_ids = Maybe [Int]
forall a. Maybe a
Nothing
, return_deleted_file_statistics :: Maybe Bool
return_deleted_file_statistics = Maybe Bool
forall a. Maybe a
Nothing
, chat_limit :: Maybe Int
chat_limit = Maybe Int
forall a. Maybe a
Nothing
}