{-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE PackageImports #-} module API where import Servant.API import Servant.Links import Servant.RawM import Servant.HTML.Blaze import Data.Proxy import qualified Data.Text as T -- imports from "mateamt" import qualified "mateamt" Types as MT -- internal imports import Types type UserAPI = Header "Cookie" T.Text :> (Get '[HTML] UserSelectPage :<|> "user" :> Capture "id" Int :> Get '[HTML] UserOverviewPage :<|> "user" :> "create" :> Get '[HTML] UserNewPage :<|> "user" :> "create" :> ReqBody '[FormUrlEncoded] MT.UserSubmit :> Post '[HTML] UserSelectPage :<|> "product" :> "list" :> QueryParam "refine" MT.ProductRefine :> Get '[HTML] ProductListPage :<|> "auth" :> Get '[HTML] (Headers '[ Header "Set-Cookie" T.Text , Header "Set-Cookie" T.Text , Header "Set-Cookie" T.Text ] AuthPage) :<|> "auth" :> ReqBody '[FormUrlEncoded] AuthReturn :> Post '[HTML] UserSelectPage ) ( userSelectLink :<|> userOverviewLink :<|> userNewLink :<|> userNewPostLink :<|> productListLink :<|> authLink :<|> authPostLink ) = allLinks (Proxy :: Proxy UserAPI)