Struct SessionClient

Source
pub struct SessionClient<S, T, U> { /* private fields */ }
Available on crate feature agent only.
Expand description

A client that maintains session data and manages endpoints and XRPC headers.

It is recommended to use this struct internally in higher-level clients such as XrpcClient, which can automatically update tokens.

Implementations§

Source§

impl<S, T, U> SessionClient<S, T, U>

Source

pub fn new(store: Arc<SessionWithEndpointStore<S, U>>, http_client: T) -> Self

Trait Implementations§

Source§

impl<S, T, U> Clone for SessionClient<S, T, U>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S, T, U> CloneWithProxy for SessionClient<S, T, U>

Source§

fn clone_with_proxy(&self, did: Did, service_type: impl AsRef<str>) -> Self

Source§

impl<S, T, U> Configure for SessionClient<S, T, U>

Source§

fn configure_endpoint(&self, endpoint: String)

Set the current endpoint.
Source§

fn configure_labelers_header(&self, labelers_dids: Option<Vec<(Did, bool)>>)

Configures the moderation services to be applied on requests.
Source§

fn configure_proxy_header(&self, did: Did, service_type: impl AsRef<str>)

Configures the atproto-proxy header to be applied on requests.
Source§

impl<S, T, U> HttpClient for SessionClient<S, T, U>
where S: Store<(), U> + Send + Sync, T: HttpClient + Send + Sync, U: Clone + Send + Sync,

Source§

async fn send_http( &self, request: Request<Vec<u8>>, ) -> Result<Response<Vec<u8>>, Box<dyn Error + Send + Sync + 'static>>

Send an HTTP request and return the response.
Source§

impl<S, T, U> XrpcClient for SessionClient<S, T, U>
where S: Store<(), U> + AuthorizationProvider + Send + Sync, T: HttpClient + Send + Sync, U: Clone + Send + Sync,

Source§

fn base_uri(&self) -> String

The base URI of the XRPC server.
Source§

async fn authorization_token( &self, is_refresh: bool, ) -> Option<AuthorizationToken>

Get the authorization token to use Authorization header.
Source§

async fn atproto_proxy_header(&self) -> Option<String>

Get the atproto-proxy header.
Source§

async fn atproto_accept_labelers_header(&self) -> Option<Vec<String>>

Get the atproto-accept-labelers header.
Source§

fn send_xrpc<P, I, O, E>( &self, request: &XrpcRequest<P, I>, ) -> impl Future<Output = Result<OutputDataOrBytes<O>, Error<E>>> + Send

Send an XRPC request and return the response.

Auto Trait Implementations§

§

impl<S, T, U> !Freeze for SessionClient<S, T, U>

§

impl<S, T, U> RefUnwindSafe for SessionClient<S, T, U>

§

impl<S, T, U> Send for SessionClient<S, T, U>
where T: Sync + Send, S: Sync + Send, U: Sync + Send,

§

impl<S, T, U> Sync for SessionClient<S, T, U>
where T: Sync + Send, S: Sync + Send, U: Sync + Send,

§

impl<S, T, U> Unpin for SessionClient<S, T, U>

§

impl<S, T, U> UnwindSafe for SessionClient<S, T, U>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, C> Cacheable<C> for T

Source§

fn cached(self, cache: C) -> Cached<T, C>

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Throttleable<P> for T
where P: Default,

Source§

fn throttled(self) -> Throttled<T, P>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.