{-# LANGUAGE TemplateHaskell #-} module Spm.Api ( SpmMailbox , SpmApi, spmApi ) where import Prelude import Servant.API import Data.Proxy (Proxy(..)) import Data.Text (Text) import GHC.Generics (Generic) import Type.Reflection (Typeable) import Control.Lens.TH import Data.CaseInsensitive (CI) import Data.CaseInsensitive.Instances () import Crypto.JOSE.JWK (JWKSet) import Data.UUID (UUID) import Data.UUID.Instances () newtype SpmMailbox = SpmMailbox { unSpmMailbox :: CI Text } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) deriving newtype (MimeRender JSON, MimeRender PlainText) makeWrapped ''SpmMailbox type SpmApi = "whoami" :> Get '[PlainText, JSON] SpmMailbox :<|> ".well-known" :> "jwks.json" :> Get '[JSON] JWKSet :<|> "instance-id" :> Get '[PlainText, JSON, OctetStream] UUID spmApi :: Proxy SpmApi spmApi = Proxy