[][src]Function warpgrapher::client::graphql

pub fn graphql(
    endpoint: String,
    query: String,
    input: Option<Value>
) -> Result<Value, Error>

Takes and executes a raw GraphQL query. Takes an optional input which is inserted in the GraphQL request as "input" in the variables.

Examples

use std::env::var_os;
use warpgrapher::client::graphql;

let query = "query { Project { id name } }";
let results = graphql("http://localhost:5000/graphql".to_owned(), query.to_owned(), None);
let projects = results.unwrap().get("Project");