Skip to content

Commit 8adf8a6

Browse files
committed
more!
1 parent e4fbf60 commit 8adf8a6

File tree

2 files changed

+54
-5
lines changed

2 files changed

+54
-5
lines changed

src/helix/client/client_ext.rs

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,23 @@ impl<'client, C: crate::HttpClient + Sync + 'client> HelixClient<'client, C> {
625625
}
626626

627627
/// Get games by ID.
628+
///
629+
/// # Examples
630+
///
631+
/// ```rust, no_run
632+
/// # #[tokio::main]
633+
/// # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
634+
/// # let client: helix::HelixClient<'static, twitch_api::client::DummyHttpClient> = helix::HelixClient::default();
635+
/// # let token = twitch_oauth2::AccessToken::new("validtoken".to_string());
636+
/// # let token = twitch_oauth2::UserToken::from_existing(&client, token, None, None).await?;
637+
/// use twitch_api::{types, helix};
638+
/// use futures::TryStreamExt;
639+
///
640+
/// let channels: &[&types::CategoryIdRef] = &["509658".into(), "32982".into(), "27471".into()];
641+
/// let games: Vec<helix::games::Game> = client.get_games_by_id(&channels, &token).try_collect().await?;
642+
///
643+
/// # Ok(()) }
644+
/// ```
628645
pub fn get_games_by_id<T>(
629646
&'client self,
630647
ids: &'client [&'client types::CategoryIdRef],
@@ -734,7 +751,6 @@ impl<'client, C: crate::HttpClient + Sync + 'client> HelixClient<'client, C> {
734751
///
735752
/// Make sure to limit the data here using [`try_take_while`](futures::stream::TryStreamExt::try_take_while), otherwise this will never end on recurring scheduled streams.
736753
///
737-
///
738754
/// # Examples
739755
///
740756
/// ```rust, no_run
@@ -818,7 +834,24 @@ impl<'client, C: crate::HttpClient + Sync + 'client> HelixClient<'client, C> {
818834
}
819835
}
820836

821-
/// Get emotes in emote set
837+
/// Get emotes in emote sets
838+
///
839+
/// # Examples
840+
///
841+
/// ```rust, no_run
842+
/// # #[tokio::main]
843+
/// # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
844+
/// # let client: helix::HelixClient<'static, twitch_api::client::DummyHttpClient> = helix::HelixClient::default();
845+
/// # let token = twitch_oauth2::AccessToken::new("validtoken".to_string());
846+
/// # let token = twitch_oauth2::UserToken::from_existing(&client, token, None, None).await?;
847+
/// use twitch_api::{types, helix};
848+
/// use futures::TryStreamExt;
849+
///
850+
/// let emote_sets: &[&types::EmoteSetIdRef] = &["0".into()];
851+
/// let games: Vec<helix::chat::get_emote_sets::Emote> = client.get_emote_sets(&emote_sets, &token).try_collect().await?;
852+
///
853+
/// # Ok(()) }
854+
/// ```
822855
pub fn get_emote_sets<T>(
823856
&'client self,
824857
emote_sets: &'client [&'client types::EmoteSetIdRef],
@@ -830,7 +863,7 @@ impl<'client, C: crate::HttpClient + Sync + 'client> HelixClient<'client, C> {
830863
where
831864
T: TwitchToken + Send + Sync + ?Sized,
832865
{
833-
futures::stream::iter(emote_sets.chunks(100))
866+
futures::stream::iter(emote_sets.chunks(25))
834867
.map(move |c| {
835868
let req = helix::chat::GetEmoteSetsRequest::emote_set_ids(c);
836869
futures::stream::once(self.req_get(req, token)).boxed()
@@ -972,6 +1005,23 @@ impl<'client, C: crate::HttpClient + Sync + 'client> HelixClient<'client, C> {
9721005
}
9731006

9741007
/// Get multiple users chat colors
1008+
///
1009+
/// # Examples
1010+
///
1011+
/// ```rust, no_run
1012+
/// # #[tokio::main]
1013+
/// # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
1014+
/// # let client: helix::HelixClient<'static, twitch_api::client::DummyHttpClient> = helix::HelixClient::default();
1015+
/// # let token = twitch_oauth2::AccessToken::new("validtoken".to_string());
1016+
/// # let token = twitch_oauth2::UserToken::from_existing(&client, token, None, None).await?;
1017+
/// use twitch_api::{types, helix};
1018+
/// use futures::TryStreamExt;
1019+
///
1020+
/// let user_ids: &[&types::UserIdRef] = &["1234".into()];
1021+
/// let games: Vec<helix::chat::UserChatColor> = client.get_users_chat_colors(&user_ids, &token).try_collect().await?;
1022+
///
1023+
/// # Ok(()) }
1024+
/// ```
9751025
pub fn get_users_chat_colors<T>(
9761026
&'client self,
9771027
user_ids: &'client [&'client types::UserIdRef],

src/helix/endpoints/chat/get_emote_sets.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ use helix::RequestGet;
4646
#[must_use]
4747
#[non_exhaustive]
4848
pub struct GetEmoteSetsRequest<'a> {
49-
// FIXME: twitch doc specifies maximum as 25, but it actually is 10
50-
/// The broadcaster whose emotes are being requested. Minimum: 1. Maximum: 10
49+
/// The broadcaster whose emotes are being requested. Minimum: 1. Maximum: 25
5150
#[cfg_attr(
5251
feature = "typed-builder",
5352
builder(default_code = "Cow::Borrowed(&[])", setter(into))

0 commit comments

Comments
 (0)