module TD.Data.AttachmentMenuBot
(AttachmentMenuBot(..)) 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.AttachmentMenuBotColor as AttachmentMenuBotColor
import qualified TD.Data.File as File
data
=
{ AttachmentMenuBot -> Maybe Int
bot_user_id :: Maybe Int
, AttachmentMenuBot -> Maybe Bool
supports_self_chat :: Maybe Bool
, AttachmentMenuBot -> Maybe Bool
supports_user_chats :: Maybe Bool
, AttachmentMenuBot -> Maybe Bool
supports_bot_chats :: Maybe Bool
, AttachmentMenuBot -> Maybe Bool
supports_group_chats :: Maybe Bool
, AttachmentMenuBot -> Maybe Bool
supports_channel_chats :: Maybe Bool
, AttachmentMenuBot -> Maybe Bool
request_write_access :: Maybe Bool
, AttachmentMenuBot -> Maybe Bool
is_added :: Maybe Bool
, :: Maybe Bool
, :: Maybe Bool
, :: Maybe Bool
, AttachmentMenuBot -> Maybe Text
name :: Maybe T.Text
, AttachmentMenuBot -> Maybe AttachmentMenuBotColor
name_color :: Maybe AttachmentMenuBotColor.AttachmentMenuBotColor
, AttachmentMenuBot -> Maybe File
default_icon :: Maybe File.File
, AttachmentMenuBot -> Maybe File
ios_static_icon :: Maybe File.File
, AttachmentMenuBot -> Maybe File
ios_animated_icon :: Maybe File.File
, :: Maybe File.File
, AttachmentMenuBot -> Maybe File
android_icon :: Maybe File.File
, AttachmentMenuBot -> Maybe File
android_side_menu_icon :: Maybe File.File
, AttachmentMenuBot -> Maybe File
macos_icon :: Maybe File.File
, :: Maybe File.File
, AttachmentMenuBot -> Maybe AttachmentMenuBotColor
icon_color :: Maybe AttachmentMenuBotColor.AttachmentMenuBotColor
, AttachmentMenuBot -> Maybe File
web_app_placeholder :: Maybe File.File
}
deriving (AttachmentMenuBot -> AttachmentMenuBot -> Bool
(AttachmentMenuBot -> AttachmentMenuBot -> Bool)
-> (AttachmentMenuBot -> AttachmentMenuBot -> Bool)
-> Eq AttachmentMenuBot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AttachmentMenuBot -> AttachmentMenuBot -> Bool
== :: AttachmentMenuBot -> AttachmentMenuBot -> Bool
$c/= :: AttachmentMenuBot -> AttachmentMenuBot -> Bool
/= :: AttachmentMenuBot -> AttachmentMenuBot -> Bool
Eq, Int -> AttachmentMenuBot -> ShowS
[AttachmentMenuBot] -> ShowS
AttachmentMenuBot -> String
(Int -> AttachmentMenuBot -> ShowS)
-> (AttachmentMenuBot -> String)
-> ([AttachmentMenuBot] -> ShowS)
-> Show AttachmentMenuBot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AttachmentMenuBot -> ShowS
showsPrec :: Int -> AttachmentMenuBot -> ShowS
$cshow :: AttachmentMenuBot -> String
show :: AttachmentMenuBot -> String
$cshowList :: [AttachmentMenuBot] -> ShowS
showList :: [AttachmentMenuBot] -> ShowS
Show)
instance I.ShortShow AttachmentMenuBot where
shortShow :: AttachmentMenuBot -> String
shortShow AttachmentMenuBot
{ bot_user_id :: AttachmentMenuBot -> Maybe Int
bot_user_id = Maybe Int
bot_user_id_
, supports_self_chat :: AttachmentMenuBot -> Maybe Bool
supports_self_chat = Maybe Bool
supports_self_chat_
, supports_user_chats :: AttachmentMenuBot -> Maybe Bool
supports_user_chats = Maybe Bool
supports_user_chats_
, supports_bot_chats :: AttachmentMenuBot -> Maybe Bool
supports_bot_chats = Maybe Bool
supports_bot_chats_
, supports_group_chats :: AttachmentMenuBot -> Maybe Bool
supports_group_chats = Maybe Bool
supports_group_chats_
, supports_channel_chats :: AttachmentMenuBot -> Maybe Bool
supports_channel_chats = Maybe Bool
supports_channel_chats_
, request_write_access :: AttachmentMenuBot -> Maybe Bool
request_write_access = Maybe Bool
request_write_access_
, is_added :: AttachmentMenuBot -> Maybe Bool
is_added = Maybe Bool
is_added_
, show_in_attachment_menu :: AttachmentMenuBot -> Maybe Bool
show_in_attachment_menu = Maybe Bool
show_in_attachment_menu_
, show_in_side_menu :: AttachmentMenuBot -> Maybe Bool
show_in_side_menu = Maybe Bool
show_in_side_menu_
, show_disclaimer_in_side_menu :: AttachmentMenuBot -> Maybe Bool
show_disclaimer_in_side_menu = Maybe Bool
show_disclaimer_in_side_menu_
, name :: AttachmentMenuBot -> Maybe Text
name = Maybe Text
name_
, name_color :: AttachmentMenuBot -> Maybe AttachmentMenuBotColor
name_color = Maybe AttachmentMenuBotColor
name_color_
, default_icon :: AttachmentMenuBot -> Maybe File
default_icon = Maybe File
default_icon_
, ios_static_icon :: AttachmentMenuBot -> Maybe File
ios_static_icon = Maybe File
ios_static_icon_
, ios_animated_icon :: AttachmentMenuBot -> Maybe File
ios_animated_icon = Maybe File
ios_animated_icon_
, ios_side_menu_icon :: AttachmentMenuBot -> Maybe File
ios_side_menu_icon = Maybe File
ios_side_menu_icon_
, android_icon :: AttachmentMenuBot -> Maybe File
android_icon = Maybe File
android_icon_
, android_side_menu_icon :: AttachmentMenuBot -> Maybe File
android_side_menu_icon = Maybe File
android_side_menu_icon_
, macos_icon :: AttachmentMenuBot -> Maybe File
macos_icon = Maybe File
macos_icon_
, macos_side_menu_icon :: AttachmentMenuBot -> Maybe File
macos_side_menu_icon = Maybe File
macos_side_menu_icon_
, icon_color :: AttachmentMenuBot -> Maybe AttachmentMenuBotColor
icon_color = Maybe AttachmentMenuBotColor
icon_color_
, web_app_placeholder :: AttachmentMenuBot -> Maybe File
web_app_placeholder = Maybe File
web_app_placeholder_
}
= String
"AttachmentMenuBot"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"bot_user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
bot_user_id_
, String
"supports_self_chat" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
supports_self_chat_
, String
"supports_user_chats" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
supports_user_chats_
, String
"supports_bot_chats" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
supports_bot_chats_
, String
"supports_group_chats" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
supports_group_chats_
, String
"supports_channel_chats" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
supports_channel_chats_
, String
"request_write_access" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
request_write_access_
, String
"is_added" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_added_
, String
"show_in_attachment_menu" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
show_in_attachment_menu_
, String
"show_in_side_menu" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
show_in_side_menu_
, String
"show_disclaimer_in_side_menu" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
show_disclaimer_in_side_menu_
, String
"name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
, String
"name_color" String -> Maybe AttachmentMenuBotColor -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe AttachmentMenuBotColor
name_color_
, String
"default_icon" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
default_icon_
, String
"ios_static_icon" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
ios_static_icon_
, String
"ios_animated_icon" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
ios_animated_icon_
, String
"ios_side_menu_icon" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
ios_side_menu_icon_
, String
"android_icon" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
android_icon_
, String
"android_side_menu_icon" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
android_side_menu_icon_
, String
"macos_icon" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
macos_icon_
, String
"macos_side_menu_icon" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
macos_side_menu_icon_
, String
"icon_color" String -> Maybe AttachmentMenuBotColor -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe AttachmentMenuBotColor
icon_color_
, String
"web_app_placeholder" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
web_app_placeholder_
]
instance AT.FromJSON AttachmentMenuBot where
parseJSON :: Value -> Parser AttachmentMenuBot
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
"attachmentMenuBot" -> Value -> Parser AttachmentMenuBot
parseAttachmentMenuBot Value
v
String
_ -> Parser AttachmentMenuBot
forall a. Monoid a => a
mempty
where
parseAttachmentMenuBot :: A.Value -> AT.Parser AttachmentMenuBot
parseAttachmentMenuBot :: Value -> Parser AttachmentMenuBot
parseAttachmentMenuBot = String
-> (Object -> Parser AttachmentMenuBot)
-> Value
-> Parser AttachmentMenuBot
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AttachmentMenuBot" ((Object -> Parser AttachmentMenuBot)
-> Value -> Parser AttachmentMenuBot)
-> (Object -> Parser AttachmentMenuBot)
-> Value
-> Parser AttachmentMenuBot
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
bot_user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"bot_user_id"
Maybe Bool
supports_self_chat_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"supports_self_chat"
Maybe Bool
supports_user_chats_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"supports_user_chats"
Maybe Bool
supports_bot_chats_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"supports_bot_chats"
Maybe Bool
supports_group_chats_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"supports_group_chats"
Maybe Bool
supports_channel_chats_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"supports_channel_chats"
Maybe Bool
request_write_access_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"request_write_access"
Maybe Bool
is_added_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_added"
Maybe Bool
show_in_attachment_menu_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"show_in_attachment_menu"
Maybe Bool
show_in_side_menu_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"show_in_side_menu"
Maybe Bool
show_disclaimer_in_side_menu_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"show_disclaimer_in_side_menu"
Maybe Text
name_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"name"
Maybe AttachmentMenuBotColor
name_color_ <- Object
o Object -> Key -> Parser (Maybe AttachmentMenuBotColor)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"name_color"
Maybe File
default_icon_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"default_icon"
Maybe File
ios_static_icon_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"ios_static_icon"
Maybe File
ios_animated_icon_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"ios_animated_icon"
Maybe File
ios_side_menu_icon_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"ios_side_menu_icon"
Maybe File
android_icon_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"android_icon"
Maybe File
android_side_menu_icon_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"android_side_menu_icon"
Maybe File
macos_icon_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"macos_icon"
Maybe File
macos_side_menu_icon_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"macos_side_menu_icon"
Maybe AttachmentMenuBotColor
icon_color_ <- Object
o Object -> Key -> Parser (Maybe AttachmentMenuBotColor)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"icon_color"
Maybe File
web_app_placeholder_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"web_app_placeholder"
AttachmentMenuBot -> Parser AttachmentMenuBot
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AttachmentMenuBot -> Parser AttachmentMenuBot)
-> AttachmentMenuBot -> Parser AttachmentMenuBot
forall a b. (a -> b) -> a -> b
$ AttachmentMenuBot
{ bot_user_id :: Maybe Int
bot_user_id = Maybe Int
bot_user_id_
, supports_self_chat :: Maybe Bool
supports_self_chat = Maybe Bool
supports_self_chat_
, supports_user_chats :: Maybe Bool
supports_user_chats = Maybe Bool
supports_user_chats_
, supports_bot_chats :: Maybe Bool
supports_bot_chats = Maybe Bool
supports_bot_chats_
, supports_group_chats :: Maybe Bool
supports_group_chats = Maybe Bool
supports_group_chats_
, supports_channel_chats :: Maybe Bool
supports_channel_chats = Maybe Bool
supports_channel_chats_
, request_write_access :: Maybe Bool
request_write_access = Maybe Bool
request_write_access_
, is_added :: Maybe Bool
is_added = Maybe Bool
is_added_
, show_in_attachment_menu :: Maybe Bool
show_in_attachment_menu = Maybe Bool
show_in_attachment_menu_
, show_in_side_menu :: Maybe Bool
show_in_side_menu = Maybe Bool
show_in_side_menu_
, show_disclaimer_in_side_menu :: Maybe Bool
show_disclaimer_in_side_menu = Maybe Bool
show_disclaimer_in_side_menu_
, name :: Maybe Text
name = Maybe Text
name_
, name_color :: Maybe AttachmentMenuBotColor
name_color = Maybe AttachmentMenuBotColor
name_color_
, default_icon :: Maybe File
default_icon = Maybe File
default_icon_
, ios_static_icon :: Maybe File
ios_static_icon = Maybe File
ios_static_icon_
, ios_animated_icon :: Maybe File
ios_animated_icon = Maybe File
ios_animated_icon_
, ios_side_menu_icon :: Maybe File
ios_side_menu_icon = Maybe File
ios_side_menu_icon_
, android_icon :: Maybe File
android_icon = Maybe File
android_icon_
, android_side_menu_icon :: Maybe File
android_side_menu_icon = Maybe File
android_side_menu_icon_
, macos_icon :: Maybe File
macos_icon = Maybe File
macos_icon_
, macos_side_menu_icon :: Maybe File
macos_side_menu_icon = Maybe File
macos_side_menu_icon_
, icon_color :: Maybe AttachmentMenuBotColor
icon_color = Maybe AttachmentMenuBotColor
icon_color_
, web_app_placeholder :: Maybe File
web_app_placeholder = Maybe File
web_app_placeholder_
}
parseJSON Value
_ = Parser AttachmentMenuBot
forall a. Monoid a => a
mempty