Struct twitch_api::helix::users::GetUsersFollowsRequest
source · [−]#[non_exhaustive]pub struct GetUsersFollowsRequest<'a> {
pub after: Option<Cow<'a, CursorRef>>,
pub first: Option<usize>,
pub from_id: Option<Cow<'a, UserIdRef>>,
pub to_id: Option<Cow<'a, UserIdRef>>,
}
helix
only.Expand description
Query Parameters for Get Users Follows
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.after: Option<Cow<'a, CursorRef>>
Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.
first: Option<usize>
Maximum number of objects to return. Maximum: 100. Default: 20.
from_id: Option<Cow<'a, UserIdRef>>
User ID. The request returns information about users who are being followed by the from_id user.
to_id: Option<Cow<'a, UserIdRef>>
User ID. The request returns information about users who are following the to_id user.
Implementations
sourceimpl<'a> GetUsersFollowsRequest<'a>
impl<'a> GetUsersFollowsRequest<'a>
sourcepub fn builder() -> GetUsersFollowsRequestBuilder<'a, ((), (), (), ())>
pub fn builder() -> GetUsersFollowsRequestBuilder<'a, ((), (), (), ())>
Create a builder for building GetUsersFollowsRequest
.
On the builder, call .after(...)
(optional), .first(...)
(optional), .from_id(...)
(optional), .to_id(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of GetUsersFollowsRequest
.
sourceimpl<'a> GetUsersFollowsRequest<'a>
impl<'a> GetUsersFollowsRequest<'a>
sourcepub fn following(from_id: impl IntoCow<'a, UserIdRef> + 'a) -> Self
pub fn following(from_id: impl IntoCow<'a, UserIdRef> + 'a) -> Self
Get the broadcasters that from_id
is following
sourcepub fn followers(to_id: impl IntoCow<'a, UserIdRef> + 'a) -> Self
pub fn followers(to_id: impl IntoCow<'a, UserIdRef> + 'a) -> Self
Get the followers of to_id
Examples found in repository?
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
pub async fn get_total_followers_from_id<'b, T>(
&'a self,
to_id: impl types::IntoCow<'b, types::UserIdRef> + 'b,
token: &T,
) -> Result<i64, ClientError<'a, C>>
where
T: TwitchToken + ?Sized,
{
let resp = self
.req_get(
helix::users::GetUsersFollowsRequest::followers(to_id),
token,
)
.await?;
Ok(resp.data.total)
}
sourcepub fn follows(
user_id: impl IntoCow<'a, UserIdRef> + 'a,
broadcaster_id: impl IntoCow<'a, UserIdRef> + 'a
) -> Self
pub fn follows(
user_id: impl IntoCow<'a, UserIdRef> + 'a,
broadcaster_id: impl IntoCow<'a, UserIdRef> + 'a
) -> Self
Check if user follows a specific broadcaster
sourcepub fn empty() -> Self
pub fn empty() -> Self
Returns an empty GetUsersFollowsRequest
Notes
This is not a valid request, it needs to be filled with other fields
Examples found in repository?
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
pub fn following(from_id: impl types::IntoCow<'a, types::UserIdRef> + 'a) -> Self {
Self {
from_id: Some(from_id.to_cow()),
..Self::empty()
}
}
/// Get the followers of `to_id`
pub fn followers(to_id: impl types::IntoCow<'a, types::UserIdRef> + 'a) -> Self {
Self {
to_id: Some(to_id.to_cow()),
..Self::empty()
}
}
/// Check if user follows a specific broadcaster
pub fn follows(
user_id: impl types::IntoCow<'a, types::UserIdRef> + 'a,
broadcaster_id: impl types::IntoCow<'a, types::UserIdRef> + 'a,
) -> Self {
Self {
from_id: Some(user_id.to_cow()),
to_id: Some(broadcaster_id.to_cow()),
..Self::empty()
}
}
More examples
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
pub fn get_follow_relationships<T>(
&'a self,
to_id: impl Into<Option<&'a types::UserIdRef>>,
from_id: impl Into<Option<&'a types::UserIdRef>>,
token: &'a T,
) -> std::pin::Pin<
Box<
dyn futures::Stream<Item = Result<helix::users::FollowRelationship, ClientError<'a, C>>>
+ Send
+ 'a,
>,
>
where
T: TwitchToken + Send + Sync + ?Sized,
{
let mut req = helix::users::GetUsersFollowsRequest::empty();
req.to_id = to_id.into().map(Cow::Borrowed);
req.from_id = from_id.into().map(Cow::Borrowed);
make_stream(req, token, self, |s| {
std::collections::VecDeque::from(s.follow_relationships)
})
}
Trait Implementations
sourceimpl<'a> Clone for GetUsersFollowsRequest<'a>
impl<'a> Clone for GetUsersFollowsRequest<'a>
sourcefn clone(&self) -> GetUsersFollowsRequest<'a>
fn clone(&self) -> GetUsersFollowsRequest<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<'a> Debug for GetUsersFollowsRequest<'a>
impl<'a> Debug for GetUsersFollowsRequest<'a>
sourceimpl<'de: 'a, 'a> Deserialize<'de> for GetUsersFollowsRequest<'a>
impl<'de: 'a, 'a> Deserialize<'de> for GetUsersFollowsRequest<'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>,
sourceimpl Paginated for GetUsersFollowsRequest<'_>
impl Paginated for GetUsersFollowsRequest<'_>
sourcefn set_pagination(&mut self, cursor: Option<Cursor>)
fn set_pagination(&mut self, cursor: Option<Cursor>)
sourceimpl<'a> PartialEq<GetUsersFollowsRequest<'a>> for GetUsersFollowsRequest<'a>
impl<'a> PartialEq<GetUsersFollowsRequest<'a>> for GetUsersFollowsRequest<'a>
sourcefn eq(&self, other: &GetUsersFollowsRequest<'a>) -> bool
fn eq(&self, other: &GetUsersFollowsRequest<'a>) -> bool
sourceimpl Request for GetUsersFollowsRequest<'_>
impl Request for GetUsersFollowsRequest<'_>
type Response = UsersFollows
type Response = UsersFollows
sourceconst OPT_SCOPE: &'static [Scope] = _
const OPT_SCOPE: &'static [Scope] = _
twitch_oauth2
only.sourceconst PATH: &'static str = "users/follows"
const PATH: &'static str = "users/follows"
channels
for Get Channel Informationsourceconst SCOPE: &'static [Scope] = _
const SCOPE: &'static [Scope] = _
twitch_oauth2
only.sourcefn query(&self) -> Result<String, SerializeError>
fn query(&self) -> Result<String, SerializeError>
sourcefn get_uri(&self) -> Result<Uri, InvalidUri>
fn get_uri(&self) -> Result<Uri, InvalidUri>
sourcefn get_bare_uri() -> Result<Uri, InvalidUri>
fn get_bare_uri() -> Result<Uri, InvalidUri>
sourceimpl RequestGet for GetUsersFollowsRequest<'_>
impl RequestGet for GetUsersFollowsRequest<'_>
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,
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>
http::Request
from this Request
in your clientsourceimpl<'a> Serialize for GetUsersFollowsRequest<'a>
impl<'a> Serialize for GetUsersFollowsRequest<'a>
impl<'a> Eq for GetUsersFollowsRequest<'a>
impl<'a> StructuralEq for GetUsersFollowsRequest<'a>
impl<'a> StructuralPartialEq for GetUsersFollowsRequest<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for GetUsersFollowsRequest<'a>
impl<'a> Send for GetUsersFollowsRequest<'a>
impl<'a> Sync for GetUsersFollowsRequest<'a>
impl<'a> Unpin for GetUsersFollowsRequest<'a>
impl<'a> UnwindSafe for GetUsersFollowsRequest<'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
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
key
and return true
if they are equal.