Crate trovo[−][src]
Expand description
A Rust api client for Trovo.
Currently supports connecting to chat, sending messages, looking up users via username, and fetching channel information, more will be added as the crate develops.
Example
Find a user by username and then connect to their chat.
use futures::prelude::*; use std::{env, error::Error}; use trovo::ClientId; #[tokio::main] async fn main() -> Result<(), Box<dyn Error>> { let client_id = env::var("CLIENT_ID").expect("missing CLIENT_ID env var"); let username = env::var("USER_NAME").expect("missing USER_NAME env var"); let client = trovo::Client::new(ClientId::new(client_id)); println!("looking up user '{}'", username); let user = client .user(username) .await? .expect("no user found for the given username"); println!("found user {:#?}", user); let mut messages = client.chat_messages_for_channel(&user.channel_id).await?; println!("listening for chat messages"); while let Some(msg) = messages.next().await { let msg = msg?; println!("[{}] {}", msg.nick_name, msg.content); } Ok(()) }
Modules
Chat
Structs
Error returned by AccessTokenOnly
when
refresh_token
is called.
A simple access token provider that errors if refreshing is attempted. It is strongly advised
that you implement your own AccessTokenProvider
so that you can handle refreshing.
Struct representing errors that trovo api responds with.
Response for the get users api
Entrypoint for making requests to the Trovo api.
A simple client id provider that simply wraps the client id string
Payload for the get channel info by id api
Payload for the get users api
Response for the get users api
Social media link for a channel
User details returned by Client::users
Enums
Represents an access token
Audience type of a channel
Standard errors that can occur on most api calls
Error codes returned by the Trovo api
Standard errors that can occur on most api calls
Traits
A trait for an auth provider that can provide an access token.
A trait for an auth provider that can provide a client id