pub struct UsersApi<'a> { /* private fields */ }Expand description
Users API - handles all user-related endpoints
Implementations§
Source§impl<'a> UsersApi<'a>
impl<'a> UsersApi<'a>
Sourcepub async fn get(&self, user_ids: Vec<u64>) -> Result<Vec<User>>
pub async fn get(&self, user_ids: Vec<u64>) -> Result<Vec<User>>
Get users by their IDs
If no IDs are provided, returns the authenticated user’s information.
Requires OAuth token with user:read scope
§Example
// Get specific users
let users = client.users().get(vec![123, 456]).await?;
// Get current authenticated user
let me = client.users().get_me().await?;Sourcepub async fn get_me(&self) -> Result<User>
pub async fn get_me(&self) -> Result<User>
Get the currently authenticated user’s information
This is a convenience method that calls get() with no IDs.
Requires OAuth token with user:read scope
§Example
let me = client.users().get_me().await?;
println!("Logged in as: {}", me.name);Sourcepub async fn introspect_token(&self) -> Result<TokenIntrospection>
pub async fn introspect_token(&self) -> Result<TokenIntrospection>
Introspect an OAuth token (validate it)
This validates the token passed in the Authorization header. Implements RFC 7662 OAuth 2.0 Token Introspection.
Note: This endpoint is deprecated but still functional.
Requires OAuth token (no specific scope needed)
§Example
let introspection = client.users().introspect_token().await?;
if introspection.is_active() {
println!("Token is valid!");
println!("Scopes: {:?}", introspection.scopes());
if introspection.has_scope("user:read") {
println!("Has user:read permission");
}
if introspection.is_expired() {
println!("Token is expired!");
}
} else {
println!("Token is invalid");
}Auto Trait Implementations§
impl<'a> Freeze for UsersApi<'a>
impl<'a> !RefUnwindSafe for UsersApi<'a>
impl<'a> Send for UsersApi<'a>
impl<'a> Sync for UsersApi<'a>
impl<'a> Unpin for UsersApi<'a>
impl<'a> !UnwindSafe for UsersApi<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more