This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::smashquery::{MyQuery, MyQueryVariables, Set, SetSlot,StreamQueue};
|
||||
use cynic::{http::SurfExt, GraphQlResponse, QueryBuilder};
|
||||
|
||||
use cynic::{ GraphQlResponse, QueryBuilder};
|
||||
//use futures::executor;
|
||||
static URL_SMASH: &str = "https://api.start.gg/gql/alpha";
|
||||
|
||||
#[derive(Debug,Clone)]
|
||||
@@ -30,20 +30,31 @@ impl SmashQueue{
|
||||
Self { name:String::from(""),matches : vec![] }
|
||||
}
|
||||
}
|
||||
|
||||
fn build_query(tournament :&str) -> cynic::Operation<MyQuery,MyQueryVariables> {
|
||||
|
||||
MyQuery::build(MyQueryVariables
|
||||
{
|
||||
slug:Some(tournament)
|
||||
} )
|
||||
}
|
||||
|
||||
fn request_stream_queue(tournament :&str, key : &str ) -> GraphQlResponse<MyQuery>{
|
||||
|
||||
let resp = async_std::task::block_on(async {
|
||||
// let resp = async_std::task::block_on(async {
|
||||
|
||||
let query = MyQuery::build(MyQueryVariables
|
||||
{
|
||||
slug:Some(tournament)
|
||||
} );
|
||||
|
||||
let resp = surf::post(URL_SMASH).header("Authorization", key).run_graphql(query).await.unwrap();
|
||||
return resp;
|
||||
});
|
||||
|
||||
return resp;
|
||||
let resp = reqwest::blocking::Client::new().post(URL_SMASH).header("Authorization", key).json(&query).send().unwrap();
|
||||
return resp.json().unwrap();
|
||||
|
||||
// });
|
||||
|
||||
// return resp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user