pub struct UsersService<'a> { /* private fields */ }Expand description
Operations on users. Obtain via LinearClient::users.
Implementations§
Source§impl<'a> UsersService<'a>
impl<'a> UsersService<'a>
Sourcepub async fn list(&self, req: ListUsersRequest) -> Result<Page<User>>
pub async fn list(&self, req: ListUsersRequest) -> Result<Page<User>>
Fetches one page of users.
§Example
use linear_api::workspace::ListUsersRequest;
let client = linear_api::LinearClient::from_env()?;
let page = client
.users()
.list(ListUsersRequest::builder().first(50).build())
.await?;
println!("has more: {}", page.page_info.has_next_page);Sourcepub fn list_stream(
self,
req: ListUsersRequest,
) -> impl Stream<Item = Result<User>> + 'a
pub fn list_stream( self, req: ListUsersRequest, ) -> impl Stream<Item = Result<User>> + 'a
Lazily streams every user matching the request across pages, starting
from req.after when set (the cursor then advances page by page).
§Example
use futures::TryStreamExt;
let client = linear_api::LinearClient::from_env()?;
let users: Vec<_> = client
.users()
.list_stream(Default::default())
.try_collect()
.await?;Sourcepub async fn get(&self, id: &UserId) -> Result<User>
pub async fn get(&self, id: &UserId) -> Result<User>
Fetches a single user by ID. For the authenticated user, use
LinearClient::viewer instead.
§Example
let client = linear_api::LinearClient::from_env()?;
let user_id = linear_api::UserId::new("9c2c88a6-99d3-4a63-a201-8ee5c7dcc374");
let user = client.users().get(&user_id).await?;
println!("{}", user.display_name);Trait Implementations§
Source§impl<'a> Clone for UsersService<'a>
impl<'a> Clone for UsersService<'a>
Source§fn clone(&self) -> UsersService<'a>
fn clone(&self) -> UsersService<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for UsersService<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for UsersService<'a>
impl<'a> !UnwindSafe for UsersService<'a>
impl<'a> Freeze for UsersService<'a>
impl<'a> Send for UsersService<'a>
impl<'a> Sync for UsersService<'a>
impl<'a> Unpin for UsersService<'a>
impl<'a> UnsafeUnpin for UsersService<'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