aboutsummaryrefslogtreecommitdiff
path: root/lib/API.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/API.hs')
-rw-r--r--lib/API.hs37
1 files changed, 20 insertions, 17 deletions
diff --git a/lib/API.hs b/lib/API.hs
index a04e131..f95132a 100644
--- a/lib/API.hs
+++ b/lib/API.hs
@@ -7,27 +7,29 @@
-- Haskell type. All other descriptions of the API are generated from this one.
module API (API, CompleteAPI, GtfsRealtimeAPI, AdminAPI) where
-import Data.Map (Map)
-import Data.Proxy (Proxy (..))
-import Data.Swagger (Swagger)
-import Data.Swagger.ParamSchema (ToParamSchema (..))
-import Data.Text (Text)
-import Data.Time (Day, UTCTime)
-import Data.UUID (UUID)
-import Servant (Application,
- FromHttpApiData (parseUrlPiece),
- Server, err401, err404, type (:>))
-import Servant.API (Capture, Get, JSON, NoContent, Post,
- QueryParam, ReqBody,
- type (:<|>) ((:<|>)))
-import Servant.API.WebSocket (WebSocket)
-import Servant.GTFS.Realtime (Proto)
-import Servant.Swagger (HasSwagger (..))
+import Data.Map (Map)
+import Data.Proxy (Proxy (..))
+import Data.Swagger (Swagger)
+import Data.Swagger.ParamSchema (ToParamSchema (..))
+import Data.Text (Text)
+import Data.Time (Day, UTCTime)
+import Data.UUID (UUID)
+import Servant (Application, FormUrlEncoded,
+ FromHttpApiData (parseUrlPiece),
+ Server, err401, err404, type (:>))
+import Servant.API (Capture, Get, JSON, NoContent,
+ PlainText, Post, QueryParam,
+ ReqBody, type (:<|>) ((:<|>)))
+import Servant.API.WebSocket (WebSocket)
+import Servant.GTFS.Realtime (Proto)
+import Servant.Swagger (HasSwagger (..))
+import Web.Internal.FormUrlEncoded (Form)
import GTFS
import GTFS.Realtime.FeedEntity
-import GTFS.Realtime.FeedMessage (FeedMessage)
+import GTFS.Realtime.FeedMessage (FeedMessage)
import Persist
+import Server.ControlRoom
-- | The server's API (as it is actually intended).
@@ -45,6 +47,7 @@ type API = "stations" :> Get '[JSON] (Map StationID Station)
:<|> "gtfs" :> GtfsRealtimeAPI
-- TODO: this should be behind auth / OpenID or something
:<|> "admin" :> AdminAPI
+ :<|> "control" :> ControlRoomAPI
-- | The API used for publishing gtfs realtime updates
type GtfsRealtimeAPI = "servicealerts" :> Get '[Proto] FeedMessage