-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMessage.hs
26 lines (22 loc) · 1.16 KB
/
Message.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# LANGUAGE DeriveGeneric #-}
module Vk.Message
( Json(..)
) where
import Data.Aeson ( FromJSON
, parseJSON
, genericParseJSON
)
import Data.Text ( Text )
import Deserialization ( customParseOptions )
import GHC.Generics ( Generic )
data Json = Json
{ _id :: Int
, _date :: Int -- время отправки в Unixtime.
, _peer_id :: Int -- идентификатор назначения.
, _from_id :: Int -- идентификатор отправителя.
, _text :: Text -- текст сообщения.
, _random_id :: Int -- идентификатор, используемый при отправке сообщения. Возвращается только для исходящих сообщений.
, _important :: Bool
} deriving (Generic, Show)
instance FromJSON Json where
parseJSON = genericParseJSON customParseOptions