aboutsummaryrefslogtreecommitdiff
path: root/src/Endpoints/VersionsEndpoint.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Endpoints/VersionsEndpoint.hs')
-rw-r--r--src/Endpoints/VersionsEndpoint.hs20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/Endpoints/VersionsEndpoint.hs b/src/Endpoints/VersionsEndpoint.hs
index 79fd3ea..e5739cf 100644
--- a/src/Endpoints/VersionsEndpoint.hs
+++ b/src/Endpoints/VersionsEndpoint.hs
@@ -1,12 +1,22 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
-module Endpoints.VersionsEndpoint (VersionsAPI, handleVersions) where
+module Endpoints.VersionsEndpoint (VersionsAPI, versionsServer) where
import Servant
-import Data.VersionsData
+import Data.Text (pack)
-type VersionsAPI = "_matrix" :> "client" :> "versions" :> Get '[JSON] Versions
+import Model.Versions
-handleVersions :: Handler Versions
-handleVersions = return (makeVersions ["1.12"])
+----------------------------------------------------------------------------------------------------
+type VersionsAPI = GetVersions
+
+versionsServer :: Server VersionsAPI
+versionsServer = handleVersionsGet
+-- http://localhost:8080
+--- GET /_matrix/client/versions -------------------------------------------------------------------
+type GetVersions = "_matrix" :> "client" :> "versions"
+ :> Get '[JSON] VersionsResponse
+
+handleVersionsGet :: Handler VersionsResponse
+handleVersionsGet = return $ VersionsResponse [pack "v1.12"]