Expand description
Client for the public sudhanva.me API.
It retrieves published profile and article metadata, performs bounded batch
reads, searches the published site, and creates or polls temporary
profile-insight jobs. It follows the stable /api/v1 contract.
The API is public and requires no credentials. Do not send private data.
§Example
use sudhanva::{Client, PostsOptions};
#[tokio::main]
async fn main() -> Result<(), sudhanva::Error> {
let client = Client::new();
let profile = client.profile().await?;
println!("{}", profile.profile.name);
let posts = client.posts(PostsOptions::new().limit(5).tag("kubernetes")).await?;
for post in &posts.posts {
println!("{} {}", post.slug, post.title);
}
let article = client.post("making-your-site-agent-friendly").await?;
println!("{}", article.post.url);
Ok(())
}§Profile insights
Creating a profile-insight job requires a caller-controlled idempotency key. Replaying the same key with the same request within 24 hours returns the same job.
use sudhanva::{Client, ProfileInsightRequest, WaitOptions};
let client = Client::new();
let request = ProfileInsightRequest::new("hiring-manager").focus(["production-ml", "inference"]);
let job = client.create_profile_insight(&request, "my-workflow-2026-08-23").await?;
let job = client.wait_for_profile_insight(&job.job_id, WaitOptions::new()).await?;
if let Some(result) = job.result {
println!("{}", result.summary);
}§Errors
Every method returns Error. A non-success HTTP response becomes
Error::Api, which carries an ApiError with the status, error code,
message, hint, documentation URL, and the decoded response body. Both the
JSON error envelope and the application/problem+json documents returned by
profile-insight requests are decoded.
let client = sudhanva::Client::new();
match client.post("missing").await {
Ok(post) => println!("{}", post.post.title),
Err(sudhanva::Error::Api(error)) if error.status == 404 => {
println!("{}: {}", error.code, error.message);
}
Err(error) => eprintln!("{error}"),
}§Features
blocking: addsblocking::Client, a synchronous client that runs the async client on its own single-threaded Tokio runtime.
TLS uses rustls, so the crate does not link OpenSSL.
Re-exports§
pub use reqwest;
Modules§
- blocking
blocking - A synchronous client, enabled by the
blockingfeature.
Structs§
- ApiError
- A structured non-success response from the API.
- AskMeta
- NLWeb response metadata.
- AskOptions
- Options for
Client::ask. - AskResponse
- An NLWeb 0.55 conversational-search answer from
POST /ask. - AskResult
- One NLWeb result: a schema.org item such as a
PersonorCreativeWork. - Batch
Operation - One read inside a batch request.
- Batch
Response - The response from
POST /batch. - Batch
Result - The outcome of one batch operation.
- Case
Study - A case study in a profile insight.
- Client
- An async client for every stable public API operation.
- Client
Builder - Configures a
Client. - Error
Detail - An error object inside a batch result or a failed job.
- Grounding
- The source of an NLWeb result.
- Organization
- An organization, such as an employer.
- Post
- Metadata for one published article.
- Post
Response - The response from
GET /posts/{slug}. - Posts
Options - Filters and pagination for
Client::posts. - Posts
Response - One page of results from
GET /posts. - Profile
- Sudhanva Narayana’s published professional profile.
- Profile
Insight Job - A short-lived profile-insight job.
- Profile
Insight Request - The body of
POST /profile-insights. - Profile
Insight Result - Guidance composed from the published profile.
- Profile
Response - The response from
GET /profile. - Suggested
Page - A page suggested by a profile insight.
- Wait
Options - Polling options for
Client::wait_for_profile_insight.
Enums§
Constants§
- DEFAULT_
BASE_ URL - The production API base URL.
- USER_
AGENT - The
User-Agentheader sent with every request. - VERSION
- The version of this SDK, taken from
Cargo.toml.