{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.Chat where
import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Text
import GHC.Generics (Generic)
import Telegram.Bot.API.Internal.Utils
import Telegram.Bot.API.Types.ChatType
import Telegram.Bot.API.Types.Common
data Chat = Chat
{ Chat -> ChatId
chatId :: ChatId
, Chat -> ChatType
chatType :: ChatType
, Chat -> Maybe Text
chatTitle :: Maybe Text
, Chat -> Maybe Text
chatUsername :: Maybe Text
, Chat -> Maybe Text
chatFirstName :: Maybe Text
, Chat -> Maybe Text
chatLastName :: Maybe Text
, Chat -> Maybe Bool
chatIsForum :: Maybe Bool
}
deriving ((forall x. Chat -> Rep Chat x)
-> (forall x. Rep Chat x -> Chat) -> Generic Chat
forall x. Rep Chat x -> Chat
forall x. Chat -> Rep Chat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Chat -> Rep Chat x
from :: forall x. Chat -> Rep Chat x
$cto :: forall x. Rep Chat x -> Chat
to :: forall x. Rep Chat x -> Chat
Generic, Int -> Chat -> ShowS
[Chat] -> ShowS
Chat -> String
(Int -> Chat -> ShowS)
-> (Chat -> String) -> ([Chat] -> ShowS) -> Show Chat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Chat -> ShowS
showsPrec :: Int -> Chat -> ShowS
$cshow :: Chat -> String
show :: Chat -> String
$cshowList :: [Chat] -> ShowS
showList :: [Chat] -> ShowS
Show)
instance ToJSON Chat where toJSON :: Chat -> Value
toJSON = Chat -> Value
forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON Chat where parseJSON :: Value -> Parser Chat
parseJSON = Value -> Parser Chat
forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON