{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE TemplateHaskell #-}
module Hasura.RQL.Types.Endpoint
( EndpointName (..),
EndpointMethod (..),
EndpointUrl (),
CreateEndpoint,
EndpointDef (..),
QueryReference (..),
EndpointMetadata (..),
DropEndpoint (..),
module Trie,
EndpointTrie,
buildEndpointsTrie,
qrCollectionName,
qrQueryName,
edQuery,
ceComment,
ceDefinition,
ceMethods,
ceName,
ceUrl,
deName,
splitPath,
mkEndpointUrl,
unEndpointUrl,
)
where
import Control.Lens
import Data.Aeson
import Data.Aeson.Casing
import Data.Aeson.TH
import Data.HashMap.Strict.Multi qualified as MM
import Data.Text qualified as T
import Data.Text.Extended
import Data.Text.NonEmpty
import Data.Trie qualified as T
import Hasura.Prelude
import Hasura.RQL.Types.Endpoint.Trie as Trie
import Hasura.RQL.Types.QueryCollection (CollectionName, QueryName)
import Web.HttpApiData (FromHttpApiData (..))
data EndpointMethod
= GET
| POST
| PUT
| DELETE
| PATCH
deriving
(Int -> EndpointMethod -> ShowS
[EndpointMethod] -> ShowS
EndpointMethod -> String
(Int -> EndpointMethod -> ShowS)
-> (EndpointMethod -> String)
-> ([EndpointMethod] -> ShowS)
-> Show EndpointMethod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointMethod] -> ShowS
$cshowList :: [EndpointMethod] -> ShowS
show :: EndpointMethod -> String
$cshow :: EndpointMethod -> String
showsPrec :: Int -> EndpointMethod -> ShowS
$cshowsPrec :: Int -> EndpointMethod -> ShowS
Show, EndpointMethod -> EndpointMethod -> Bool
(EndpointMethod -> EndpointMethod -> Bool)
-> (EndpointMethod -> EndpointMethod -> Bool) -> Eq EndpointMethod
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointMethod -> EndpointMethod -> Bool
$c/= :: EndpointMethod -> EndpointMethod -> Bool
== :: EndpointMethod -> EndpointMethod -> Bool
$c== :: EndpointMethod -> EndpointMethod -> Bool
Eq, Eq EndpointMethod
Eq EndpointMethod
-> (EndpointMethod -> EndpointMethod -> Ordering)
-> (EndpointMethod -> EndpointMethod -> Bool)
-> (EndpointMethod -> EndpointMethod -> Bool)
-> (EndpointMethod -> EndpointMethod -> Bool)
-> (EndpointMethod -> EndpointMethod -> Bool)
-> (EndpointMethod -> EndpointMethod -> EndpointMethod)
-> (EndpointMethod -> EndpointMethod -> EndpointMethod)
-> Ord EndpointMethod
EndpointMethod -> EndpointMethod -> Bool
EndpointMethod -> EndpointMethod -> Ordering
EndpointMethod -> EndpointMethod -> EndpointMethod
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EndpointMethod -> EndpointMethod -> EndpointMethod
$cmin :: EndpointMethod -> EndpointMethod -> EndpointMethod
max :: EndpointMethod -> EndpointMethod -> EndpointMethod
$cmax :: EndpointMethod -> EndpointMethod -> EndpointMethod
>= :: EndpointMethod -> EndpointMethod -> Bool
$c>= :: EndpointMethod -> EndpointMethod -> Bool
> :: EndpointMethod -> EndpointMethod -> Bool
$c> :: EndpointMethod -> EndpointMethod -> Bool
<= :: EndpointMethod -> EndpointMethod -> Bool
$c<= :: EndpointMethod -> EndpointMethod -> Bool
< :: EndpointMethod -> EndpointMethod -> Bool
$c< :: EndpointMethod -> EndpointMethod -> Bool
compare :: EndpointMethod -> EndpointMethod -> Ordering
$ccompare :: EndpointMethod -> EndpointMethod -> Ordering
$cp1Ord :: Eq EndpointMethod
Ord, Int -> EndpointMethod -> Int
EndpointMethod -> Int
(Int -> EndpointMethod -> Int)
-> (EndpointMethod -> Int) -> Hashable EndpointMethod
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: EndpointMethod -> Int
$chash :: EndpointMethod -> Int
hashWithSalt :: Int -> EndpointMethod -> Int
$chashWithSalt :: Int -> EndpointMethod -> Int
Hashable, Value -> Parser [EndpointMethod]
Value -> Parser EndpointMethod
(Value -> Parser EndpointMethod)
-> (Value -> Parser [EndpointMethod]) -> FromJSON EndpointMethod
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [EndpointMethod]
$cparseJSONList :: Value -> Parser [EndpointMethod]
parseJSON :: Value -> Parser EndpointMethod
$cparseJSON :: Value -> Parser EndpointMethod
FromJSON, [EndpointMethod] -> Value
[EndpointMethod] -> Encoding
EndpointMethod -> Value
EndpointMethod -> Encoding
(EndpointMethod -> Value)
-> (EndpointMethod -> Encoding)
-> ([EndpointMethod] -> Value)
-> ([EndpointMethod] -> Encoding)
-> ToJSON EndpointMethod
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [EndpointMethod] -> Encoding
$ctoEncodingList :: [EndpointMethod] -> Encoding
toJSONList :: [EndpointMethod] -> Value
$ctoJSONList :: [EndpointMethod] -> Value
toEncoding :: EndpointMethod -> Encoding
$ctoEncoding :: EndpointMethod -> Encoding
toJSON :: EndpointMethod -> Value
$ctoJSON :: EndpointMethod -> Value
ToJSON, ToJSONKeyFunction [EndpointMethod]
ToJSONKeyFunction EndpointMethod
ToJSONKeyFunction EndpointMethod
-> ToJSONKeyFunction [EndpointMethod] -> ToJSONKey EndpointMethod
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [EndpointMethod]
$ctoJSONKeyList :: ToJSONKeyFunction [EndpointMethod]
toJSONKey :: ToJSONKeyFunction EndpointMethod
$ctoJSONKey :: ToJSONKeyFunction EndpointMethod
ToJSONKey, (forall x. EndpointMethod -> Rep EndpointMethod x)
-> (forall x. Rep EndpointMethod x -> EndpointMethod)
-> Generic EndpointMethod
forall x. Rep EndpointMethod x -> EndpointMethod
forall x. EndpointMethod -> Rep EndpointMethod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointMethod x -> EndpointMethod
$cfrom :: forall x. EndpointMethod -> Rep EndpointMethod x
Generic)
instance ToTxt EndpointMethod where
toTxt :: EndpointMethod -> Text
toTxt = EndpointMethod -> Text
forall a. Show a => a -> Text
tshow
newtype EndpointName = EndpointName {EndpointName -> NonEmptyText
unEndpointName :: NonEmptyText}
deriving newtype
( Int -> EndpointName -> ShowS
[EndpointName] -> ShowS
EndpointName -> String
(Int -> EndpointName -> ShowS)
-> (EndpointName -> String)
-> ([EndpointName] -> ShowS)
-> Show EndpointName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointName] -> ShowS
$cshowList :: [EndpointName] -> ShowS
show :: EndpointName -> String
$cshow :: EndpointName -> String
showsPrec :: Int -> EndpointName -> ShowS
$cshowsPrec :: Int -> EndpointName -> ShowS
Show,
EndpointName -> EndpointName -> Bool
(EndpointName -> EndpointName -> Bool)
-> (EndpointName -> EndpointName -> Bool) -> Eq EndpointName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointName -> EndpointName -> Bool
$c/= :: EndpointName -> EndpointName -> Bool
== :: EndpointName -> EndpointName -> Bool
$c== :: EndpointName -> EndpointName -> Bool
Eq,
Eq EndpointName
Eq EndpointName
-> (EndpointName -> EndpointName -> Ordering)
-> (EndpointName -> EndpointName -> Bool)
-> (EndpointName -> EndpointName -> Bool)
-> (EndpointName -> EndpointName -> Bool)
-> (EndpointName -> EndpointName -> Bool)
-> (EndpointName -> EndpointName -> EndpointName)
-> (EndpointName -> EndpointName -> EndpointName)
-> Ord EndpointName
EndpointName -> EndpointName -> Bool
EndpointName -> EndpointName -> Ordering
EndpointName -> EndpointName -> EndpointName
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EndpointName -> EndpointName -> EndpointName
$cmin :: EndpointName -> EndpointName -> EndpointName
max :: EndpointName -> EndpointName -> EndpointName
$cmax :: EndpointName -> EndpointName -> EndpointName
>= :: EndpointName -> EndpointName -> Bool
$c>= :: EndpointName -> EndpointName -> Bool
> :: EndpointName -> EndpointName -> Bool
$c> :: EndpointName -> EndpointName -> Bool
<= :: EndpointName -> EndpointName -> Bool
$c<= :: EndpointName -> EndpointName -> Bool
< :: EndpointName -> EndpointName -> Bool
$c< :: EndpointName -> EndpointName -> Bool
compare :: EndpointName -> EndpointName -> Ordering
$ccompare :: EndpointName -> EndpointName -> Ordering
$cp1Ord :: Eq EndpointName
Ord,
EndpointName -> Text
(EndpointName -> Text) -> ToTxt EndpointName
forall a. (a -> Text) -> ToTxt a
toTxt :: EndpointName -> Text
$ctoTxt :: EndpointName -> Text
ToTxt,
Int -> EndpointName -> Int
EndpointName -> Int
(Int -> EndpointName -> Int)
-> (EndpointName -> Int) -> Hashable EndpointName
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: EndpointName -> Int
$chash :: EndpointName -> Int
hashWithSalt :: Int -> EndpointName -> Int
$chashWithSalt :: Int -> EndpointName -> Int
Hashable,
[EndpointName] -> Value
[EndpointName] -> Encoding
EndpointName -> Value
EndpointName -> Encoding
(EndpointName -> Value)
-> (EndpointName -> Encoding)
-> ([EndpointName] -> Value)
-> ([EndpointName] -> Encoding)
-> ToJSON EndpointName
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [EndpointName] -> Encoding
$ctoEncodingList :: [EndpointName] -> Encoding
toJSONList :: [EndpointName] -> Value
$ctoJSONList :: [EndpointName] -> Value
toEncoding :: EndpointName -> Encoding
$ctoEncoding :: EndpointName -> Encoding
toJSON :: EndpointName -> Value
$ctoJSON :: EndpointName -> Value
ToJSON,
Value -> Parser [EndpointName]
Value -> Parser EndpointName
(Value -> Parser EndpointName)
-> (Value -> Parser [EndpointName]) -> FromJSON EndpointName
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [EndpointName]
$cparseJSONList :: Value -> Parser [EndpointName]
parseJSON :: Value -> Parser EndpointName
$cparseJSON :: Value -> Parser EndpointName
FromJSON
)
newtype EndpointUrl = EndpointUrl {EndpointUrl -> NonEmptyText
unEndpointUrl :: NonEmptyText}
deriving newtype
( Int -> EndpointUrl -> ShowS
[EndpointUrl] -> ShowS
EndpointUrl -> String
(Int -> EndpointUrl -> ShowS)
-> (EndpointUrl -> String)
-> ([EndpointUrl] -> ShowS)
-> Show EndpointUrl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointUrl] -> ShowS
$cshowList :: [EndpointUrl] -> ShowS
show :: EndpointUrl -> String
$cshow :: EndpointUrl -> String
showsPrec :: Int -> EndpointUrl -> ShowS
$cshowsPrec :: Int -> EndpointUrl -> ShowS
Show,
EndpointUrl -> EndpointUrl -> Bool
(EndpointUrl -> EndpointUrl -> Bool)
-> (EndpointUrl -> EndpointUrl -> Bool) -> Eq EndpointUrl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointUrl -> EndpointUrl -> Bool
$c/= :: EndpointUrl -> EndpointUrl -> Bool
== :: EndpointUrl -> EndpointUrl -> Bool
$c== :: EndpointUrl -> EndpointUrl -> Bool
Eq,
Eq EndpointUrl
Eq EndpointUrl
-> (EndpointUrl -> EndpointUrl -> Ordering)
-> (EndpointUrl -> EndpointUrl -> Bool)
-> (EndpointUrl -> EndpointUrl -> Bool)
-> (EndpointUrl -> EndpointUrl -> Bool)
-> (EndpointUrl -> EndpointUrl -> Bool)
-> (EndpointUrl -> EndpointUrl -> EndpointUrl)
-> (EndpointUrl -> EndpointUrl -> EndpointUrl)
-> Ord EndpointUrl
EndpointUrl -> EndpointUrl -> Bool
EndpointUrl -> EndpointUrl -> Ordering
EndpointUrl -> EndpointUrl -> EndpointUrl
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EndpointUrl -> EndpointUrl -> EndpointUrl
$cmin :: EndpointUrl -> EndpointUrl -> EndpointUrl
max :: EndpointUrl -> EndpointUrl -> EndpointUrl
$cmax :: EndpointUrl -> EndpointUrl -> EndpointUrl
>= :: EndpointUrl -> EndpointUrl -> Bool
$c>= :: EndpointUrl -> EndpointUrl -> Bool
> :: EndpointUrl -> EndpointUrl -> Bool
$c> :: EndpointUrl -> EndpointUrl -> Bool
<= :: EndpointUrl -> EndpointUrl -> Bool
$c<= :: EndpointUrl -> EndpointUrl -> Bool
< :: EndpointUrl -> EndpointUrl -> Bool
$c< :: EndpointUrl -> EndpointUrl -> Bool
compare :: EndpointUrl -> EndpointUrl -> Ordering
$ccompare :: EndpointUrl -> EndpointUrl -> Ordering
$cp1Ord :: Eq EndpointUrl
Ord,
EndpointUrl -> Text
(EndpointUrl -> Text) -> ToTxt EndpointUrl
forall a. (a -> Text) -> ToTxt a
toTxt :: EndpointUrl -> Text
$ctoTxt :: EndpointUrl -> Text
ToTxt,
Int -> EndpointUrl -> Int
EndpointUrl -> Int
(Int -> EndpointUrl -> Int)
-> (EndpointUrl -> Int) -> Hashable EndpointUrl
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: EndpointUrl -> Int
$chash :: EndpointUrl -> Int
hashWithSalt :: Int -> EndpointUrl -> Int
$chashWithSalt :: Int -> EndpointUrl -> Int
Hashable,
[EndpointUrl] -> Value
[EndpointUrl] -> Encoding
EndpointUrl -> Value
EndpointUrl -> Encoding
(EndpointUrl -> Value)
-> (EndpointUrl -> Encoding)
-> ([EndpointUrl] -> Value)
-> ([EndpointUrl] -> Encoding)
-> ToJSON EndpointUrl
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [EndpointUrl] -> Encoding
$ctoEncodingList :: [EndpointUrl] -> Encoding
toJSONList :: [EndpointUrl] -> Value
$ctoJSONList :: [EndpointUrl] -> Value
toEncoding :: EndpointUrl -> Encoding
$ctoEncoding :: EndpointUrl -> Encoding
toJSON :: EndpointUrl -> Value
$ctoJSON :: EndpointUrl -> Value
ToJSON,
Value -> Parser [EndpointUrl]
Value -> Parser EndpointUrl
(Value -> Parser EndpointUrl)
-> (Value -> Parser [EndpointUrl]) -> FromJSON EndpointUrl
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [EndpointUrl]
$cparseJSONList :: Value -> Parser [EndpointUrl]
parseJSON :: Value -> Parser EndpointUrl
$cparseJSON :: Value -> Parser EndpointUrl
FromJSON
)
mkEndpointUrl :: ToTxt a => a -> Maybe EndpointUrl
mkEndpointUrl :: a -> Maybe EndpointUrl
mkEndpointUrl a
s = NonEmptyText -> EndpointUrl
EndpointUrl (NonEmptyText -> EndpointUrl)
-> Maybe NonEmptyText -> Maybe EndpointUrl
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> Maybe NonEmptyText
mkNonEmptyText (a -> Text
forall a. ToTxt a => a -> Text
toTxt a
s)
instance FromHttpApiData EndpointUrl where
parseQueryParam :: Text -> Either Text EndpointUrl
parseQueryParam Text
s =
Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
parseQueryParam Text
s Either Text Text
-> (Text -> Either Text EndpointUrl) -> Either Text EndpointUrl
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Text
t ->
case Text -> Maybe NonEmptyText
mkNonEmptyText Text
t of
Maybe NonEmptyText
Nothing -> Text -> Either Text EndpointUrl
forall a b. a -> Either a b
Left Text
"Endpoint url must be non-empty"
Just NonEmptyText
net -> EndpointUrl -> Either Text EndpointUrl
forall a b. b -> Either a b
Right (NonEmptyText -> EndpointUrl
EndpointUrl NonEmptyText
net)
data QueryReference = QueryReference
{ QueryReference -> CollectionName
_qrCollectionName :: CollectionName,
QueryReference -> QueryName
_qrQueryName :: QueryName
}
deriving stock (Int -> QueryReference -> ShowS
[QueryReference] -> ShowS
QueryReference -> String
(Int -> QueryReference -> ShowS)
-> (QueryReference -> String)
-> ([QueryReference] -> ShowS)
-> Show QueryReference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryReference] -> ShowS
$cshowList :: [QueryReference] -> ShowS
show :: QueryReference -> String
$cshow :: QueryReference -> String
showsPrec :: Int -> QueryReference -> ShowS
$cshowsPrec :: Int -> QueryReference -> ShowS
Show, QueryReference -> QueryReference -> Bool
(QueryReference -> QueryReference -> Bool)
-> (QueryReference -> QueryReference -> Bool) -> Eq QueryReference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryReference -> QueryReference -> Bool
$c/= :: QueryReference -> QueryReference -> Bool
== :: QueryReference -> QueryReference -> Bool
$c== :: QueryReference -> QueryReference -> Bool
Eq, (forall x. QueryReference -> Rep QueryReference x)
-> (forall x. Rep QueryReference x -> QueryReference)
-> Generic QueryReference
forall x. Rep QueryReference x -> QueryReference
forall x. QueryReference -> Rep QueryReference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryReference x -> QueryReference
$cfrom :: forall x. QueryReference -> Rep QueryReference x
Generic)
$(deriveJSON (aesonDrop 3 snakeCase) ''QueryReference)
$(makeLenses ''QueryReference)
data EndpointDef query = EndpointDef
{ EndpointDef query -> query
_edQuery :: query
}
deriving stock (Int -> EndpointDef query -> ShowS
[EndpointDef query] -> ShowS
EndpointDef query -> String
(Int -> EndpointDef query -> ShowS)
-> (EndpointDef query -> String)
-> ([EndpointDef query] -> ShowS)
-> Show (EndpointDef query)
forall query. Show query => Int -> EndpointDef query -> ShowS
forall query. Show query => [EndpointDef query] -> ShowS
forall query. Show query => EndpointDef query -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointDef query] -> ShowS
$cshowList :: forall query. Show query => [EndpointDef query] -> ShowS
show :: EndpointDef query -> String
$cshow :: forall query. Show query => EndpointDef query -> String
showsPrec :: Int -> EndpointDef query -> ShowS
$cshowsPrec :: forall query. Show query => Int -> EndpointDef query -> ShowS
Show, EndpointDef query -> EndpointDef query -> Bool
(EndpointDef query -> EndpointDef query -> Bool)
-> (EndpointDef query -> EndpointDef query -> Bool)
-> Eq (EndpointDef query)
forall query.
Eq query =>
EndpointDef query -> EndpointDef query -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointDef query -> EndpointDef query -> Bool
$c/= :: forall query.
Eq query =>
EndpointDef query -> EndpointDef query -> Bool
== :: EndpointDef query -> EndpointDef query -> Bool
$c== :: forall query.
Eq query =>
EndpointDef query -> EndpointDef query -> Bool
Eq, Eq (EndpointDef query)
Eq (EndpointDef query)
-> (EndpointDef query -> EndpointDef query -> Ordering)
-> (EndpointDef query -> EndpointDef query -> Bool)
-> (EndpointDef query -> EndpointDef query -> Bool)
-> (EndpointDef query -> EndpointDef query -> Bool)
-> (EndpointDef query -> EndpointDef query -> Bool)
-> (EndpointDef query -> EndpointDef query -> EndpointDef query)
-> (EndpointDef query -> EndpointDef query -> EndpointDef query)
-> Ord (EndpointDef query)
EndpointDef query -> EndpointDef query -> Bool
EndpointDef query -> EndpointDef query -> Ordering
EndpointDef query -> EndpointDef query -> EndpointDef query
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall query. Ord query => Eq (EndpointDef query)
forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> Bool
forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> Ordering
forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> EndpointDef query
min :: EndpointDef query -> EndpointDef query -> EndpointDef query
$cmin :: forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> EndpointDef query
max :: EndpointDef query -> EndpointDef query -> EndpointDef query
$cmax :: forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> EndpointDef query
>= :: EndpointDef query -> EndpointDef query -> Bool
$c>= :: forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> Bool
> :: EndpointDef query -> EndpointDef query -> Bool
$c> :: forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> Bool
<= :: EndpointDef query -> EndpointDef query -> Bool
$c<= :: forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> Bool
< :: EndpointDef query -> EndpointDef query -> Bool
$c< :: forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> Bool
compare :: EndpointDef query -> EndpointDef query -> Ordering
$ccompare :: forall query.
Ord query =>
EndpointDef query -> EndpointDef query -> Ordering
$cp1Ord :: forall query. Ord query => Eq (EndpointDef query)
Ord, (forall x. EndpointDef query -> Rep (EndpointDef query) x)
-> (forall x. Rep (EndpointDef query) x -> EndpointDef query)
-> Generic (EndpointDef query)
forall x. Rep (EndpointDef query) x -> EndpointDef query
forall x. EndpointDef query -> Rep (EndpointDef query) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall query x. Rep (EndpointDef query) x -> EndpointDef query
forall query x. EndpointDef query -> Rep (EndpointDef query) x
$cto :: forall query x. Rep (EndpointDef query) x -> EndpointDef query
$cfrom :: forall query x. EndpointDef query -> Rep (EndpointDef query) x
Generic, a -> EndpointDef b -> EndpointDef a
(a -> b) -> EndpointDef a -> EndpointDef b
(forall a b. (a -> b) -> EndpointDef a -> EndpointDef b)
-> (forall a b. a -> EndpointDef b -> EndpointDef a)
-> Functor EndpointDef
forall a b. a -> EndpointDef b -> EndpointDef a
forall a b. (a -> b) -> EndpointDef a -> EndpointDef b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> EndpointDef b -> EndpointDef a
$c<$ :: forall a b. a -> EndpointDef b -> EndpointDef a
fmap :: (a -> b) -> EndpointDef a -> EndpointDef b
$cfmap :: forall a b. (a -> b) -> EndpointDef a -> EndpointDef b
Functor, EndpointDef a -> Bool
(a -> m) -> EndpointDef a -> m
(a -> b -> b) -> b -> EndpointDef a -> b
(forall m. Monoid m => EndpointDef m -> m)
-> (forall m a. Monoid m => (a -> m) -> EndpointDef a -> m)
-> (forall m a. Monoid m => (a -> m) -> EndpointDef a -> m)
-> (forall a b. (a -> b -> b) -> b -> EndpointDef a -> b)
-> (forall a b. (a -> b -> b) -> b -> EndpointDef a -> b)
-> (forall b a. (b -> a -> b) -> b -> EndpointDef a -> b)
-> (forall b a. (b -> a -> b) -> b -> EndpointDef a -> b)
-> (forall a. (a -> a -> a) -> EndpointDef a -> a)
-> (forall a. (a -> a -> a) -> EndpointDef a -> a)
-> (forall a. EndpointDef a -> [a])
-> (forall a. EndpointDef a -> Bool)
-> (forall a. EndpointDef a -> Int)
-> (forall a. Eq a => a -> EndpointDef a -> Bool)
-> (forall a. Ord a => EndpointDef a -> a)
-> (forall a. Ord a => EndpointDef a -> a)
-> (forall a. Num a => EndpointDef a -> a)
-> (forall a. Num a => EndpointDef a -> a)
-> Foldable EndpointDef
forall a. Eq a => a -> EndpointDef a -> Bool
forall a. Num a => EndpointDef a -> a
forall a. Ord a => EndpointDef a -> a
forall m. Monoid m => EndpointDef m -> m
forall a. EndpointDef a -> Bool
forall a. EndpointDef a -> Int
forall a. EndpointDef a -> [a]
forall a. (a -> a -> a) -> EndpointDef a -> a
forall m a. Monoid m => (a -> m) -> EndpointDef a -> m
forall b a. (b -> a -> b) -> b -> EndpointDef a -> b
forall a b. (a -> b -> b) -> b -> EndpointDef a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: EndpointDef a -> a
$cproduct :: forall a. Num a => EndpointDef a -> a
sum :: EndpointDef a -> a
$csum :: forall a. Num a => EndpointDef a -> a
minimum :: EndpointDef a -> a
$cminimum :: forall a. Ord a => EndpointDef a -> a
maximum :: EndpointDef a -> a
$cmaximum :: forall a. Ord a => EndpointDef a -> a
elem :: a -> EndpointDef a -> Bool
$celem :: forall a. Eq a => a -> EndpointDef a -> Bool
length :: EndpointDef a -> Int
$clength :: forall a. EndpointDef a -> Int
null :: EndpointDef a -> Bool
$cnull :: forall a. EndpointDef a -> Bool
toList :: EndpointDef a -> [a]
$ctoList :: forall a. EndpointDef a -> [a]
foldl1 :: (a -> a -> a) -> EndpointDef a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> EndpointDef a -> a
foldr1 :: (a -> a -> a) -> EndpointDef a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> EndpointDef a -> a
foldl' :: (b -> a -> b) -> b -> EndpointDef a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> EndpointDef a -> b
foldl :: (b -> a -> b) -> b -> EndpointDef a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> EndpointDef a -> b
foldr' :: (a -> b -> b) -> b -> EndpointDef a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> EndpointDef a -> b
foldr :: (a -> b -> b) -> b -> EndpointDef a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> EndpointDef a -> b
foldMap' :: (a -> m) -> EndpointDef a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> EndpointDef a -> m
foldMap :: (a -> m) -> EndpointDef a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> EndpointDef a -> m
fold :: EndpointDef m -> m
$cfold :: forall m. Monoid m => EndpointDef m -> m
Foldable, Functor EndpointDef
Foldable EndpointDef
Functor EndpointDef
-> Foldable EndpointDef
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> EndpointDef a -> f (EndpointDef b))
-> (forall (f :: * -> *) a.
Applicative f =>
EndpointDef (f a) -> f (EndpointDef a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> EndpointDef a -> m (EndpointDef b))
-> (forall (m :: * -> *) a.
Monad m =>
EndpointDef (m a) -> m (EndpointDef a))
-> Traversable EndpointDef
(a -> f b) -> EndpointDef a -> f (EndpointDef b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
EndpointDef (m a) -> m (EndpointDef a)
forall (f :: * -> *) a.
Applicative f =>
EndpointDef (f a) -> f (EndpointDef a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> EndpointDef a -> m (EndpointDef b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> EndpointDef a -> f (EndpointDef b)
sequence :: EndpointDef (m a) -> m (EndpointDef a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
EndpointDef (m a) -> m (EndpointDef a)
mapM :: (a -> m b) -> EndpointDef a -> m (EndpointDef b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> EndpointDef a -> m (EndpointDef b)
sequenceA :: EndpointDef (f a) -> f (EndpointDef a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
EndpointDef (f a) -> f (EndpointDef a)
traverse :: (a -> f b) -> EndpointDef a -> f (EndpointDef b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> EndpointDef a -> f (EndpointDef b)
$cp2Traversable :: Foldable EndpointDef
$cp1Traversable :: Functor EndpointDef
Traversable)
$(deriveJSON (aesonDrop 3 snakeCase) ''EndpointDef)
$(makeLenses ''EndpointDef)
type EndpointTrie query = MultiMapPathTrie Text EndpointMethod (EndpointMetadata query)
buildEndpointsTrie :: Ord query => [EndpointMetadata query] -> EndpointTrie query
buildEndpointsTrie :: [EndpointMetadata query] -> EndpointTrie query
buildEndpointsTrie = (EndpointTrie query
-> EndpointMetadata query -> EndpointTrie query)
-> EndpointTrie query
-> [EndpointMetadata query]
-> EndpointTrie query
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' EndpointTrie query -> EndpointMetadata query -> EndpointTrie query
forall query.
Ord query =>
Trie
(PathComponent Text)
(MultiMap EndpointMethod (EndpointMetadata query))
-> EndpointMetadata query
-> Trie
(PathComponent Text)
(MultiMap EndpointMethod (EndpointMetadata query))
insert EndpointTrie query
forall a. Monoid a => a
mempty
where
insert :: Trie
(PathComponent Text)
(MultiMap EndpointMethod (EndpointMetadata query))
-> EndpointMetadata query
-> Trie
(PathComponent Text)
(MultiMap EndpointMethod (EndpointMetadata query))
insert Trie
(PathComponent Text)
(MultiMap EndpointMethod (EndpointMetadata query))
t EndpointMetadata query
q =
let endpointMap :: MultiMap EndpointMethod (EndpointMetadata query)
endpointMap = (EndpointMethod
-> MultiMap EndpointMethod (EndpointMetadata query))
-> NonEmpty EndpointMethod
-> MultiMap EndpointMethod (EndpointMetadata query)
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (EndpointMethod
-> EndpointMetadata query
-> MultiMap EndpointMethod (EndpointMetadata query)
forall k v. Hashable k => k -> v -> MultiMap k v
`MM.singleton` EndpointMetadata query
q) (NonEmpty EndpointMethod
-> MultiMap EndpointMethod (EndpointMetadata query))
-> NonEmpty EndpointMethod
-> MultiMap EndpointMethod (EndpointMetadata query)
forall a b. (a -> b) -> a -> b
$ EndpointMetadata query -> NonEmpty EndpointMethod
forall query. EndpointMetadata query -> NonEmpty EndpointMethod
_ceMethods EndpointMetadata query
q
in (MultiMap EndpointMethod (EndpointMetadata query)
-> MultiMap EndpointMethod (EndpointMetadata query)
-> MultiMap EndpointMethod (EndpointMetadata query))
-> [PathComponent Text]
-> MultiMap EndpointMethod (EndpointMetadata query)
-> Trie
(PathComponent Text)
(MultiMap EndpointMethod (EndpointMetadata query))
-> Trie
(PathComponent Text)
(MultiMap EndpointMethod (EndpointMetadata query))
forall k v.
(Eq k, Hashable k) =>
(v -> v -> v) -> [k] -> v -> Trie k v -> Trie k v
T.insertWith MultiMap EndpointMethod (EndpointMetadata query)
-> MultiMap EndpointMethod (EndpointMetadata query)
-> MultiMap EndpointMethod (EndpointMetadata query)
forall a. Semigroup a => a -> a -> a
(<>) ((Text -> PathComponent Text)
-> (Text -> PathComponent Text)
-> EndpointUrl
-> [PathComponent Text]
forall a. (Text -> a) -> (Text -> a) -> EndpointUrl -> [a]
splitPath (PathComponent Text -> Text -> PathComponent Text
forall a b. a -> b -> a
const PathComponent Text
forall a. PathComponent a
PathParam) Text -> PathComponent Text
forall a. a -> PathComponent a
PathLiteral (EndpointMetadata query -> EndpointUrl
forall query. EndpointMetadata query -> EndpointUrl
_ceUrl EndpointMetadata query
q)) MultiMap EndpointMethod (EndpointMetadata query)
endpointMap Trie
(PathComponent Text)
(MultiMap EndpointMethod (EndpointMetadata query))
t
splitPath :: (T.Text -> a) -> (T.Text -> a) -> EndpointUrl -> [a]
splitPath :: (Text -> a) -> (Text -> a) -> EndpointUrl -> [a]
splitPath Text -> a
var Text -> a
lit = (Text -> a) -> [Text] -> [a]
forall a b. (a -> b) -> [a] -> [b]
map Text -> a
toPathComponent ([Text] -> [a]) -> (EndpointUrl -> [Text]) -> EndpointUrl -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> Text -> [Text]
T.split (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'/') (Text -> [Text]) -> (EndpointUrl -> Text) -> EndpointUrl -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EndpointUrl -> Text
forall a. ToTxt a => a -> Text
toTxt
where
toPathComponent :: Text -> a
toPathComponent Text
x
| Text
":" Text -> Text -> Bool
`T.isPrefixOf` Text
x = Text -> a
var Text
x
| Bool
otherwise = Text -> a
lit Text
x
type CreateEndpoint = EndpointMetadata QueryReference
data EndpointMetadata query = EndpointMetadata
{ EndpointMetadata query -> EndpointName
_ceName :: EndpointName,
EndpointMetadata query -> EndpointUrl
_ceUrl :: EndpointUrl,
EndpointMetadata query -> NonEmpty EndpointMethod
_ceMethods :: NonEmpty EndpointMethod,
EndpointMetadata query -> EndpointDef query
_ceDefinition :: EndpointDef query,
:: Maybe Text
}
deriving (Int -> EndpointMetadata query -> ShowS
[EndpointMetadata query] -> ShowS
EndpointMetadata query -> String
(Int -> EndpointMetadata query -> ShowS)
-> (EndpointMetadata query -> String)
-> ([EndpointMetadata query] -> ShowS)
-> Show (EndpointMetadata query)
forall query. Show query => Int -> EndpointMetadata query -> ShowS
forall query. Show query => [EndpointMetadata query] -> ShowS
forall query. Show query => EndpointMetadata query -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointMetadata query] -> ShowS
$cshowList :: forall query. Show query => [EndpointMetadata query] -> ShowS
show :: EndpointMetadata query -> String
$cshow :: forall query. Show query => EndpointMetadata query -> String
showsPrec :: Int -> EndpointMetadata query -> ShowS
$cshowsPrec :: forall query. Show query => Int -> EndpointMetadata query -> ShowS
Show, EndpointMetadata query -> EndpointMetadata query -> Bool
(EndpointMetadata query -> EndpointMetadata query -> Bool)
-> (EndpointMetadata query -> EndpointMetadata query -> Bool)
-> Eq (EndpointMetadata query)
forall query.
Eq query =>
EndpointMetadata query -> EndpointMetadata query -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointMetadata query -> EndpointMetadata query -> Bool
$c/= :: forall query.
Eq query =>
EndpointMetadata query -> EndpointMetadata query -> Bool
== :: EndpointMetadata query -> EndpointMetadata query -> Bool
$c== :: forall query.
Eq query =>
EndpointMetadata query -> EndpointMetadata query -> Bool
Eq, Eq (EndpointMetadata query)
Eq (EndpointMetadata query)
-> (EndpointMetadata query -> EndpointMetadata query -> Ordering)
-> (EndpointMetadata query -> EndpointMetadata query -> Bool)
-> (EndpointMetadata query -> EndpointMetadata query -> Bool)
-> (EndpointMetadata query -> EndpointMetadata query -> Bool)
-> (EndpointMetadata query -> EndpointMetadata query -> Bool)
-> (EndpointMetadata query
-> EndpointMetadata query -> EndpointMetadata query)
-> (EndpointMetadata query
-> EndpointMetadata query -> EndpointMetadata query)
-> Ord (EndpointMetadata query)
EndpointMetadata query -> EndpointMetadata query -> Bool
EndpointMetadata query -> EndpointMetadata query -> Ordering
EndpointMetadata query
-> EndpointMetadata query -> EndpointMetadata query
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall query. Ord query => Eq (EndpointMetadata query)
forall query.
Ord query =>
EndpointMetadata query -> EndpointMetadata query -> Bool
forall query.
Ord query =>
EndpointMetadata query -> EndpointMetadata query -> Ordering
forall query.
Ord query =>
EndpointMetadata query
-> EndpointMetadata query -> EndpointMetadata query
min :: EndpointMetadata query
-> EndpointMetadata query -> EndpointMetadata query
$cmin :: forall query.
Ord query =>
EndpointMetadata query
-> EndpointMetadata query -> EndpointMetadata query
max :: EndpointMetadata query
-> EndpointMetadata query -> EndpointMetadata query
$cmax :: forall query.
Ord query =>
EndpointMetadata query
-> EndpointMetadata query -> EndpointMetadata query
>= :: EndpointMetadata query -> EndpointMetadata query -> Bool
$c>= :: forall query.
Ord query =>
EndpointMetadata query -> EndpointMetadata query -> Bool
> :: EndpointMetadata query -> EndpointMetadata query -> Bool
$c> :: forall query.
Ord query =>
EndpointMetadata query -> EndpointMetadata query -> Bool
<= :: EndpointMetadata query -> EndpointMetadata query -> Bool
$c<= :: forall query.
Ord query =>
EndpointMetadata query -> EndpointMetadata query -> Bool
< :: EndpointMetadata query -> EndpointMetadata query -> Bool
$c< :: forall query.
Ord query =>
EndpointMetadata query -> EndpointMetadata query -> Bool
compare :: EndpointMetadata query -> EndpointMetadata query -> Ordering
$ccompare :: forall query.
Ord query =>
EndpointMetadata query -> EndpointMetadata query -> Ordering
$cp1Ord :: forall query. Ord query => Eq (EndpointMetadata query)
Ord, (forall x.
EndpointMetadata query -> Rep (EndpointMetadata query) x)
-> (forall x.
Rep (EndpointMetadata query) x -> EndpointMetadata query)
-> Generic (EndpointMetadata query)
forall x. Rep (EndpointMetadata query) x -> EndpointMetadata query
forall x. EndpointMetadata query -> Rep (EndpointMetadata query) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall query x.
Rep (EndpointMetadata query) x -> EndpointMetadata query
forall query x.
EndpointMetadata query -> Rep (EndpointMetadata query) x
$cto :: forall query x.
Rep (EndpointMetadata query) x -> EndpointMetadata query
$cfrom :: forall query x.
EndpointMetadata query -> Rep (EndpointMetadata query) x
Generic, a -> EndpointMetadata b -> EndpointMetadata a
(a -> b) -> EndpointMetadata a -> EndpointMetadata b
(forall a b. (a -> b) -> EndpointMetadata a -> EndpointMetadata b)
-> (forall a b. a -> EndpointMetadata b -> EndpointMetadata a)
-> Functor EndpointMetadata
forall a b. a -> EndpointMetadata b -> EndpointMetadata a
forall a b. (a -> b) -> EndpointMetadata a -> EndpointMetadata b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> EndpointMetadata b -> EndpointMetadata a
$c<$ :: forall a b. a -> EndpointMetadata b -> EndpointMetadata a
fmap :: (a -> b) -> EndpointMetadata a -> EndpointMetadata b
$cfmap :: forall a b. (a -> b) -> EndpointMetadata a -> EndpointMetadata b
Functor, EndpointMetadata a -> Bool
(a -> m) -> EndpointMetadata a -> m
(a -> b -> b) -> b -> EndpointMetadata a -> b
(forall m. Monoid m => EndpointMetadata m -> m)
-> (forall m a. Monoid m => (a -> m) -> EndpointMetadata a -> m)
-> (forall m a. Monoid m => (a -> m) -> EndpointMetadata a -> m)
-> (forall a b. (a -> b -> b) -> b -> EndpointMetadata a -> b)
-> (forall a b. (a -> b -> b) -> b -> EndpointMetadata a -> b)
-> (forall b a. (b -> a -> b) -> b -> EndpointMetadata a -> b)
-> (forall b a. (b -> a -> b) -> b -> EndpointMetadata a -> b)
-> (forall a. (a -> a -> a) -> EndpointMetadata a -> a)
-> (forall a. (a -> a -> a) -> EndpointMetadata a -> a)
-> (forall a. EndpointMetadata a -> [a])
-> (forall a. EndpointMetadata a -> Bool)
-> (forall a. EndpointMetadata a -> Int)
-> (forall a. Eq a => a -> EndpointMetadata a -> Bool)
-> (forall a. Ord a => EndpointMetadata a -> a)
-> (forall a. Ord a => EndpointMetadata a -> a)
-> (forall a. Num a => EndpointMetadata a -> a)
-> (forall a. Num a => EndpointMetadata a -> a)
-> Foldable EndpointMetadata
forall a. Eq a => a -> EndpointMetadata a -> Bool
forall a. Num a => EndpointMetadata a -> a
forall a. Ord a => EndpointMetadata a -> a
forall m. Monoid m => EndpointMetadata m -> m
forall a. EndpointMetadata a -> Bool
forall a. EndpointMetadata a -> Int
forall a. EndpointMetadata a -> [a]
forall a. (a -> a -> a) -> EndpointMetadata a -> a
forall m a. Monoid m => (a -> m) -> EndpointMetadata a -> m
forall b a. (b -> a -> b) -> b -> EndpointMetadata a -> b
forall a b. (a -> b -> b) -> b -> EndpointMetadata a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: EndpointMetadata a -> a
$cproduct :: forall a. Num a => EndpointMetadata a -> a
sum :: EndpointMetadata a -> a
$csum :: forall a. Num a => EndpointMetadata a -> a
minimum :: EndpointMetadata a -> a
$cminimum :: forall a. Ord a => EndpointMetadata a -> a
maximum :: EndpointMetadata a -> a
$cmaximum :: forall a. Ord a => EndpointMetadata a -> a
elem :: a -> EndpointMetadata a -> Bool
$celem :: forall a. Eq a => a -> EndpointMetadata a -> Bool
length :: EndpointMetadata a -> Int
$clength :: forall a. EndpointMetadata a -> Int
null :: EndpointMetadata a -> Bool
$cnull :: forall a. EndpointMetadata a -> Bool
toList :: EndpointMetadata a -> [a]
$ctoList :: forall a. EndpointMetadata a -> [a]
foldl1 :: (a -> a -> a) -> EndpointMetadata a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> EndpointMetadata a -> a
foldr1 :: (a -> a -> a) -> EndpointMetadata a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> EndpointMetadata a -> a
foldl' :: (b -> a -> b) -> b -> EndpointMetadata a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> EndpointMetadata a -> b
foldl :: (b -> a -> b) -> b -> EndpointMetadata a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> EndpointMetadata a -> b
foldr' :: (a -> b -> b) -> b -> EndpointMetadata a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> EndpointMetadata a -> b
foldr :: (a -> b -> b) -> b -> EndpointMetadata a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> EndpointMetadata a -> b
foldMap' :: (a -> m) -> EndpointMetadata a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> EndpointMetadata a -> m
foldMap :: (a -> m) -> EndpointMetadata a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> EndpointMetadata a -> m
fold :: EndpointMetadata m -> m
$cfold :: forall m. Monoid m => EndpointMetadata m -> m
Foldable, Functor EndpointMetadata
Foldable EndpointMetadata
Functor EndpointMetadata
-> Foldable EndpointMetadata
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> EndpointMetadata a -> f (EndpointMetadata b))
-> (forall (f :: * -> *) a.
Applicative f =>
EndpointMetadata (f a) -> f (EndpointMetadata a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> EndpointMetadata a -> m (EndpointMetadata b))
-> (forall (m :: * -> *) a.
Monad m =>
EndpointMetadata (m a) -> m (EndpointMetadata a))
-> Traversable EndpointMetadata
(a -> f b) -> EndpointMetadata a -> f (EndpointMetadata b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
EndpointMetadata (m a) -> m (EndpointMetadata a)
forall (f :: * -> *) a.
Applicative f =>
EndpointMetadata (f a) -> f (EndpointMetadata a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> EndpointMetadata a -> m (EndpointMetadata b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> EndpointMetadata a -> f (EndpointMetadata b)
sequence :: EndpointMetadata (m a) -> m (EndpointMetadata a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
EndpointMetadata (m a) -> m (EndpointMetadata a)
mapM :: (a -> m b) -> EndpointMetadata a -> m (EndpointMetadata b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> EndpointMetadata a -> m (EndpointMetadata b)
sequenceA :: EndpointMetadata (f a) -> f (EndpointMetadata a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
EndpointMetadata (f a) -> f (EndpointMetadata a)
traverse :: (a -> f b) -> EndpointMetadata a -> f (EndpointMetadata b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> EndpointMetadata a -> f (EndpointMetadata b)
$cp2Traversable :: Foldable EndpointMetadata
$cp1Traversable :: Functor EndpointMetadata
Traversable)
$(deriveJSON (aesonDrop 3 snakeCase) ''EndpointMetadata)
$()
data DropEndpoint = DropEndpoint
{ DropEndpoint -> EndpointName
_deName :: EndpointName
}
deriving (Int -> DropEndpoint -> ShowS
[DropEndpoint] -> ShowS
DropEndpoint -> String
(Int -> DropEndpoint -> ShowS)
-> (DropEndpoint -> String)
-> ([DropEndpoint] -> ShowS)
-> Show DropEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DropEndpoint] -> ShowS
$cshowList :: [DropEndpoint] -> ShowS
show :: DropEndpoint -> String
$cshow :: DropEndpoint -> String
showsPrec :: Int -> DropEndpoint -> ShowS
$cshowsPrec :: Int -> DropEndpoint -> ShowS
Show, DropEndpoint -> DropEndpoint -> Bool
(DropEndpoint -> DropEndpoint -> Bool)
-> (DropEndpoint -> DropEndpoint -> Bool) -> Eq DropEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DropEndpoint -> DropEndpoint -> Bool
$c/= :: DropEndpoint -> DropEndpoint -> Bool
== :: DropEndpoint -> DropEndpoint -> Bool
$c== :: DropEndpoint -> DropEndpoint -> Bool
Eq, (forall x. DropEndpoint -> Rep DropEndpoint x)
-> (forall x. Rep DropEndpoint x -> DropEndpoint)
-> Generic DropEndpoint
forall x. Rep DropEndpoint x -> DropEndpoint
forall x. DropEndpoint -> Rep DropEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DropEndpoint x -> DropEndpoint
$cfrom :: forall x. DropEndpoint -> Rep DropEndpoint x
Generic)
$(deriveJSON (aesonDrop 3 snakeCase) ''DropEndpoint)
$(makeLenses ''DropEndpoint)