Struct twitch_api2::HelixClient[][src]

pub struct HelixClient<'a, C> where
    C: HttpClient<'a>, 
{ /* fields omitted */ }
This is supported on crate features client and helix only.

Client for Helix or the New Twitch API

Provides HelixClient::req_get for requesting endpoints which uses GET method.

Most clients will be able to use the 'static lifetime

pub struct MyStruct {
    twitch: HelixClient<'static, reqwest::Client>,
    token: twitch_oauth2::AppAccessToken,
}
// etc

See HttpClient for implemented http clients, you can also define your own if needed.

Implementations

impl<'a, C: HttpClient<'a>> HelixClient<'a, C>[src]

pub fn with_client(client: C) -> HelixClient<'a, C>[src]

Create a new client with an existing client

pub fn new() -> HelixClient<'a, C> where
    C: Default
[src]

Create a new HelixClient with a default HttpClient

pub fn clone_client(&self) -> C where
    C: Clone
[src]

Retrieve a clone of the HttpClient inside this HelixClient

pub async fn req_get<R, D, T: ?Sized>(
    &'a self,
    request: R,
    token: &T
) -> Result<Response<R, D>, ClientRequestError<<C as HttpClient<'a>>::Error>> where
    R: Request<Response = D> + Request + RequestGet,
    D: DeserializeOwned + PartialEq,
    T: TwitchToken
[src]

Request on a valid RequestGet endpoint

    let req = channels::GetChannelInformationRequest::builder().broadcaster_id("123456").build();
    let client = HelixClient::new();

    let response = client.req_get(req, &token).await;

pub async fn req_post<R, B, D, T: ?Sized>(
    &'a self,
    request: R,
    body: B,
    token: &T
) -> Result<Response<R, D>, ClientRequestError<<C as HttpClient<'a>>::Error>> where
    R: Request<Response = D> + Request + RequestPost<Body = B>,
    B: Serialize,
    D: DeserializeOwned + PartialEq,
    T: TwitchToken
[src]

Request on a valid RequestPost endpoint

pub async fn req_patch<R, B, D, T: ?Sized>(
    &'a self,
    request: R,
    body: B,
    token: &T
) -> Result<D, ClientRequestError<<C as HttpClient<'a>>::Error>> where
    R: Request<Response = D> + Request + RequestPatch<Body = B>,
    B: Serialize,
    D: TryFrom<StatusCode, Error = Cow<'static, str>> + DeserializeOwned + PartialEq,
    T: TwitchToken
[src]

Request on a valid RequestPatch endpoint

pub async fn req_delete<R, D, T: ?Sized>(
    &'a self,
    request: R,
    token: &T
) -> Result<D, ClientRequestError<<C as HttpClient<'a>>::Error>> where
    R: Request<Response = D> + Request + RequestDelete,
    D: TryFrom<StatusCode, Error = Cow<'static, str>> + DeserializeOwned + PartialEq,
    T: TwitchToken
[src]

Request on a valid RequestDelete endpoint

pub async fn req_put<R, D, T: ?Sized>(
    &'a self,
    request: R,
    token: &T
) -> Result<D, ClientRequestError<<C as HttpClient<'a>>::Error>> where
    R: Request<Response = D> + Request + RequestPut,
    D: TryFrom<StatusCode, Error = Cow<'static, str>> + DeserializeOwned + PartialEq,
    T: TwitchToken
[src]

Request on a valid RequestPut endpoint

Trait Implementations

impl<'a, C: Clone> Clone for HelixClient<'a, C> where
    C: HttpClient<'a>, 
[src]

impl<'a, C> Default for HelixClient<'a, C> where
    C: HttpClient<'a> + Default
[src]

Auto Trait Implementations

impl<'a, C> RefUnwindSafe for HelixClient<'a, C> where
    C: RefUnwindSafe
[src]

impl<'a, C> Send for HelixClient<'a, C>[src]

impl<'a, C> Sync for HelixClient<'a, C> where
    C: Sync
[src]

impl<'a, C> Unpin for HelixClient<'a, C> where
    C: Unpin
[src]

impl<'a, C> UnwindSafe for HelixClient<'a, C> where
    C: UnwindSafe
[src]

Blanket Implementations

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

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

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

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

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]