module TD.Query.SetChatNotificationSettings
(SetChatNotificationSettings(..)
, defaultSetChatNotificationSettings
) 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 SetChatNotificationSettings
= SetChatNotificationSettings
{ SetChatNotificationSettings -> Maybe Int
chat_id :: Maybe Int
, SetChatNotificationSettings -> Maybe ChatNotificationSettings
notification_settings :: Maybe ChatNotificationSettings.ChatNotificationSettings
}
deriving (SetChatNotificationSettings -> SetChatNotificationSettings -> Bool
(SetChatNotificationSettings
-> SetChatNotificationSettings -> Bool)
-> (SetChatNotificationSettings
-> SetChatNotificationSettings -> Bool)
-> Eq SetChatNotificationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetChatNotificationSettings -> SetChatNotificationSettings -> Bool
== :: SetChatNotificationSettings -> SetChatNotificationSettings -> Bool
$c/= :: SetChatNotificationSettings -> SetChatNotificationSettings -> Bool
/= :: SetChatNotificationSettings -> SetChatNotificationSettings -> Bool
Eq, Int -> SetChatNotificationSettings -> ShowS
[SetChatNotificationSettings] -> ShowS
SetChatNotificationSettings -> String
(Int -> SetChatNotificationSettings -> ShowS)
-> (SetChatNotificationSettings -> String)
-> ([SetChatNotificationSettings] -> ShowS)
-> Show SetChatNotificationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetChatNotificationSettings -> ShowS
showsPrec :: Int -> SetChatNotificationSettings -> ShowS
$cshow :: SetChatNotificationSettings -> String
show :: SetChatNotificationSettings -> String
$cshowList :: [SetChatNotificationSettings] -> ShowS
showList :: [SetChatNotificationSettings] -> ShowS
Show)
instance I.ShortShow SetChatNotificationSettings where
shortShow :: SetChatNotificationSettings -> String
shortShow
SetChatNotificationSettings
{ chat_id :: SetChatNotificationSettings -> Maybe Int
chat_id = Maybe Int
chat_id_
, notification_settings :: SetChatNotificationSettings -> Maybe ChatNotificationSettings
notification_settings = Maybe ChatNotificationSettings
notification_settings_
}
= String
"SetChatNotificationSettings"
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
"notification_settings" String -> Maybe ChatNotificationSettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatNotificationSettings
notification_settings_
]
instance AT.ToJSON SetChatNotificationSettings where
toJSON :: SetChatNotificationSettings -> Value
toJSON
SetChatNotificationSettings
{ chat_id :: SetChatNotificationSettings -> Maybe Int
chat_id = Maybe Int
chat_id_
, notification_settings :: SetChatNotificationSettings -> 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
"setChatNotificationSettings"
, 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
"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_
]
defaultSetChatNotificationSettings :: SetChatNotificationSettings
defaultSetChatNotificationSettings :: SetChatNotificationSettings
defaultSetChatNotificationSettings =
SetChatNotificationSettings
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, notification_settings :: Maybe ChatNotificationSettings
notification_settings = Maybe ChatNotificationSettings
forall a. Maybe a
Nothing
}