Skip to main content

Module api

Module api 

Source
Expand description

HTTP client, retry logic, and Context7 API calls.

This module owns the full lifecycle of API interaction: request building, status handling, and key-rotation retry.

Structs§

CodeBlock
A single code block within a documentation snippet.
DocumentationResponse
Top-level response from the documentation endpoint (GET /api/v1/{library_id}).
DocumentationSnippet
Represents a single documentation excerpt returned by the docs endpoint (JSON mode).
LibraryListResponse
Top-level response from the library search endpoint (GET /api/v1/search).
LibrarySearchResult
Represents a single library entry returned by the search endpoint.

Functions§

create_http_client
Creates a reusable HTTP client with rustls-TLS, 30 s timeout, and HTTP/2.
fetch_documentation
Fetches documentation for library_id with an optional query filter (JSON mode).
fetch_documentation_text
Fetches documentation for library_id as raw plain text (markdown).
run_with_retry
Executes an API call with retry and key rotation.
search_library
Searches for libraries matching name with optional relevance context_query.