From a0886694f73fc382d78da79ab8bfb27475757bab Mon Sep 17 00:00:00 2001 From: adambrangenberg Date: Wed, 24 Dec 2025 03:40:10 +0100 Subject: Implemented basic auth, refactor --- src/Model/MatrixErrorResponse.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/Model/MatrixErrorResponse.hs (limited to 'src/Model/MatrixErrorResponse.hs') diff --git a/src/Model/MatrixErrorResponse.hs b/src/Model/MatrixErrorResponse.hs new file mode 100644 index 0000000..22f5ae5 --- /dev/null +++ b/src/Model/MatrixErrorResponse.hs @@ -0,0 +1,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 + } -- cgit v1.2.3