module TD.Data.ChatAdministratorRights
( ChatAdministratorRights(..)
, defaultChatAdministratorRights
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data ChatAdministratorRights
= ChatAdministratorRights
{ ChatAdministratorRights -> Maybe Bool
can_manage_chat :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_change_info :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_post_messages :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_edit_messages :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_delete_messages :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_invite_users :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_restrict_members :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_pin_messages :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_manage_topics :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_promote_members :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_manage_video_chats :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_post_stories :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_edit_stories :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
can_delete_stories :: Maybe Bool
, ChatAdministratorRights -> Maybe Bool
is_anonymous :: Maybe Bool
}
deriving (ChatAdministratorRights -> ChatAdministratorRights -> Bool
(ChatAdministratorRights -> ChatAdministratorRights -> Bool)
-> (ChatAdministratorRights -> ChatAdministratorRights -> Bool)
-> Eq ChatAdministratorRights
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ChatAdministratorRights -> ChatAdministratorRights -> Bool
== :: ChatAdministratorRights -> ChatAdministratorRights -> Bool
$c/= :: ChatAdministratorRights -> ChatAdministratorRights -> Bool
/= :: ChatAdministratorRights -> ChatAdministratorRights -> Bool
Eq, Int -> ChatAdministratorRights -> ShowS
[ChatAdministratorRights] -> ShowS
ChatAdministratorRights -> String
(Int -> ChatAdministratorRights -> ShowS)
-> (ChatAdministratorRights -> String)
-> ([ChatAdministratorRights] -> ShowS)
-> Show ChatAdministratorRights
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatAdministratorRights -> ShowS
showsPrec :: Int -> ChatAdministratorRights -> ShowS
$cshow :: ChatAdministratorRights -> String
show :: ChatAdministratorRights -> String
$cshowList :: [ChatAdministratorRights] -> ShowS
showList :: [ChatAdministratorRights] -> ShowS
Show)
instance I.ShortShow ChatAdministratorRights where
shortShow :: ChatAdministratorRights -> String
shortShow ChatAdministratorRights
{ can_manage_chat :: ChatAdministratorRights -> Maybe Bool
can_manage_chat = Maybe Bool
can_manage_chat_
, can_change_info :: ChatAdministratorRights -> Maybe Bool
can_change_info = Maybe Bool
can_change_info_
, can_post_messages :: ChatAdministratorRights -> Maybe Bool
can_post_messages = Maybe Bool
can_post_messages_
, can_edit_messages :: ChatAdministratorRights -> Maybe Bool
can_edit_messages = Maybe Bool
can_edit_messages_
, can_delete_messages :: ChatAdministratorRights -> Maybe Bool
can_delete_messages = Maybe Bool
can_delete_messages_
, can_invite_users :: ChatAdministratorRights -> Maybe Bool
can_invite_users = Maybe Bool
can_invite_users_
, can_restrict_members :: ChatAdministratorRights -> Maybe Bool
can_restrict_members = Maybe Bool
can_restrict_members_
, can_pin_messages :: ChatAdministratorRights -> Maybe Bool
can_pin_messages = Maybe Bool
can_pin_messages_
, can_manage_topics :: ChatAdministratorRights -> Maybe Bool
can_manage_topics = Maybe Bool
can_manage_topics_
, can_promote_members :: ChatAdministratorRights -> Maybe Bool
can_promote_members = Maybe Bool
can_promote_members_
, can_manage_video_chats :: ChatAdministratorRights -> Maybe Bool
can_manage_video_chats = Maybe Bool
can_manage_video_chats_
, can_post_stories :: ChatAdministratorRights -> Maybe Bool
can_post_stories = Maybe Bool
can_post_stories_
, can_edit_stories :: ChatAdministratorRights -> Maybe Bool
can_edit_stories = Maybe Bool
can_edit_stories_
, can_delete_stories :: ChatAdministratorRights -> Maybe Bool
can_delete_stories = Maybe Bool
can_delete_stories_
, is_anonymous :: ChatAdministratorRights -> Maybe Bool
is_anonymous = Maybe Bool
is_anonymous_
}
= String
"ChatAdministratorRights"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"can_manage_chat" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_manage_chat_
, String
"can_change_info" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_change_info_
, String
"can_post_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_post_messages_
, String
"can_edit_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_edit_messages_
, String
"can_delete_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_delete_messages_
, String
"can_invite_users" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_invite_users_
, String
"can_restrict_members" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_restrict_members_
, String
"can_pin_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_pin_messages_
, String
"can_manage_topics" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_manage_topics_
, String
"can_promote_members" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_promote_members_
, String
"can_manage_video_chats" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_manage_video_chats_
, String
"can_post_stories" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_post_stories_
, String
"can_edit_stories" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_edit_stories_
, String
"can_delete_stories" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_delete_stories_
, String
"is_anonymous" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_anonymous_
]
instance AT.FromJSON ChatAdministratorRights where
parseJSON :: Value -> Parser ChatAdministratorRights
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
"chatAdministratorRights" -> Value -> Parser ChatAdministratorRights
parseChatAdministratorRights Value
v
String
_ -> Parser ChatAdministratorRights
forall a. Monoid a => a
mempty
where
parseChatAdministratorRights :: A.Value -> AT.Parser ChatAdministratorRights
parseChatAdministratorRights :: Value -> Parser ChatAdministratorRights
parseChatAdministratorRights = String
-> (Object -> Parser ChatAdministratorRights)
-> Value
-> Parser ChatAdministratorRights
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"ChatAdministratorRights" ((Object -> Parser ChatAdministratorRights)
-> Value -> Parser ChatAdministratorRights)
-> (Object -> Parser ChatAdministratorRights)
-> Value
-> Parser ChatAdministratorRights
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
can_manage_chat_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_manage_chat"
Maybe Bool
can_change_info_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_change_info"
Maybe Bool
can_post_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_post_messages"
Maybe Bool
can_edit_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_edit_messages"
Maybe Bool
can_delete_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_delete_messages"
Maybe Bool
can_invite_users_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_invite_users"
Maybe Bool
can_restrict_members_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_restrict_members"
Maybe Bool
can_pin_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_pin_messages"
Maybe Bool
can_manage_topics_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_manage_topics"
Maybe Bool
can_promote_members_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_promote_members"
Maybe Bool
can_manage_video_chats_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_manage_video_chats"
Maybe Bool
can_post_stories_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_post_stories"
Maybe Bool
can_edit_stories_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_edit_stories"
Maybe Bool
can_delete_stories_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_delete_stories"
Maybe Bool
is_anonymous_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_anonymous"
ChatAdministratorRights -> Parser ChatAdministratorRights
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ChatAdministratorRights -> Parser ChatAdministratorRights)
-> ChatAdministratorRights -> Parser ChatAdministratorRights
forall a b. (a -> b) -> a -> b
$ ChatAdministratorRights
{ can_manage_chat :: Maybe Bool
can_manage_chat = Maybe Bool
can_manage_chat_
, can_change_info :: Maybe Bool
can_change_info = Maybe Bool
can_change_info_
, can_post_messages :: Maybe Bool
can_post_messages = Maybe Bool
can_post_messages_
, can_edit_messages :: Maybe Bool
can_edit_messages = Maybe Bool
can_edit_messages_
, can_delete_messages :: Maybe Bool
can_delete_messages = Maybe Bool
can_delete_messages_
, can_invite_users :: Maybe Bool
can_invite_users = Maybe Bool
can_invite_users_
, can_restrict_members :: Maybe Bool
can_restrict_members = Maybe Bool
can_restrict_members_
, can_pin_messages :: Maybe Bool
can_pin_messages = Maybe Bool
can_pin_messages_
, can_manage_topics :: Maybe Bool
can_manage_topics = Maybe Bool
can_manage_topics_
, can_promote_members :: Maybe Bool
can_promote_members = Maybe Bool
can_promote_members_
, can_manage_video_chats :: Maybe Bool
can_manage_video_chats = Maybe Bool
can_manage_video_chats_
, can_post_stories :: Maybe Bool
can_post_stories = Maybe Bool
can_post_stories_
, can_edit_stories :: Maybe Bool
can_edit_stories = Maybe Bool
can_edit_stories_
, can_delete_stories :: Maybe Bool
can_delete_stories = Maybe Bool
can_delete_stories_
, is_anonymous :: Maybe Bool
is_anonymous = Maybe Bool
is_anonymous_
}
parseJSON Value
_ = Parser ChatAdministratorRights
forall a. Monoid a => a
mempty
instance AT.ToJSON ChatAdministratorRights where
toJSON :: ChatAdministratorRights -> Value
toJSON ChatAdministratorRights
{ can_manage_chat :: ChatAdministratorRights -> Maybe Bool
can_manage_chat = Maybe Bool
can_manage_chat_
, can_change_info :: ChatAdministratorRights -> Maybe Bool
can_change_info = Maybe Bool
can_change_info_
, can_post_messages :: ChatAdministratorRights -> Maybe Bool
can_post_messages = Maybe Bool
can_post_messages_
, can_edit_messages :: ChatAdministratorRights -> Maybe Bool
can_edit_messages = Maybe Bool
can_edit_messages_
, can_delete_messages :: ChatAdministratorRights -> Maybe Bool
can_delete_messages = Maybe Bool
can_delete_messages_
, can_invite_users :: ChatAdministratorRights -> Maybe Bool
can_invite_users = Maybe Bool
can_invite_users_
, can_restrict_members :: ChatAdministratorRights -> Maybe Bool
can_restrict_members = Maybe Bool
can_restrict_members_
, can_pin_messages :: ChatAdministratorRights -> Maybe Bool
can_pin_messages = Maybe Bool
can_pin_messages_
, can_manage_topics :: ChatAdministratorRights -> Maybe Bool
can_manage_topics = Maybe Bool
can_manage_topics_
, can_promote_members :: ChatAdministratorRights -> Maybe Bool
can_promote_members = Maybe Bool
can_promote_members_
, can_manage_video_chats :: ChatAdministratorRights -> Maybe Bool
can_manage_video_chats = Maybe Bool
can_manage_video_chats_
, can_post_stories :: ChatAdministratorRights -> Maybe Bool
can_post_stories = Maybe Bool
can_post_stories_
, can_edit_stories :: ChatAdministratorRights -> Maybe Bool
can_edit_stories = Maybe Bool
can_edit_stories_
, can_delete_stories :: ChatAdministratorRights -> Maybe Bool
can_delete_stories = Maybe Bool
can_delete_stories_
, is_anonymous :: ChatAdministratorRights -> Maybe Bool
is_anonymous = Maybe Bool
is_anonymous_
}
= [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
"chatAdministratorRights"
, Key
"can_manage_chat" 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_chat_
, Key
"can_change_info" 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_info_
, Key
"can_post_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_post_messages_
, Key
"can_edit_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_edit_messages_
, Key
"can_delete_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_messages_
, Key
"can_invite_users" 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_invite_users_
, Key
"can_restrict_members" 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_restrict_members_
, Key
"can_pin_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_pin_messages_
, Key
"can_manage_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
can_manage_topics_
, Key
"can_promote_members" 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_promote_members_
, Key
"can_manage_video_chats" 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_video_chats_
, Key
"can_post_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_post_stories_
, Key
"can_edit_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_edit_stories_
, Key
"can_delete_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_delete_stories_
, Key
"is_anonymous" 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_anonymous_
]
defaultChatAdministratorRights :: ChatAdministratorRights
defaultChatAdministratorRights :: ChatAdministratorRights
defaultChatAdministratorRights =
ChatAdministratorRights
{ can_manage_chat :: Maybe Bool
can_manage_chat = Maybe Bool
forall a. Maybe a
Nothing
, can_change_info :: Maybe Bool
can_change_info = Maybe Bool
forall a. Maybe a
Nothing
, can_post_messages :: Maybe Bool
can_post_messages = Maybe Bool
forall a. Maybe a
Nothing
, can_edit_messages :: Maybe Bool
can_edit_messages = Maybe Bool
forall a. Maybe a
Nothing
, can_delete_messages :: Maybe Bool
can_delete_messages = Maybe Bool
forall a. Maybe a
Nothing
, can_invite_users :: Maybe Bool
can_invite_users = Maybe Bool
forall a. Maybe a
Nothing
, can_restrict_members :: Maybe Bool
can_restrict_members = Maybe Bool
forall a. Maybe a
Nothing
, can_pin_messages :: Maybe Bool
can_pin_messages = Maybe Bool
forall a. Maybe a
Nothing
, can_manage_topics :: Maybe Bool
can_manage_topics = Maybe Bool
forall a. Maybe a
Nothing
, can_promote_members :: Maybe Bool
can_promote_members = Maybe Bool
forall a. Maybe a
Nothing
, can_manage_video_chats :: Maybe Bool
can_manage_video_chats = Maybe Bool
forall a. Maybe a
Nothing
, can_post_stories :: Maybe Bool
can_post_stories = Maybe Bool
forall a. Maybe a
Nothing
, can_edit_stories :: Maybe Bool
can_edit_stories = Maybe Bool
forall a. Maybe a
Nothing
, can_delete_stories :: Maybe Bool
can_delete_stories = Maybe Bool
forall a. Maybe a
Nothing
, is_anonymous :: Maybe Bool
is_anonymous = Maybe Bool
forall a. Maybe a
Nothing
}