module Wire.API.Routes.Internal.Brig.OAuth where
import Data.Id (OAuthClientId)
import Servant (JSON)
import Servant hiding (Handler, JSON, Tagged, addHeader, respond)
import Servant.OpenApi.Internal.Orphans ()
import Wire.API.Error
import Wire.API.OAuth
import Wire.API.Routes.Named (Named)
type OAuthAPI =
Named
"create-oauth-client"
( Summary "Register an OAuth client"
:> CanThrow 'OAuthFeatureDisabled
:> "oauth"
:> "clients"
:> ReqBody '[JSON] OAuthClientConfig
:> Post '[JSON] OAuthClientCredentials
)
:<|> Named
"i-get-oauth-client"
( Summary "Get OAuth client by id"
:> CanThrow 'OAuthFeatureDisabled
:> CanThrow 'OAuthClientNotFound
:> "oauth"
:> "clients"
:> Capture "id" OAuthClientId
:> Get '[JSON] OAuthClient
)
:<|> Named
"update-oauth-client"
( Summary "Update OAuth client"
:> CanThrow 'OAuthFeatureDisabled
:> CanThrow 'OAuthClientNotFound
:> "oauth"
:> "clients"
:> Capture "id" OAuthClientId
:> ReqBody '[JSON] OAuthClientConfig
:> Put '[JSON] OAuthClient
)
:<|> Named
"delete-oauth-client"
( Summary "Delete OAuth client"
:> CanThrow 'OAuthFeatureDisabled
:> CanThrow 'OAuthClientNotFound
:> "oauth"
:> "clients"
:> Capture "id" OAuthClientId
:> Delete '[JSON] ()
)