summaryrefslogtreecommitdiffhomepage
path: root/HTTP
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-28 16:40:24 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-28 16:40:24 -0400
commitd149bf03647b09caa2af9e55a392251e4d619640 (patch)
tree6e2f3336d48205041fb515dbdd550a31c16dab22 /HTTP
parent9908ae571c5b4086047443c8560cb65838b0caa2 (diff)
downloadkeysafe-d149bf03647b09caa2af9e55a392251e4d619640.tar.gz
simplify http api, remove apiversion
Not needed since all routes are tagged with the api version.
Diffstat (limited to 'HTTP')
-rw-r--r--HTTP/Client.hs10
-rw-r--r--HTTP/Server.hs6
2 files changed, 5 insertions, 11 deletions
diff --git a/HTTP/Client.hs b/HTTP/Client.hs
index 4a5106b..0a79ba0 100644
--- a/HTTP/Client.hs
+++ b/HTTP/Client.hs
@@ -13,13 +13,11 @@ import Servant.Client
import Data.Proxy
import Network.HTTP.Client (Manager)
-apiVersion :: Manager -> BaseUrl -> ClientM APIVersion
+httpAPI :: Proxy HttpAPI
+httpAPI = Proxy
+
motd :: Manager -> BaseUrl -> ClientM Motd
getObject :: StorableObjectIdent -> Maybe ProofOfWork -> Manager -> BaseUrl -> ClientM (ProofOfWorkRequirement StorableObject)
putObject :: StorableObjectIdent -> Maybe ProofOfWork -> StorableObject -> Manager -> BaseUrl -> ClientM (ProofOfWorkRequirement StoreResult)
countObjects :: Maybe ProofOfWork -> Manager -> BaseUrl -> ClientM (ProofOfWorkRequirement CountResult)
-apiVersion
- :<|> motd
- :<|> getObject
- :<|> putObject
- :<|> countObjects = client (Proxy :: Proxy HttpAPI)
+motd :<|> getObject :<|> putObject :<|> countObjects = client httpAPI
diff --git a/HTTP/Server.hs b/HTTP/Server.hs
index a26cd5e..7086167 100644
--- a/HTTP/Server.hs
+++ b/HTTP/Server.hs
@@ -44,15 +44,11 @@ userAPI :: Proxy HttpAPI
userAPI = Proxy
server :: ServerState -> Server HttpAPI
-server st = apiVersion
- :<|> motd
+server st = motd
:<|> getObject st
:<|> putObject st
:<|> countObjects st
-apiVersion :: Handler APIVersion
-apiVersion = return (APIVersion 1)
-
motd :: Handler Motd
motd = return $ Motd "Hello World!"