Skip to main content

Module endpoint

Module endpoint 

Source
Expand description

Typed API routes via the Endpoint trait.

Define routes as types, then use Client::call for a typed EndpointRequestBuilder. Path params use .params() with type-state (NeedsParams); query uses .query() with structs when you want a query string — not enforced by type-state (see EndpointQuery).

For ad-hoc string paths, use Client::get instead (see RequestBuilder).

Helpers: [endpoint!], [define_params!], and (feature macros) EndpointParamsDerive / EndpointQueryDerive.

Structs§

EndpointRequestBuilder
Fluent builder for a typed Endpoint.
NeedsBody
Type-state: request body required before send (POST with typed body via #[derive(Endpoint)]).
NeedsParams
Type-state: path parameters still required before send.
Ready
Type-state: ready to configure query/headers and send.

Traits§

DefaultParamsInitial
Default () params initial state when E::Params is [()].
Endpoint
Describes a typed API route.
EndpointBody
Applies a typed request body before send.
EndpointHeaders
Applies typed default headers before send.
EndpointParams
Applies path parameters to a RequestBuilder.
EndpointParamsInitial
Creates the initial EndpointRequestBuilder for client.call::<E>().
EndpointQuery
Applies query parameters to a RequestBuilder.

Functions§

apply_serialized_query
Applies a serde-serializable query struct to a request builder (feature json).

Type Aliases§

ParamsBuilderState
Initial builder state for an endpoint’s path parameters.
ParamsBuilderStateAfter
Builder state after path params when E::Body may require a body.