Example #1
0
        public static async Task <HttpResponseData> ExecuteFunctionsQueryAsync(
            this IGraphQLAzureFunctionsExecutorProxy graphqlExecutorProxy,
            HttpRequestData httpRequestData,
            ILogger log = null,
            CancellationToken cancellationToken = default
            )
        {
            AssertParamIsNotNull(graphqlExecutorProxy, nameof(graphqlExecutorProxy));
            AssertParamIsNotNull(httpRequestData, nameof(httpRequestData));

            //Create the GraphQL HttpContext Shim to help marshall data from the Isolated Process HttpRequestData into a
            //  AspNetCore compatible HttpContext, and marshall results back into HttpResponseData from the HttpContext...
            await using var graphQLHttpContextShim = new GraphQLHttpContextShim(httpRequestData);

            //Build the Http Context Shim for HotChocolate to consume via the AzureFunctionsProxy...
            var graphqlHttpContextShim = await graphQLHttpContextShim.CreateGraphQLHttpContextAsync();


            //Execute the full HotChocolate middleware pipeline via AzureFunctionsProxy...
            var logger = log ?? httpRequestData.FunctionContext.GetLogger <IGraphQLAzureFunctionsExecutorProxy>();

            await graphqlExecutorProxy.ExecuteFunctionsQueryAsync(graphqlHttpContextShim, logger, cancellationToken).ConfigureAwait(false);

            //Marshall the results back into the isolated process compatible HttpResponseData...
            var httpResponseData = await graphQLHttpContextShim.CreateHttpResponseDataAsync().ConfigureAwait(false);

            return(httpResponseData);
        }
 public StarWarsFunctionEndpoint(IGraphQLAzureFunctionsExecutorProxy graphqlExecutorProxy)
 {
     _graphqlExecutorProxy = graphqlExecutorProxy;
 }
 public GraphQLBananaCakePopEndpoint(IGraphQLAzureFunctionsExecutorProxy graphqlExecutorProxy)
 {
     _graphqlExecutorProxy = graphqlExecutorProxy;
 }
Example #4
0
 public BeerFunction(IGraphQLAzureFunctionsExecutorProxy graphQLProxy)
 {
     _graphqlExecutorProxy = graphQLProxy;
 }
 public HelloWorldFunction(IGraphQLAzureFunctionsExecutorProxy graphqlExecutorProxy)
 {
     _graphqlExecutorProxy = graphqlExecutorProxy;
 }
 public GraphQLPlaygroundFunctionEndpoint(IGraphQLAzureFunctionsExecutorProxy graphqlExecutorProxy)
 {
     _graphqlExecutorProxy = graphqlExecutorProxy;
 }