pub struct Client { /* private fields */ }Expand description
Asynchronous client for the Anakin web-scraping API.
use anakin::Client;
let client = Client::builder().api_key("ak-...").build()?;
let doc = client.scrape("https://example.com").await?;
println!("{}", doc.markdown.unwrap_or_default());The client is Clone and Send + Sync — share a single instance across
tasks rather than building a new one per request.
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Start building a client. See ClientBuilder.
Sourcepub async fn scrape(&self, url: &str) -> Result<Document>
pub async fn scrape(&self, url: &str) -> Result<Document>
Scrape a single URL. Polls internally until the job reaches a terminal status.
Sourcepub async fn scrape_with(
&self,
url: &str,
opts: Option<Value>,
) -> Result<Document>
pub async fn scrape_with( &self, url: &str, opts: Option<Value>, ) -> Result<Document>
Scrape with extra options (passed as a JSON object).
Sourcepub async fn map(&self, url: &str) -> Result<MapResult>
pub async fn map(&self, url: &str) -> Result<MapResult>
Discover links for a domain. Polls until the job completes.
pub async fn map_with( &self, url: &str, opts: Option<Value>, ) -> Result<MapResult>
Sourcepub async fn crawl(&self, url: &str) -> Result<CrawlResult>
pub async fn crawl(&self, url: &str) -> Result<CrawlResult>
Crawl a site starting from a URL. Polls until the job completes.
pub async fn crawl_with( &self, url: &str, opts: Option<Value>, ) -> Result<CrawlResult>
Sourcepub async fn search(&self, query: &str) -> Result<SearchResult>
pub async fn search(&self, query: &str) -> Result<SearchResult>
Synchronous web search.
pub async fn search_with( &self, query: &str, opts: Option<Value>, ) -> Result<SearchResult>
Sourcepub async fn agentic_search(&self, prompt: &str) -> Result<AgenticSearchResult>
pub async fn agentic_search(&self, prompt: &str) -> Result<AgenticSearchResult>
AI-synthesised agentic search. Polls until the job completes.
pub async fn agentic_search_with( &self, prompt: &str, opts: Option<Value>, ) -> Result<AgenticSearchResult>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
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