{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
module Web.Telegram.Types
(
User (..),
Message (..),
MessageMetadata (..),
MessageEntity (..),
MessageEntityType (..),
MessageContent (..),
ParseMode (..),
ChatId (..),
Chat (..),
ChatType (..),
ChatPermissions (..),
ChatPhoto (..),
ChatStatus (..),
ChatMember (..),
PhotoSize (..),
Audio (..),
Animation (..),
Document (..),
Video (..),
Voice (..),
VideoNote (..),
Contact (..),
Location (..),
Venue (..),
PollOption (..),
Poll (..),
PollType (..),
PollAnswer (..),
UserProfilePhotos (..),
File (..),
Sticker (..),
StickerSet (..),
MaskPosition (..),
SuccessfulPayment (..),
OrderInfo (..),
ShippingAddress (..),
coe,
liftUnion,
QueryR,
Default (..),
)
where
import Data.Aeson
import Data.Coerce
import Data.Hashable
import Data.OpenUnion
import Data.Text (Text)
import Deriving.Aeson
import Servant.API
import Web.Telegram.Types.Internal.Common
import Web.Telegram.Types.Internal.InputMedia
import Web.Telegram.Types.Internal.Media
import Web.Telegram.Types.Internal.Sticker
import Web.Telegram.Types.Internal.User
import Web.Telegram.Types.Internal.Utils
data ChatId
= ChatId Integer
| ChanId Text
deriving (Show, Eq, Generic, Default, Hashable)
deriving (FromJSON, ToJSON) via UntaggedSum ChatId
instance ToHttpApiData ChatId where
toQueryParam (ChatId i) = toQueryParam i
toQueryParam (ChanId t) = t
coe :: Coercible a b => a -> b
coe = coerce
type QueryR = QueryParam' '[Required, Strict]