Struct github_rs::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: AsRef<str>,
T: AsRef<str>,
Create a new Github client struct. It takes a type that can convert into
an &str (String
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
Get the currently set Authorization Token
fn set_token<T>(&mut self, token: T) where
T: AsRef<str>,
T: AsRef<str>,
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>>
Exposes the inner event loop for those who need access to it. The reccomended 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 reccomended you don't unless you know
there is no other mutable reference to it.
fn get(&self) -> GetQueryBuilder
Begin building up a GET request to GitHub
fn put_empty(&self) -> PutQueryBuilder
Begin building up a PUT request with no data to GitHub
fn put<T>(&self, body: T) -> PutQueryBuilder where
T: Serialize,
T: Serialize,
Begin building up a PUT request with data to GitHub
fn post<T>(&self, body: T) -> PostQueryBuilder where
T: Serialize,
T: Serialize,
Begin building up a POST request with data to GitHub
fn patch<T>(&self, body: T) -> PatchQueryBuilder where
T: Serialize,
T: Serialize,
Begin building up a PATCH request with data to GitHub
fn delete<T>(&self, body: T) -> DeleteQueryBuilder where
T: Serialize,
T: Serialize,
Begin building up a DELETE request with data to GitHub
fn delete_empty(&self) -> DeleteQueryBuilder
Begin building up a DELETE request without data to GitHub
Trait Implementations
impl Clone for Github
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more