aboutsummaryrefslogtreecommitdiff
path: root/lib/API.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/API.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/API.hs b/lib/API.hs
index 12d5ba6..3962f73 100644
--- a/lib/API.hs
+++ b/lib/API.hs
@@ -29,7 +29,7 @@ import Servant.API (Accept, Capture, Get, JSON,
MimeRender, MimeUnrender,
NoContent, OctetStream, PlainText,
Post, QueryParam, Raw, ReqBody,
- type (:<|>) (..))
+ type (:<|>) (..), QueryFlag)
import Servant.API.WebSocket (WebSocket)
import Servant.Swagger (HasSwagger (..))
import Web.Internal.FormUrlEncoded (Form)
@@ -51,6 +51,7 @@ import Persist
import Prometheus
import Proto.GtfsRealtime (FeedMessage)
import Servant.API.ContentTypes (Accept (..))
+import qualified OwnTracks as OT
-- | a bare ping as sent by a tracker device
data SentPing = SentPing
@@ -75,11 +76,14 @@ type API =
:<|> "debug" :> "pings" :> Capture "Ticket Id" UUID :> Get '[JSON] [Ping]
:<|> "gtfs.zip" :> Get '[OctetStream] GTFSFile
:<|> "gtfs" :> GtfsRealtimeAPI
+ :<|> "owntracks" :> OwnTracksAPI
type GtfsRealtimeAPI = "servicealerts" :> QueryFlag "force" :> Get '[Proto] FeedMessage
:<|> "tripupdates" :> QueryFlag "force" :> Get '[Proto] FeedMessage
:<|> "vehiclepositions" :> QueryFlag "force" :> Get '[Proto] FeedMessage
+type OwnTracksAPI =
+ "pub" :> QueryParam "u" Text :> QueryParam "d" Text :> ReqBody '[JSON] OT.Message :> Post '[JSON] ()
type CompleteAPI =