module TD.Query.SearchFileDownloads
(SearchFileDownloads(..)
, defaultSearchFileDownloads
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
data SearchFileDownloads
= SearchFileDownloads
{ SearchFileDownloads -> Maybe Text
query :: Maybe T.Text
, SearchFileDownloads -> Maybe Bool
only_active :: Maybe Bool
, SearchFileDownloads -> Maybe Bool
only_completed :: Maybe Bool
, SearchFileDownloads -> Maybe Text
offset :: Maybe T.Text
, SearchFileDownloads -> Maybe Int
limit :: Maybe Int
}
deriving (SearchFileDownloads -> SearchFileDownloads -> Bool
(SearchFileDownloads -> SearchFileDownloads -> Bool)
-> (SearchFileDownloads -> SearchFileDownloads -> Bool)
-> Eq SearchFileDownloads
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SearchFileDownloads -> SearchFileDownloads -> Bool
== :: SearchFileDownloads -> SearchFileDownloads -> Bool
$c/= :: SearchFileDownloads -> SearchFileDownloads -> Bool
/= :: SearchFileDownloads -> SearchFileDownloads -> Bool
Eq, Int -> SearchFileDownloads -> ShowS
[SearchFileDownloads] -> ShowS
SearchFileDownloads -> String
(Int -> SearchFileDownloads -> ShowS)
-> (SearchFileDownloads -> String)
-> ([SearchFileDownloads] -> ShowS)
-> Show SearchFileDownloads
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SearchFileDownloads -> ShowS
showsPrec :: Int -> SearchFileDownloads -> ShowS
$cshow :: SearchFileDownloads -> String
show :: SearchFileDownloads -> String
$cshowList :: [SearchFileDownloads] -> ShowS
showList :: [SearchFileDownloads] -> ShowS
Show)
instance I.ShortShow SearchFileDownloads where
shortShow :: SearchFileDownloads -> String
shortShow
SearchFileDownloads
{ query :: SearchFileDownloads -> Maybe Text
query = Maybe Text
query_
, only_active :: SearchFileDownloads -> Maybe Bool
only_active = Maybe Bool
only_active_
, only_completed :: SearchFileDownloads -> Maybe Bool
only_completed = Maybe Bool
only_completed_
, offset :: SearchFileDownloads -> Maybe Text
offset = Maybe Text
offset_
, limit :: SearchFileDownloads -> Maybe Int
limit = Maybe Int
limit_
}
= String
"SearchFileDownloads"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"query" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
query_
, String
"only_active" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
only_active_
, String
"only_completed" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
only_completed_
, String
"offset" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
offset_
, String
"limit" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
]
instance AT.ToJSON SearchFileDownloads where
toJSON :: SearchFileDownloads -> Value
toJSON
SearchFileDownloads
{ query :: SearchFileDownloads -> Maybe Text
query = Maybe Text
query_
, only_active :: SearchFileDownloads -> Maybe Bool
only_active = Maybe Bool
only_active_
, only_completed :: SearchFileDownloads -> Maybe Bool
only_completed = Maybe Bool
only_completed_
, offset :: SearchFileDownloads -> Maybe Text
offset = Maybe Text
offset_
, limit :: SearchFileDownloads -> Maybe Int
limit = Maybe Int
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
"searchFileDownloads"
, Key
"query" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
query_
, Key
"only_active" 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_active_
, Key
"only_completed" 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_completed_
, Key
"offset" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
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_
]
defaultSearchFileDownloads :: SearchFileDownloads
defaultSearchFileDownloads :: SearchFileDownloads
defaultSearchFileDownloads =
SearchFileDownloads
{ query :: Maybe Text
query = Maybe Text
forall a. Maybe a
Nothing
, only_active :: Maybe Bool
only_active = Maybe Bool
forall a. Maybe a
Nothing
, only_completed :: Maybe Bool
only_completed = Maybe Bool
forall a. Maybe a
Nothing
, offset :: Maybe Text
offset = Maybe Text
forall a. Maybe a
Nothing
, limit :: Maybe Int
limit = Maybe Int
forall a. Maybe a
Nothing
}