Expand description
HTTP API type definition and handlers.
Ported from Haskell KB/API.hs and KB/API/Handlers.hs.
Uses axum instead of Servant.
§Endpoints
GET /nodes/:id→ 200 NodeView | 404PUT /nodes/:id→ UpdateNodeRequest → 200 NodeView | 404DELETE /nodes/:id→ 204 | 404GET /nodes/:id/neighbors→ 200 NeighborhoodResponsePOST /nodes?id=…→ CreateNodeRequest → 201 NodeView | 409GET /nodes?limit=&offset=→ 200 NodeSummaryGET /search?q=…→ 200 NodeSummaryGET /tags/:tag→ 200 NodeSummaryGET /recent→ 200 NodeSummaryPOST /admin/relink→ 200 RelinkResponse
§Content negotiation
Read/write endpoints honour text/org (with text/plain as a synonym)
on both Content-Type (request) and Accept (response). An org
request body is parsed via crate::parser; an org response renders
the document via crate::generator. An org response carries the
node id and timestamps in a leading :PROPERTIES: drawer (see
crate::org_meta); a matching drawer on an org request body is
stripped before storage. On PUT the drawer’s :ID:, when present,
must equal the path id (a mismatch is 400); on POST it is
discarded — callers wanting to set an id must use ?id=.
Structs§
- AppState
- Shared application state passed to all handlers.
- Create
Node Query POST /nodesquery parameters.- Create
Node Request POST /nodesbody.- List
Nodes Query GET /nodesquery parameters.- Neighbor
Edge - One edge in a node’s link neighborhood.
- Neighborhood
Response - The link neighborhood of a node: outgoing and incoming edges.
- Node
Summary - Compact node listing for search/tags/recent results.
- Node
View - Full node response: identity, derived metadata, the AST, and timestamps.
- Relink
Response - The shape returned by
POST /admin/relink. - Search
Query GET /searchquery parameters.- Update
Node Request PUT /nodes/:idbody.
Constants§
- REQUEST_
BODY_ LIMIT_ BYTES - Maximum request body size for write-path handlers.
Functions§
- build_
router - Build the full axum Router for the KB API.