[−][src]Struct github_rs::client::Github
Struct used to make calls to the Github API.
Methods
impl Github
[src]
pub 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
an &str (String
or Vec<u8>
for example). As long as the function is
given a valid API Token your requests will work.
pub fn get_token(&self) -> &str
[src]
Get the currently set Authorization Token
pub 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.
pub 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.
pub fn get(&self) -> GetQueryBuilder
[src]
Begin building up a GET request to GitHub
pub fn put_empty(&self) -> PutQueryBuilder
[src]
Begin building up a PUT request with no data to GitHub
pub fn put<T>(&self, body: T) -> PutQueryBuilder where
T: Serialize,
[src]
T: Serialize,
Begin building up a PUT request with data to GitHub
pub fn post<T>(&self, body: T) -> PostQueryBuilder where
T: Serialize,
[src]
T: Serialize,
Begin building up a POST request with data to GitHub
pub fn patch<T>(&self, body: T) -> PatchQueryBuilder where
T: Serialize,
[src]
T: Serialize,
Begin building up a PATCH request with data to GitHub
pub fn delete<T>(&self, body: T) -> DeleteQueryBuilder where
T: Serialize,
[src]
T: Serialize,
Begin building up a DELETE request with data to GitHub
pub fn delete_empty(&self) -> DeleteQueryBuilder
[src]
Begin building up a DELETE request without data to GitHub
Trait Implementations
impl<'g> From<&'g Github> for GetQueryBuilder<'g>
[src]
impl<'g> From<&'g Github> for PutQueryBuilder<'g>
[src]
impl<'g> From<&'g Github> for PostQueryBuilder<'g>
[src]
impl<'g> From<&'g Github> for PatchQueryBuilder<'g>
[src]
impl<'g> From<&'g Github> for DeleteQueryBuilder<'g>
[src]
impl Clone for Github
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.