module TD.Data.BusinessBotRights
( BusinessBotRights(..)
, defaultBusinessBotRights
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data BusinessBotRights
= BusinessBotRights
{ BusinessBotRights -> Maybe Bool
can_reply :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_read_messages :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_delete_sent_messages :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_delete_all_messages :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_edit_name :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_edit_bio :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_edit_profile_photo :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_edit_username :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_view_gifts_and_stars :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_sell_gifts :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_change_gift_settings :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_transfer_and_upgrade_gifts :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_transfer_stars :: Maybe Bool
, BusinessBotRights -> Maybe Bool
can_manage_stories :: Maybe Bool
}
deriving (BusinessBotRights -> BusinessBotRights -> Bool
(BusinessBotRights -> BusinessBotRights -> Bool)
-> (BusinessBotRights -> BusinessBotRights -> Bool)
-> Eq BusinessBotRights
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BusinessBotRights -> BusinessBotRights -> Bool
== :: BusinessBotRights -> BusinessBotRights -> Bool
$c/= :: BusinessBotRights -> BusinessBotRights -> Bool
/= :: BusinessBotRights -> BusinessBotRights -> Bool
Eq, Int -> BusinessBotRights -> ShowS
[BusinessBotRights] -> ShowS
BusinessBotRights -> String
(Int -> BusinessBotRights -> ShowS)
-> (BusinessBotRights -> String)
-> ([BusinessBotRights] -> ShowS)
-> Show BusinessBotRights
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BusinessBotRights -> ShowS
showsPrec :: Int -> BusinessBotRights -> ShowS
$cshow :: BusinessBotRights -> String
show :: BusinessBotRights -> String
$cshowList :: [BusinessBotRights] -> ShowS
showList :: [BusinessBotRights] -> ShowS
Show)
instance I.ShortShow BusinessBotRights where
shortShow :: BusinessBotRights -> String
shortShow BusinessBotRights
{ can_reply :: BusinessBotRights -> Maybe Bool
can_reply = Maybe Bool
can_reply_
, can_read_messages :: BusinessBotRights -> Maybe Bool
can_read_messages = Maybe Bool
can_read_messages_
, can_delete_sent_messages :: BusinessBotRights -> Maybe Bool
can_delete_sent_messages = Maybe Bool
can_delete_sent_messages_
, can_delete_all_messages :: BusinessBotRights -> Maybe Bool
can_delete_all_messages = Maybe Bool
can_delete_all_messages_
, can_edit_name :: BusinessBotRights -> Maybe Bool
can_edit_name = Maybe Bool
can_edit_name_
, can_edit_bio :: BusinessBotRights -> Maybe Bool
can_edit_bio = Maybe Bool
can_edit_bio_
, can_edit_profile_photo :: BusinessBotRights -> Maybe Bool
can_edit_profile_photo = Maybe Bool
can_edit_profile_photo_
, can_edit_username :: BusinessBotRights -> Maybe Bool
can_edit_username = Maybe Bool
can_edit_username_
, can_view_gifts_and_stars :: BusinessBotRights -> Maybe Bool
can_view_gifts_and_stars = Maybe Bool
can_view_gifts_and_stars_
, can_sell_gifts :: BusinessBotRights -> Maybe Bool
can_sell_gifts = Maybe Bool
can_sell_gifts_
, can_change_gift_settings :: BusinessBotRights -> Maybe Bool
can_change_gift_settings = Maybe Bool
can_change_gift_settings_
, can_transfer_and_upgrade_gifts :: BusinessBotRights -> Maybe Bool
can_transfer_and_upgrade_gifts = Maybe Bool
can_transfer_and_upgrade_gifts_
, can_transfer_stars :: BusinessBotRights -> Maybe Bool
can_transfer_stars = Maybe Bool
can_transfer_stars_
, can_manage_stories :: BusinessBotRights -> Maybe Bool
can_manage_stories = Maybe Bool
can_manage_stories_
}
= String
"BusinessBotRights"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"can_reply" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_reply_
, String
"can_read_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_read_messages_
, String
"can_delete_sent_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_delete_sent_messages_
, String
"can_delete_all_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_delete_all_messages_
, String
"can_edit_name" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_edit_name_
, String
"can_edit_bio" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_edit_bio_
, String
"can_edit_profile_photo" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_edit_profile_photo_
, String
"can_edit_username" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_edit_username_
, String
"can_view_gifts_and_stars" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_view_gifts_and_stars_
, String
"can_sell_gifts" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_sell_gifts_
, String
"can_change_gift_settings" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_change_gift_settings_
, String
"can_transfer_and_upgrade_gifts" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_transfer_and_upgrade_gifts_
, String
"can_transfer_stars" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_transfer_stars_
, String
"can_manage_stories" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_manage_stories_
]
instance AT.FromJSON BusinessBotRights where
parseJSON :: Value -> Parser BusinessBotRights
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
"businessBotRights" -> Value -> Parser BusinessBotRights
parseBusinessBotRights Value
v
String
_ -> Parser BusinessBotRights
forall a. Monoid a => a
mempty
where
parseBusinessBotRights :: A.Value -> AT.Parser BusinessBotRights
parseBusinessBotRights :: Value -> Parser BusinessBotRights
parseBusinessBotRights = String
-> (Object -> Parser BusinessBotRights)
-> Value
-> Parser BusinessBotRights
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BusinessBotRights" ((Object -> Parser BusinessBotRights)
-> Value -> Parser BusinessBotRights)
-> (Object -> Parser BusinessBotRights)
-> Value
-> Parser BusinessBotRights
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
can_reply_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_reply"
Maybe Bool
can_read_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_read_messages"
Maybe Bool
can_delete_sent_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_delete_sent_messages"
Maybe Bool
can_delete_all_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_delete_all_messages"
Maybe Bool
can_edit_name_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_edit_name"
Maybe Bool
can_edit_bio_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_edit_bio"
Maybe Bool
can_edit_profile_photo_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_edit_profile_photo"
Maybe Bool
can_edit_username_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_edit_username"
Maybe Bool
can_view_gifts_and_stars_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_view_gifts_and_stars"
Maybe Bool
can_sell_gifts_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_sell_gifts"
Maybe Bool
can_change_gift_settings_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_change_gift_settings"
Maybe Bool
can_transfer_and_upgrade_gifts_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_transfer_and_upgrade_gifts"
Maybe Bool
can_transfer_stars_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_transfer_stars"
Maybe Bool
can_manage_stories_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_manage_stories"
BusinessBotRights -> Parser BusinessBotRights
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BusinessBotRights -> Parser BusinessBotRights)
-> BusinessBotRights -> Parser BusinessBotRights
forall a b. (a -> b) -> a -> b
$ BusinessBotRights
{ can_reply :: Maybe Bool
can_reply = Maybe Bool
can_reply_
, can_read_messages :: Maybe Bool
can_read_messages = Maybe Bool
can_read_messages_
, can_delete_sent_messages :: Maybe Bool
can_delete_sent_messages = Maybe Bool
can_delete_sent_messages_
, can_delete_all_messages :: Maybe Bool
can_delete_all_messages = Maybe Bool
can_delete_all_messages_
, can_edit_name :: Maybe Bool
can_edit_name = Maybe Bool
can_edit_name_
, can_edit_bio :: Maybe Bool
can_edit_bio = Maybe Bool
can_edit_bio_
, can_edit_profile_photo :: Maybe Bool
can_edit_profile_photo = Maybe Bool
can_edit_profile_photo_
, can_edit_username :: Maybe Bool
can_edit_username = Maybe Bool
can_edit_username_
, can_view_gifts_and_stars :: Maybe Bool
can_view_gifts_and_stars = Maybe Bool
can_view_gifts_and_stars_
, can_sell_gifts :: Maybe Bool
can_sell_gifts = Maybe Bool
can_sell_gifts_
, can_change_gift_settings :: Maybe Bool
can_change_gift_settings = Maybe Bool
can_change_gift_settings_
, can_transfer_and_upgrade_gifts :: Maybe Bool
can_transfer_and_upgrade_gifts = Maybe Bool
can_transfer_and_upgrade_gifts_
, can_transfer_stars :: Maybe Bool
can_transfer_stars = Maybe Bool
can_transfer_stars_
, can_manage_stories :: Maybe Bool
can_manage_stories = Maybe Bool
can_manage_stories_
}
parseJSON Value
_ = Parser BusinessBotRights
forall a. Monoid a => a
mempty
instance AT.ToJSON BusinessBotRights where
toJSON :: BusinessBotRights -> Value
toJSON BusinessBotRights
{ can_reply :: BusinessBotRights -> Maybe Bool
can_reply = Maybe Bool
can_reply_
, can_read_messages :: BusinessBotRights -> Maybe Bool
can_read_messages = Maybe Bool
can_read_messages_
, can_delete_sent_messages :: BusinessBotRights -> Maybe Bool
can_delete_sent_messages = Maybe Bool
can_delete_sent_messages_
, can_delete_all_messages :: BusinessBotRights -> Maybe Bool
can_delete_all_messages = Maybe Bool
can_delete_all_messages_
, can_edit_name :: BusinessBotRights -> Maybe Bool
can_edit_name = Maybe Bool
can_edit_name_
, can_edit_bio :: BusinessBotRights -> Maybe Bool
can_edit_bio = Maybe Bool
can_edit_bio_
, can_edit_profile_photo :: BusinessBotRights -> Maybe Bool
can_edit_profile_photo = Maybe Bool
can_edit_profile_photo_
, can_edit_username :: BusinessBotRights -> Maybe Bool
can_edit_username = Maybe Bool
can_edit_username_
, can_view_gifts_and_stars :: BusinessBotRights -> Maybe Bool
can_view_gifts_and_stars = Maybe Bool
can_view_gifts_and_stars_
, can_sell_gifts :: BusinessBotRights -> Maybe Bool
can_sell_gifts = Maybe Bool
can_sell_gifts_
, can_change_gift_settings :: BusinessBotRights -> Maybe Bool
can_change_gift_settings = Maybe Bool
can_change_gift_settings_
, can_transfer_and_upgrade_gifts :: BusinessBotRights -> Maybe Bool
can_transfer_and_upgrade_gifts = Maybe Bool
can_transfer_and_upgrade_gifts_
, can_transfer_stars :: BusinessBotRights -> Maybe Bool
can_transfer_stars = Maybe Bool
can_transfer_stars_
, can_manage_stories :: BusinessBotRights -> Maybe Bool
can_manage_stories = Maybe Bool
can_manage_stories_
}
= [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
"businessBotRights"
, Key
"can_reply" 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_reply_
, Key
"can_read_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_messages_
, Key
"can_delete_sent_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_delete_sent_messages_
, Key
"can_delete_all_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_delete_all_messages_
, Key
"can_edit_name" 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_edit_name_
, Key
"can_edit_bio" 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_edit_bio_
, Key
"can_edit_profile_photo" 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_edit_profile_photo_
, Key
"can_edit_username" 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_edit_username_
, Key
"can_view_gifts_and_stars" 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_view_gifts_and_stars_
, Key
"can_sell_gifts" 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_sell_gifts_
, Key
"can_change_gift_settings" 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_change_gift_settings_
, Key
"can_transfer_and_upgrade_gifts" 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_transfer_and_upgrade_gifts_
, Key
"can_transfer_stars" 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_transfer_stars_
, Key
"can_manage_stories" 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_stories_
]
defaultBusinessBotRights :: BusinessBotRights
defaultBusinessBotRights :: BusinessBotRights
defaultBusinessBotRights =
BusinessBotRights
{ can_reply :: Maybe Bool
can_reply = Maybe Bool
forall a. Maybe a
Nothing
, can_read_messages :: Maybe Bool
can_read_messages = Maybe Bool
forall a. Maybe a
Nothing
, can_delete_sent_messages :: Maybe Bool
can_delete_sent_messages = Maybe Bool
forall a. Maybe a
Nothing
, can_delete_all_messages :: Maybe Bool
can_delete_all_messages = Maybe Bool
forall a. Maybe a
Nothing
, can_edit_name :: Maybe Bool
can_edit_name = Maybe Bool
forall a. Maybe a
Nothing
, can_edit_bio :: Maybe Bool
can_edit_bio = Maybe Bool
forall a. Maybe a
Nothing
, can_edit_profile_photo :: Maybe Bool
can_edit_profile_photo = Maybe Bool
forall a. Maybe a
Nothing
, can_edit_username :: Maybe Bool
can_edit_username = Maybe Bool
forall a. Maybe a
Nothing
, can_view_gifts_and_stars :: Maybe Bool
can_view_gifts_and_stars = Maybe Bool
forall a. Maybe a
Nothing
, can_sell_gifts :: Maybe Bool
can_sell_gifts = Maybe Bool
forall a. Maybe a
Nothing
, can_change_gift_settings :: Maybe Bool
can_change_gift_settings = Maybe Bool
forall a. Maybe a
Nothing
, can_transfer_and_upgrade_gifts :: Maybe Bool
can_transfer_and_upgrade_gifts = Maybe Bool
forall a. Maybe a
Nothing
, can_transfer_stars :: Maybe Bool
can_transfer_stars = Maybe Bool
forall a. Maybe a
Nothing
, can_manage_stories :: Maybe Bool
can_manage_stories = Maybe Bool
forall a. Maybe a
Nothing
}