module TD.Data.BotSetting
(BotSetting(..)) 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.BotCallbackQueryMode as BotCallbackQueryMode
data BotSetting
= BotSettingIsInline
{ BotSetting -> Maybe Bool
is_inline :: Maybe Bool
}
| BotSettingInlineQueryPlaceholder
{ BotSetting -> Maybe Text
placeholder :: Maybe T.Text
}
| BotSettingNeedLocation
{ BotSetting -> Maybe Bool
need_location :: Maybe Bool
}
| BotSettingInlineFeedback
{ BotSetting -> Maybe Int
share_denominator :: Maybe Int
}
| BotSettingCanJoinGroups
{ BotSetting -> Maybe Bool
can_join_groups :: Maybe Bool
}
| BotSettingCanReadAllGroupMessages
{ BotSetting -> Maybe Bool
can_read_all_group_messages :: Maybe Bool
}
| BotSettingCanConnectToBusiness
{ BotSetting -> Maybe Bool
can_connect_to_business :: Maybe Bool
}
| BotSettingCanManageBots
{ BotSetting -> Maybe Bool
can_manage_bots :: Maybe Bool
}
| BotSettingSupportsGuestQueries
{ BotSetting -> Maybe Bool
supports_guest_queries :: Maybe Bool
}
| BotSettingIsGuard
{ BotSetting -> Maybe Bool
is_guard :: Maybe Bool
}
| BotSettingHasTopics
{ BotSetting -> Maybe Bool
has_topics :: Maybe Bool
}
| BotSettingAllowsUsersToCreateTopics
{ BotSetting -> Maybe Bool
allows_users_to_create_topics :: Maybe Bool
}
|
{ :: Maybe Bool
}
| BotSettingCanCommunicateWithBots
{ BotSetting -> Maybe Bool
can_communicate_with_bots :: Maybe Bool
}
| BotSettingCallbackQueryMode
{ BotSetting -> Maybe BotCallbackQueryMode
mode :: Maybe BotCallbackQueryMode.BotCallbackQueryMode
}
deriving (BotSetting -> BotSetting -> Bool
(BotSetting -> BotSetting -> Bool)
-> (BotSetting -> BotSetting -> Bool) -> Eq BotSetting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BotSetting -> BotSetting -> Bool
== :: BotSetting -> BotSetting -> Bool
$c/= :: BotSetting -> BotSetting -> Bool
/= :: BotSetting -> BotSetting -> Bool
Eq, Int -> BotSetting -> ShowS
[BotSetting] -> ShowS
BotSetting -> String
(Int -> BotSetting -> ShowS)
-> (BotSetting -> String)
-> ([BotSetting] -> ShowS)
-> Show BotSetting
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BotSetting -> ShowS
showsPrec :: Int -> BotSetting -> ShowS
$cshow :: BotSetting -> String
show :: BotSetting -> String
$cshowList :: [BotSetting] -> ShowS
showList :: [BotSetting] -> ShowS
Show)
instance I.ShortShow BotSetting where
shortShow :: BotSetting -> String
shortShow BotSettingIsInline
{ is_inline :: BotSetting -> Maybe Bool
is_inline = Maybe Bool
is_inline_
}
= String
"BotSettingIsInline"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"is_inline" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_inline_
]
shortShow BotSettingInlineQueryPlaceholder
{ placeholder :: BotSetting -> Maybe Text
placeholder = Maybe Text
placeholder_
}
= String
"BotSettingInlineQueryPlaceholder"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"placeholder" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
placeholder_
]
shortShow BotSettingNeedLocation
{ need_location :: BotSetting -> Maybe Bool
need_location = Maybe Bool
need_location_
}
= String
"BotSettingNeedLocation"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"need_location" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
need_location_
]
shortShow BotSettingInlineFeedback
{ share_denominator :: BotSetting -> Maybe Int
share_denominator = Maybe Int
share_denominator_
}
= String
"BotSettingInlineFeedback"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"share_denominator" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
share_denominator_
]
shortShow BotSettingCanJoinGroups
{ can_join_groups :: BotSetting -> Maybe Bool
can_join_groups = Maybe Bool
can_join_groups_
}
= String
"BotSettingCanJoinGroups"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"can_join_groups" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_join_groups_
]
shortShow BotSettingCanReadAllGroupMessages
{ can_read_all_group_messages :: BotSetting -> Maybe Bool
can_read_all_group_messages = Maybe Bool
can_read_all_group_messages_
}
= String
"BotSettingCanReadAllGroupMessages"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"can_read_all_group_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_read_all_group_messages_
]
shortShow BotSettingCanConnectToBusiness
{ can_connect_to_business :: BotSetting -> Maybe Bool
can_connect_to_business = Maybe Bool
can_connect_to_business_
}
= String
"BotSettingCanConnectToBusiness"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"can_connect_to_business" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_connect_to_business_
]
shortShow BotSettingCanManageBots
{ can_manage_bots :: BotSetting -> Maybe Bool
can_manage_bots = Maybe Bool
can_manage_bots_
}
= String
"BotSettingCanManageBots"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"can_manage_bots" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_manage_bots_
]
shortShow BotSettingSupportsGuestQueries
{ supports_guest_queries :: BotSetting -> Maybe Bool
supports_guest_queries = Maybe Bool
supports_guest_queries_
}
= String
"BotSettingSupportsGuestQueries"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"supports_guest_queries" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
supports_guest_queries_
]
shortShow BotSettingIsGuard
{ is_guard :: BotSetting -> Maybe Bool
is_guard = Maybe Bool
is_guard_
}
= String
"BotSettingIsGuard"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"is_guard" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_guard_
]
shortShow BotSettingHasTopics
{ has_topics :: BotSetting -> Maybe Bool
has_topics = Maybe Bool
has_topics_
}
= String
"BotSettingHasTopics"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"has_topics" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_topics_
]
shortShow BotSettingAllowsUsersToCreateTopics
{ allows_users_to_create_topics :: BotSetting -> Maybe Bool
allows_users_to_create_topics = Maybe Bool
allows_users_to_create_topics_
}
= String
"BotSettingAllowsUsersToCreateTopics"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"allows_users_to_create_topics" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
allows_users_to_create_topics_
]
shortShow BotSettingHasTopicSidebar
{ has_topic_sidebar :: BotSetting -> Maybe Bool
has_topic_sidebar = Maybe Bool
has_topic_sidebar_
}
= String
"BotSettingHasTopicSidebar"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"has_topic_sidebar" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_topic_sidebar_
]
shortShow BotSettingCanCommunicateWithBots
{ can_communicate_with_bots :: BotSetting -> Maybe Bool
can_communicate_with_bots = Maybe Bool
can_communicate_with_bots_
}
= String
"BotSettingCanCommunicateWithBots"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"can_communicate_with_bots" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_communicate_with_bots_
]
shortShow BotSettingCallbackQueryMode
{ mode :: BotSetting -> Maybe BotCallbackQueryMode
mode = Maybe BotCallbackQueryMode
mode_
}
= String
"BotSettingCallbackQueryMode"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"mode" String -> Maybe BotCallbackQueryMode -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BotCallbackQueryMode
mode_
]
instance AT.FromJSON BotSetting where
parseJSON :: Value -> Parser BotSetting
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
"botSettingIsInline" -> Value -> Parser BotSetting
parseBotSettingIsInline Value
v
String
"botSettingInlineQueryPlaceholder" -> Value -> Parser BotSetting
parseBotSettingInlineQueryPlaceholder Value
v
String
"botSettingNeedLocation" -> Value -> Parser BotSetting
parseBotSettingNeedLocation Value
v
String
"botSettingInlineFeedback" -> Value -> Parser BotSetting
parseBotSettingInlineFeedback Value
v
String
"botSettingCanJoinGroups" -> Value -> Parser BotSetting
parseBotSettingCanJoinGroups Value
v
String
"botSettingCanReadAllGroupMessages" -> Value -> Parser BotSetting
parseBotSettingCanReadAllGroupMessages Value
v
String
"botSettingCanConnectToBusiness" -> Value -> Parser BotSetting
parseBotSettingCanConnectToBusiness Value
v
String
"botSettingCanManageBots" -> Value -> Parser BotSetting
parseBotSettingCanManageBots Value
v
String
"botSettingSupportsGuestQueries" -> Value -> Parser BotSetting
parseBotSettingSupportsGuestQueries Value
v
String
"botSettingIsGuard" -> Value -> Parser BotSetting
parseBotSettingIsGuard Value
v
String
"botSettingHasTopics" -> Value -> Parser BotSetting
parseBotSettingHasTopics Value
v
String
"botSettingAllowsUsersToCreateTopics" -> Value -> Parser BotSetting
parseBotSettingAllowsUsersToCreateTopics Value
v
String
"botSettingHasTopicSidebar" -> Value -> Parser BotSetting
parseBotSettingHasTopicSidebar Value
v
String
"botSettingCanCommunicateWithBots" -> Value -> Parser BotSetting
parseBotSettingCanCommunicateWithBots Value
v
String
"botSettingCallbackQueryMode" -> Value -> Parser BotSetting
parseBotSettingCallbackQueryMode Value
v
String
_ -> Parser BotSetting
forall a. Monoid a => a
mempty
where
parseBotSettingIsInline :: A.Value -> AT.Parser BotSetting
parseBotSettingIsInline :: Value -> Parser BotSetting
parseBotSettingIsInline = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingIsInline" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
is_inline_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_inline"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingIsInline
{ is_inline :: Maybe Bool
is_inline = Maybe Bool
is_inline_
}
parseBotSettingInlineQueryPlaceholder :: A.Value -> AT.Parser BotSetting
parseBotSettingInlineQueryPlaceholder :: Value -> Parser BotSetting
parseBotSettingInlineQueryPlaceholder = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingInlineQueryPlaceholder" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
placeholder_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"placeholder"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingInlineQueryPlaceholder
{ placeholder :: Maybe Text
placeholder = Maybe Text
placeholder_
}
parseBotSettingNeedLocation :: A.Value -> AT.Parser BotSetting
parseBotSettingNeedLocation :: Value -> Parser BotSetting
parseBotSettingNeedLocation = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingNeedLocation" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
need_location_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"need_location"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingNeedLocation
{ need_location :: Maybe Bool
need_location = Maybe Bool
need_location_
}
parseBotSettingInlineFeedback :: A.Value -> AT.Parser BotSetting
parseBotSettingInlineFeedback :: Value -> Parser BotSetting
parseBotSettingInlineFeedback = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingInlineFeedback" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
share_denominator_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"share_denominator"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingInlineFeedback
{ share_denominator :: Maybe Int
share_denominator = Maybe Int
share_denominator_
}
parseBotSettingCanJoinGroups :: A.Value -> AT.Parser BotSetting
parseBotSettingCanJoinGroups :: Value -> Parser BotSetting
parseBotSettingCanJoinGroups = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingCanJoinGroups" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
can_join_groups_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_join_groups"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingCanJoinGroups
{ can_join_groups :: Maybe Bool
can_join_groups = Maybe Bool
can_join_groups_
}
parseBotSettingCanReadAllGroupMessages :: A.Value -> AT.Parser BotSetting
parseBotSettingCanReadAllGroupMessages :: Value -> Parser BotSetting
parseBotSettingCanReadAllGroupMessages = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingCanReadAllGroupMessages" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
can_read_all_group_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_read_all_group_messages"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingCanReadAllGroupMessages
{ can_read_all_group_messages :: Maybe Bool
can_read_all_group_messages = Maybe Bool
can_read_all_group_messages_
}
parseBotSettingCanConnectToBusiness :: A.Value -> AT.Parser BotSetting
parseBotSettingCanConnectToBusiness :: Value -> Parser BotSetting
parseBotSettingCanConnectToBusiness = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingCanConnectToBusiness" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
can_connect_to_business_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_connect_to_business"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingCanConnectToBusiness
{ can_connect_to_business :: Maybe Bool
can_connect_to_business = Maybe Bool
can_connect_to_business_
}
parseBotSettingCanManageBots :: A.Value -> AT.Parser BotSetting
parseBotSettingCanManageBots :: Value -> Parser BotSetting
parseBotSettingCanManageBots = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingCanManageBots" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
can_manage_bots_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_manage_bots"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingCanManageBots
{ can_manage_bots :: Maybe Bool
can_manage_bots = Maybe Bool
can_manage_bots_
}
parseBotSettingSupportsGuestQueries :: A.Value -> AT.Parser BotSetting
parseBotSettingSupportsGuestQueries :: Value -> Parser BotSetting
parseBotSettingSupportsGuestQueries = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingSupportsGuestQueries" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
supports_guest_queries_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"supports_guest_queries"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingSupportsGuestQueries
{ supports_guest_queries :: Maybe Bool
supports_guest_queries = Maybe Bool
supports_guest_queries_
}
parseBotSettingIsGuard :: A.Value -> AT.Parser BotSetting
parseBotSettingIsGuard :: Value -> Parser BotSetting
parseBotSettingIsGuard = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingIsGuard" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
is_guard_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_guard"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingIsGuard
{ is_guard :: Maybe Bool
is_guard = Maybe Bool
is_guard_
}
parseBotSettingHasTopics :: A.Value -> AT.Parser BotSetting
parseBotSettingHasTopics :: Value -> Parser BotSetting
parseBotSettingHasTopics = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingHasTopics" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
has_topics_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_topics"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingHasTopics
{ has_topics :: Maybe Bool
has_topics = Maybe Bool
has_topics_
}
parseBotSettingAllowsUsersToCreateTopics :: A.Value -> AT.Parser BotSetting
parseBotSettingAllowsUsersToCreateTopics :: Value -> Parser BotSetting
parseBotSettingAllowsUsersToCreateTopics = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingAllowsUsersToCreateTopics" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
allows_users_to_create_topics_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"allows_users_to_create_topics"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingAllowsUsersToCreateTopics
{ allows_users_to_create_topics :: Maybe Bool
allows_users_to_create_topics = Maybe Bool
allows_users_to_create_topics_
}
parseBotSettingHasTopicSidebar :: A.Value -> AT.Parser BotSetting
parseBotSettingHasTopicSidebar :: Value -> Parser BotSetting
parseBotSettingHasTopicSidebar = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingHasTopicSidebar" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
has_topic_sidebar_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_topic_sidebar"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingHasTopicSidebar
{ has_topic_sidebar :: Maybe Bool
has_topic_sidebar = Maybe Bool
has_topic_sidebar_
}
parseBotSettingCanCommunicateWithBots :: A.Value -> AT.Parser BotSetting
parseBotSettingCanCommunicateWithBots :: Value -> Parser BotSetting
parseBotSettingCanCommunicateWithBots = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingCanCommunicateWithBots" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
can_communicate_with_bots_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_communicate_with_bots"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingCanCommunicateWithBots
{ can_communicate_with_bots :: Maybe Bool
can_communicate_with_bots = Maybe Bool
can_communicate_with_bots_
}
parseBotSettingCallbackQueryMode :: A.Value -> AT.Parser BotSetting
parseBotSettingCallbackQueryMode :: Value -> Parser BotSetting
parseBotSettingCallbackQueryMode = String
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotSettingCallbackQueryMode" ((Object -> Parser BotSetting) -> Value -> Parser BotSetting)
-> (Object -> Parser BotSetting) -> Value -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe BotCallbackQueryMode
mode_ <- Object
o Object -> Key -> Parser (Maybe BotCallbackQueryMode)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"mode"
BotSetting -> Parser BotSetting
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotSetting -> Parser BotSetting)
-> BotSetting -> Parser BotSetting
forall a b. (a -> b) -> a -> b
$ BotSettingCallbackQueryMode
{ mode :: Maybe BotCallbackQueryMode
mode = Maybe BotCallbackQueryMode
mode_
}
parseJSON Value
_ = Parser BotSetting
forall a. Monoid a => a
mempty
instance AT.ToJSON BotSetting where
toJSON :: BotSetting -> Value
toJSON BotSettingIsInline
{ is_inline :: BotSetting -> Maybe Bool
is_inline = Maybe Bool
is_inline_
}
= [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
"botSettingIsInline"
, Key
"is_inline" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_inline_
]
toJSON BotSettingInlineQueryPlaceholder
{ placeholder :: BotSetting -> Maybe Text
placeholder = Maybe Text
placeholder_
}
= [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
"botSettingInlineQueryPlaceholder"
, Key
"placeholder" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
placeholder_
]
toJSON BotSettingNeedLocation
{ need_location :: BotSetting -> Maybe Bool
need_location = Maybe Bool
need_location_
}
= [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
"botSettingNeedLocation"
, Key
"need_location" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
need_location_
]
toJSON BotSettingInlineFeedback
{ share_denominator :: BotSetting -> Maybe Int
share_denominator = Maybe Int
share_denominator_
}
= [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
"botSettingInlineFeedback"
, Key
"share_denominator" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
share_denominator_
]
toJSON BotSettingCanJoinGroups
{ can_join_groups :: BotSetting -> Maybe Bool
can_join_groups = Maybe Bool
can_join_groups_
}
= [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
"botSettingCanJoinGroups"
, Key
"can_join_groups" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
can_join_groups_
]
toJSON BotSettingCanReadAllGroupMessages
{ can_read_all_group_messages :: BotSetting -> Maybe Bool
can_read_all_group_messages = Maybe Bool
can_read_all_group_messages_
}
= [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
"botSettingCanReadAllGroupMessages"
, Key
"can_read_all_group_messages" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
can_read_all_group_messages_
]
toJSON BotSettingCanConnectToBusiness
{ can_connect_to_business :: BotSetting -> Maybe Bool
can_connect_to_business = Maybe Bool
can_connect_to_business_
}
= [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
"botSettingCanConnectToBusiness"
, Key
"can_connect_to_business" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
can_connect_to_business_
]
toJSON BotSettingCanManageBots
{ can_manage_bots :: BotSetting -> Maybe Bool
can_manage_bots = Maybe Bool
can_manage_bots_
}
= [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
"botSettingCanManageBots"
, Key
"can_manage_bots" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
can_manage_bots_
]
toJSON BotSettingSupportsGuestQueries
{ supports_guest_queries :: BotSetting -> Maybe Bool
supports_guest_queries = Maybe Bool
supports_guest_queries_
}
= [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
"botSettingSupportsGuestQueries"
, Key
"supports_guest_queries" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
supports_guest_queries_
]
toJSON BotSettingIsGuard
{ is_guard :: BotSetting -> Maybe Bool
is_guard = Maybe Bool
is_guard_
}
= [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
"botSettingIsGuard"
, Key
"is_guard" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_guard_
]
toJSON BotSettingHasTopics
{ has_topics :: BotSetting -> Maybe Bool
has_topics = Maybe Bool
has_topics_
}
= [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
"botSettingHasTopics"
, Key
"has_topics" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
has_topics_
]
toJSON BotSettingAllowsUsersToCreateTopics
{ allows_users_to_create_topics :: BotSetting -> Maybe Bool
allows_users_to_create_topics = Maybe Bool
allows_users_to_create_topics_
}
= [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
"botSettingAllowsUsersToCreateTopics"
, Key
"allows_users_to_create_topics" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
allows_users_to_create_topics_
]
toJSON BotSettingHasTopicSidebar
{ has_topic_sidebar :: BotSetting -> Maybe Bool
has_topic_sidebar = Maybe Bool
has_topic_sidebar_
}
= [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
"botSettingHasTopicSidebar"
, Key
"has_topic_sidebar" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
has_topic_sidebar_
]
toJSON BotSettingCanCommunicateWithBots
{ can_communicate_with_bots :: BotSetting -> Maybe Bool
can_communicate_with_bots = Maybe Bool
can_communicate_with_bots_
}
= [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
"botSettingCanCommunicateWithBots"
, Key
"can_communicate_with_bots" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
can_communicate_with_bots_
]
toJSON BotSettingCallbackQueryMode
{ mode :: BotSetting -> Maybe BotCallbackQueryMode
mode = Maybe BotCallbackQueryMode
mode_
}
= [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
"botSettingCallbackQueryMode"
, Key
"mode" Key -> Maybe BotCallbackQueryMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe BotCallbackQueryMode
mode_
]