module TD.Data.UserPrivacySetting
(UserPrivacySetting(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data UserPrivacySetting
= UserPrivacySettingShowStatus
| UserPrivacySettingShowProfilePhoto
| UserPrivacySettingShowLinkInForwardedMessages
| UserPrivacySettingShowPhoneNumber
| UserPrivacySettingShowBio
| UserPrivacySettingShowBirthdate
| UserPrivacySettingAllowChatInvites
| UserPrivacySettingAllowCalls
| UserPrivacySettingAllowPeerToPeerCalls
| UserPrivacySettingAllowFindingByPhoneNumber
| UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages
| UserPrivacySettingAutosaveGifts
deriving (UserPrivacySetting -> UserPrivacySetting -> Bool
(UserPrivacySetting -> UserPrivacySetting -> Bool)
-> (UserPrivacySetting -> UserPrivacySetting -> Bool)
-> Eq UserPrivacySetting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UserPrivacySetting -> UserPrivacySetting -> Bool
== :: UserPrivacySetting -> UserPrivacySetting -> Bool
$c/= :: UserPrivacySetting -> UserPrivacySetting -> Bool
/= :: UserPrivacySetting -> UserPrivacySetting -> Bool
Eq, Int -> UserPrivacySetting -> ShowS
[UserPrivacySetting] -> ShowS
UserPrivacySetting -> String
(Int -> UserPrivacySetting -> ShowS)
-> (UserPrivacySetting -> String)
-> ([UserPrivacySetting] -> ShowS)
-> Show UserPrivacySetting
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UserPrivacySetting -> ShowS
showsPrec :: Int -> UserPrivacySetting -> ShowS
$cshow :: UserPrivacySetting -> String
show :: UserPrivacySetting -> String
$cshowList :: [UserPrivacySetting] -> ShowS
showList :: [UserPrivacySetting] -> ShowS
Show)
instance I.ShortShow UserPrivacySetting where
shortShow :: UserPrivacySetting -> String
shortShow UserPrivacySetting
UserPrivacySettingShowStatus
= String
"UserPrivacySettingShowStatus"
shortShow UserPrivacySetting
UserPrivacySettingShowProfilePhoto
= String
"UserPrivacySettingShowProfilePhoto"
shortShow UserPrivacySetting
UserPrivacySettingShowLinkInForwardedMessages
= String
"UserPrivacySettingShowLinkInForwardedMessages"
shortShow UserPrivacySetting
UserPrivacySettingShowPhoneNumber
= String
"UserPrivacySettingShowPhoneNumber"
shortShow UserPrivacySetting
UserPrivacySettingShowBio
= String
"UserPrivacySettingShowBio"
shortShow UserPrivacySetting
UserPrivacySettingShowBirthdate
= String
"UserPrivacySettingShowBirthdate"
shortShow UserPrivacySetting
UserPrivacySettingAllowChatInvites
= String
"UserPrivacySettingAllowChatInvites"
shortShow UserPrivacySetting
UserPrivacySettingAllowCalls
= String
"UserPrivacySettingAllowCalls"
shortShow UserPrivacySetting
UserPrivacySettingAllowPeerToPeerCalls
= String
"UserPrivacySettingAllowPeerToPeerCalls"
shortShow UserPrivacySetting
UserPrivacySettingAllowFindingByPhoneNumber
= String
"UserPrivacySettingAllowFindingByPhoneNumber"
shortShow UserPrivacySetting
UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages
= String
"UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages"
shortShow UserPrivacySetting
UserPrivacySettingAutosaveGifts
= String
"UserPrivacySettingAutosaveGifts"
instance AT.FromJSON UserPrivacySetting where
parseJSON :: Value -> Parser UserPrivacySetting
parseJSON (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
"userPrivacySettingShowStatus" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingShowStatus
String
"userPrivacySettingShowProfilePhoto" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingShowProfilePhoto
String
"userPrivacySettingShowLinkInForwardedMessages" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingShowLinkInForwardedMessages
String
"userPrivacySettingShowPhoneNumber" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingShowPhoneNumber
String
"userPrivacySettingShowBio" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingShowBio
String
"userPrivacySettingShowBirthdate" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingShowBirthdate
String
"userPrivacySettingAllowChatInvites" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingAllowChatInvites
String
"userPrivacySettingAllowCalls" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingAllowCalls
String
"userPrivacySettingAllowPeerToPeerCalls" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingAllowPeerToPeerCalls
String
"userPrivacySettingAllowFindingByPhoneNumber" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingAllowFindingByPhoneNumber
String
"userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages
String
"userPrivacySettingAutosaveGifts" -> UserPrivacySetting -> Parser UserPrivacySetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UserPrivacySetting
UserPrivacySettingAutosaveGifts
String
_ -> Parser UserPrivacySetting
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser UserPrivacySetting
forall a. Monoid a => a
mempty
instance AT.ToJSON UserPrivacySetting where
toJSON :: UserPrivacySetting -> Value
toJSON UserPrivacySetting
UserPrivacySettingShowStatus
= [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
"userPrivacySettingShowStatus"
]
toJSON UserPrivacySetting
UserPrivacySettingShowProfilePhoto
= [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
"userPrivacySettingShowProfilePhoto"
]
toJSON UserPrivacySetting
UserPrivacySettingShowLinkInForwardedMessages
= [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
"userPrivacySettingShowLinkInForwardedMessages"
]
toJSON UserPrivacySetting
UserPrivacySettingShowPhoneNumber
= [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
"userPrivacySettingShowPhoneNumber"
]
toJSON UserPrivacySetting
UserPrivacySettingShowBio
= [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
"userPrivacySettingShowBio"
]
toJSON UserPrivacySetting
UserPrivacySettingShowBirthdate
= [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
"userPrivacySettingShowBirthdate"
]
toJSON UserPrivacySetting
UserPrivacySettingAllowChatInvites
= [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
"userPrivacySettingAllowChatInvites"
]
toJSON UserPrivacySetting
UserPrivacySettingAllowCalls
= [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
"userPrivacySettingAllowCalls"
]
toJSON UserPrivacySetting
UserPrivacySettingAllowPeerToPeerCalls
= [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
"userPrivacySettingAllowPeerToPeerCalls"
]
toJSON UserPrivacySetting
UserPrivacySettingAllowFindingByPhoneNumber
= [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
"userPrivacySettingAllowFindingByPhoneNumber"
]
toJSON UserPrivacySetting
UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages
= [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
"userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages"
]
toJSON UserPrivacySetting
UserPrivacySettingAutosaveGifts
= [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
"userPrivacySettingAutosaveGifts"
]