module TD.Query.PinChatMessage
(PinChatMessage(..)
, defaultPinChatMessage
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data PinChatMessage
= PinChatMessage
{ PinChatMessage -> Maybe Int
chat_id :: Maybe Int
, PinChatMessage -> Maybe Int
message_id :: Maybe Int
, PinChatMessage -> Maybe Bool
disable_notification :: Maybe Bool
, PinChatMessage -> Maybe Bool
only_for_self :: Maybe Bool
}
deriving (PinChatMessage -> PinChatMessage -> Bool
(PinChatMessage -> PinChatMessage -> Bool)
-> (PinChatMessage -> PinChatMessage -> Bool) -> Eq PinChatMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PinChatMessage -> PinChatMessage -> Bool
== :: PinChatMessage -> PinChatMessage -> Bool
$c/= :: PinChatMessage -> PinChatMessage -> Bool
/= :: PinChatMessage -> PinChatMessage -> Bool
Eq, Int -> PinChatMessage -> ShowS
[PinChatMessage] -> ShowS
PinChatMessage -> String
(Int -> PinChatMessage -> ShowS)
-> (PinChatMessage -> String)
-> ([PinChatMessage] -> ShowS)
-> Show PinChatMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PinChatMessage -> ShowS
showsPrec :: Int -> PinChatMessage -> ShowS
$cshow :: PinChatMessage -> String
show :: PinChatMessage -> String
$cshowList :: [PinChatMessage] -> ShowS
showList :: [PinChatMessage] -> ShowS
Show)
instance I.ShortShow PinChatMessage where
shortShow :: PinChatMessage -> String
shortShow
PinChatMessage
{ chat_id :: PinChatMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: PinChatMessage -> Maybe Int
message_id = Maybe Int
message_id_
, disable_notification :: PinChatMessage -> Maybe Bool
disable_notification = Maybe Bool
disable_notification_
, only_for_self :: PinChatMessage -> Maybe Bool
only_for_self = Maybe Bool
only_for_self_
}
= String
"PinChatMessage"
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_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
, String
"disable_notification" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
disable_notification_
, String
"only_for_self" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
only_for_self_
]
instance AT.ToJSON PinChatMessage where
toJSON :: PinChatMessage -> Value
toJSON
PinChatMessage
{ chat_id :: PinChatMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: PinChatMessage -> Maybe Int
message_id = Maybe Int
message_id_
, disable_notification :: PinChatMessage -> Maybe Bool
disable_notification = Maybe Bool
disable_notification_
, only_for_self :: PinChatMessage -> Maybe Bool
only_for_self = Maybe Bool
only_for_self_
}
= [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
"pinChatMessage"
, 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_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_id_
, Key
"disable_notification" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
disable_notification_
, Key
"only_for_self" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
only_for_self_
]
defaultPinChatMessage :: PinChatMessage
defaultPinChatMessage :: PinChatMessage
defaultPinChatMessage =
PinChatMessage
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, message_id :: Maybe Int
message_id = Maybe Int
forall a. Maybe a
Nothing
, disable_notification :: Maybe Bool
disable_notification = Maybe Bool
forall a. Maybe a
Nothing
, only_for_self :: Maybe Bool
only_for_self = Maybe Bool
forall a. Maybe a
Nothing
}