{-# LANGUAGE OverloadedStrings #-}
module Logging.Scope
( Scope (..)
, server
, database
, logging
, docs
, docsText
, docsTextRevision
, docsTree
, docsTreeRevision
, docsComment
, userManagement
, email
) where
import Data.Text (Text)
import Data.Aeson (FromJSON (parseJSON), ToJSON)
import Data.Aeson.Types (ToJSON (toJSON))
import Data.OpenApi (ToSchema)
import Data.OpenApi.Schema (ToSchema (declareNamedSchema))
import Data.Proxy (Proxy (Proxy))
newtype Scope = Scope
{ Scope -> Text
unScope :: Text
}
instance ToJSON Scope where
toJSON :: Scope -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
toJSON (Text -> Value) -> (Scope -> Text) -> Scope -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Scope -> Text
unScope
instance FromJSON Scope where
parseJSON :: Value -> Parser Scope
parseJSON = (Text -> Scope) -> Parser Text -> Parser Scope
forall a b. (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> Scope
Scope (Parser Text -> Parser Scope)
-> (Value -> Parser Text) -> Value -> Parser Scope
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
parseJSON
instance ToSchema Scope where
declareNamedSchema :: Proxy Scope -> Declare (Definitions Schema) NamedSchema
declareNamedSchema Proxy Scope
_ = Proxy Text -> Declare (Definitions Schema) NamedSchema
forall a.
ToSchema a =>
Proxy a -> Declare (Definitions Schema) NamedSchema
declareNamedSchema (Proxy Text
forall {k} (t :: k). Proxy t
Proxy :: Proxy Text)
server :: Scope
server :: Scope
server = Text -> Scope
Scope Text
"server"
database :: Scope
database :: Scope
database = Text -> Scope
Scope Text
"database"
logging :: Scope
logging :: Scope
logging = Text -> Scope
Scope Text
"logging"
docs :: Scope
docs :: Scope
docs = Text -> Scope
Scope Text
"docs"
docsText :: Scope
docsText :: Scope
docsText = Text -> Scope
Scope Text
"docs.text"
docsTextRevision :: Scope
docsTextRevision :: Scope
docsTextRevision = Text -> Scope
Scope Text
"docs.text.revision"
docsTree :: Scope
docsTree :: Scope
docsTree = Text -> Scope
Scope Text
"docs.tree"
docsTreeRevision :: Scope
docsTreeRevision :: Scope
docsTreeRevision = Text -> Scope
Scope Text
"docs.tree.revision"
docsComment :: Scope
= Text -> Scope
Scope Text
"docs.comment"
userManagement :: Scope
userManagement :: Scope
userManagement = Text -> Scope
Scope Text
"user-management"
email :: Scope
email :: Scope
email = Text -> Scope
Scope Text
"email"