module TD.Query.SetForumTopicNotificationSettings
(SetForumTopicNotificationSettings(..)
, defaultSetForumTopicNotificationSettings
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.ChatNotificationSettings as ChatNotificationSettings
data SetForumTopicNotificationSettings
= SetForumTopicNotificationSettings
{ SetForumTopicNotificationSettings -> Maybe Int
chat_id :: Maybe Int
, SetForumTopicNotificationSettings -> Maybe Int
message_thread_id :: Maybe Int
, SetForumTopicNotificationSettings -> Maybe ChatNotificationSettings
notification_settings :: Maybe ChatNotificationSettings.ChatNotificationSettings
}
deriving (SetForumTopicNotificationSettings
-> SetForumTopicNotificationSettings -> Bool
(SetForumTopicNotificationSettings
-> SetForumTopicNotificationSettings -> Bool)
-> (SetForumTopicNotificationSettings
-> SetForumTopicNotificationSettings -> Bool)
-> Eq SetForumTopicNotificationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetForumTopicNotificationSettings
-> SetForumTopicNotificationSettings -> Bool
== :: SetForumTopicNotificationSettings
-> SetForumTopicNotificationSettings -> Bool
$c/= :: SetForumTopicNotificationSettings
-> SetForumTopicNotificationSettings -> Bool
/= :: SetForumTopicNotificationSettings
-> SetForumTopicNotificationSettings -> Bool
Eq, Int -> SetForumTopicNotificationSettings -> ShowS
[SetForumTopicNotificationSettings] -> ShowS
SetForumTopicNotificationSettings -> String
(Int -> SetForumTopicNotificationSettings -> ShowS)
-> (SetForumTopicNotificationSettings -> String)
-> ([SetForumTopicNotificationSettings] -> ShowS)
-> Show SetForumTopicNotificationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetForumTopicNotificationSettings -> ShowS
showsPrec :: Int -> SetForumTopicNotificationSettings -> ShowS
$cshow :: SetForumTopicNotificationSettings -> String
show :: SetForumTopicNotificationSettings -> String
$cshowList :: [SetForumTopicNotificationSettings] -> ShowS
showList :: [SetForumTopicNotificationSettings] -> ShowS
Show)
instance I.ShortShow SetForumTopicNotificationSettings where
shortShow :: SetForumTopicNotificationSettings -> String
shortShow
SetForumTopicNotificationSettings
{ chat_id :: SetForumTopicNotificationSettings -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_thread_id :: SetForumTopicNotificationSettings -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, notification_settings :: SetForumTopicNotificationSettings -> Maybe ChatNotificationSettings
notification_settings = Maybe ChatNotificationSettings
notification_settings_
}
= String
"SetForumTopicNotificationSettings"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
, String
"message_thread_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_thread_id_
, String
"notification_settings" String -> Maybe ChatNotificationSettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatNotificationSettings
notification_settings_
]
instance AT.ToJSON SetForumTopicNotificationSettings where
toJSON :: SetForumTopicNotificationSettings -> Value
toJSON
SetForumTopicNotificationSettings
{ chat_id :: SetForumTopicNotificationSettings -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_thread_id :: SetForumTopicNotificationSettings -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, notification_settings :: SetForumTopicNotificationSettings -> Maybe ChatNotificationSettings
notification_settings = Maybe ChatNotificationSettings
notification_settings_
}
= [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
"setForumTopicNotificationSettings"
, Key
"chat_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
, Key
"message_thread_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
message_thread_id_
, Key
"notification_settings" Key -> Maybe ChatNotificationSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ChatNotificationSettings
notification_settings_
]
defaultSetForumTopicNotificationSettings :: SetForumTopicNotificationSettings
defaultSetForumTopicNotificationSettings :: SetForumTopicNotificationSettings
defaultSetForumTopicNotificationSettings =
SetForumTopicNotificationSettings
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, message_thread_id :: Maybe Int
message_thread_id = Maybe Int
forall a. Maybe a
Nothing
, notification_settings :: Maybe ChatNotificationSettings
notification_settings = Maybe ChatNotificationSettings
forall a. Maybe a
Nothing
}