specify post relay API endpoints

contributes to #41, #32
This commit is contained in:
Trolli Schmittlauch 2020-07-23 00:09:45 +02:00
parent e2ecf0739d
commit 5fedd9f87c
2 changed files with 19 additions and 2 deletions

View file

@ -0,0 +1,17 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE OverloadedStrings #-}
module Hash2Pub.PostService where
import Servant
import qualified Data.Text as Txt
type ServiceAPI = "relay" :> "inbox" :> PostCreated '[PlainText] Txt.Text
-- ^ delivery endpoint of new posts to relay
:<|> "relay" :> "subscribers" :> Post '[PlainText] Txt.Text
-- ^ endpoint for delivering the subscription and outstanding queue
:<|> "post" :> Capture "postid" Txt.Text :> Get '[PlainText] Txt.Text
:<|> "tags" :> Capture "hashtag" Txt.Text :> PostCreated '[PlainText] Txt.Text
:<|> "tags" :> Capture "hashtag" Txt.Text :> "subscribe" :> Header "Origin" Txt.Text :> Get '[PlainText] Txt.Text
:<|> "tags" :> Capture "hashtag" Txt.Text :> "unsubscribe" :> Header "Origin" Txt.Text :> Get '[PlainText] Txt.Text