module TD.Query.AddContact
(AddContact(..)
, defaultAddContact
) 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.Contact as Contact
data AddContact
= AddContact
{ AddContact -> Maybe Contact
contact :: Maybe Contact.Contact
, AddContact -> Maybe Bool
share_phone_number :: Maybe Bool
}
deriving (AddContact -> AddContact -> Bool
(AddContact -> AddContact -> Bool)
-> (AddContact -> AddContact -> Bool) -> Eq AddContact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AddContact -> AddContact -> Bool
== :: AddContact -> AddContact -> Bool
$c/= :: AddContact -> AddContact -> Bool
/= :: AddContact -> AddContact -> Bool
Eq, Int -> AddContact -> ShowS
[AddContact] -> ShowS
AddContact -> String
(Int -> AddContact -> ShowS)
-> (AddContact -> String)
-> ([AddContact] -> ShowS)
-> Show AddContact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddContact -> ShowS
showsPrec :: Int -> AddContact -> ShowS
$cshow :: AddContact -> String
show :: AddContact -> String
$cshowList :: [AddContact] -> ShowS
showList :: [AddContact] -> ShowS
Show)
instance I.ShortShow AddContact where
shortShow :: AddContact -> String
shortShow
AddContact
{ contact :: AddContact -> Maybe Contact
contact = Maybe Contact
contact_
, share_phone_number :: AddContact -> Maybe Bool
share_phone_number = Maybe Bool
share_phone_number_
}
= String
"AddContact"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"contact" String -> Maybe Contact -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Contact
contact_
, String
"share_phone_number" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
share_phone_number_
]
instance AT.ToJSON AddContact where
toJSON :: AddContact -> Value
toJSON
AddContact
{ contact :: AddContact -> Maybe Contact
contact = Maybe Contact
contact_
, share_phone_number :: AddContact -> Maybe Bool
share_phone_number = Maybe Bool
share_phone_number_
}
= [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
"addContact"
, Key
"contact" Key -> Maybe Contact -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Contact
contact_
, Key
"share_phone_number" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
share_phone_number_
]
defaultAddContact :: AddContact
defaultAddContact :: AddContact
defaultAddContact =
AddContact
{ contact :: Maybe Contact
contact = Maybe Contact
forall a. Maybe a
Nothing
, share_phone_number :: Maybe Bool
share_phone_number = Maybe Bool
forall a. Maybe a
Nothing
}