module TD.Query.SendPhoneNumberCode
(SendPhoneNumberCode(..)
, defaultSendPhoneNumberCode
) 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
import qualified TD.Data.PhoneNumberAuthenticationSettings as PhoneNumberAuthenticationSettings
import qualified TD.Data.PhoneNumberCodeType as PhoneNumberCodeType
data SendPhoneNumberCode
= SendPhoneNumberCode
{ SendPhoneNumberCode -> Maybe Text
phone_number :: Maybe T.Text
, SendPhoneNumberCode -> Maybe PhoneNumberAuthenticationSettings
settings :: Maybe PhoneNumberAuthenticationSettings.PhoneNumberAuthenticationSettings
, SendPhoneNumberCode -> Maybe PhoneNumberCodeType
_type :: Maybe PhoneNumberCodeType.PhoneNumberCodeType
}
deriving (SendPhoneNumberCode -> SendPhoneNumberCode -> Bool
(SendPhoneNumberCode -> SendPhoneNumberCode -> Bool)
-> (SendPhoneNumberCode -> SendPhoneNumberCode -> Bool)
-> Eq SendPhoneNumberCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendPhoneNumberCode -> SendPhoneNumberCode -> Bool
== :: SendPhoneNumberCode -> SendPhoneNumberCode -> Bool
$c/= :: SendPhoneNumberCode -> SendPhoneNumberCode -> Bool
/= :: SendPhoneNumberCode -> SendPhoneNumberCode -> Bool
Eq, Int -> SendPhoneNumberCode -> ShowS
[SendPhoneNumberCode] -> ShowS
SendPhoneNumberCode -> String
(Int -> SendPhoneNumberCode -> ShowS)
-> (SendPhoneNumberCode -> String)
-> ([SendPhoneNumberCode] -> ShowS)
-> Show SendPhoneNumberCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendPhoneNumberCode -> ShowS
showsPrec :: Int -> SendPhoneNumberCode -> ShowS
$cshow :: SendPhoneNumberCode -> String
show :: SendPhoneNumberCode -> String
$cshowList :: [SendPhoneNumberCode] -> ShowS
showList :: [SendPhoneNumberCode] -> ShowS
Show)
instance I.ShortShow SendPhoneNumberCode where
shortShow :: SendPhoneNumberCode -> String
shortShow
SendPhoneNumberCode
{ phone_number :: SendPhoneNumberCode -> Maybe Text
phone_number = Maybe Text
phone_number_
, settings :: SendPhoneNumberCode -> Maybe PhoneNumberAuthenticationSettings
settings = Maybe PhoneNumberAuthenticationSettings
settings_
, _type :: SendPhoneNumberCode -> Maybe PhoneNumberCodeType
_type = Maybe PhoneNumberCodeType
_type_
}
= String
"SendPhoneNumberCode"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"phone_number" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
phone_number_
, String
"settings" String -> Maybe PhoneNumberAuthenticationSettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PhoneNumberAuthenticationSettings
settings_
, String
"_type" String -> Maybe PhoneNumberCodeType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PhoneNumberCodeType
_type_
]
instance AT.ToJSON SendPhoneNumberCode where
toJSON :: SendPhoneNumberCode -> Value
toJSON
SendPhoneNumberCode
{ phone_number :: SendPhoneNumberCode -> Maybe Text
phone_number = Maybe Text
phone_number_
, settings :: SendPhoneNumberCode -> Maybe PhoneNumberAuthenticationSettings
settings = Maybe PhoneNumberAuthenticationSettings
settings_
, _type :: SendPhoneNumberCode -> Maybe PhoneNumberCodeType
_type = Maybe PhoneNumberCodeType
_type_
}
= [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
"sendPhoneNumberCode"
, Key
"phone_number" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
phone_number_
, Key
"settings" Key -> Maybe PhoneNumberAuthenticationSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe PhoneNumberAuthenticationSettings
settings_
, Key
"type" Key -> Maybe PhoneNumberCodeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe PhoneNumberCodeType
_type_
]
defaultSendPhoneNumberCode :: SendPhoneNumberCode
defaultSendPhoneNumberCode :: SendPhoneNumberCode
defaultSendPhoneNumberCode =
SendPhoneNumberCode
{ phone_number :: Maybe Text
phone_number = Maybe Text
forall a. Maybe a
Nothing
, settings :: Maybe PhoneNumberAuthenticationSettings
settings = Maybe PhoneNumberAuthenticationSettings
forall a. Maybe a
Nothing
, _type :: Maybe PhoneNumberCodeType
_type = Maybe PhoneNumberCodeType
forall a. Maybe a
Nothing
}