summaryrefslogtreecommitdiffhomepage
path: root/HTTP
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-20 17:59:14 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-20 17:59:14 -0400
commit7ed6961a0e0ef713c136a9d36f86bc7e31414dc5 (patch)
tree591fd6c5f60276c946962f8af27ec3def5d9b303 /HTTP
parent3633c44893bfbd50f25b84ac353012975388332c (diff)
downloadkeysafe-7ed6961a0e0ef713c136a9d36f86bc7e31414dc5.tar.gz
http client, and --server
Diffstat (limited to 'HTTP')
-rw-r--r--HTTP/Client.hs27
-rw-r--r--HTTP/Server.hs4
2 files changed, 30 insertions, 1 deletions
diff --git a/HTTP/Client.hs b/HTTP/Client.hs
new file mode 100644
index 0000000..e4e9b67
--- /dev/null
+++ b/HTTP/Client.hs
@@ -0,0 +1,27 @@
+{- Copyright 2016 Joey Hess <id@joeyh.name>
+ -
+ - Licensed under the GNU AGPL version 3 or higher.
+ -}
+
+module HTTP.Client where
+
+import HTTP
+import Types
+import Types.Storage
+import Servant.API
+import Servant.Client
+import Data.Proxy
+import Network.HTTP.Client (Manager)
+
+apiVersion :: Manager -> BaseUrl -> ClientM APIVersion
+motd :: Manager -> BaseUrl -> ClientM Motd
+proofOfWorkRequirement :: Manager -> BaseUrl -> ClientM (Maybe ProofOfWorkRequirement)
+getObject :: StorableObjectIdent -> Maybe ProofOfWork -> Manager -> BaseUrl -> ClientM StorableObject
+putObject :: StorableObjectIdent -> Maybe ProofOfWork -> Types.StorableObject -> Manager -> BaseUrl -> ClientM StoreResult
+countObjects :: Maybe ProofOfWork -> Manager -> BaseUrl -> ClientM CountResult
+apiVersion
+ :<|> motd
+ :<|> proofOfWorkRequirement
+ :<|> getObject
+ :<|> putObject
+ :<|> countObjects = client (Proxy :: Proxy HttpAPI)
diff --git a/HTTP/Server.hs b/HTTP/Server.hs
index 5df3d06..a6b0f2d 100644
--- a/HTTP/Server.hs
+++ b/HTTP/Server.hs
@@ -1,9 +1,11 @@
+{-# LANGUAGE OverloadedStrings #-}
+
{- Copyright 2016 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
-module HTTP.Server where
+module HTTP.Server (runServer) where
import HTTP
import Types