From e65e1eaac335a4738abb9e8ee8da7a229f96c2c0 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 17 Oct 2015 21:23:45 +0200 Subject: Drafts --- servant/api/Thermoprint/Api.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'servant/api/Thermoprint/Api.hs') diff --git a/servant/api/Thermoprint/Api.hs b/servant/api/Thermoprint/Api.hs index bd5744b..f3318c4 100644 --- a/servant/api/Thermoprint/Api.hs +++ b/servant/api/Thermoprint/Api.hs @@ -14,6 +14,8 @@ import GHC.Generics import Control.Monad +import Data.Int (Int64) + instance ToJSON ByteString where toJSON = toJSON . Text.pack . ByteString.unpack instance FromJSON ByteString where @@ -25,4 +27,9 @@ instance FromJSON c => FromJSON (Inline c) instance ToJSON c => ToJSON (Block c) instance FromJSON c => FromJSON (Block c) -type ThermoprintApi = "print" :> Capture "printerId" Integer :> ReqBody '[JSON] (Block String) :> Post '[JSON] () +type ThermoprintApi = "print" :> Capture "printerId" Integer :> ReqBody '[JSON] (Block String) :> Post '[JSON] () + :<|> "drafts" :> Get '[JSON] [(Int64, String)] + :<|> "drafts" :> ReqBody '[JSON] (String, Block String) :> Put '[JSON] Int64 + :<|> "drafts" :> Capture "draftId" Int64 :> Get '[JSON] (String, Block String) + :<|> "drafts" :> Capture "draftId" Int64 :> ReqBody '[JSON] (String, Block String) :> Put '[JSON] () + :<|> "drafts" :> Capture "draftId" Int64 :> Delete '[JSON] () -- cgit v1.2.3