pub struct TmiClient<'a, C: HttpClient<'a>> { /* private fields */ }
Available on crate features
client
and tmi
only.Expand description
Client for the twitch TMI endpoint, almost entirely undocumented and certainly not supported.
§Examples
let client = TmiClient::new();
println!("{:?}", client.get_chatters("justinfan10".into()).await?);
Most clients will be able to use the 'static
lifetime
pub struct MyStruct {
twitch: TmiClient<'static, surf::Client>,
token: twitch_oauth2::AppAccessToken,
}
// etc
See HttpClient
for implemented http clients, you can also define your own if needed.
Implementations§
Source§impl<'a, C: HttpClient<'a>> TmiClient<'a, C>
impl<'a, C: HttpClient<'a>> TmiClient<'a, C>
Sourcepub fn with_client(client: C) -> TmiClient<'a, C>
pub fn with_client(client: C) -> TmiClient<'a, C>
Create a new client with an existing client
Sourcepub fn new() -> TmiClient<'a, C>where
C: ClientDefault<'a>,
pub fn new() -> TmiClient<'a, C>where
C: ClientDefault<'a>,
Create a new TmiClient
with a default HttpClient
Sourcepub fn clone_client(&self) -> Cwhere
C: Clone,
pub fn clone_client(&self) -> Cwhere
C: Clone,
Retrieve a clone of the HttpClient
inside this TmiClient
Sourcepub fn get_client(&self) -> &C
pub fn get_client(&self) -> &C
Retrieve a reference of the HttpClient
inside this TmiClient
Sourcepub async fn get_chatters(
&'a self,
broadcaster: &UserNameRef,
) -> Result<GetChatters, RequestError<<C as HttpClient<'a>>::Error>>
pub async fn get_chatters( &'a self, broadcaster: &UserNameRef, ) -> Result<GetChatters, RequestError<<C as HttpClient<'a>>::Error>>
Get all the chatters in the chat
§Notes
This function will aside from url sanitize the broadcasters username, will also remove any #
and make it lowercase ascii
Trait Implementations§
Source§impl<C: HttpClient<'static> + ClientDefault<'static>> Default for TmiClient<'static, C>
impl<C: HttpClient<'static> + ClientDefault<'static>> Default for TmiClient<'static, C>
Auto Trait Implementations§
impl<'a, C> Freeze for TmiClient<'a, C>where
C: Freeze,
impl<'a, C> RefUnwindSafe for TmiClient<'a, C>where
C: RefUnwindSafe,
impl<'a, C> Send for TmiClient<'a, C>
impl<'a, C> Sync for TmiClient<'a, C>
impl<'a, C> Unpin for TmiClient<'a, C>where
C: Unpin,
impl<'a, C> UnwindSafe for TmiClient<'a, C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more