module TD.Query.CreateTemporaryPassword
(CreateTemporaryPassword(..)
, defaultCreateTemporaryPassword
) 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 CreateTemporaryPassword
= CreateTemporaryPassword
{ CreateTemporaryPassword -> Maybe Text
password :: Maybe T.Text
, CreateTemporaryPassword -> Maybe Int
valid_for :: Maybe Int
}
deriving (CreateTemporaryPassword -> CreateTemporaryPassword -> Bool
(CreateTemporaryPassword -> CreateTemporaryPassword -> Bool)
-> (CreateTemporaryPassword -> CreateTemporaryPassword -> Bool)
-> Eq CreateTemporaryPassword
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateTemporaryPassword -> CreateTemporaryPassword -> Bool
== :: CreateTemporaryPassword -> CreateTemporaryPassword -> Bool
$c/= :: CreateTemporaryPassword -> CreateTemporaryPassword -> Bool
/= :: CreateTemporaryPassword -> CreateTemporaryPassword -> Bool
Eq, Int -> CreateTemporaryPassword -> ShowS
[CreateTemporaryPassword] -> ShowS
CreateTemporaryPassword -> String
(Int -> CreateTemporaryPassword -> ShowS)
-> (CreateTemporaryPassword -> String)
-> ([CreateTemporaryPassword] -> ShowS)
-> Show CreateTemporaryPassword
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateTemporaryPassword -> ShowS
showsPrec :: Int -> CreateTemporaryPassword -> ShowS
$cshow :: CreateTemporaryPassword -> String
show :: CreateTemporaryPassword -> String
$cshowList :: [CreateTemporaryPassword] -> ShowS
showList :: [CreateTemporaryPassword] -> ShowS
Show)
instance I.ShortShow CreateTemporaryPassword where
shortShow :: CreateTemporaryPassword -> String
shortShow
CreateTemporaryPassword
{ password :: CreateTemporaryPassword -> Maybe Text
password = Maybe Text
password_
, valid_for :: CreateTemporaryPassword -> Maybe Int
valid_for = Maybe Int
valid_for_
}
= String
"CreateTemporaryPassword"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"password" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
password_
, String
"valid_for" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
valid_for_
]
instance AT.ToJSON CreateTemporaryPassword where
toJSON :: CreateTemporaryPassword -> Value
toJSON
CreateTemporaryPassword
{ password :: CreateTemporaryPassword -> Maybe Text
password = Maybe Text
password_
, valid_for :: CreateTemporaryPassword -> Maybe Int
valid_for = Maybe Int
valid_for_
}
= [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
"createTemporaryPassword"
, Key
"password" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
password_
, Key
"valid_for" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
valid_for_
]
defaultCreateTemporaryPassword :: CreateTemporaryPassword
defaultCreateTemporaryPassword :: CreateTemporaryPassword
defaultCreateTemporaryPassword =
CreateTemporaryPassword
{ password :: Maybe Text
password = Maybe Text
forall a. Maybe a
Nothing
, valid_for :: Maybe Int
valid_for = Maybe Int
forall a. Maybe a
Nothing
}