[][src]Struct github_rs::client::Github

pub struct Github { /* fields omitted */ }

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]

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]

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]

Begin building up a PUT request with data to GitHub

pub fn post<T>(&self, body: T) -> PostQueryBuilder where
    T: Serialize
[src]

Begin building up a POST request with data to GitHub

pub fn patch<T>(&self, body: T) -> PatchQueryBuilder where
    T: Serialize
[src]

Begin building up a PATCH request with data to GitHub

pub fn delete<T>(&self, body: T) -> DeleteQueryBuilder where
    T: Serialize
[src]

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]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl !Send for Github

impl !Sync for Github

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T