module Web.Telegram.API.Bot.API.Queries
(
answerInlineQuery
, answerInlineQueryM
, answerCallbackQuery
, answerCallbackQueryM
, TelegramBotQueriesAPI
, queriesApi
) where
import Data.Proxy
import Network.HTTP.Client (Manager)
import Servant.API
import Servant.Client
import Web.Telegram.API.Bot.API.Core
import Web.Telegram.API.Bot.Requests
import Web.Telegram.API.Bot.Responses
type TelegramBotQueriesAPI =
TelegramToken :> "answerInlineQuery"
:> ReqBody '[JSON] AnswerInlineQueryRequest
:> Post '[JSON] InlineQueryResponse
:<|> TelegramToken :> "answerCallbackQuery"
:> ReqBody '[JSON] AnswerCallbackQueryRequest
:> Post '[JSON] CallbackQueryResponse
queriesApi :: Proxy TelegramBotQueriesAPI
queriesApi = Proxy
answerInlineQuery_ :: Token -> AnswerInlineQueryRequest -> ClientM InlineQueryResponse
answerCallbackQuery_ :: Token -> AnswerCallbackQueryRequest -> ClientM CallbackQueryResponse
answerInlineQuery_ :<|> answerCallbackQuery_
= client queriesApi
answerInlineQuery :: Token -> AnswerInlineQueryRequest -> Manager -> IO (Either ServantError InlineQueryResponse)
answerInlineQuery = runM answerInlineQueryM
answerInlineQueryM :: AnswerInlineQueryRequest -> TelegramClient InlineQueryResponse
answerInlineQueryM = run_ answerInlineQuery_
answerCallbackQuery :: Token -> AnswerCallbackQueryRequest -> Manager -> IO (Either ServantError CallbackQueryResponse)
answerCallbackQuery = runM answerCallbackQueryM
answerCallbackQueryM :: AnswerCallbackQueryRequest -> TelegramClient CallbackQueryResponse
answerCallbackQueryM = run_ answerCallbackQuery_