{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Telegram.Bot.API.WebApps where
import Data.Text (Text)
import Data.Proxy
import GHC.Generics (Generic)
import Servant.API
import Servant.Client hiding (Response)
import Telegram.Bot.API.Internal.Utils (deriveJSON')
import Telegram.Bot.API.MakingRequests (Response)
import Telegram.Bot.API.InlineMode (InlineQueryId)
import Telegram.Bot.API.InlineMode.InlineQueryResult (InlineQueryResult)
data AnswerWebAppQueryRequest = AnswerWebAppQueryRequest
{ AnswerWebAppQueryRequest -> Text
answerWebAppQueryRequestWebAppQueryId :: Text
, AnswerWebAppQueryRequest -> InlineQueryResult
answerWebAppQueryRequestResult :: InlineQueryResult
}
deriving ((forall x.
AnswerWebAppQueryRequest -> Rep AnswerWebAppQueryRequest x)
-> (forall x.
Rep AnswerWebAppQueryRequest x -> AnswerWebAppQueryRequest)
-> Generic AnswerWebAppQueryRequest
forall x.
Rep AnswerWebAppQueryRequest x -> AnswerWebAppQueryRequest
forall x.
AnswerWebAppQueryRequest -> Rep AnswerWebAppQueryRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AnswerWebAppQueryRequest x -> AnswerWebAppQueryRequest
$cfrom :: forall x.
AnswerWebAppQueryRequest -> Rep AnswerWebAppQueryRequest x
Generic, Int -> AnswerWebAppQueryRequest -> ShowS
[AnswerWebAppQueryRequest] -> ShowS
AnswerWebAppQueryRequest -> String
(Int -> AnswerWebAppQueryRequest -> ShowS)
-> (AnswerWebAppQueryRequest -> String)
-> ([AnswerWebAppQueryRequest] -> ShowS)
-> Show AnswerWebAppQueryRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnswerWebAppQueryRequest] -> ShowS
$cshowList :: [AnswerWebAppQueryRequest] -> ShowS
show :: AnswerWebAppQueryRequest -> String
$cshow :: AnswerWebAppQueryRequest -> String
showsPrec :: Int -> AnswerWebAppQueryRequest -> ShowS
$cshowsPrec :: Int -> AnswerWebAppQueryRequest -> ShowS
Show)
newtype SentWebAppMessage = SentWebAppMessage
{ SentWebAppMessage -> Maybe InlineQueryId
sentWebAppMessageInlineMessageId :: Maybe InlineQueryId
}
deriving ((forall x. SentWebAppMessage -> Rep SentWebAppMessage x)
-> (forall x. Rep SentWebAppMessage x -> SentWebAppMessage)
-> Generic SentWebAppMessage
forall x. Rep SentWebAppMessage x -> SentWebAppMessage
forall x. SentWebAppMessage -> Rep SentWebAppMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SentWebAppMessage x -> SentWebAppMessage
$cfrom :: forall x. SentWebAppMessage -> Rep SentWebAppMessage x
Generic, Int -> SentWebAppMessage -> ShowS
[SentWebAppMessage] -> ShowS
SentWebAppMessage -> String
(Int -> SentWebAppMessage -> ShowS)
-> (SentWebAppMessage -> String)
-> ([SentWebAppMessage] -> ShowS)
-> Show SentWebAppMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SentWebAppMessage] -> ShowS
$cshowList :: [SentWebAppMessage] -> ShowS
show :: SentWebAppMessage -> String
$cshow :: SentWebAppMessage -> String
showsPrec :: Int -> SentWebAppMessage -> ShowS
$cshowsPrec :: Int -> SentWebAppMessage -> ShowS
Show)
foldMap deriveJSON'
[ ''SentWebAppMessage
, ''AnswerWebAppQueryRequest
]
type AnswerWebAppQuery
= "answerWebAppQuery" :> ReqBody '[JSON] AnswerWebAppQueryRequest :> Post '[JSON] (Response SentWebAppMessage)
answerWebAppQuery :: AnswerWebAppQueryRequest -> ClientM (Response SentWebAppMessage)
answerWebAppQuery :: AnswerWebAppQueryRequest -> ClientM (Response SentWebAppMessage)
answerWebAppQuery = Proxy AnswerWebAppQuery -> Client ClientM AnswerWebAppQuery
forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (Proxy AnswerWebAppQuery
forall k (t :: k). Proxy t
Proxy @AnswerWebAppQuery)