diff options
Diffstat (limited to 'servant/api/Thermoprint/Api.hs')
| -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] () | ||
