[][src]Struct lightql::Request

pub struct Request { /* fields omitted */ }

The principal struct of the lib. It's the API that you should use.

let players: Players = Request::new("{players { uuid }}", QlType::Query)
    .send("https://your-api-url/"); // Simple inline request.

let id = 12332;
let mut user_id = Hasmap::new();
user_id.insert(
    "_id",
    id::parse()
);
let user = Request::from_path("path/to/ql/request.query")
    .prepare(user_id)
    .send::<User>("https://your-api-url/"); // Complexe request creation from file.

Methods

impl Request
[src]

Create a new request.

Get method for the request. Default is post.

type of the request. default is query

Create a request from a file.

prepare the request with a hasmap for each argument

let mut param_map = Hashmap::new();
param_map.insert("_uuid", "The real value");
let response = Request::new("player(uuid: \"_uuid\") { uuid }", QlType::Query)
    .prepare(param_map)
    .send::<Player>()
    .expect("Player cannot be retrieved");

If the is no args to the query the send should detect it, so you don't need to use prepare.

Force the preparation in certain case that can be usefull.

Send need a type to Deserialize the response of the sended request. you can either use it like:

let player: Player = request.send();

let player = request.send::<Player>(); // Turbo-fish :D

Count the number of param needed by the request.

Trait Implementations

impl Eq for Request
[src]

impl PartialEq<Request> for Request
[src]

impl Debug for Request
[src]

Auto Trait Implementations

impl Send for Request

impl Sync for Request

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]