Struct twitch_api::helix::channels::get_channel_information::GetChannelInformationRequest
source · [−]#[non_exhaustive]pub struct GetChannelInformationRequest<'a> {
pub broadcaster_id: Cow<'a, UserIdRef>,
}
Available on crate feature
helix
only.Expand description
Query Parameters for Get Channel Information
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.broadcaster_id: Cow<'a, UserIdRef>
ID of the channel
Implementations
sourceimpl<'a> GetChannelInformationRequest<'a>
impl<'a> GetChannelInformationRequest<'a>
sourceimpl<'a> GetChannelInformationRequest<'a>
impl<'a> GetChannelInformationRequest<'a>
sourcepub fn broadcaster_id(broadcaster_id: impl IntoCow<'a, UserIdRef> + 'a) -> Self
pub fn broadcaster_id(broadcaster_id: impl IntoCow<'a, UserIdRef> + 'a) -> Self
Get channel information for a specific broadcaster.
Examples found in repository?
src/helix/client/client_ext.rs (line 71)
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
pub async fn get_channel_from_id<'b, T>(
&'a self,
id: impl types::IntoCow<'b, types::UserIdRef> + 'b,
token: &T,
) -> Result<Option<helix::channels::ChannelInformation>, ClientError<'a, C>>
where
T: TwitchToken + ?Sized,
{
self.req_get(
helix::channels::GetChannelInformationRequest::broadcaster_id(id),
token,
)
.await
.map(|response| response.first())
}
More examples
examples/channel_information_custom.rs (line 30)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let _ = dotenvy::dotenv();
let mut args = std::env::args().skip(1);
let client: HelixClient<reqwest::Client> = HelixClient::default();
let token = std::env::var("TWITCH_TOKEN")
.ok()
.or_else(|| args.next())
.map(AccessToken::new)
.expect("Please set env: TWITCH_TOKEN or pass token as first argument");
let token = UserToken::from_existing(&client, token, None, None).await?;
let resp = client
.req_get_custom(
helix::channels::GetChannelInformationRequest::broadcaster_id(&token.user_id),
&token,
)
.await
.expect("oops");
let channel: Vec<CustomChannelInformation> = resp.data()?;
println!("Stream information:\n{:#?}", channel);
Ok(())
}
Trait Implementations
sourceimpl<'a> Clone for GetChannelInformationRequest<'a>
impl<'a> Clone for GetChannelInformationRequest<'a>
sourcefn clone(&self) -> GetChannelInformationRequest<'a>
fn clone(&self) -> GetChannelInformationRequest<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<'a> Debug for GetChannelInformationRequest<'a>
impl<'a> Debug for GetChannelInformationRequest<'a>
sourceimpl<'de: 'a, 'a> Deserialize<'de> for GetChannelInformationRequest<'a>
impl<'de: 'a, 'a> Deserialize<'de> for GetChannelInformationRequest<'a>
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a> PartialEq<GetChannelInformationRequest<'a>> for GetChannelInformationRequest<'a>
impl<'a> PartialEq<GetChannelInformationRequest<'a>> for GetChannelInformationRequest<'a>
sourcefn eq(&self, other: &GetChannelInformationRequest<'a>) -> bool
fn eq(&self, other: &GetChannelInformationRequest<'a>) -> bool
sourceimpl Request for GetChannelInformationRequest<'_>
impl Request for GetChannelInformationRequest<'_>
type Response = Option<ChannelInformation>
type Response = Option<ChannelInformation>
Response type. twitch’s response will deserialize to this.
sourceconst PATH: &'static str = "channels"
const PATH: &'static str = "channels"
The path to the endpoint relative to the helix root. eg.
channels
for Get Channel Informationsourceconst SCOPE: &'static [Scope] = _
const SCOPE: &'static [Scope] = _
Available on crate feature
twitch_oauth2
only.Scopes needed by this endpoint
sourceconst OPT_SCOPE: &'static [Scope] = _
const OPT_SCOPE: &'static [Scope] = _
Available on crate feature
twitch_oauth2
only.Optional scopes needed by this endpoint
sourcefn query(&self) -> Result<String, SerializeError>
fn query(&self) -> Result<String, SerializeError>
Defines layout of the url parameters.
sourcefn get_uri(&self) -> Result<Uri, InvalidUri>
fn get_uri(&self) -> Result<Uri, InvalidUri>
Returns full URI for the request, including query parameters.
sourcefn get_bare_uri() -> Result<Uri, InvalidUri>
fn get_bare_uri() -> Result<Uri, InvalidUri>
Returns bare URI for the request, NOT including query parameters.
sourceimpl RequestGet for GetChannelInformationRequest<'_>
impl RequestGet for GetChannelInformationRequest<'_>
sourcefn parse_inner_response(
request: Option<Self>,
uri: &Uri,
response: &str,
status: StatusCode
) -> Result<Response<Self, Self::Response>, HelixRequestGetError>where
Self: Sized,
fn parse_inner_response(
request: Option<Self>,
uri: &Uri,
response: &str,
status: StatusCode
) -> Result<Response<Self, Self::Response>, HelixRequestGetError>where
Self: Sized,
Parse a response string into the response.
sourcefn create_request(
&self,
token: &str,
client_id: &str
) -> Result<Request<Bytes>, CreateRequestError>
fn create_request(
&self,
token: &str,
client_id: &str
) -> Result<Request<Bytes>, CreateRequestError>
Create a
http::Request
from this Request
in your clientsourceimpl<'a> Serialize for GetChannelInformationRequest<'a>
impl<'a> Serialize for GetChannelInformationRequest<'a>
impl<'a> Eq for GetChannelInformationRequest<'a>
impl<'a> StructuralEq for GetChannelInformationRequest<'a>
impl<'a> StructuralPartialEq for GetChannelInformationRequest<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for GetChannelInformationRequest<'a>
impl<'a> Send for GetChannelInformationRequest<'a>
impl<'a> Sync for GetChannelInformationRequest<'a>
impl<'a> Unpin for GetChannelInformationRequest<'a>
impl<'a> UnwindSafe for GetChannelInformationRequest<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.