From d5c7beb4507f5a0ba361464173447ed3521d9973 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 2 Jul 2022 18:14:47 +0200 Subject: rudimentary admin api implementation --- lib/API.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/API.hs') diff --git a/lib/API.hs b/lib/API.hs index 5afd041..845ad06 100644 --- a/lib/API.hs +++ b/lib/API.hs @@ -40,6 +40,7 @@ type API = "stations" :> Get '[JSON] (Map StationID Station) -- debug things :<|> "debug" :> "state" :> Get '[JSON] (Map Token [TripPing]) :<|> "gtfs" :> GtfsRealtimeAPI + -- TODO: this should be behind auth / OpenID or something :<|> "admin" :> AdminAPI -- | The API used for publishing gtfs realtime updates @@ -49,10 +50,10 @@ type GtfsRealtimeAPI = "servicealerts" :> Get '[Proto] FeedMessage -- | Admin API used for short-term timetable changes etc. ("leitstelle") type AdminAPI = - "trip" :> "announce" :> Capture "Trip ID" TripID :> QueryParam "day" Day :> ReqBody '[JSON] Text :> Post '[JSON] UUID + "trip" :> "announce" :> ReqBody '[JSON] Announcement :> Post '[JSON] UUID :<|> "trip" :> "announce" :> "delete" :> Capture "Announcement ID" UUID :> Post '[JSON] () - :<|> "trip" :> "date" :> "add" :> Capture "Trip ID" TripID :> Post '[JSON] () - :<|> "trip" :> "date" :> "cancel" :> Capture "Trip ID" TripID :> Post '[JSON] () + :<|> "trip" :> "date" :> "add" :> Capture "Trip ID" TripID :> Capture "day" Day :> Post '[JSON] () + :<|> "trip" :> "date" :> "cancel" :> Capture "Trip ID" TripID :> Capture "day" Day :> Post '[JSON] () -- TODO for this to be useful there ought to be a half-deep Trip type -- (that has stops but not shapes) :<|> "extraordinary" :> "trip" :> ReqBody '[JSON] (Trip Deep Shallow) :> Post '[JSON] () -- cgit v1.2.3