pub struct GraphClient { /* private fields */ }Expand description
Stateful Microsoft Graph client. Holds an AuthClient and a shared HTTP client.
Implementations§
Source§impl GraphClient
impl GraphClient
pub fn new(auth: AuthClient) -> Result<Self, ClientError>
pub fn for_test(auth: AuthClient, base_url: impl Into<String>) -> Self
pub fn auth(&self) -> &AuthClient
Sourcepub async fn me(&self, access_token: &str) -> Result<Me, ClientError>
pub async fn me(&self, access_token: &str) -> Result<Me, ClientError>
GET /me. Used right after sign-in to learn the user’s email.
Sourcepub async fn list_inbox(
&self,
account: &str,
limit: usize,
unread_only: bool,
) -> Result<Vec<Message>, ClientError>
pub async fn list_inbox( &self, account: &str, limit: usize, unread_only: bool, ) -> Result<Vec<Message>, ClientError>
GET /me/mailFolders/inbox/messages for a given account email.
Acquires/refreshes a token transparently via AuthClient::get_valid_token.
Sourcepub async fn get_message(
&self,
account: &str,
message_id: &str,
) -> Result<FullMessage, ClientError>
pub async fn get_message( &self, account: &str, message_id: &str, ) -> Result<FullMessage, ClientError>
GET /me/messages/{id} for a given account email.
Sourcepub async fn list_attachments(
&self,
account: &str,
message_id: &str,
) -> Result<Vec<Attachment>, ClientError>
pub async fn list_attachments( &self, account: &str, message_id: &str, ) -> Result<Vec<Attachment>, ClientError>
GET /me/messages/{id}/attachments.
Sourcepub async fn get_attachment_bytes(
&self,
account: &str,
message_id: &str,
attachment_id: &str,
) -> Result<Vec<u8>, ClientError>
pub async fn get_attachment_bytes( &self, account: &str, message_id: &str, attachment_id: &str, ) -> Result<Vec<u8>, ClientError>
GET /me/messages/{id}/attachments/{att_id} returning decoded bytes.
Auto Trait Implementations§
impl Freeze for GraphClient
impl !RefUnwindSafe for GraphClient
impl Send for GraphClient
impl Sync for GraphClient
impl Unpin for GraphClient
impl UnsafeUnpin for GraphClient
impl !UnwindSafe for GraphClient
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