pub struct AtpAgent<S, T>where
S: AtpSessionStore + Send + Sync,
T: XrpcClient + Send + Sync,
S::Error: Error + Send + Sync + 'static,{ /* private fields */ }
Available on crate feature
agent
only.Expand description
An ATP “Agent”. Manages session token lifecycles and provides convenience methods.
This will be deprecated in the near future. Use Agent
directly
with a CredentialSession
instead:
§Example
use atrium_api::agent::atp_agent::{store::MemorySessionStore, CredentialSession};
use atrium_api::agent::Agent;
use atrium_xrpc_client::reqwest::ReqwestClient;
let session = CredentialSession::new(
ReqwestClient::new("https://bsky.social"),
MemorySessionStore::default(),
);
let agent = Agent::new(session);
Implementations§
Source§impl<S, T> AtpAgent<S, T>where
S: AtpSessionStore + Send + Sync,
T: XrpcClient + Send + Sync,
S::Error: Error + Send + Sync + 'static,
impl<S, T> AtpAgent<S, T>where
S: AtpSessionStore + Send + Sync,
T: XrpcClient + Send + Sync,
S::Error: Error + Send + Sync + 'static,
Sourcepub async fn login(
&self,
identifier: impl AsRef<str>,
password: impl AsRef<str>,
) -> Result<AtpSession, Error<Error>>
pub async fn login( &self, identifier: impl AsRef<str>, password: impl AsRef<str>, ) -> Result<AtpSession, Error<Error>>
Start a new session with this agent.
pub async fn resume_session( &self, session: AtpSession, ) -> Result<(), Error<Error>>
Sourcepub async fn get_session(&self) -> Option<AtpSession>
pub async fn get_session(&self) -> Option<AtpSession>
Get the current session.
Sourcepub async fn get_endpoint(&self) -> String
pub async fn get_endpoint(&self) -> String
Get the current endpoint.
Sourcepub async fn get_labelers_header(&self) -> Option<Vec<String>>
pub async fn get_labelers_header(&self) -> Option<Vec<String>>
Get the current labelers header.
Sourcepub async fn get_proxy_header(&self) -> Option<String>
pub async fn get_proxy_header(&self) -> Option<String>
Get the current proxy header.
Methods from Deref<Target = Agent<Wrapper<CredentialSession<S, T>>>>§
Trait Implementations§
Auto Trait Implementations§
impl<S, T> Freeze for AtpAgent<S, T>
impl<S, T> !RefUnwindSafe for AtpAgent<S, T>
impl<S, T> Send for AtpAgent<S, T>
impl<S, T> Sync for AtpAgent<S, T>
impl<S, T> Unpin for AtpAgent<S, T>
impl<S, T> !UnwindSafe for AtpAgent<S, T>
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