Available on crate feature
transport only.Expand description
Everything between the JSON and the HTTP: envelope, status codes, headers, credentials tokens, pagination, routing, endpoint URLs, PATCH and per-peer quirks.
This layer has no HTTP client and no async runtime. It is the shared vocabulary that
client, server and hub are written in,
and it is deliberately usable on its own by anyone who wants to keep their own HTTP stack.
§The rules this layer exists to enforce
- HTTP status codes are almost never how OCPI reports a problem. Only five situations get
an HTTP error; everything else is
200 OKwith a four-digit code in the body. SeeOcpiError::http_status. - A hub renews
X-Request-IDand preservesX-Correlation-ID.RequestIds::forwarded. - Routing headers belong on functional modules only.
RoutingHeaders::applies_to. CREDENTIALS_TOKEN_Ais scoped tocredentialsandversions.TokenRole::may_access.- A PATCH must carry
last_updated.Patch::apply.
Spec: 2.3.0 §transport_and_format_transport_and_format, §status_codes_status_codes
Re-exports§
pub use auth::CredentialsToken;pub use auth::InvalidToken;pub use auth::TOKEN_PREFIX;pub use auth::TokenRole;pub use endpoints::ReceiverEndpoint;pub use endpoints::SenderEndpoint;pub use envelope::OcpiError;pub use envelope::OcpiResponse;pub use headers::RequestIds;pub use headers::header_party;pub use headers::header_str;pub use headers::header_u64;pub use headers::link_next;pub use headers::parse_link_next;pub use pagination::CrawlAdjustment;pub use pagination::Page;pub use pagination::PageMeta;pub use pagination::PageQuery;pub use pagination::crawl_adjustment;pub use patch::Patch;pub use patch::PatchFallback;pub use patch::merge;pub use patch::patch_fallback;pub use quirks::Quirks;pub use routing::RoutingHeaders;pub use routing::RoutingScenario;pub use crate::client::OcpiRequest;clientpub use status::StatusClass;pub use status::StatusCode;
Modules§
- auth
- Credentials tokens: the
Authorization: Token <base64>header, done carefully. - endpoints
- Endpoint URL builders, one per documented URL shape.
- envelope
- The OCPI response envelope, and the error type that maps onto it.
- headers
- The HTTP headers OCPI defines, as typed values.
- pagination
- Pagination: the query parameters, the three response headers, and the crawl.
- patch
- PATCH: JSON Merge Patch with the two rules OCPI adds on top.
- quirks
Quirks— per-peer interoperability flags, each with the sentence that makes it necessary.- routing
- Message routing: the four
OCPI-*headers and the scenarios that decide what goes in them. - status
- OCPI status codes: the four-digit codes that live inside a 200 OK.