Expand description
crates.io search-crates operation.
Split by responsibility:
types— agent-facing wire payloads and request echourls— URL builders and pagination boundsparse— JSON body parsing and hostile-field cappingfetch— HTTP execution against an allowlisted origin
Structs§
- Crate
Search Hit - One hit from crates.io search.
- Search
Crates Data - Full search-crates data payload.
- Search
Echo - Echo fields for
search-cratestaken from the effective request URL (single source of truth after URL planning, including--page-token). - Search
Meta - Pagination meta from crates.io (may contain
page=orseek=tokens).
Functions§
- clamp_
search_ pagination - Clamp crates.io pagination to product bounds (
per_page1..=100,page>= 1). - echo_
params_ from_ url - Derive echo params from the planned URL query string.
- parse_
search_ body - Parse crates.io JSON body into product types (offline-testable).
- planned_
url - Build the planned crates.io search URL (production origin).
- planned_
url_ on_ host - Build the crates.io search URL for an allowlisted origin (
pagepagination). - planned_
url_ with_ page_ token - Build search URL using an opaque
next_page/prev_pagetoken from crates.io meta. - search_
crates - Execute search-crates against crates.io (production origin).
- search_
crates_ at - Execute search against a pre-built URL (mock hosts in tests).
- search_
crates_ on_ origin - Execute search-crates against an allowlisted origin (offline mocks).
- validate_
search_ pagination - Validate explicit CLI pagination flags (fail-closed).