Struct twitch_api::helix::games::GetGamesRequest
source · [−]#[non_exhaustive]pub struct GetGamesRequest<'a> {
pub id: Cow<'a, [&'a CategoryIdRef]>,
pub name: Cow<'a, [&'a str]>,
}
Available on crate feature
helix
only.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.id: Cow<'a, [&'a CategoryIdRef]>
Game ID. At most 100 id values can be specified.
name: Cow<'a, [&'a str]>
Game name. The name must be an exact match. For instance, “Pokemon” will not return a list of Pokemon games; instead, query the specific Pokemon game(s) in which you are interested. At most 100 name values can be specified.
Implementations
sourceimpl<'a> GetGamesRequest<'a>
impl<'a> GetGamesRequest<'a>
sourceimpl<'a> GetGamesRequest<'a>
impl<'a> GetGamesRequest<'a>
sourcepub fn names(names: impl Into<Cow<'a, [&'a str]>>) -> Self
pub fn names(names: impl Into<Cow<'a, [&'a str]>>) -> Self
Get games with specific exact name match.
sourcepub fn ids(ids: impl Into<Cow<'a, [&'a CategoryIdRef]>>) -> Self
pub fn ids(ids: impl Into<Cow<'a, [&'a CategoryIdRef]>>) -> Self
Get games with specific exact id match.
Examples found in repository?
src/helix/client/client_ext.rs (line 437)
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
pub async fn get_games_by_id<T>(
&'a self,
ids: impl AsRef<[&'a types::CategoryIdRef]>,
token: &T,
) -> Result<std::collections::HashMap<types::CategoryId, helix::games::Game>, ClientError<'a, C>>
where
T: TwitchToken + ?Sized,
{
let ids = ids.as_ref();
if ids.len() > 100 {
return Err(ClientRequestError::Custom("too many IDs, max 100".into()));
}
let resp = self
.req_get(helix::games::GetGamesRequest::ids(ids), token)
.await?;
Ok(resp
.data
.into_iter()
.map(|g: helix::games::Game| (g.id.clone(), g))
.collect())
}
Trait Implementations
sourceimpl<'a> Clone for GetGamesRequest<'a>
impl<'a> Clone for GetGamesRequest<'a>
sourcefn clone(&self) -> GetGamesRequest<'a>
fn clone(&self) -> GetGamesRequest<'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 GetGamesRequest<'a>
impl<'a> Debug for GetGamesRequest<'a>
sourceimpl<'de: 'a, 'a> Deserialize<'de> for GetGamesRequest<'a>
impl<'de: 'a, 'a> Deserialize<'de> for GetGamesRequest<'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<GetGamesRequest<'a>> for GetGamesRequest<'a>
impl<'a> PartialEq<GetGamesRequest<'a>> for GetGamesRequest<'a>
sourcefn eq(&self, other: &GetGamesRequest<'a>) -> bool
fn eq(&self, other: &GetGamesRequest<'a>) -> bool
sourceimpl Request for GetGamesRequest<'_>
impl Request for GetGamesRequest<'_>
type Response = Vec<TwitchCategory, Global>
type Response = Vec<TwitchCategory, Global>
Response type. twitch’s response will deserialize to this.
sourceconst PATH: &'static str = "games"
const PATH: &'static str = "games"
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 GetGamesRequest<'_>
impl RequestGet for GetGamesRequest<'_>
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 clientsourcefn parse_response<B: Into<Bytes>>(
request: Option<Self>,
uri: &Uri,
response: Response<B>
) -> Result<Response<Self, <Self as Request>::Response>, HelixRequestGetError>where
Self: Sized,
fn parse_response<B: Into<Bytes>>(
request: Option<Self>,
uri: &Uri,
response: Response<B>
) -> Result<Response<Self, <Self as Request>::Response>, HelixRequestGetError>where
Self: Sized,
Parse response. Read more
sourcefn parse_inner_response(
request: Option<Self>,
uri: &Uri,
response: &str,
status: StatusCode
) -> Result<Response<Self, <Self as Request>::Response>, HelixRequestGetError>where
Self: Sized,
fn parse_inner_response(
request: Option<Self>,
uri: &Uri,
response: &str,
status: StatusCode
) -> Result<Response<Self, <Self as Request>::Response>, HelixRequestGetError>where
Self: Sized,
Parse a response string into the response.
sourceimpl<'a> Serialize for GetGamesRequest<'a>
impl<'a> Serialize for GetGamesRequest<'a>
impl<'a> Eq for GetGamesRequest<'a>
impl<'a> StructuralEq for GetGamesRequest<'a>
impl<'a> StructuralPartialEq for GetGamesRequest<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for GetGamesRequest<'a>
impl<'a> Send for GetGamesRequest<'a>
impl<'a> Sync for GetGamesRequest<'a>
impl<'a> Unpin for GetGamesRequest<'a>
impl<'a> UnwindSafe for GetGamesRequest<'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.