Struct github_gql::client::Github
[−]
[src]
pub struct Github { /* fields omitted */ }
Struct used to make calls to the Github API.
Methods
impl Github
[src]
fn new<T>(token: T) -> Result<Self> where
T: ToString,
[src]
T: ToString,
Create a new Github client struct. It takes a type that can convert into
a String
(&str
or Vec<u8>
for example). As long as the function is
given a valid API Token your requests will work.
fn get_token(&self) -> &str
[src]
Get the currently set Authorization Token
fn set_token<T>(&mut self, token: T) where
T: ToString,
[src]
T: ToString,
Change the currently set Authorization Token using a type that can turn into an &str. Must be a valid API Token for requests to work.
fn get_core(&self) -> &Rc<RefCell<Core>>
[src]
Exposes the inner event loop for those who need access to it. The recommended way to safely access the core would be
let g = Github::new("API KEY");
let core = g.get_core();
// Handle the error here.
let ref mut core_mut = *core.try_borrow_mut()?;
// Do stuff with the core here. This prevents a runtime failure by
// having two mutable borrows to the core at the same time.
This is how other parts of the API are implemented to avoid causing your
program to crash unexpectedly. While you could borrow without the
Result
being handled it's highly recommended you don't unless you know
there is no other mutable reference to it.
fn query<T>(
&mut self,
query: &Query
) -> Result<(Headers, StatusCode, Option<T>)> where
T: DeserializeOwned,
[src]
&mut self,
query: &Query
) -> Result<(Headers, StatusCode, Option<T>)> where
T: DeserializeOwned,
fn mutation<T>(
&mut self,
mutation: &Mutation
) -> Result<(Headers, StatusCode, Option<T>)> where
T: DeserializeOwned,
[src]
&mut self,
mutation: &Mutation
) -> Result<(Headers, StatusCode, Option<T>)> where
T: DeserializeOwned,