protected static async Task <IBatchQueryResult> ExecuteOperationBatchAsync( HttpContext context, IRequestExecutor requestExecutor, IHttpRequestInterceptor requestInterceptor, IServerDiagnosticEvents diagnosticEvents, GraphQLRequest request, IReadOnlyList <string> operationNames) { diagnosticEvents.StartOperationBatchRequest(context, request, operationNames); var requestBatch = new IReadOnlyQueryRequest[operationNames.Count]; for (var i = 0; i < operationNames.Count; i++) { QueryRequestBuilder requestBuilder = QueryRequestBuilder.From(request); requestBuilder.SetOperation(operationNames[i]); await requestInterceptor.OnCreateAsync( context, requestExecutor, requestBuilder, context.RequestAborted); requestBatch[i] = requestBuilder.Create(); } return(await requestExecutor.ExecuteBatchAsync( requestBatch, cancellationToken : context.RequestAborted)); }
protected async Task <IExecutionResult> ExecuteSingleAsync( HttpContext context, IRequestExecutor requestExecutor, IHttpRequestInterceptor requestInterceptor, GraphQLRequest request) { QueryRequestBuilder requestBuilder = QueryRequestBuilder.From(request); await requestInterceptor.OnCreateAsync( context, requestExecutor, requestBuilder, context.RequestAborted); return(await requestExecutor.ExecuteAsync( requestBuilder.Create(), context.RequestAborted)); }
protected static async Task <IExecutionResult> ExecuteSingleAsync( HttpContext context, IRequestExecutor requestExecutor, IHttpRequestInterceptor requestInterceptor, IServerDiagnosticEvents diagnosticEvents, GraphQLRequest request, OperationType[]?allowedOperations = null) { diagnosticEvents.StartSingleRequest(context, request); var requestBuilder = QueryRequestBuilder.From(request); requestBuilder.SetAllowedOperations(allowedOperations); await requestInterceptor.OnCreateAsync( context, requestExecutor, requestBuilder, context.RequestAborted); return(await requestExecutor.ExecuteAsync( requestBuilder.Create(), context.RequestAborted)); }
protected async Task <IBatchQueryResult> ExecuteBatchAsync( HttpContext context, IRequestExecutor requestExecutor, IHttpRequestInterceptor requestInterceptor, IReadOnlyList <GraphQLRequest> requests) { var requestBatch = new IReadOnlyQueryRequest[requests.Count]; for (var i = 0; i < requests.Count; i++) { QueryRequestBuilder requestBuilder = QueryRequestBuilder.From(requests[0]); await requestInterceptor.OnCreateAsync( context, requestExecutor, requestBuilder, context.RequestAborted); requestBatch[i] = requestBuilder.Create(); } return(await requestExecutor.ExecuteBatchAsync( requestBatch, cancellationToken : context.RequestAborted)); }