module TD.Query.SavePreparedKeyboardButton
(SavePreparedKeyboardButton(..)
, defaultSavePreparedKeyboardButton
) 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.KeyboardButton as KeyboardButton
data SavePreparedKeyboardButton
= SavePreparedKeyboardButton
{ SavePreparedKeyboardButton -> Maybe Int
user_id :: Maybe Int
, SavePreparedKeyboardButton -> Maybe KeyboardButton
button :: Maybe KeyboardButton.KeyboardButton
}
deriving (SavePreparedKeyboardButton -> SavePreparedKeyboardButton -> Bool
(SavePreparedKeyboardButton -> SavePreparedKeyboardButton -> Bool)
-> (SavePreparedKeyboardButton
-> SavePreparedKeyboardButton -> Bool)
-> Eq SavePreparedKeyboardButton
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SavePreparedKeyboardButton -> SavePreparedKeyboardButton -> Bool
== :: SavePreparedKeyboardButton -> SavePreparedKeyboardButton -> Bool
$c/= :: SavePreparedKeyboardButton -> SavePreparedKeyboardButton -> Bool
/= :: SavePreparedKeyboardButton -> SavePreparedKeyboardButton -> Bool
Eq, Int -> SavePreparedKeyboardButton -> ShowS
[SavePreparedKeyboardButton] -> ShowS
SavePreparedKeyboardButton -> String
(Int -> SavePreparedKeyboardButton -> ShowS)
-> (SavePreparedKeyboardButton -> String)
-> ([SavePreparedKeyboardButton] -> ShowS)
-> Show SavePreparedKeyboardButton
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SavePreparedKeyboardButton -> ShowS
showsPrec :: Int -> SavePreparedKeyboardButton -> ShowS
$cshow :: SavePreparedKeyboardButton -> String
show :: SavePreparedKeyboardButton -> String
$cshowList :: [SavePreparedKeyboardButton] -> ShowS
showList :: [SavePreparedKeyboardButton] -> ShowS
Show)
instance I.ShortShow SavePreparedKeyboardButton where
shortShow :: SavePreparedKeyboardButton -> String
shortShow
SavePreparedKeyboardButton
{ user_id :: SavePreparedKeyboardButton -> Maybe Int
user_id = Maybe Int
user_id_
, button :: SavePreparedKeyboardButton -> Maybe KeyboardButton
button = Maybe KeyboardButton
button_
}
= String
"SavePreparedKeyboardButton"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
, String
"button" String -> Maybe KeyboardButton -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe KeyboardButton
button_
]
instance AT.ToJSON SavePreparedKeyboardButton where
toJSON :: SavePreparedKeyboardButton -> Value
toJSON
SavePreparedKeyboardButton
{ user_id :: SavePreparedKeyboardButton -> Maybe Int
user_id = Maybe Int
user_id_
, button :: SavePreparedKeyboardButton -> Maybe KeyboardButton
button = Maybe KeyboardButton
button_
}
= [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
"savePreparedKeyboardButton"
, Key
"user_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
user_id_
, Key
"button" Key -> Maybe KeyboardButton -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe KeyboardButton
button_
]
defaultSavePreparedKeyboardButton :: SavePreparedKeyboardButton
defaultSavePreparedKeyboardButton :: SavePreparedKeyboardButton
defaultSavePreparedKeyboardButton =
SavePreparedKeyboardButton
{ user_id :: Maybe Int
user_id = Maybe Int
forall a. Maybe a
Nothing
, button :: Maybe KeyboardButton
button = Maybe KeyboardButton
forall a. Maybe a
Nothing
}