{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
module Web.Telegram.Types.Interaction
(
CallbackQuery (..),
ShippingQuery (..),
PreCheckoutQuery (..),
ReplyKeyboardMarkup (..),
KeyboardButton (..),
KeyboardButtonPollType (..),
ReplyKeyboardRemove (..),
InlineKeyboardMarkup (..),
InlineKeyboardButton (..),
ForceReply (..),
LoginUrl (..),
ReplyMarkup,
Action (..),
)
where
import Data.Aeson
import Data.OpenUnion
import Deriving.Aeson
import Servant.API
import Web.Telegram.Types.Internal.Keyboard
import Web.Telegram.Types.Internal.Utils
import Web.Telegram.Types.Internal.Common
type ReplyMarkup =
Union
'[ InlineKeyboardMarkup,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
ForceReply
]
instance ToJSON ReplyMarkup where
toJSON =
(\(inlineM :: InlineKeyboardMarkup) -> toJSON inlineM)
@> (\(replyM :: ReplyKeyboardMarkup) -> toJSON replyM)
@> (\(replyR :: ReplyKeyboardRemove) -> toJSON replyR)
@> (\(forceR :: ForceReply) -> toJSON forceR)
@> typesExhausted
deriving via Serialize ReplyMarkup instance ToHttpApiData ReplyMarkup
data Action
= Typing
| UploadPhoto
| RecordVideo
| UploadVideo
| RecordAudio
| UploadAudio
| UploadDocument
| FindLocation
| RecordVideoNote
| UploadVideoNote
deriving (Show, Eq, Ord, Generic, Default)
deriving (ToJSON, FromJSON) via Snake Action
deriving (ToHttpApiData) via Serialize Action