module TD.Data.EmailAddressAuthenticationCodeInfo
(EmailAddressAuthenticationCodeInfo(..)) 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 EmailAddressAuthenticationCodeInfo
= EmailAddressAuthenticationCodeInfo
{ EmailAddressAuthenticationCodeInfo -> Maybe Text
email_address_pattern :: Maybe T.Text
, EmailAddressAuthenticationCodeInfo -> Maybe Int
_length :: Maybe Int
}
deriving (EmailAddressAuthenticationCodeInfo
-> EmailAddressAuthenticationCodeInfo -> Bool
(EmailAddressAuthenticationCodeInfo
-> EmailAddressAuthenticationCodeInfo -> Bool)
-> (EmailAddressAuthenticationCodeInfo
-> EmailAddressAuthenticationCodeInfo -> Bool)
-> Eq EmailAddressAuthenticationCodeInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EmailAddressAuthenticationCodeInfo
-> EmailAddressAuthenticationCodeInfo -> Bool
== :: EmailAddressAuthenticationCodeInfo
-> EmailAddressAuthenticationCodeInfo -> Bool
$c/= :: EmailAddressAuthenticationCodeInfo
-> EmailAddressAuthenticationCodeInfo -> Bool
/= :: EmailAddressAuthenticationCodeInfo
-> EmailAddressAuthenticationCodeInfo -> Bool
Eq, Int -> EmailAddressAuthenticationCodeInfo -> ShowS
[EmailAddressAuthenticationCodeInfo] -> ShowS
EmailAddressAuthenticationCodeInfo -> String
(Int -> EmailAddressAuthenticationCodeInfo -> ShowS)
-> (EmailAddressAuthenticationCodeInfo -> String)
-> ([EmailAddressAuthenticationCodeInfo] -> ShowS)
-> Show EmailAddressAuthenticationCodeInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EmailAddressAuthenticationCodeInfo -> ShowS
showsPrec :: Int -> EmailAddressAuthenticationCodeInfo -> ShowS
$cshow :: EmailAddressAuthenticationCodeInfo -> String
show :: EmailAddressAuthenticationCodeInfo -> String
$cshowList :: [EmailAddressAuthenticationCodeInfo] -> ShowS
showList :: [EmailAddressAuthenticationCodeInfo] -> ShowS
Show)
instance I.ShortShow EmailAddressAuthenticationCodeInfo where
shortShow :: EmailAddressAuthenticationCodeInfo -> String
shortShow EmailAddressAuthenticationCodeInfo
{ email_address_pattern :: EmailAddressAuthenticationCodeInfo -> Maybe Text
email_address_pattern = Maybe Text
email_address_pattern_
, _length :: EmailAddressAuthenticationCodeInfo -> Maybe Int
_length = Maybe Int
_length_
}
= String
"EmailAddressAuthenticationCodeInfo"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"email_address_pattern" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
email_address_pattern_
, String
"_length" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_length_
]
instance AT.FromJSON EmailAddressAuthenticationCodeInfo where
parseJSON :: Value -> Parser EmailAddressAuthenticationCodeInfo
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"emailAddressAuthenticationCodeInfo" -> Value -> Parser EmailAddressAuthenticationCodeInfo
parseEmailAddressAuthenticationCodeInfo Value
v
String
_ -> Parser EmailAddressAuthenticationCodeInfo
forall a. Monoid a => a
mempty
where
parseEmailAddressAuthenticationCodeInfo :: A.Value -> AT.Parser EmailAddressAuthenticationCodeInfo
parseEmailAddressAuthenticationCodeInfo :: Value -> Parser EmailAddressAuthenticationCodeInfo
parseEmailAddressAuthenticationCodeInfo = String
-> (Object -> Parser EmailAddressAuthenticationCodeInfo)
-> Value
-> Parser EmailAddressAuthenticationCodeInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"EmailAddressAuthenticationCodeInfo" ((Object -> Parser EmailAddressAuthenticationCodeInfo)
-> Value -> Parser EmailAddressAuthenticationCodeInfo)
-> (Object -> Parser EmailAddressAuthenticationCodeInfo)
-> Value
-> Parser EmailAddressAuthenticationCodeInfo
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
email_address_pattern_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"email_address_pattern"
Maybe Int
_length_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"length"
EmailAddressAuthenticationCodeInfo
-> Parser EmailAddressAuthenticationCodeInfo
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EmailAddressAuthenticationCodeInfo
-> Parser EmailAddressAuthenticationCodeInfo)
-> EmailAddressAuthenticationCodeInfo
-> Parser EmailAddressAuthenticationCodeInfo
forall a b. (a -> b) -> a -> b
$ EmailAddressAuthenticationCodeInfo
{ email_address_pattern :: Maybe Text
email_address_pattern = Maybe Text
email_address_pattern_
, _length :: Maybe Int
_length = Maybe Int
_length_
}
parseJSON Value
_ = Parser EmailAddressAuthenticationCodeInfo
forall a. Monoid a => a
mempty