module TD.Data.BotInfo
(BotInfo(..)) 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.Photo as Photo
import qualified TD.Data.Animation as Animation
import qualified TD.Data.BotMenuButton as BotMenuButton
import qualified TD.Data.BotCommand as BotCommand
import qualified TD.Data.ChatAdministratorRights as ChatAdministratorRights
import qualified TD.Data.AffiliateProgramInfo as AffiliateProgramInfo
import qualified TD.Data.BotVerificationParameters as BotVerificationParameters
import qualified TD.Data.InternalLinkType as InternalLinkType
data BotInfo
= BotInfo
{ BotInfo -> Maybe Text
short_description :: Maybe T.Text
, BotInfo -> Maybe Text
description :: Maybe T.Text
, BotInfo -> Maybe Photo
photo :: Maybe Photo.Photo
, BotInfo -> Maybe Animation
animation :: Maybe Animation.Animation
, :: Maybe BotMenuButton.BotMenuButton
, BotInfo -> Maybe [BotCommand]
commands :: Maybe [BotCommand.BotCommand]
, BotInfo -> Maybe Text
privacy_policy_url :: Maybe T.Text
, BotInfo -> Maybe ChatAdministratorRights
default_group_administrator_rights :: Maybe ChatAdministratorRights.ChatAdministratorRights
, BotInfo -> Maybe ChatAdministratorRights
default_channel_administrator_rights :: Maybe ChatAdministratorRights.ChatAdministratorRights
, BotInfo -> Maybe AffiliateProgramInfo
affiliate_program :: Maybe AffiliateProgramInfo.AffiliateProgramInfo
, BotInfo -> Maybe Int
web_app_background_light_color :: Maybe Int
, BotInfo -> Maybe Int
web_app_background_dark_color :: Maybe Int
, :: Maybe Int
, :: Maybe Int
, BotInfo -> Maybe BotVerificationParameters
verification_parameters :: Maybe BotVerificationParameters.BotVerificationParameters
, BotInfo -> Maybe Bool
can_get_revenue_statistics :: Maybe Bool
, BotInfo -> Maybe Bool
can_manage_emoji_status :: Maybe Bool
, BotInfo -> Maybe Bool
has_media_previews :: Maybe Bool
, BotInfo -> Maybe InternalLinkType
edit_commands_link :: Maybe InternalLinkType.InternalLinkType
, BotInfo -> Maybe InternalLinkType
edit_description_link :: Maybe InternalLinkType.InternalLinkType
, BotInfo -> Maybe InternalLinkType
edit_description_media_link :: Maybe InternalLinkType.InternalLinkType
, BotInfo -> Maybe InternalLinkType
edit_settings_link :: Maybe InternalLinkType.InternalLinkType
}
deriving (BotInfo -> BotInfo -> Bool
(BotInfo -> BotInfo -> Bool)
-> (BotInfo -> BotInfo -> Bool) -> Eq BotInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BotInfo -> BotInfo -> Bool
== :: BotInfo -> BotInfo -> Bool
$c/= :: BotInfo -> BotInfo -> Bool
/= :: BotInfo -> BotInfo -> Bool
Eq, Int -> BotInfo -> ShowS
[BotInfo] -> ShowS
BotInfo -> String
(Int -> BotInfo -> ShowS)
-> (BotInfo -> String) -> ([BotInfo] -> ShowS) -> Show BotInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BotInfo -> ShowS
showsPrec :: Int -> BotInfo -> ShowS
$cshow :: BotInfo -> String
show :: BotInfo -> String
$cshowList :: [BotInfo] -> ShowS
showList :: [BotInfo] -> ShowS
Show)
instance I.ShortShow BotInfo where
shortShow :: BotInfo -> String
shortShow BotInfo
{ short_description :: BotInfo -> Maybe Text
short_description = Maybe Text
short_description_
, description :: BotInfo -> Maybe Text
description = Maybe Text
description_
, photo :: BotInfo -> Maybe Photo
photo = Maybe Photo
photo_
, animation :: BotInfo -> Maybe Animation
animation = Maybe Animation
animation_
, menu_button :: BotInfo -> Maybe BotMenuButton
menu_button = Maybe BotMenuButton
menu_button_
, commands :: BotInfo -> Maybe [BotCommand]
commands = Maybe [BotCommand]
commands_
, privacy_policy_url :: BotInfo -> Maybe Text
privacy_policy_url = Maybe Text
privacy_policy_url_
, default_group_administrator_rights :: BotInfo -> Maybe ChatAdministratorRights
default_group_administrator_rights = Maybe ChatAdministratorRights
default_group_administrator_rights_
, default_channel_administrator_rights :: BotInfo -> Maybe ChatAdministratorRights
default_channel_administrator_rights = Maybe ChatAdministratorRights
default_channel_administrator_rights_
, affiliate_program :: BotInfo -> Maybe AffiliateProgramInfo
affiliate_program = Maybe AffiliateProgramInfo
affiliate_program_
, web_app_background_light_color :: BotInfo -> Maybe Int
web_app_background_light_color = Maybe Int
web_app_background_light_color_
, web_app_background_dark_color :: BotInfo -> Maybe Int
web_app_background_dark_color = Maybe Int
web_app_background_dark_color_
, web_app_header_light_color :: BotInfo -> Maybe Int
web_app_header_light_color = Maybe Int
web_app_header_light_color_
, web_app_header_dark_color :: BotInfo -> Maybe Int
web_app_header_dark_color = Maybe Int
web_app_header_dark_color_
, verification_parameters :: BotInfo -> Maybe BotVerificationParameters
verification_parameters = Maybe BotVerificationParameters
verification_parameters_
, can_get_revenue_statistics :: BotInfo -> Maybe Bool
can_get_revenue_statistics = Maybe Bool
can_get_revenue_statistics_
, can_manage_emoji_status :: BotInfo -> Maybe Bool
can_manage_emoji_status = Maybe Bool
can_manage_emoji_status_
, has_media_previews :: BotInfo -> Maybe Bool
has_media_previews = Maybe Bool
has_media_previews_
, edit_commands_link :: BotInfo -> Maybe InternalLinkType
edit_commands_link = Maybe InternalLinkType
edit_commands_link_
, edit_description_link :: BotInfo -> Maybe InternalLinkType
edit_description_link = Maybe InternalLinkType
edit_description_link_
, edit_description_media_link :: BotInfo -> Maybe InternalLinkType
edit_description_media_link = Maybe InternalLinkType
edit_description_media_link_
, edit_settings_link :: BotInfo -> Maybe InternalLinkType
edit_settings_link = Maybe InternalLinkType
edit_settings_link_
}
= String
"BotInfo"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"short_description" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
short_description_
, String
"description" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
description_
, String
"photo" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
photo_
, String
"animation" String -> Maybe Animation -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Animation
animation_
, String
"menu_button" String -> Maybe BotMenuButton -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BotMenuButton
menu_button_
, String
"commands" String -> Maybe [BotCommand] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [BotCommand]
commands_
, String
"privacy_policy_url" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
privacy_policy_url_
, String
"default_group_administrator_rights" String -> Maybe ChatAdministratorRights -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatAdministratorRights
default_group_administrator_rights_
, String
"default_channel_administrator_rights" String -> Maybe ChatAdministratorRights -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatAdministratorRights
default_channel_administrator_rights_
, String
"affiliate_program" String -> Maybe AffiliateProgramInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe AffiliateProgramInfo
affiliate_program_
, String
"web_app_background_light_color" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
web_app_background_light_color_
, String
"web_app_background_dark_color" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
web_app_background_dark_color_
, String
"web_app_header_light_color" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
web_app_header_light_color_
, String
"web_app_header_dark_color" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
web_app_header_dark_color_
, String
"verification_parameters" String -> Maybe BotVerificationParameters -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BotVerificationParameters
verification_parameters_
, String
"can_get_revenue_statistics" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_get_revenue_statistics_
, String
"can_manage_emoji_status" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_manage_emoji_status_
, String
"has_media_previews" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_media_previews_
, String
"edit_commands_link" String -> Maybe InternalLinkType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InternalLinkType
edit_commands_link_
, String
"edit_description_link" String -> Maybe InternalLinkType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InternalLinkType
edit_description_link_
, String
"edit_description_media_link" String -> Maybe InternalLinkType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InternalLinkType
edit_description_media_link_
, String
"edit_settings_link" String -> Maybe InternalLinkType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InternalLinkType
edit_settings_link_
]
instance AT.FromJSON BotInfo where
parseJSON :: Value -> Parser BotInfo
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
"botInfo" -> Value -> Parser BotInfo
parseBotInfo Value
v
String
_ -> Parser BotInfo
forall a. Monoid a => a
mempty
where
parseBotInfo :: A.Value -> AT.Parser BotInfo
parseBotInfo :: Value -> Parser BotInfo
parseBotInfo = String -> (Object -> Parser BotInfo) -> Value -> Parser BotInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotInfo" ((Object -> Parser BotInfo) -> Value -> Parser BotInfo)
-> (Object -> Parser BotInfo) -> Value -> Parser BotInfo
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
short_description_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"short_description"
Maybe Text
description_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"description"
Maybe Photo
photo_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"photo"
Maybe Animation
animation_ <- Object
o Object -> Key -> Parser (Maybe Animation)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"animation"
Maybe BotMenuButton
menu_button_ <- Object
o Object -> Key -> Parser (Maybe BotMenuButton)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"menu_button"
Maybe [BotCommand]
commands_ <- Object
o Object -> Key -> Parser (Maybe [BotCommand])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"commands"
Maybe Text
privacy_policy_url_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"privacy_policy_url"
Maybe ChatAdministratorRights
default_group_administrator_rights_ <- Object
o Object -> Key -> Parser (Maybe ChatAdministratorRights)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"default_group_administrator_rights"
Maybe ChatAdministratorRights
default_channel_administrator_rights_ <- Object
o Object -> Key -> Parser (Maybe ChatAdministratorRights)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"default_channel_administrator_rights"
Maybe AffiliateProgramInfo
affiliate_program_ <- Object
o Object -> Key -> Parser (Maybe AffiliateProgramInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"affiliate_program"
Maybe Int
web_app_background_light_color_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"web_app_background_light_color"
Maybe Int
web_app_background_dark_color_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"web_app_background_dark_color"
Maybe Int
web_app_header_light_color_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"web_app_header_light_color"
Maybe Int
web_app_header_dark_color_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"web_app_header_dark_color"
Maybe BotVerificationParameters
verification_parameters_ <- Object
o Object -> Key -> Parser (Maybe BotVerificationParameters)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"verification_parameters"
Maybe Bool
can_get_revenue_statistics_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_get_revenue_statistics"
Maybe Bool
can_manage_emoji_status_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_manage_emoji_status"
Maybe Bool
has_media_previews_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_media_previews"
Maybe InternalLinkType
edit_commands_link_ <- Object
o Object -> Key -> Parser (Maybe InternalLinkType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"edit_commands_link"
Maybe InternalLinkType
edit_description_link_ <- Object
o Object -> Key -> Parser (Maybe InternalLinkType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"edit_description_link"
Maybe InternalLinkType
edit_description_media_link_ <- Object
o Object -> Key -> Parser (Maybe InternalLinkType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"edit_description_media_link"
Maybe InternalLinkType
edit_settings_link_ <- Object
o Object -> Key -> Parser (Maybe InternalLinkType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"edit_settings_link"
BotInfo -> Parser BotInfo
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotInfo -> Parser BotInfo) -> BotInfo -> Parser BotInfo
forall a b. (a -> b) -> a -> b
$ BotInfo
{ short_description :: Maybe Text
short_description = Maybe Text
short_description_
, description :: Maybe Text
description = Maybe Text
description_
, photo :: Maybe Photo
photo = Maybe Photo
photo_
, animation :: Maybe Animation
animation = Maybe Animation
animation_
, menu_button :: Maybe BotMenuButton
menu_button = Maybe BotMenuButton
menu_button_
, commands :: Maybe [BotCommand]
commands = Maybe [BotCommand]
commands_
, privacy_policy_url :: Maybe Text
privacy_policy_url = Maybe Text
privacy_policy_url_
, default_group_administrator_rights :: Maybe ChatAdministratorRights
default_group_administrator_rights = Maybe ChatAdministratorRights
default_group_administrator_rights_
, default_channel_administrator_rights :: Maybe ChatAdministratorRights
default_channel_administrator_rights = Maybe ChatAdministratorRights
default_channel_administrator_rights_
, affiliate_program :: Maybe AffiliateProgramInfo
affiliate_program = Maybe AffiliateProgramInfo
affiliate_program_
, web_app_background_light_color :: Maybe Int
web_app_background_light_color = Maybe Int
web_app_background_light_color_
, web_app_background_dark_color :: Maybe Int
web_app_background_dark_color = Maybe Int
web_app_background_dark_color_
, web_app_header_light_color :: Maybe Int
web_app_header_light_color = Maybe Int
web_app_header_light_color_
, web_app_header_dark_color :: Maybe Int
web_app_header_dark_color = Maybe Int
web_app_header_dark_color_
, verification_parameters :: Maybe BotVerificationParameters
verification_parameters = Maybe BotVerificationParameters
verification_parameters_
, can_get_revenue_statistics :: Maybe Bool
can_get_revenue_statistics = Maybe Bool
can_get_revenue_statistics_
, can_manage_emoji_status :: Maybe Bool
can_manage_emoji_status = Maybe Bool
can_manage_emoji_status_
, has_media_previews :: Maybe Bool
has_media_previews = Maybe Bool
has_media_previews_
, edit_commands_link :: Maybe InternalLinkType
edit_commands_link = Maybe InternalLinkType
edit_commands_link_
, edit_description_link :: Maybe InternalLinkType
edit_description_link = Maybe InternalLinkType
edit_description_link_
, edit_description_media_link :: Maybe InternalLinkType
edit_description_media_link = Maybe InternalLinkType
edit_description_media_link_
, edit_settings_link :: Maybe InternalLinkType
edit_settings_link = Maybe InternalLinkType
edit_settings_link_
}
parseJSON Value
_ = Parser BotInfo
forall a. Monoid a => a
mempty