diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-10-17 21:23:45 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-10-17 21:23:45 +0200 |
commit | e65e1eaac335a4738abb9e8ee8da7a229f96c2c0 (patch) | |
tree | 8711caffd49f24ee8136523e0aefc76e37d8666a /servant/api | |
parent | 005dc408dc09c3b479398ebe3e92efa2cd54846e (diff) | |
download | thermoprint-e65e1eaac335a4738abb9e8ee8da7a229f96c2c0.tar thermoprint-e65e1eaac335a4738abb9e8ee8da7a229f96c2c0.tar.gz thermoprint-e65e1eaac335a4738abb9e8ee8da7a229f96c2c0.tar.bz2 thermoprint-e65e1eaac335a4738abb9e8ee8da7a229f96c2c0.tar.xz thermoprint-e65e1eaac335a4738abb9e8ee8da7a229f96c2c0.zip |
Drafts
Diffstat (limited to 'servant/api')
-rw-r--r-- | servant/api/Thermoprint/Api.hs | 9 |
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 | ||
15 | import Control.Monad | 15 | import Control.Monad |
16 | 16 | ||
17 | import Data.Int (Int64) | ||
18 | |||
17 | instance ToJSON ByteString where | 19 | instance ToJSON ByteString where |
18 | toJSON = toJSON . Text.pack . ByteString.unpack | 20 | toJSON = toJSON . Text.pack . ByteString.unpack |
19 | instance FromJSON ByteString where | 21 | instance FromJSON ByteString where |
@@ -25,4 +27,9 @@ instance FromJSON c => FromJSON (Inline c) | |||
25 | instance ToJSON c => ToJSON (Block c) | 27 | instance ToJSON c => ToJSON (Block c) |
26 | instance FromJSON c => FromJSON (Block c) | 28 | instance FromJSON c => FromJSON (Block c) |
27 | 29 | ||
28 | type ThermoprintApi = "print" :> Capture "printerId" Integer :> ReqBody '[JSON] (Block String) :> Post '[JSON] () | 30 | type 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] () | ||