{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.InlineMode.InputMessageContent (InputMessageContent(..), defaultInputTextMessageContent, defaultInputLocationMessageContent) where
import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Text (Text)
import GHC.Generics (Generic)
import Telegram.Bot.API.Internal.Utils
data InputMessageContent =
InputTextMessageContent
{ InputMessageContent -> Text
inputMessageContentMessageText :: Text
, InputMessageContent -> Maybe Text
inputMessageContentParseMode :: Maybe Text
, InputMessageContent -> Maybe Bool
inputMessageContentDisableWebPagePrefiew :: Maybe Bool
}
| InputLocationMessageContent
{ InputMessageContent -> Float
inputMessageContentLatitude :: Float
, InputMessageContent -> Float
inputMessageContentLongitude :: Float
, InputMessageContent -> Maybe Float
inputMessageContentHorizontalAccuracy :: Maybe Float
, InputMessageContent -> Maybe Integer
inputMessageContentLivePeriod :: Maybe Integer
, InputMessageContent -> Maybe Integer
inputMessageContentHeading :: Maybe Integer
, InputMessageContent -> Maybe Integer
inputMessageContentProximityAlertRadius :: Maybe Integer
}
| InputVenueMessageContent
{ inputMessageContentLatitude :: Float
, inputMessageContentLongitude :: Float
, InputMessageContent -> Text
inputMessageContentTitle :: Text
, InputMessageContent -> Text
inputMessageContentAddress :: Text
, InputMessageContent -> Maybe Text
inputMessageContentFoursquareId :: Maybe Text
, InputMessageContent -> Maybe Text
inputMessageContentFoursquareType :: Maybe Text
, InputMessageContent -> Maybe Text
inputMessageContentGooglePlaceId :: Maybe Text
, InputMessageContent -> Maybe Text
inputMessageContentGooglePlaceType :: Maybe Text
}
| InputContactMessageContent
{ InputMessageContent -> Text
inputMessageContentPhoneNumber :: Text
, InputMessageContent -> Text
inputMessageContentFirstName :: Text
, InputMessageContent -> Maybe Text
inputMessageContentSecondName :: Maybe Text
, InputMessageContent -> Maybe Text
inputMessageContentVcard :: Maybe Text
} deriving (forall x. Rep InputMessageContent x -> InputMessageContent
forall x. InputMessageContent -> Rep InputMessageContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputMessageContent x -> InputMessageContent
$cfrom :: forall x. InputMessageContent -> Rep InputMessageContent x
Generic, Int -> InputMessageContent -> ShowS
[InputMessageContent] -> ShowS
InputMessageContent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputMessageContent] -> ShowS
$cshowList :: [InputMessageContent] -> ShowS
show :: InputMessageContent -> String
$cshow :: InputMessageContent -> String
showsPrec :: Int -> InputMessageContent -> ShowS
$cshowsPrec :: Int -> InputMessageContent -> ShowS
Show)
defaultInputTextMessageContent :: Text -> InputMessageContent
defaultInputTextMessageContent :: Text -> InputMessageContent
defaultInputTextMessageContent Text
text = Text -> Maybe Text -> Maybe Bool -> InputMessageContent
InputTextMessageContent Text
text forall a. Maybe a
Nothing forall a. Maybe a
Nothing
defaultInputLocationMessageContent :: Float -> Float -> InputMessageContent
defaultInputLocationMessageContent :: Float -> Float -> InputMessageContent
defaultInputLocationMessageContent Float
lat Float
long = Float
-> Float
-> Maybe Float
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> InputMessageContent
InputLocationMessageContent Float
lat Float
long forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing
instance ToJSON InputMessageContent where toJSON :: InputMessageContent -> 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 InputMessageContent where parseJSON :: Value -> Parser InputMessageContent
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON