module TD.Data.ChatEventLogFilters
( ChatEventLogFilters(..)
, defaultChatEventLogFilters
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data ChatEventLogFilters
= ChatEventLogFilters
{ ChatEventLogFilters -> Maybe Bool
message_edits :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
message_deletions :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
message_pins :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
member_joins :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
member_leaves :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
member_invites :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
member_promotions :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
member_restrictions :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
info_changes :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
setting_changes :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
invite_link_changes :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
video_chat_changes :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
forum_changes :: Maybe Bool
, ChatEventLogFilters -> Maybe Bool
subscription_extensions :: Maybe Bool
}
deriving (ChatEventLogFilters -> ChatEventLogFilters -> Bool
(ChatEventLogFilters -> ChatEventLogFilters -> Bool)
-> (ChatEventLogFilters -> ChatEventLogFilters -> Bool)
-> Eq ChatEventLogFilters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ChatEventLogFilters -> ChatEventLogFilters -> Bool
== :: ChatEventLogFilters -> ChatEventLogFilters -> Bool
$c/= :: ChatEventLogFilters -> ChatEventLogFilters -> Bool
/= :: ChatEventLogFilters -> ChatEventLogFilters -> Bool
Eq, Int -> ChatEventLogFilters -> ShowS
[ChatEventLogFilters] -> ShowS
ChatEventLogFilters -> String
(Int -> ChatEventLogFilters -> ShowS)
-> (ChatEventLogFilters -> String)
-> ([ChatEventLogFilters] -> ShowS)
-> Show ChatEventLogFilters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatEventLogFilters -> ShowS
showsPrec :: Int -> ChatEventLogFilters -> ShowS
$cshow :: ChatEventLogFilters -> String
show :: ChatEventLogFilters -> String
$cshowList :: [ChatEventLogFilters] -> ShowS
showList :: [ChatEventLogFilters] -> ShowS
Show)
instance I.ShortShow ChatEventLogFilters where
shortShow :: ChatEventLogFilters -> String
shortShow ChatEventLogFilters
{ message_edits :: ChatEventLogFilters -> Maybe Bool
message_edits = Maybe Bool
message_edits_
, message_deletions :: ChatEventLogFilters -> Maybe Bool
message_deletions = Maybe Bool
message_deletions_
, message_pins :: ChatEventLogFilters -> Maybe Bool
message_pins = Maybe Bool
message_pins_
, member_joins :: ChatEventLogFilters -> Maybe Bool
member_joins = Maybe Bool
member_joins_
, member_leaves :: ChatEventLogFilters -> Maybe Bool
member_leaves = Maybe Bool
member_leaves_
, member_invites :: ChatEventLogFilters -> Maybe Bool
member_invites = Maybe Bool
member_invites_
, member_promotions :: ChatEventLogFilters -> Maybe Bool
member_promotions = Maybe Bool
member_promotions_
, member_restrictions :: ChatEventLogFilters -> Maybe Bool
member_restrictions = Maybe Bool
member_restrictions_
, info_changes :: ChatEventLogFilters -> Maybe Bool
info_changes = Maybe Bool
info_changes_
, setting_changes :: ChatEventLogFilters -> Maybe Bool
setting_changes = Maybe Bool
setting_changes_
, invite_link_changes :: ChatEventLogFilters -> Maybe Bool
invite_link_changes = Maybe Bool
invite_link_changes_
, video_chat_changes :: ChatEventLogFilters -> Maybe Bool
video_chat_changes = Maybe Bool
video_chat_changes_
, forum_changes :: ChatEventLogFilters -> Maybe Bool
forum_changes = Maybe Bool
forum_changes_
, subscription_extensions :: ChatEventLogFilters -> Maybe Bool
subscription_extensions = Maybe Bool
subscription_extensions_
}
= String
"ChatEventLogFilters"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"message_edits" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
message_edits_
, String
"message_deletions" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
message_deletions_
, String
"message_pins" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
message_pins_
, String
"member_joins" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
member_joins_
, String
"member_leaves" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
member_leaves_
, String
"member_invites" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
member_invites_
, String
"member_promotions" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
member_promotions_
, String
"member_restrictions" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
member_restrictions_
, String
"info_changes" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
info_changes_
, String
"setting_changes" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
setting_changes_
, String
"invite_link_changes" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
invite_link_changes_
, String
"video_chat_changes" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
video_chat_changes_
, String
"forum_changes" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
forum_changes_
, String
"subscription_extensions" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
subscription_extensions_
]
instance AT.FromJSON ChatEventLogFilters where
parseJSON :: Value -> Parser ChatEventLogFilters
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
"chatEventLogFilters" -> Value -> Parser ChatEventLogFilters
parseChatEventLogFilters Value
v
String
_ -> Parser ChatEventLogFilters
forall a. Monoid a => a
mempty
where
parseChatEventLogFilters :: A.Value -> AT.Parser ChatEventLogFilters
parseChatEventLogFilters :: Value -> Parser ChatEventLogFilters
parseChatEventLogFilters = String
-> (Object -> Parser ChatEventLogFilters)
-> Value
-> Parser ChatEventLogFilters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"ChatEventLogFilters" ((Object -> Parser ChatEventLogFilters)
-> Value -> Parser ChatEventLogFilters)
-> (Object -> Parser ChatEventLogFilters)
-> Value
-> Parser ChatEventLogFilters
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
message_edits_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"message_edits"
Maybe Bool
message_deletions_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"message_deletions"
Maybe Bool
message_pins_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"message_pins"
Maybe Bool
member_joins_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"member_joins"
Maybe Bool
member_leaves_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"member_leaves"
Maybe Bool
member_invites_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"member_invites"
Maybe Bool
member_promotions_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"member_promotions"
Maybe Bool
member_restrictions_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"member_restrictions"
Maybe Bool
info_changes_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"info_changes"
Maybe Bool
setting_changes_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"setting_changes"
Maybe Bool
invite_link_changes_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"invite_link_changes"
Maybe Bool
video_chat_changes_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"video_chat_changes"
Maybe Bool
forum_changes_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"forum_changes"
Maybe Bool
subscription_extensions_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"subscription_extensions"
ChatEventLogFilters -> Parser ChatEventLogFilters
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ChatEventLogFilters -> Parser ChatEventLogFilters)
-> ChatEventLogFilters -> Parser ChatEventLogFilters
forall a b. (a -> b) -> a -> b
$ ChatEventLogFilters
{ message_edits :: Maybe Bool
message_edits = Maybe Bool
message_edits_
, message_deletions :: Maybe Bool
message_deletions = Maybe Bool
message_deletions_
, message_pins :: Maybe Bool
message_pins = Maybe Bool
message_pins_
, member_joins :: Maybe Bool
member_joins = Maybe Bool
member_joins_
, member_leaves :: Maybe Bool
member_leaves = Maybe Bool
member_leaves_
, member_invites :: Maybe Bool
member_invites = Maybe Bool
member_invites_
, member_promotions :: Maybe Bool
member_promotions = Maybe Bool
member_promotions_
, member_restrictions :: Maybe Bool
member_restrictions = Maybe Bool
member_restrictions_
, info_changes :: Maybe Bool
info_changes = Maybe Bool
info_changes_
, setting_changes :: Maybe Bool
setting_changes = Maybe Bool
setting_changes_
, invite_link_changes :: Maybe Bool
invite_link_changes = Maybe Bool
invite_link_changes_
, video_chat_changes :: Maybe Bool
video_chat_changes = Maybe Bool
video_chat_changes_
, forum_changes :: Maybe Bool
forum_changes = Maybe Bool
forum_changes_
, subscription_extensions :: Maybe Bool
subscription_extensions = Maybe Bool
subscription_extensions_
}
parseJSON Value
_ = Parser ChatEventLogFilters
forall a. Monoid a => a
mempty
instance AT.ToJSON ChatEventLogFilters where
toJSON :: ChatEventLogFilters -> Value
toJSON ChatEventLogFilters
{ message_edits :: ChatEventLogFilters -> Maybe Bool
message_edits = Maybe Bool
message_edits_
, message_deletions :: ChatEventLogFilters -> Maybe Bool
message_deletions = Maybe Bool
message_deletions_
, message_pins :: ChatEventLogFilters -> Maybe Bool
message_pins = Maybe Bool
message_pins_
, member_joins :: ChatEventLogFilters -> Maybe Bool
member_joins = Maybe Bool
member_joins_
, member_leaves :: ChatEventLogFilters -> Maybe Bool
member_leaves = Maybe Bool
member_leaves_
, member_invites :: ChatEventLogFilters -> Maybe Bool
member_invites = Maybe Bool
member_invites_
, member_promotions :: ChatEventLogFilters -> Maybe Bool
member_promotions = Maybe Bool
member_promotions_
, member_restrictions :: ChatEventLogFilters -> Maybe Bool
member_restrictions = Maybe Bool
member_restrictions_
, info_changes :: ChatEventLogFilters -> Maybe Bool
info_changes = Maybe Bool
info_changes_
, setting_changes :: ChatEventLogFilters -> Maybe Bool
setting_changes = Maybe Bool
setting_changes_
, invite_link_changes :: ChatEventLogFilters -> Maybe Bool
invite_link_changes = Maybe Bool
invite_link_changes_
, video_chat_changes :: ChatEventLogFilters -> Maybe Bool
video_chat_changes = Maybe Bool
video_chat_changes_
, forum_changes :: ChatEventLogFilters -> Maybe Bool
forum_changes = Maybe Bool
forum_changes_
, subscription_extensions :: ChatEventLogFilters -> Maybe Bool
subscription_extensions = Maybe Bool
subscription_extensions_
}
= [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
"chatEventLogFilters"
, Key
"message_edits" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
message_edits_
, Key
"message_deletions" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
message_deletions_
, Key
"message_pins" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
message_pins_
, Key
"member_joins" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
member_joins_
, Key
"member_leaves" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
member_leaves_
, Key
"member_invites" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
member_invites_
, Key
"member_promotions" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
member_promotions_
, Key
"member_restrictions" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
member_restrictions_
, Key
"info_changes" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
info_changes_
, Key
"setting_changes" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
setting_changes_
, Key
"invite_link_changes" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
invite_link_changes_
, Key
"video_chat_changes" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
video_chat_changes_
, Key
"forum_changes" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
forum_changes_
, Key
"subscription_extensions" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
subscription_extensions_
]
defaultChatEventLogFilters :: ChatEventLogFilters
defaultChatEventLogFilters :: ChatEventLogFilters
defaultChatEventLogFilters =
ChatEventLogFilters
{ message_edits :: Maybe Bool
message_edits = Maybe Bool
forall a. Maybe a
Nothing
, message_deletions :: Maybe Bool
message_deletions = Maybe Bool
forall a. Maybe a
Nothing
, message_pins :: Maybe Bool
message_pins = Maybe Bool
forall a. Maybe a
Nothing
, member_joins :: Maybe Bool
member_joins = Maybe Bool
forall a. Maybe a
Nothing
, member_leaves :: Maybe Bool
member_leaves = Maybe Bool
forall a. Maybe a
Nothing
, member_invites :: Maybe Bool
member_invites = Maybe Bool
forall a. Maybe a
Nothing
, member_promotions :: Maybe Bool
member_promotions = Maybe Bool
forall a. Maybe a
Nothing
, member_restrictions :: Maybe Bool
member_restrictions = Maybe Bool
forall a. Maybe a
Nothing
, info_changes :: Maybe Bool
info_changes = Maybe Bool
forall a. Maybe a
Nothing
, setting_changes :: Maybe Bool
setting_changes = Maybe Bool
forall a. Maybe a
Nothing
, invite_link_changes :: Maybe Bool
invite_link_changes = Maybe Bool
forall a. Maybe a
Nothing
, video_chat_changes :: Maybe Bool
video_chat_changes = Maybe Bool
forall a. Maybe a
Nothing
, forum_changes :: Maybe Bool
forum_changes = Maybe Bool
forall a. Maybe a
Nothing
, subscription_extensions :: Maybe Bool
subscription_extensions = Maybe Bool
forall a. Maybe a
Nothing
}