{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Telegram.Bot.API.Methods.SendPoll 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
data SendPollRequest = SendPollRequest
{ SendPollRequest -> SomeChatId
sendPollChatId :: SomeChatId
, SendPollRequest -> Maybe MessageThreadId
sendPollMessageThreadId :: Maybe MessageThreadId
, SendPollRequest -> Text
sendPollQuestion :: Text
, SendPollRequest -> [Text]
sendPollOptions :: [Text]
, SendPollRequest -> Maybe Bool
sendPollIsAnonymous :: Maybe Bool
, SendPollRequest -> Maybe Text
sendPollType :: Maybe Text
, SendPollRequest -> Maybe Bool
sendPollAllowsMultipleAnswers :: Maybe Bool
, SendPollRequest -> Maybe Int
sendPollCorrectOptionId :: Maybe Int
, SendPollRequest -> Maybe Text
sendPollExplanation :: Maybe Text
, SendPollRequest -> Maybe ParseMode
sendPollExplanationParseMode :: Maybe ParseMode
, SendPollRequest -> Maybe [MessageEntity]
sendPollExplanationEntities :: Maybe [MessageEntity]
, SendPollRequest -> Maybe Int
sendPollOpenPeriod :: Maybe Int
, SendPollRequest -> Maybe Int
sendPollCloseDate :: Maybe Int
, SendPollRequest -> Maybe Bool
sendPollIsClosed :: Maybe Bool
, SendPollRequest -> Maybe Bool
sendPollDisableNotification :: Maybe Bool
, SendPollRequest -> Maybe Bool
sendPollProtectContent :: Maybe Bool
, SendPollRequest -> Maybe MessageId
sendPollReplyToMessageId :: Maybe MessageId
, SendPollRequest -> Maybe Bool
sendPollAllowSendingWithoutReply :: Maybe Bool
, SendPollRequest -> Maybe InlineKeyboardMarkup
sendPollReplyMarkup :: Maybe InlineKeyboardMarkup
}
deriving forall x. Rep SendPollRequest x -> SendPollRequest
forall x. SendPollRequest -> Rep SendPollRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendPollRequest x -> SendPollRequest
$cfrom :: forall x. SendPollRequest -> Rep SendPollRequest x
Generic
instance ToJSON SendPollRequest where toJSON :: SendPollRequest -> 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 SendPollRequest where parseJSON :: Value -> Parser SendPollRequest
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON
type SendPoll = "sendPoll"
:> ReqBody '[JSON] SendPollRequest
:> Post '[JSON] (Response Message)
sendPoll :: SendPollRequest -> ClientM (Response Message)
sendPoll :: SendPollRequest -> ClientM (Response Message)
sendPoll = forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (forall {k} (t :: k). Proxy t
Proxy @SendPoll)