public IActionResult GetGraphQLResult( [FromBody] GraphQLBody body ) { var json = _schema.Execute(_ => { _.UserContext = BlockChain; _.Query = body.Query; if (body.Variables != null) { _.Inputs = body.Variables.ToString(Newtonsoft.Json.Formatting.None).ToInputs(); } }); return(Ok(JObject.Parse(json))); }
public IActionResult GetGraphQLResult( [FromBody] GraphQLBody body ) { var schema = new Schema { Query = new BlocksQuery <T>(GetBlockChain()) }; var json = schema.Execute(_ => { _.Query = body.Query; if (body.Variables != null) { _.Inputs = body.Variables.ToString(Newtonsoft.Json.Formatting.None).ToInputs(); } }); return(Ok(JObject.Parse(json))); }
public async Task <IActionResult> GetGraphQLResult( [FromBody] GraphQLBody body ) { var json = await _schema.ExecuteAsync(_ => { _.UserContext = new Dictionary <string, object> { [nameof(_context.Store)] = _context.Store, [nameof(_context.BlockChain)] = _context.BlockChain, }; _.Query = body.Query; _.ThrowOnUnhandledException = true; if (body.Variables != null) { _.Inputs = body.Variables.ToString(Newtonsoft.Json.Formatting.None).ToInputs(); } }); return(Ok(JObject.Parse(json))); }