Skip to main content

ocpi_kit/transport/
mod.rs

1//! Everything between the JSON and the HTTP: envelope, status codes, headers, credentials
2//! tokens, pagination, routing, endpoint URLs, PATCH and per-peer quirks.
3//!
4//! This layer has no HTTP client and no async runtime. It is the shared vocabulary that
5//! [`client`](crate::client), [`server`](crate::server) and [`hub`](crate::hub) are written in,
6//! and it is deliberately usable on its own by anyone who wants to keep their own HTTP stack.
7//!
8//! # The rules this layer exists to enforce
9//!
10//! * **HTTP status codes are almost never how OCPI reports a problem.** Only five situations get
11//!   an HTTP error; everything else is `200 OK` with a four-digit code in the body. See
12//!   [`OcpiError::http_status`].
13//! * **A hub renews `X-Request-ID` and preserves `X-Correlation-ID`.** [`RequestIds::forwarded`].
14//! * **Routing headers belong on functional modules only.** [`RoutingHeaders::applies_to`].
15//! * **`CREDENTIALS_TOKEN_A` is scoped to `credentials` and `versions`.** [`TokenRole::may_access`].
16//! * **A PATCH must carry `last_updated`.** [`Patch::apply`].
17//!
18//! Spec: 2.3.0 §transport_and_format_transport_and_format, §status_codes_status_codes
19
20pub mod auth;
21pub mod endpoints;
22pub mod envelope;
23pub mod headers;
24pub mod pagination;
25pub mod patch;
26pub mod quirks;
27pub mod routing;
28pub mod status;
29
30pub use auth::{CredentialsToken, InvalidToken, TOKEN_PREFIX, TokenRole};
31pub use endpoints::{ReceiverEndpoint, SenderEndpoint};
32pub use envelope::{OcpiError, OcpiResponse};
33pub use headers::{RequestIds, header_party, header_str, header_u64, link_next, parse_link_next};
34pub use pagination::{CrawlAdjustment, Page, PageMeta, PageQuery, crawl_adjustment};
35pub use patch::{Patch, PatchFallback, merge, patch_fallback};
36pub use quirks::Quirks;
37pub use routing::{RoutingHeaders, RoutingScenario};
38
39#[cfg(feature = "client")]
40pub use crate::client::OcpiRequest;
41pub use status::{StatusClass, StatusCode};