Skip to main content

Crate sudhanva

Crate sudhanva 

Source
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: adds blocking::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§

blockingblocking
A synchronous client, enabled by the blocking feature.

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 Person or CreativeWork.
BatchOperation
One read inside a batch request.
BatchResponse
The response from POST /batch.
BatchResult
The outcome of one batch operation.
CaseStudy
A case study in a profile insight.
Client
An async client for every stable public API operation.
ClientBuilder
Configures a Client.
ErrorDetail
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.
PostResponse
The response from GET /posts/{slug}.
PostsOptions
Filters and pagination for Client::posts.
PostsResponse
One page of results from GET /posts.
Profile
Sudhanva Narayana’s published professional profile.
ProfileInsightJob
A short-lived profile-insight job.
ProfileInsightRequest
The body of POST /profile-insights.
ProfileInsightResult
Guidance composed from the published profile.
ProfileResponse
The response from GET /profile.
SuggestedPage
A page suggested by a profile insight.
WaitOptions
Polling options for Client::wait_for_profile_insight.

Enums§

Error
Every failure this crate can return.
JobStatus
The lifecycle state of a profile-insight job.

Constants§

DEFAULT_BASE_URL
The production API base URL.
USER_AGENT
The User-Agent header sent with every request.
VERSION
The version of this SDK, taken from Cargo.toml.

Type Aliases§

Result
A Result whose error type is Error.