diff options
author | stuebinm | 2022-07-03 22:41:46 +0200 |
---|---|---|
committer | stuebinm | 2022-07-03 22:41:46 +0200 |
commit | 198290cf11d859aa7f10e9377db8b65646340bca (patch) | |
tree | e731eb44c93a04b6fde47ee8e5948fbd816ec849 /lib/API.hs | |
parent | e254e7ae61ce55cde3e4dc0bae5a94e16577f7bf (diff) |
barebones webform API & frontend
Diffstat (limited to '')
-rw-r--r-- | lib/API.hs | 37 |
1 files changed, 20 insertions, 17 deletions
@@ -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 |