From 3633c44893bfbd50f25b84ac353012975388332c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 20 Aug 2016 17:28:19 -0400 Subject: initial http api using servant --- Types/Storage.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Types') diff --git a/Types/Storage.hs b/Types/Storage.hs index 01ae0ad..5032949 100644 --- a/Types/Storage.hs +++ b/Types/Storage.hs @@ -4,10 +4,13 @@ -} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE DeriveGeneric #-} module Types.Storage where import Types +import GHC.Generics +import Data.Aeson.Types -- | All known locations where shares can be stored, ordered with -- preferred locations first. @@ -31,12 +34,16 @@ data Storage = Storage } data StoreResult = StoreSuccess | StoreAlreadyExists | StoreFailure String - deriving (Show) + deriving (Show, Generic) data RetrieveResult = RetrieveSuccess Share | RetrieveFailure String + deriving (Generic) data ObscureResult = ObscureSuccess | ObscureFailure String - deriving (Show) + deriving (Show, Generic) data CountResult = CountResult Integer | CountFailure String - deriving (Show) + deriving (Show, Generic) + +instance ToJSON StoreResult +instance ToJSON CountResult -- cgit v1.2.3