4r/4r-feed/Feed/V1/Spec.hs

27 lines
962 B
Haskell

module Feed.V1.Spec (FeedApi, feedApi) where
import Relude
import Api.V1.Types (Topic)
import Feed.V1.Types (TopicsNew)
import Servant.API
import Servant.API.ContentTypes.AtomFeed (AtomFeed)
import Servant.API.ContentTypes.AtomFeed.Instances ()
{- | Mimics 4rum's schema with additions
- /v1/topic/:topic_id - Subscribe to a topic
- /v1/sections/:section_id?ignore_topic=:topic_id - Subscribe to all topics in `section_id` ignoring `topic_id`
- /v1/sections/:section_id/new - Subscribe to new topics in `section_id` (returns only initial post)
- /v1/sections/all?ignore_thread=:section_id&ignore_topic=:topic_id - Subscribe to topics in all threads sans `section_id` ignoring `topic_id`
-}
type FeedApi =
"v1"
:> ( "topic" :> Capture "topic_id" Integer :> Get '[AtomFeed] Topic
:<|> "sections" :> Capture "section_id" Integer
:> "new"
:> Get '[AtomFeed] TopicsNew
)
feedApi :: Proxy FeedApi
feedApi = Proxy