graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.Server.Rest

Synopsis

Documentation

alignVars :: [VariableDefinition] -> [(Text, Either Text Value)] -> HashMap Name (These VariableDefinition (Either Text Value)) Source #

resolveVar :: Name -> These VariableDefinition (Either Text Value) -> Either Text (Maybe Value) Source #

resolveVar is responsible for decoding variables sent via REST request. These can either be via body (represented by Right) or via query-param or URL param (represented by Left). A variable can be expected, unexpected, or missing (represented by These, This, and That).

data RestRequest method Source #

Constructors

RestRequest 

Fields

  • reqPath :: Text

    Remainder of the url path after `api/rest`

  • reqMethod :: method
     
  • reqArgs :: [(Text, Either Text Value)]

    URL Query/Request Body Arguments

Instances

Instances details
Functor RestRequest Source # 
Instance details

Defined in Hasura.Server.Rest

Methods

fmap :: (a -> b) -> RestRequest a -> RestRequest b #

(<$) :: a -> RestRequest b -> RestRequest a #

Foldable RestRequest Source # 
Instance details

Defined in Hasura.Server.Rest

Methods

fold :: Monoid m => RestRequest m -> m #

foldMap :: Monoid m => (a -> m) -> RestRequest a -> m #

foldMap' :: Monoid m => (a -> m) -> RestRequest a -> m #

foldr :: (a -> b -> b) -> b -> RestRequest a -> b #

foldr' :: (a -> b -> b) -> b -> RestRequest a -> b #

foldl :: (b -> a -> b) -> b -> RestRequest a -> b #

foldl' :: (b -> a -> b) -> b -> RestRequest a -> b #

foldr1 :: (a -> a -> a) -> RestRequest a -> a #

foldl1 :: (a -> a -> a) -> RestRequest a -> a #

toList :: RestRequest a -> [a] #

null :: RestRequest a -> Bool #

length :: RestRequest a -> Int #

elem :: Eq a => a -> RestRequest a -> Bool #

maximum :: Ord a => RestRequest a -> a #

minimum :: Ord a => RestRequest a -> a #

sum :: Num a => RestRequest a -> a #

product :: Num a => RestRequest a -> a #

Traversable RestRequest Source # 
Instance details

Defined in Hasura.Server.Rest

Methods

traverse :: Applicative f => (a -> f b) -> RestRequest a -> f (RestRequest b) #

sequenceA :: Applicative f => RestRequest (f a) -> f (RestRequest a) #

mapM :: Monad m => (a -> m b) -> RestRequest a -> m (RestRequest b) #

sequence :: Monad m => RestRequest (m a) -> m (RestRequest a) #

runCustomEndpoint :: forall m. (MonadIO m, MonadError QErr m, MonadTrace m, MonadBaseControl IO m, MonadGQLExecutionCheck m, MonadQueryLog m, MonadExecuteQuery m, MonadMetadataStorage (MetadataStorageT m), HttpLog m, MonadQueryTags m, HasResourceLimits m) => Environment -> ExecutionCtx -> RequestId -> UserInfo -> [Header] -> IpAddress -> RestRequest EndpointMethod -> EndpointTrie GQLQueryWithText -> m (HttpLogMetadata m, HttpResponse EncJSON) Source #

Implements all the custom endpoints by looking up the path/methods in the endpoint trie and delegating to the graphql handler.