{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.KeyboardButton where
import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.String
import Data.Text (Text)
import GHC.Generics (Generic)
import Telegram.Bot.API.Types.Common
import Telegram.Bot.API.Types.KeyboardButtonRequestChat
import Telegram.Bot.API.Types.KeyboardButtonRequestUser
import Telegram.Bot.API.Types.PollType
import Telegram.Bot.API.Internal.Utils
data KeyboardButton = KeyboardButton
{ KeyboardButton -> Text
keyboardButtonText :: Text
, KeyboardButton -> Maybe KeyboardButtonRequestUser
keyboardButtonRequestUser :: Maybe KeyboardButtonRequestUser
, KeyboardButton -> Maybe KeyboardButtonRequestChat
keyboardButtonRequestChat :: Maybe KeyboardButtonRequestChat
, KeyboardButton -> Maybe Bool
keyboardButtonRequestContact :: Maybe Bool
, KeyboardButton -> Maybe Bool
keyboardButtonRequestLocation :: Maybe Bool
, KeyboardButton -> Maybe PollType
keyboardButtonRequestPoll :: Maybe PollType
, KeyboardButton -> Maybe WebAppInfo
keyboardButtonWebApp :: Maybe WebAppInfo
}
deriving (forall x. Rep KeyboardButton x -> KeyboardButton
forall x. KeyboardButton -> Rep KeyboardButton x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyboardButton x -> KeyboardButton
$cfrom :: forall x. KeyboardButton -> Rep KeyboardButton x
Generic, Int -> KeyboardButton -> ShowS
[KeyboardButton] -> ShowS
KeyboardButton -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyboardButton] -> ShowS
$cshowList :: [KeyboardButton] -> ShowS
show :: KeyboardButton -> String
$cshow :: KeyboardButton -> String
showsPrec :: Int -> KeyboardButton -> ShowS
$cshowsPrec :: Int -> KeyboardButton -> ShowS
Show)
instance IsString KeyboardButton where
fromString :: String -> KeyboardButton
fromString String
s = Text
-> Maybe KeyboardButtonRequestUser
-> Maybe KeyboardButtonRequestChat
-> Maybe Bool
-> Maybe Bool
-> Maybe PollType
-> Maybe WebAppInfo
-> KeyboardButton
KeyboardButton (forall a. IsString a => String -> a
fromString String
s) forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing
instance ToJSON KeyboardButton where toJSON :: KeyboardButton -> Value
toJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON KeyboardButton where parseJSON :: Value -> Parser KeyboardButton
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON