pub(crate) struct OAuthCli {
pub(crate) client: Client,
pub(crate) restored: bool,
pub(crate) session_file: PathBuf,
}
Expand description
An OAuth 2.0 CLI.
Fields§
§client: Client
The Matrix client.
restored: bool
Whether this is a restored client.
session_file: PathBuf
The path to the file storing the session.
Implementations§
Source§impl OAuthCli
impl OAuthCli
Sourcepub(crate) async fn new(data_dir: &Path, session_file: PathBuf) -> Result<Self>
pub(crate) async fn new(data_dir: &Path, session_file: PathBuf) -> Result<Self>
Create a new session by logging in.
Sourcepub(crate) async fn register_and_login(&self, data_dir: &Path) -> Result<()>
pub(crate) async fn register_and_login(&self, data_dir: &Path) -> Result<()>
Register the client and log in the user via the OAuth 2.0 Authorization Code flow.
Sourcepub(crate) async fn from_stored_session(session_file: PathBuf) -> Result<Self>
pub(crate) async fn from_stored_session(session_file: PathBuf) -> Result<Self>
Restore a previous session from a file.
pub(crate) async fn recover(&self) -> Result<()>
pub(crate) async fn reset_cross_signing(&self) -> Result<()>
Sourcepub(crate) async fn account(&self, action: Option<AccountManagementActionFull>)
pub(crate) async fn account(&self, action: Option<AccountManagementActionFull>)
Get the account management URL.
Sourcepub(crate) async fn watch_sliding_sync(&self) -> Result<()>
pub(crate) async fn watch_sliding_sync(&self) -> Result<()>
This watches for incoming responses using the high-level sliding sync
helpers (SyncService
).
Sourcepub(crate) fn setup_background_save(&self)
pub(crate) fn setup_background_save(&self)
Sets up this client so that it automatically saves the session onto disk whenever there are new tokens that have been received.
This should always be set up whenever automatic refresh is happening.
Sourcepub(crate) async fn update_stored_session(&self) -> Result<()>
pub(crate) async fn update_stored_session(&self) -> Result<()>
Update the session stored on the system.
This should be called everytime the access token (and possibly refresh token) has changed.
Sourcepub(crate) async fn refresh_token(&self) -> Result<()>
pub(crate) async fn refresh_token(&self) -> Result<()>
Refresh the access token.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OAuthCli
impl !RefUnwindSafe for OAuthCli
impl Send for OAuthCli
impl Sync for OAuthCli
impl Unpin for OAuthCli
impl !UnwindSafe for OAuthCli
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more