aboutsummaryrefslogtreecommitdiff
path: root/src/Model/MatrixErrorResponse.hs
blob: 22f5ae56930a8b405849f92596c7cbb78271bf81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE DeriveGeneric #-}

module Model.MatrixErrorResponse (MatrixErrorResponse (..)) where

import Data.Aeson
import GHC.Generics (Generic)
import Data.Text (Text)

----------------------------------------------------------------------------------------------------
data MatrixErrorResponse = MatrixErrorResponse
  { error_code :: Text -- TODO: Enum?
  , error :: Text
  } deriving (Eq, Show, Generic)

instance ToJSON MatrixErrorResponse where
  toJSON = genericToJSON defaultOptions { fieldLabelModifier = \name ->
      case name of
        "error_code" -> "errcode"
        other -> other
    }