pub struct AppViewClient { /* private fields */ }Expand description
Read-only AppView XRPC client.
Implementations§
Source§impl AppViewClient
impl AppViewClient
Sourcepub fn with_endpoint(endpoint: impl Into<String>) -> Self
pub fn with_endpoint(endpoint: impl Into<String>) -> Self
Creates a client with a custom AppView endpoint and the default CDN.
Sourcepub fn with_endpoints(
appview_endpoint: impl Into<String>,
cdn_endpoint: impl Into<String>,
) -> Self
pub fn with_endpoints( appview_endpoint: impl Into<String>, cdn_endpoint: impl Into<String>, ) -> Self
Creates a client with custom AppView and CDN endpoints.
Sourcepub fn appview_url(&self) -> &str
pub fn appview_url(&self) -> &str
Returns the configured AppView base URL.
Sourcepub fn http_client(&self) -> &Client
pub fn http_client(&self) -> &Client
Returns a reference to the underlying HTTP client.
Sourcepub async fn get<T: DeserializeOwned>(
&self,
endpoint: &str,
query: &[(&str, String)],
) -> Result<T, SkybaseError>
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.
Sourcepub async fn paginate<T, I, F>(
&self,
endpoint: &str,
base_query: &[(&str, String)],
page_limit: u8,
extract: F,
) -> Vec<I>
pub async fn paginate<T, I, F>( &self, endpoint: &str, base_query: &[(&str, String)], page_limit: u8, extract: F, ) -> Vec<I>
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.
Sourcepub async fn resolve_handle(&self, handle: &str) -> Option<String>
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.
Sourcepub async fn search_actors_typeahead(
&self,
query: &str,
limit: u8,
) -> Vec<ActorSuggestion>
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.
Sourcepub async fn fetch_profile(&self, did: &str) -> Option<ActorProfile>
pub async fn fetch_profile(&self, did: &str) -> Option<ActorProfile>
Fetches an actor profile via app.bsky.actor.getProfile.
Returns None on any failure.
Sourcepub async fn fetch_post(&self, uri: &str) -> Option<PostView>
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.
Sourcepub async fn fetch_follows(&self, actor: &str, limit: u8) -> Vec<String>
pub async fn fetch_follows(&self, actor: &str, limit: u8) -> Vec<String>
Fetches followed DIDs for an actor via app.bsky.graph.getFollows.
Sourcepub async fn fetch_followers(&self, actor: &str, limit: u8) -> Vec<String>
pub async fn fetch_followers(&self, actor: &str, limit: u8) -> Vec<String>
Fetches incoming follower DIDs for an actor via app.bsky.graph.getFollowers.
Sourcepub async fn fetch_follow_records(
&self,
actor: &str,
limit: u8,
) -> Vec<(String, String)>
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.
Sourcepub fn thumbnail_url(&self, author_did: &str, cid: &str) -> String
pub fn thumbnail_url(&self, author_did: &str, cid: &str) -> String
Builds a CDN thumbnail URL for an author DID and image CID.