Module graph_indexed

Source
Expand description

An HTTP typed header for the graph-indexed header.

The graph-indexed header contains a JSON-encoded BlockInfo struct indicating the latest indexed block information.

§Using the headers::HeaderMapExt extension trait

use headers::HeaderMapExt as _;
use thegraph_headers::graph_indexed::{GraphIndexed, HEADER_NAME};

let mut header_map = http::HeaderMap::new();

// Insert a `graph-indexed` HTTP header
header_map.typed_insert(GraphIndexed(value));

// Get the `graph-indexed` HTTP header by name
let header_by_name = header_map.get(HEADER_NAME);
assert!(header_by_name.is_some());

// Get the `graph-indexed` HTTP header by type
let header_typed = header_map.typed_get::<GraphIndexed>();
assert!(matches!(header_typed, Some(GraphIndexed(..))));

Structs§

BlockInfo
A struct containing information about the latest block.
GraphIndexed
An HTTP typed header for the graph-indexed header.

Constants§

HEADER_NAME
The HTTP header name for the graph-indexed header.