blob: 1a8f201735fd1f790cafdb989f0e2f8eda97d98b (
plain) (
blame)
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
26
|
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module Model.Profile (ProfileResponse (..)) where
import Data.Aeson
import GHC.Generics
import Data.Text (Text)
----------------------------------------------------------------------------------------------------
data ProfileResponse = ProfileResponse
{ display_name :: Maybe Text
, avatar_url :: Maybe Text
, tz :: Maybe Text
-- TODO: <other properties>
} deriving (Show, Eq, Generic)
instance ToJSON ProfileResponse where
toJSON = genericToJSON defaultOptions
{ fieldLabelModifier = \name ->
case name of
"display_name" -> "displayname"
"tz" -> "m.tz"
other -> other
, omitNothingFields = True
}
|