{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# 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 :> QueryParam "refine" MT.ProductRefine :> Get '[HTML] UserOverviewPage :<|> "user" :> Capture "id" Int :> "buy" :> ReqBody '[FormUrlEncoded] [MT.PurchaseDetail] :> Post '[HTML] UserManagePage :<|> "user" :> Capture "id" Int :> "manage" :> Get '[HTML] UserManagePage :<|> "user" :> Capture "id" Int :> "manage" :> ReqBody '[FormUrlEncoded] MT.UserDetailsSubmit :> Post '[HTML] UserManagePage :<|> "user" :> Capture "id" Int :> "manage" :> "authcreate" :> ReqBody '[FormUrlEncoded] AuthSubmitReturn :> Post '[HTML] UserManagePage :<|> "user" :> Capture "id" Int :> "manage" :> "authdelete" :> ReqBody '[FormUrlEncoded] AuthDetailId :> Post '[HTML] UserManagePage :<|> "user" :> "create" :> Get '[HTML] UserNewPage :<|> "user" :> "create" :> ReqBody '[FormUrlEncoded] MT.UserSubmit :> Post '[HTML] UserSelectPage :<|> "auth" :> QueryParam "destination" T.Text :> Get '[HTML] (Headers '[ Header "Set-Cookie" T.Text , Header "Set-Cookie" T.Text ] AuthPage) :<|> "auth" :> QueryParam "destination" T.Text :> ReqBody '[FormUrlEncoded] AuthReturn :> Post '[HTML] UserSelectPage :<|> "auth" :> "logout" :> Post '[HTML] UserOverviewPage ) ( userSelectLink :<|> userOverviewLink :<|> buyLink :<|> userManageLink :<|> userManageDetailsSubmitLink :<|> userManageAuthCreateLink :<|> userManageAuthDeleteLink :<|> userNewLink :<|> userNewPostLink :<|> authLink :<|> authPostLink :<|> authLogoutLink ) = allLinks (Proxy :: Proxy UserAPI)