{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Telegram.Bot.API.Methods.SendMessage where
import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Proxy
import Data.Text
import GHC.Generics (Generic)
import Servant.API
import Servant.Client hiding (Response)
import Telegram.Bot.API.Internal.Utils
import Telegram.Bot.API.MakingRequests
import Telegram.Bot.API.Types
import Telegram.Bot.API.Types.ParseMode
import Telegram.Bot.API.Types.SomeReplyMarkup
type SendMessage
= "sendMessage" :> ReqBody '[JSON] SendMessageRequest :> Post '[JSON] (Response Message)
sendMessage :: SendMessageRequest -> ClientM (Response Message)
sendMessage :: SendMessageRequest -> ClientM (Response Message)
sendMessage = forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (forall {k} (t :: k). Proxy t
Proxy @SendMessage)
data SendMessageRequest = SendMessageRequest
{ SendMessageRequest -> SomeChatId
sendMessageChatId :: SomeChatId
, SendMessageRequest -> Maybe MessageThreadId
sendMessageMessageThreadId :: Maybe MessageThreadId
, SendMessageRequest -> Text
sendMessageText :: Text
, SendMessageRequest -> Maybe ParseMode
sendMessageParseMode :: Maybe ParseMode
, SendMessageRequest -> Maybe [MessageEntity]
sendMessageEntities :: Maybe [MessageEntity]
, SendMessageRequest -> Maybe Bool
sendMessageDisableWebPagePreview :: Maybe Bool
, SendMessageRequest -> Maybe Bool
sendMessageDisableNotification :: Maybe Bool
, SendMessageRequest -> Maybe Bool
sendMessageProtectContent :: Maybe Bool
, SendMessageRequest -> Maybe MessageId
sendMessageReplyToMessageId :: Maybe MessageId
, SendMessageRequest -> Maybe Bool
sendMessageAllowSendingWithoutReply :: Maybe Bool
, SendMessageRequest -> Maybe SomeReplyMarkup
sendMessageReplyMarkup :: Maybe SomeReplyMarkup
} deriving (forall x. Rep SendMessageRequest x -> SendMessageRequest
forall x. SendMessageRequest -> Rep SendMessageRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendMessageRequest x -> SendMessageRequest
$cfrom :: forall x. SendMessageRequest -> Rep SendMessageRequest x
Generic)
instance ToJSON SendMessageRequest where toJSON :: SendMessageRequest -> 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 SendMessageRequest where parseJSON :: Value -> Parser SendMessageRequest
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON