module TD.Data.UserFullInfo
(UserFullInfo(..)) 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.ChatPhoto as ChatPhoto
import qualified TD.Data.BlockList as BlockList
import qualified TD.Data.FormattedText as FormattedText
import qualified TD.Data.Birthdate as Birthdate
import qualified TD.Data.BotVerification as BotVerification
import qualified TD.Data.BusinessInfo as BusinessInfo
import qualified TD.Data.BotInfo as BotInfo
data UserFullInfo
= UserFullInfo
{ UserFullInfo -> Maybe ChatPhoto
personal_photo :: Maybe ChatPhoto.ChatPhoto
, UserFullInfo -> Maybe ChatPhoto
photo :: Maybe ChatPhoto.ChatPhoto
, UserFullInfo -> Maybe ChatPhoto
public_photo :: Maybe ChatPhoto.ChatPhoto
, UserFullInfo -> Maybe BlockList
block_list :: Maybe BlockList.BlockList
, UserFullInfo -> Maybe Bool
can_be_called :: Maybe Bool
, UserFullInfo -> Maybe Bool
supports_video_calls :: Maybe Bool
, UserFullInfo -> Maybe Bool
has_private_calls :: Maybe Bool
, UserFullInfo -> Maybe Bool
has_private_forwards :: Maybe Bool
, UserFullInfo -> Maybe Bool
has_restricted_voice_and_video_note_messages :: Maybe Bool
, UserFullInfo -> Maybe Bool
has_posted_to_profile_stories :: Maybe Bool
, :: Maybe Bool
, UserFullInfo -> Maybe Bool
need_phone_number_privacy_exception :: Maybe Bool
, UserFullInfo -> Maybe Bool
set_chat_background :: Maybe Bool
, UserFullInfo -> Maybe FormattedText
bio :: Maybe FormattedText.FormattedText
, UserFullInfo -> Maybe Birthdate
birthdate :: Maybe Birthdate.Birthdate
, UserFullInfo -> Maybe Int
personal_chat_id :: Maybe Int
, UserFullInfo -> Maybe Int
gift_count :: Maybe Int
, UserFullInfo -> Maybe Int
group_in_common_count :: Maybe Int
, UserFullInfo -> Maybe BotVerification
bot_verification :: Maybe BotVerification.BotVerification
, UserFullInfo -> Maybe BusinessInfo
business_info :: Maybe BusinessInfo.BusinessInfo
, UserFullInfo -> Maybe BotInfo
bot_info :: Maybe BotInfo.BotInfo
}
deriving (UserFullInfo -> UserFullInfo -> Bool
(UserFullInfo -> UserFullInfo -> Bool)
-> (UserFullInfo -> UserFullInfo -> Bool) -> Eq UserFullInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UserFullInfo -> UserFullInfo -> Bool
== :: UserFullInfo -> UserFullInfo -> Bool
$c/= :: UserFullInfo -> UserFullInfo -> Bool
/= :: UserFullInfo -> UserFullInfo -> Bool
Eq, Int -> UserFullInfo -> ShowS
[UserFullInfo] -> ShowS
UserFullInfo -> String
(Int -> UserFullInfo -> ShowS)
-> (UserFullInfo -> String)
-> ([UserFullInfo] -> ShowS)
-> Show UserFullInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UserFullInfo -> ShowS
showsPrec :: Int -> UserFullInfo -> ShowS
$cshow :: UserFullInfo -> String
show :: UserFullInfo -> String
$cshowList :: [UserFullInfo] -> ShowS
showList :: [UserFullInfo] -> ShowS
Show)
instance I.ShortShow UserFullInfo where
shortShow :: UserFullInfo -> String
shortShow UserFullInfo
{ personal_photo :: UserFullInfo -> Maybe ChatPhoto
personal_photo = Maybe ChatPhoto
personal_photo_
, photo :: UserFullInfo -> Maybe ChatPhoto
photo = Maybe ChatPhoto
photo_
, public_photo :: UserFullInfo -> Maybe ChatPhoto
public_photo = Maybe ChatPhoto
public_photo_
, block_list :: UserFullInfo -> Maybe BlockList
block_list = Maybe BlockList
block_list_
, can_be_called :: UserFullInfo -> Maybe Bool
can_be_called = Maybe Bool
can_be_called_
, supports_video_calls :: UserFullInfo -> Maybe Bool
supports_video_calls = Maybe Bool
supports_video_calls_
, has_private_calls :: UserFullInfo -> Maybe Bool
has_private_calls = Maybe Bool
has_private_calls_
, has_private_forwards :: UserFullInfo -> Maybe Bool
has_private_forwards = Maybe Bool
has_private_forwards_
, has_restricted_voice_and_video_note_messages :: UserFullInfo -> Maybe Bool
has_restricted_voice_and_video_note_messages = Maybe Bool
has_restricted_voice_and_video_note_messages_
, has_posted_to_profile_stories :: UserFullInfo -> Maybe Bool
has_posted_to_profile_stories = Maybe Bool
has_posted_to_profile_stories_
, has_sponsored_messages_enabled :: UserFullInfo -> Maybe Bool
has_sponsored_messages_enabled = Maybe Bool
has_sponsored_messages_enabled_
, need_phone_number_privacy_exception :: UserFullInfo -> Maybe Bool
need_phone_number_privacy_exception = Maybe Bool
need_phone_number_privacy_exception_
, set_chat_background :: UserFullInfo -> Maybe Bool
set_chat_background = Maybe Bool
set_chat_background_
, bio :: UserFullInfo -> Maybe FormattedText
bio = Maybe FormattedText
bio_
, birthdate :: UserFullInfo -> Maybe Birthdate
birthdate = Maybe Birthdate
birthdate_
, personal_chat_id :: UserFullInfo -> Maybe Int
personal_chat_id = Maybe Int
personal_chat_id_
, gift_count :: UserFullInfo -> Maybe Int
gift_count = Maybe Int
gift_count_
, group_in_common_count :: UserFullInfo -> Maybe Int
group_in_common_count = Maybe Int
group_in_common_count_
, bot_verification :: UserFullInfo -> Maybe BotVerification
bot_verification = Maybe BotVerification
bot_verification_
, business_info :: UserFullInfo -> Maybe BusinessInfo
business_info = Maybe BusinessInfo
business_info_
, bot_info :: UserFullInfo -> Maybe BotInfo
bot_info = Maybe BotInfo
bot_info_
}
= String
"UserFullInfo"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"personal_photo" String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
personal_photo_
, String
"photo" String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
photo_
, String
"public_photo" String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
public_photo_
, String
"block_list" String -> Maybe BlockList -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BlockList
block_list_
, String
"can_be_called" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_be_called_
, String
"supports_video_calls" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
supports_video_calls_
, String
"has_private_calls" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_private_calls_
, String
"has_private_forwards" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_private_forwards_
, String
"has_restricted_voice_and_video_note_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_restricted_voice_and_video_note_messages_
, String
"has_posted_to_profile_stories" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_posted_to_profile_stories_
, String
"has_sponsored_messages_enabled" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_sponsored_messages_enabled_
, String
"need_phone_number_privacy_exception" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
need_phone_number_privacy_exception_
, String
"set_chat_background" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
set_chat_background_
, String
"bio" String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
bio_
, String
"birthdate" String -> Maybe Birthdate -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Birthdate
birthdate_
, String
"personal_chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
personal_chat_id_
, String
"gift_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
gift_count_
, String
"group_in_common_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
group_in_common_count_
, String
"bot_verification" String -> Maybe BotVerification -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BotVerification
bot_verification_
, String
"business_info" String -> Maybe BusinessInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BusinessInfo
business_info_
, String
"bot_info" String -> Maybe BotInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BotInfo
bot_info_
]
instance AT.FromJSON UserFullInfo where
parseJSON :: Value -> Parser UserFullInfo
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
"userFullInfo" -> Value -> Parser UserFullInfo
parseUserFullInfo Value
v
String
_ -> Parser UserFullInfo
forall a. Monoid a => a
mempty
where
parseUserFullInfo :: A.Value -> AT.Parser UserFullInfo
parseUserFullInfo :: Value -> Parser UserFullInfo
parseUserFullInfo = String
-> (Object -> Parser UserFullInfo) -> Value -> Parser UserFullInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"UserFullInfo" ((Object -> Parser UserFullInfo) -> Value -> Parser UserFullInfo)
-> (Object -> Parser UserFullInfo) -> Value -> Parser UserFullInfo
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe ChatPhoto
personal_photo_ <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"personal_photo"
Maybe ChatPhoto
photo_ <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"photo"
Maybe ChatPhoto
public_photo_ <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"public_photo"
Maybe BlockList
block_list_ <- Object
o Object -> Key -> Parser (Maybe BlockList)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"block_list"
Maybe Bool
can_be_called_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_be_called"
Maybe Bool
supports_video_calls_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"supports_video_calls"
Maybe Bool
has_private_calls_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_private_calls"
Maybe Bool
has_private_forwards_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_private_forwards"
Maybe Bool
has_restricted_voice_and_video_note_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_restricted_voice_and_video_note_messages"
Maybe Bool
has_posted_to_profile_stories_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_posted_to_profile_stories"
Maybe Bool
has_sponsored_messages_enabled_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_sponsored_messages_enabled"
Maybe Bool
need_phone_number_privacy_exception_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"need_phone_number_privacy_exception"
Maybe Bool
set_chat_background_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"set_chat_background"
Maybe FormattedText
bio_ <- Object
o Object -> Key -> Parser (Maybe FormattedText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"bio"
Maybe Birthdate
birthdate_ <- Object
o Object -> Key -> Parser (Maybe Birthdate)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"birthdate"
Maybe Int
personal_chat_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"personal_chat_id"
Maybe Int
gift_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"gift_count"
Maybe Int
group_in_common_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"group_in_common_count"
Maybe BotVerification
bot_verification_ <- Object
o Object -> Key -> Parser (Maybe BotVerification)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"bot_verification"
Maybe BusinessInfo
business_info_ <- Object
o Object -> Key -> Parser (Maybe BusinessInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"business_info"
Maybe BotInfo
bot_info_ <- Object
o Object -> Key -> Parser (Maybe BotInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"bot_info"
UserFullInfo -> Parser UserFullInfo
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (UserFullInfo -> Parser UserFullInfo)
-> UserFullInfo -> Parser UserFullInfo
forall a b. (a -> b) -> a -> b
$ UserFullInfo
{ personal_photo :: Maybe ChatPhoto
personal_photo = Maybe ChatPhoto
personal_photo_
, photo :: Maybe ChatPhoto
photo = Maybe ChatPhoto
photo_
, public_photo :: Maybe ChatPhoto
public_photo = Maybe ChatPhoto
public_photo_
, block_list :: Maybe BlockList
block_list = Maybe BlockList
block_list_
, can_be_called :: Maybe Bool
can_be_called = Maybe Bool
can_be_called_
, supports_video_calls :: Maybe Bool
supports_video_calls = Maybe Bool
supports_video_calls_
, has_private_calls :: Maybe Bool
has_private_calls = Maybe Bool
has_private_calls_
, has_private_forwards :: Maybe Bool
has_private_forwards = Maybe Bool
has_private_forwards_
, has_restricted_voice_and_video_note_messages :: Maybe Bool
has_restricted_voice_and_video_note_messages = Maybe Bool
has_restricted_voice_and_video_note_messages_
, has_posted_to_profile_stories :: Maybe Bool
has_posted_to_profile_stories = Maybe Bool
has_posted_to_profile_stories_
, has_sponsored_messages_enabled :: Maybe Bool
has_sponsored_messages_enabled = Maybe Bool
has_sponsored_messages_enabled_
, need_phone_number_privacy_exception :: Maybe Bool
need_phone_number_privacy_exception = Maybe Bool
need_phone_number_privacy_exception_
, set_chat_background :: Maybe Bool
set_chat_background = Maybe Bool
set_chat_background_
, bio :: Maybe FormattedText
bio = Maybe FormattedText
bio_
, birthdate :: Maybe Birthdate
birthdate = Maybe Birthdate
birthdate_
, personal_chat_id :: Maybe Int
personal_chat_id = Maybe Int
personal_chat_id_
, gift_count :: Maybe Int
gift_count = Maybe Int
gift_count_
, group_in_common_count :: Maybe Int
group_in_common_count = Maybe Int
group_in_common_count_
, bot_verification :: Maybe BotVerification
bot_verification = Maybe BotVerification
bot_verification_
, business_info :: Maybe BusinessInfo
business_info = Maybe BusinessInfo
business_info_
, bot_info :: Maybe BotInfo
bot_info = Maybe BotInfo
bot_info_
}
parseJSON Value
_ = Parser UserFullInfo
forall a. Monoid a => a
mempty