Struct twitch_api::helix::chat::get_user_chat_color::GetUserChatColorRequest
source · [−]Available on crate feature
helix
only.Expand description
Query Parameters for Get Chatters
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.user_id: Cow<'a, [&'a UserIdRef]>
The ID of the user whose color you want to get.
Implementations
sourceimpl<'a> GetUserChatColorRequest<'a>
impl<'a> GetUserChatColorRequest<'a>
sourceimpl<'a> GetUserChatColorRequest<'a>
impl<'a> GetUserChatColorRequest<'a>
sourcepub fn user_ids(user_ids: impl Into<Cow<'a, [&'a UserIdRef]>>) -> Self
pub fn user_ids(user_ids: impl Into<Cow<'a, [&'a UserIdRef]>>) -> Self
Get chat colors of specified users
Examples found in repository?
src/helix/client/client_ext.rs (line 740)
≺ ≻
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777
pub async fn get_user_chat_color<T>(
&'a self,
user_id: impl Into<&types::UserIdRef>,
token: &T,
) -> Result<Option<helix::chat::UserChatColor>, ClientError<'a, C>>
where
T: TwitchToken + ?Sized,
{
Ok(self
.req_get(
helix::chat::GetUserChatColorRequest::user_ids(&[user_id.into()][..]),
token,
)
.await?
.first())
}
/// Get a users chat color
pub async fn update_user_chat_color<'b, T>(
&'a self,
user_id: impl types::IntoCow<'b, types::UserIdRef> + 'b,
color: impl Into<types::NamedUserColor<'b>> + 'b,
token: &T,
) -> Result<helix::chat::UpdateUserChatColorResponse, ClientError<'a, C>>
where
T: TwitchToken + ?Sized,
{
let req = helix::chat::UpdateUserChatColorRequest {
user_id: user_id.to_cow(),
color: color.into(),
};
Ok(self.req_put(req, helix::EmptyBody, token).await?.data)
}
/// Get multiple users chat colors
pub async fn get_users_chat_colors<T>(
&'a self,
user_ids: impl AsRef<[&'a types::UserIdRef]>,
token: &T,
) -> Result<Vec<helix::chat::UserChatColor>, ClientError<'a, C>>
where
T: TwitchToken + ?Sized,
{
let req = helix::chat::GetUserChatColorRequest::user_ids(user_ids.as_ref());
Ok(self.req_get(req, token).await?.data)
}
Trait Implementations
sourceimpl<'a> Clone for GetUserChatColorRequest<'a>
impl<'a> Clone for GetUserChatColorRequest<'a>
sourcefn clone(&self) -> GetUserChatColorRequest<'a>
fn clone(&self) -> GetUserChatColorRequest<'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 GetUserChatColorRequest<'a>
impl<'a> Debug for GetUserChatColorRequest<'a>
sourceimpl<'de: 'a, 'a> Deserialize<'de> for GetUserChatColorRequest<'a>
impl<'de: 'a, 'a> Deserialize<'de> for GetUserChatColorRequest<'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<GetUserChatColorRequest<'a>> for GetUserChatColorRequest<'a>
impl<'a> PartialEq<GetUserChatColorRequest<'a>> for GetUserChatColorRequest<'a>
sourcefn eq(&self, other: &GetUserChatColorRequest<'a>) -> bool
fn eq(&self, other: &GetUserChatColorRequest<'a>) -> bool
sourceimpl Request for GetUserChatColorRequest<'_>
impl Request for GetUserChatColorRequest<'_>
type Response = Vec<UserChatColor, Global>
type Response = Vec<UserChatColor, Global>
Response type. twitch’s response will deserialize to this.
sourceconst PATH: &'static str = "chat/color"
const PATH: &'static str = "chat/color"
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 GetUserChatColorRequest<'_>
impl RequestGet for GetUserChatColorRequest<'_>
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 GetUserChatColorRequest<'a>
impl<'a> Serialize for GetUserChatColorRequest<'a>
impl<'a> Eq for GetUserChatColorRequest<'a>
impl<'a> StructuralEq for GetUserChatColorRequest<'a>
impl<'a> StructuralPartialEq for GetUserChatColorRequest<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for GetUserChatColorRequest<'a>
impl<'a> Send for GetUserChatColorRequest<'a>
impl<'a> Sync for GetUserChatColorRequest<'a>
impl<'a> Unpin for GetUserChatColorRequest<'a>
impl<'a> UnwindSafe for GetUserChatColorRequest<'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.