Struct twitch_api2::HelixClient [−][src]
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]
C: Default,
Create a new HelixClient
with a default HttpClient
pub fn clone_client(&self) -> C where
C: Clone,
[src]
C: Clone,
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]
&'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,
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]
&'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,
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]
&'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,
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]
&'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,
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]
&'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,
Request on a valid RequestPut
endpoint
Trait Implementations
impl<'a, C: Clone> Clone for HelixClient<'a, C> where
C: HttpClient<'a>,
[src]
C: HttpClient<'a>,
fn clone(&self) -> HelixClient<'a, C>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, C> Default for HelixClient<'a, C> where
C: HttpClient<'a> + Default,
[src]
C: HttpClient<'a> + Default,
fn default() -> HelixClient<'a, C>
[src]
Auto Trait Implementations
impl<'a, C> RefUnwindSafe for HelixClient<'a, C> where
C: RefUnwindSafe,
[src]
C: RefUnwindSafe,
impl<'a, C> Send for HelixClient<'a, C>
[src]
impl<'a, C> Sync for HelixClient<'a, C> where
C: Sync,
[src]
C: Sync,
impl<'a, C> Unpin for HelixClient<'a, C> where
C: Unpin,
[src]
C: Unpin,
impl<'a, C> UnwindSafe for HelixClient<'a, C> where
C: UnwindSafe,
[src]
C: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,