{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TemplateHaskell #-}
module Telegram.Bot.API.UpdatingMessages where
import Data.Aeson
import Data.Proxy
import Data.Text (Text)
import GHC.Generics (Generic)
import Servant.API
import Servant.Client (ClientM, client)
import Telegram.Bot.API.Internal.Utils (deriveJSON', gtoJSON)
import Telegram.Bot.API.MakingRequests
import Telegram.Bot.API.Methods
import Telegram.Bot.API.Types
data EditMessageTextRequest = EditMessageTextRequest
{ EditMessageTextRequest -> Maybe SomeChatId
editMessageTextChatId :: Maybe SomeChatId
, EditMessageTextRequest -> Maybe MessageId
editMessageTextMessageId :: Maybe MessageId
, EditMessageTextRequest -> Maybe MessageId
editMessageTextInlineMessageId :: Maybe MessageId
, EditMessageTextRequest -> Text
editMessageTextText :: Text
, EditMessageTextRequest -> Maybe ParseMode
editMessageTextParseMode :: Maybe ParseMode
, EditMessageTextRequest -> Maybe [MessageEntity]
editMessageEntities :: Maybe [MessageEntity]
, EditMessageTextRequest -> Maybe Bool
editMessageTextDisableWebPagePreview :: Maybe Bool
, EditMessageTextRequest -> Maybe SomeReplyMarkup
editMessageTextReplyMarkup :: Maybe SomeReplyMarkup
} deriving ((forall x. EditMessageTextRequest -> Rep EditMessageTextRequest x)
-> (forall x.
Rep EditMessageTextRequest x -> EditMessageTextRequest)
-> Generic EditMessageTextRequest
forall x. Rep EditMessageTextRequest x -> EditMessageTextRequest
forall x. EditMessageTextRequest -> Rep EditMessageTextRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EditMessageTextRequest x -> EditMessageTextRequest
$cfrom :: forall x. EditMessageTextRequest -> Rep EditMessageTextRequest x
Generic)
data EditMessageCaptionRequest = EditMessageCaptionRequest
{ EditMessageCaptionRequest -> Maybe SomeChatId
editMessageCaptionChatId :: Maybe SomeChatId
, EditMessageCaptionRequest -> Maybe MessageId
editMessageCaptionMessageId :: Maybe MessageId
, EditMessageCaptionRequest -> Maybe MessageId
editMessageCaptionInlineMessageId :: Maybe MessageId
, EditMessageCaptionRequest -> Maybe Text
editMessageCaptionCaption :: Maybe Text
, EditMessageCaptionRequest -> Maybe ParseMode
editMessageCaptionParseMode :: Maybe ParseMode
, EditMessageCaptionRequest -> Maybe [MessageEntity]
editMessageCaptionCaptionEntities :: Maybe [MessageEntity]
, EditMessageCaptionRequest -> Maybe SomeReplyMarkup
editMessageCaptionReplyMarkup :: Maybe SomeReplyMarkup
} deriving ((forall x.
EditMessageCaptionRequest -> Rep EditMessageCaptionRequest x)
-> (forall x.
Rep EditMessageCaptionRequest x -> EditMessageCaptionRequest)
-> Generic EditMessageCaptionRequest
forall x.
Rep EditMessageCaptionRequest x -> EditMessageCaptionRequest
forall x.
EditMessageCaptionRequest -> Rep EditMessageCaptionRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EditMessageCaptionRequest x -> EditMessageCaptionRequest
$cfrom :: forall x.
EditMessageCaptionRequest -> Rep EditMessageCaptionRequest x
Generic)
data EditMessageMediaRequest = EditMessageMediaRequest
{ EditMessageMediaRequest -> Maybe SomeChatId
editMessageMediaChatId :: Maybe SomeChatId
, EditMessageMediaRequest -> Maybe MessageId
editMessageMediaMessageId :: Maybe MessageId
, EditMessageMediaRequest -> Maybe MessageId
editMessageMediaInlineMessageId :: Maybe MessageId
, EditMessageMediaRequest -> InputMedia
editMessageMediaMedia :: InputMedia
, EditMessageMediaRequest -> Maybe SomeReplyMarkup
editMessageMediaReplyMarkup :: Maybe SomeReplyMarkup
} deriving ((forall x.
EditMessageMediaRequest -> Rep EditMessageMediaRequest x)
-> (forall x.
Rep EditMessageMediaRequest x -> EditMessageMediaRequest)
-> Generic EditMessageMediaRequest
forall x. Rep EditMessageMediaRequest x -> EditMessageMediaRequest
forall x. EditMessageMediaRequest -> Rep EditMessageMediaRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EditMessageMediaRequest x -> EditMessageMediaRequest
$cfrom :: forall x. EditMessageMediaRequest -> Rep EditMessageMediaRequest x
Generic)
instance ToJSON EditMessageMediaRequest where toJSON :: EditMessageMediaRequest -> Value
toJSON = EditMessageMediaRequest -> Value
forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
data EditMessageReplyMarkupRequest = EditMessageReplyMarkupRequest
{ EditMessageReplyMarkupRequest -> Maybe SomeChatId
editMessageReplyMarkupChatId :: Maybe SomeChatId
, EditMessageReplyMarkupRequest -> Maybe MessageId
editMessageReplyMarkupMessageId :: Maybe MessageId
, EditMessageReplyMarkupRequest -> Maybe MessageId
editMessageReplyMarkupInlineMessageId :: Maybe MessageId
, EditMessageReplyMarkupRequest -> Maybe SomeReplyMarkup
editMessageReplyMarkupReplyMarkup :: Maybe SomeReplyMarkup
} deriving ((forall x.
EditMessageReplyMarkupRequest
-> Rep EditMessageReplyMarkupRequest x)
-> (forall x.
Rep EditMessageReplyMarkupRequest x
-> EditMessageReplyMarkupRequest)
-> Generic EditMessageReplyMarkupRequest
forall x.
Rep EditMessageReplyMarkupRequest x
-> EditMessageReplyMarkupRequest
forall x.
EditMessageReplyMarkupRequest
-> Rep EditMessageReplyMarkupRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EditMessageReplyMarkupRequest x
-> EditMessageReplyMarkupRequest
$cfrom :: forall x.
EditMessageReplyMarkupRequest
-> Rep EditMessageReplyMarkupRequest x
Generic)
data StopPollRequest = StopPollRequest
{ StopPollRequest -> SomeChatId
stopPollChatId :: SomeChatId
, StopPollRequest -> MessageId
stopPollMessageId :: MessageId
, StopPollRequest -> Maybe SomeReplyMarkup
stopPollReplyMarkup :: Maybe SomeReplyMarkup
} deriving ((forall x. StopPollRequest -> Rep StopPollRequest x)
-> (forall x. Rep StopPollRequest x -> StopPollRequest)
-> Generic StopPollRequest
forall x. Rep StopPollRequest x -> StopPollRequest
forall x. StopPollRequest -> Rep StopPollRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopPollRequest x -> StopPollRequest
$cfrom :: forall x. StopPollRequest -> Rep StopPollRequest x
Generic)
foldMap deriveJSON'
[ ''EditMessageTextRequest
, ''EditMessageCaptionRequest
, ''EditMessageReplyMarkupRequest
, ''StopPollRequest
]
type EditMessageText
= "editMessageText"
:> ReqBody '[JSON] EditMessageTextRequest
:> Post '[JSON] (Response (Either Bool Message))
editMessageText :: EditMessageTextRequest -> ClientM (Response (Either Bool Message))
editMessageText :: EditMessageTextRequest -> ClientM (Response (Either Bool Message))
editMessageText = Proxy EditMessageText -> Client ClientM EditMessageText
forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (Proxy EditMessageText
forall k (t :: k). Proxy t
Proxy @EditMessageText)
type EditMessageCaption = "editMessageCaption"
:> ReqBody '[JSON] EditMessageCaptionRequest
:> Post '[JSON] (Response (Either Bool Message))
editMessageCaption :: EditMessageCaptionRequest -> ClientM (Response (Either Bool Message))
editMessageCaption :: EditMessageCaptionRequest
-> ClientM (Response (Either Bool Message))
editMessageCaption = Proxy EditMessageCaption -> Client ClientM EditMessageCaption
forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (Proxy EditMessageCaption
forall k (t :: k). Proxy t
Proxy @EditMessageCaption)
type EditMessageMedia = "editMessageMedia"
:> ReqBody '[JSON] EditMessageMediaRequest
:> Post '[JSON] (Response (Either Bool Message))
editMessageMedia :: EditMessageMediaRequest -> ClientM (Response (Either Bool Message))
editMessageMedia :: EditMessageMediaRequest -> ClientM (Response (Either Bool Message))
editMessageMedia = Proxy EditMessageMedia -> Client ClientM EditMessageMedia
forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (Proxy EditMessageMedia
forall k (t :: k). Proxy t
Proxy @EditMessageMedia)
type EditMessageReplyMarkup = "editMessageReplyMarkup"
:> ReqBody '[JSON] EditMessageReplyMarkupRequest
:> Post '[JSON] (Response (Either Bool Message))
editMessageReplyMarkup :: EditMessageReplyMarkupRequest -> ClientM (Response (Either Bool Message))
editMessageReplyMarkup :: EditMessageReplyMarkupRequest
-> ClientM (Response (Either Bool Message))
editMessageReplyMarkup = Proxy EditMessageReplyMarkup
-> Client ClientM EditMessageReplyMarkup
forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (Proxy EditMessageReplyMarkup
forall k (t :: k). Proxy t
Proxy @EditMessageReplyMarkup)
type StopPoll = "stopPoll"
:> ReqBody '[JSON] StopPollRequest
:> Post '[JSON] (Response Poll)
stopPoll :: StopPollRequest -> ClientM (Response Poll)
stopPoll :: StopPollRequest -> ClientM (Response Poll)
stopPoll = Proxy StopPoll -> Client ClientM StopPoll
forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (Proxy StopPoll
forall k (t :: k). Proxy t
Proxy @StopPoll)