module Web.Telegram.API.Bot.Responses
(
Response (..)
, ResponseParameters (..)
, GetMeResponse
, MessageResponse
, ChatActionResponse
, UpdatesResponse
, FileResponse
, UserProfilePhotosResponse
, SetWebhookResponse
, InlineQueryResponse
, CallbackQueryResponse
, KickChatMemberResponse
, LeaveChatResponse
, UnbanChatMemberResponse
, GetChatResponse
, GetChatAdministratorsResponse
, GetChatMembersCountResponse
, GetChatMemberResponse
, GetWebhookInfoResponse
, AnswerShippingQueryResponse
, AnswerPreCheckoutQueryResponse
) where
import Data.Aeson
import Data.Int (Int64)
import GHC.Generics
import Web.Telegram.API.Bot.Data
import Web.Telegram.API.Bot.JsonExt
data Response a = Response
{
result :: a
, parameters :: Maybe ResponseParameters
} deriving (Show, Generic, FromJSON)
data ResponseParameters = ResponseParameters
{
res_migrate_to_chat_id :: Maybe Int64
, res_retry_after :: Maybe Int
} deriving (Show, Generic)
instance FromJSON ResponseParameters where
parseJSON = parseJsonDrop 4
type GetMeResponse = Response User
type MessageResponse = Response Message
type ChatActionResponse = Response Bool
type UpdatesResponse = Response [Update]
type FileResponse = Response File
type UserProfilePhotosResponse = Response UserProfilePhotos
type SetWebhookResponse = Response Bool
type InlineQueryResponse = Response Bool
type CallbackQueryResponse = Response Bool
type KickChatMemberResponse = Response Bool
type LeaveChatResponse = Response Bool
type UnbanChatMemberResponse = Response Bool
type GetChatResponse = Response Chat
type GetChatAdministratorsResponse = Response [ChatMember]
type GetChatMembersCountResponse = Response Int
type GetChatMemberResponse = Response ChatMember
type GetWebhookInfoResponse = Response WebhookInfo
type AnswerShippingQueryResponse = Response Bool
type AnswerPreCheckoutQueryResponse = Response Bool