public async Task<ExecutionResult> Execute( Schema schema, object rootObject, string query, string operationName = null, Inputs inputs = null) { var executer = new DocumentExecuter(); return await executer.ExecuteAsync(schema, rootObject, query, operationName); }
public static async Task <string> ExecuteAsync(this ISchema schema, Action <ExecutionOptions> configure) { var executor = new DocumentExecuter(); var result = await executor.ExecuteAsync(options => { options.Schema = schema; configure(options); }).ConfigureAwait(false); return(await new DocumentWriter(indent: true).WriteToStringAsync(result).ConfigureAwait(false)); }
public static string Execute(this ISchema schema, Action <ExecutionOptions> configure) { var executor = new DocumentExecuter(); var result = executor.ExecuteAsync(options => { options.Schema = schema; configure(options); }).GetAwaiter().GetResult(); return(new DocumentWriter(indent: true).Write(result)); }
public static async Task <string> ExecuteAsync(this ISchema schema, Action <ExecutionOptions> configure) { var executor = new DocumentExecuter(); var result = await executor.ExecuteAsync(_ => { _.Schema = schema; configure(_); }); return(new DocumentWriter(indent: true).Write(result)); }
/// <summary> /// Executes a GraphQL request with the default <see cref="DocumentExecuter"/>, serializes the result using the specified <see cref="IDocumentWriter"/>, and returns the result /// </summary> /// <param name="schema">An instance of <see cref="ISchema"/> to use to execute the query</param> /// <param name="documentWriter">An instance of <see cref="IDocumentExecuter"/> to use to serialize the result</param> /// <param name="configure">A delegate which configures the execution options</param> public static async Task <string> ExecuteAsync(this ISchema schema, IDocumentWriter documentWriter, Action <ExecutionOptions> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var executor = new DocumentExecuter(); var result = await executor.ExecuteAsync(options => { options.Schema = schema; configure(options); }).ConfigureAwait(false); return(await documentWriter.WriteToStringAsync(result).ConfigureAwait(false)); }
/// <summary> /// Executes a GraphQL request with the default <see cref="DocumentExecuter"/>, serializes the result using the specified <see cref="IGraphQLTextSerializer"/>, and returns the result /// </summary> /// <param name="schema">An instance of <see cref="ISchema"/> to use to execute the query</param> /// <param name="serializer">An instance of <see cref="IGraphQLTextSerializer"/> to use to serialize the result</param> /// <param name="configure">A delegate which configures the execution options</param> public static async Task <string> ExecuteAsync(this ISchema schema, IGraphQLTextSerializer serializer, Action <ExecutionOptions> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var executor = new DocumentExecuter(); var result = await executor.ExecuteAsync(options => { options.Schema = schema; configure(options); }).ConfigureAwait(false); return(serializer.Serialize(result)); }