twitch-rs / twitch_api

Rust library for talking with the Twitch API aka. "Helix", TMI and more! Use Twitch endpoints fearlessly!
Apache License 2.0
151 stars 33 forks source link

Why can't I put multiple broadcaster_id in GetChannelInformationRequest? #294

Closed B4TT3RY closed 1 year ago

B4TT3RY commented 1 year ago

image Is it that I don't know how? Or is it not supported?

i used twitch_api2 v0.6.1

Emilgardis commented 1 year ago

good catch! This is indeed a fault in the library and should be supported.

in 2020 when this code was added this was not documented

https://web.archive.org/web/20201126161544/https://dev.twitch.tv/docs/api/reference

I'll make sure this gets added to 0.7.0

Emilgardis commented 1 year ago

To fix this https://github.com/twitch-rs/twitch_api/blob/2d4b88d8644af0c9e21826712778ed13622bf028/src/helix/endpoints/channels/get_channel_information.rs#L50 needs to be changed to

pub struct GetChannelInformationRequest<'a> {
    /// The IDs of the broadcasters whose channels you want to get.
    ///
    /// You may specify a maximum of 100 IDs. The API ignores duplicate IDs and IDs that are not found.
    #[cfg_attr(not(feature = "deser_borrow"), serde(bound(deserialize = "'de: 'a")))]
    pub broadcaster_id: Cow<'a, [&'a types::UserIdRef]>,
}

and all other applicable places and documentation needs to be updated accordingly.

Do you feel up to implementing the change? No worries if not, I can implement the change :)