Struct use_github_api::GithubClientBuilder[][src]

#[non_exhaustive]
pub struct GithubClientBuilder<'a> { /* fields omitted */ }
This is supported on crate feature auth only.
Expand description

A GithubClient builder. Allows building a GithubClient while still setting options like the base URL and auth token. Only useful when either the auth or enterprise feature enabled.

Examples

use use_github_api::{GithubClient, GithubClientBuilder};
// If `enterprise` is enabled
let client = GithubClientBuilder::new().auth("adS*lkjha(&W3").base_url("https://gh.enterprise.org/api/v3").build().unwrap();
// If `enterprise` is not enabled
let client = GithubClientBuilder::new().auth("ghp_kajshdkja").build().unwrap();

Implementations

impl<'a> GithubClientBuilder<'a>[src]

pub fn new() -> Self[src]

Creates a new GithubClientBuilder.

pub fn build(self) -> Result<GithubClient<'a>, Box<dyn StdError>>[src]

Builds the builder and returns a client.

Errors

If either the auth token or the base url is missing, this will error out.

pub fn auth(self, auth_token: &'a str) -> Self[src]

Sets the auth token.

Examples

let builder = GithubClientBuilder::new();
let builder = builder.auth("my auth token");
// Build client and do stuff

pub fn base_url(self, base_url: &'a str) -> Self[src]

Sets the base url.

Examples

let builder = GithubClientBuilder::new();
let builder = builder.base_url("https://something.com/api/v3");
// Build client and do stuff

Trait Implementations

impl<'a> Default for GithubClientBuilder<'a>[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

Auto Trait Implementations

impl<'a> RefUnwindSafe for GithubClientBuilder<'a>

impl<'a> Send for GithubClientBuilder<'a>

impl<'a> Sync for GithubClientBuilder<'a>

impl<'a> Unpin for GithubClientBuilder<'a>

impl<'a> UnwindSafe for GithubClientBuilder<'a>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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

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

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.