Skip to main content

AppViewClient

Struct AppViewClient 

Source
pub struct AppViewClient { /* private fields */ }
Expand description

Read-only AppView XRPC client.

Implementations§

Source§

impl AppViewClient

Source

pub fn new() -> Self

Creates a client targeting the default public AppView and CDN.

Source

pub fn with_endpoint(endpoint: impl Into<String>) -> Self

Creates a client with a custom AppView endpoint and the default CDN.

Source

pub fn with_endpoints( appview_endpoint: impl Into<String>, cdn_endpoint: impl Into<String>, ) -> Self

Creates a client with custom AppView and CDN endpoints.

Source

pub fn appview_url(&self) -> &str

Returns the configured AppView base URL.

Source

pub fn cdn_url(&self) -> &str

Returns the configured CDN base URL.

Source

pub fn http_client(&self) -> &Client

Returns a reference to the underlying HTTP client.

Source

pub async fn get<T: DeserializeOwned>( &self, endpoint: &str, query: &[(&str, String)], ) -> Result<T, SkybaseError>

Performs a GET against an AppView XRPC endpoint and decodes the JSON response.

§Errors

Returns SkybaseError::Network on transport failure or SkybaseError::Serialization on a non-success status or decode failure.

Source

pub async fn paginate<T, I, F>( &self, endpoint: &str, base_query: &[(&str, String)], page_limit: u8, extract: F, ) -> Vec<I>
where T: DeserializeOwned, F: Fn(T) -> (Vec<I>, Option<String>),

Paginates an AppView XRPC endpoint, following cursors for at most DEFAULT_MAX_PAGES pages.

extract projects each decoded response into a page of items plus the next cursor. Stops on a transport/decode error, an empty page, or a missing cursor.

Source

pub async fn resolve_handle(&self, handle: &str) -> Option<String>

Resolves an ATProto handle to a DID via com.atproto.identity.resolveHandle.

Single-label handles without a domain (e.g. "alice" or "@alice") automatically default to .bsky.social via skyauth::identity::normalize_user_handle. Returns None on any failure. A DID input is returned unchanged.

Source

pub async fn search_actors_typeahead( &self, query: &str, limit: u8, ) -> Vec<ActorSuggestion>

Searches actor profiles by handle/name prefix via app.bsky.actor.searchActorsTypeahead.

Returns an empty vector if query is empty or on any transport/decode failure.

Source

pub async fn fetch_profile(&self, did: &str) -> Option<ActorProfile>

Fetches an actor profile via app.bsky.actor.getProfile.

Returns None on any failure.

Source

pub async fn fetch_post(&self, uri: &str) -> Option<PostView>

Fetches a single post view via app.bsky.feed.getPosts.

Returns None on any failure or an empty response.

Source

pub async fn fetch_follows(&self, actor: &str, limit: u8) -> Vec<String>

Fetches followed DIDs for an actor via app.bsky.graph.getFollows.

Source

pub async fn fetch_followers(&self, actor: &str, limit: u8) -> Vec<String>

Fetches incoming follower DIDs for an actor via app.bsky.graph.getFollowers.

Source

pub async fn fetch_follow_records( &self, actor: &str, limit: u8, ) -> Vec<(String, String)>

Fetches follow records (rkey, followed_did) for an actor via com.atproto.repo.listRecords on app.bsky.graph.follow.

Source

pub fn thumbnail_url(&self, author_did: &str, cid: &str) -> String

Builds a CDN thumbnail URL for an author DID and image CID.

Trait Implementations§

Source§

impl Clone for AppViewClient

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AppViewClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AppViewClient

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more