aboutsummaryrefslogtreecommitdiff
path: root/servant/api/Thermoprint/Api.hs
diff options
context:
space:
mode:
Diffstat (limited to 'servant/api/Thermoprint/Api.hs')
-rw-r--r--servant/api/Thermoprint/Api.hs9
1 files changed, 8 insertions, 1 deletions
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
14 14
15import Control.Monad 15import Control.Monad
16 16
17import Data.Int (Int64)
18
17instance ToJSON ByteString where 19instance ToJSON ByteString where
18 toJSON = toJSON . Text.pack . ByteString.unpack 20 toJSON = toJSON . Text.pack . ByteString.unpack
19instance FromJSON ByteString where 21instance FromJSON ByteString where
@@ -25,4 +27,9 @@ instance FromJSON c => FromJSON (Inline c)
25instance ToJSON c => ToJSON (Block c) 27instance ToJSON c => ToJSON (Block c)
26instance FromJSON c => FromJSON (Block c) 28instance FromJSON c => FromJSON (Block c)
27 29
28type ThermoprintApi = "print" :> Capture "printerId" Integer :> ReqBody '[JSON] (Block String) :> Post '[JSON] () 30type ThermoprintApi = "print" :> Capture "printerId" Integer :> ReqBody '[JSON] (Block String) :> Post '[JSON] ()
31 :<|> "drafts" :> Get '[JSON] [(Int64, String)]
32 :<|> "drafts" :> ReqBody '[JSON] (String, Block String) :> Put '[JSON] Int64
33 :<|> "drafts" :> Capture "draftId" Int64 :> Get '[JSON] (String, Block String)
34 :<|> "drafts" :> Capture "draftId" Int64 :> ReqBody '[JSON] (String, Block String) :> Put '[JSON] ()
35 :<|> "drafts" :> Capture "draftId" Int64 :> Delete '[JSON] ()