diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-12-25 17:56:13 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-12-25 17:56:13 +0000 |
commit | 9db2c42f4880362cf098358de830415c14f6878c (patch) | |
tree | 2b0b9257f01eec926152746fc2e7646764063c3a /servant/api | |
parent | 08eee2f0de77ffa631e84ccf734e8e95817b7c81 (diff) | |
download | thermoprint-9db2c42f4880362cf098358de830415c14f6878c.tar thermoprint-9db2c42f4880362cf098358de830415c14f6878c.tar.gz thermoprint-9db2c42f4880362cf098358de830415c14f6878c.tar.bz2 thermoprint-9db2c42f4880362cf098358de830415c14f6878c.tar.xz thermoprint-9db2c42f4880362cf098358de830415c14f6878c.zip |
Cleaned tree for rewrite
Diffstat (limited to 'servant/api')
-rw-r--r-- | servant/api/Thermoprint/Api.hs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/servant/api/Thermoprint/Api.hs b/servant/api/Thermoprint/Api.hs deleted file mode 100644 index f3318c4..0000000 --- a/servant/api/Thermoprint/Api.hs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | {-# LANGUAGE DataKinds, TypeOperators, DeriveGeneric #-} | ||
2 | |||
3 | module Thermoprint.Api | ||
4 | ( ThermoprintApi | ||
5 | ) where | ||
6 | |||
7 | import Thermoprint | ||
8 | import Data.Aeson | ||
9 | import Servant.API | ||
10 | import qualified Data.Text.Lazy as Text | ||
11 | import qualified Data.ByteString.Lazy.Char8 as ByteString | ||
12 | import Data.ByteString.Lazy.Char8 (ByteString) | ||
13 | import GHC.Generics | ||
14 | |||
15 | import Control.Monad | ||
16 | |||
17 | import Data.Int (Int64) | ||
18 | |||
19 | instance ToJSON ByteString where | ||
20 | toJSON = toJSON . Text.pack . ByteString.unpack | ||
21 | instance FromJSON ByteString where | ||
22 | parseJSON value = (ByteString.pack . Text.unpack) `liftM` parseJSON value | ||
23 | |||
24 | instance ToJSON c => ToJSON (Inline c) | ||
25 | instance FromJSON c => FromJSON (Inline c) | ||
26 | |||
27 | instance ToJSON c => ToJSON (Block c) | ||
28 | instance FromJSON c => FromJSON (Block c) | ||
29 | |||
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] () | ||