Skip to main content

Crate api_fetch

Crate api_fetch 

Source
Expand description

§api-fetch

This crate is an alias for better-fetch: same types, same API, alternate name on crates.io.

Modules§

auth
backend
cancel
Request cancellation (CancellationToken) compatible with cooperative async abort.
client
endpoint
error
hooks
Lifecycle hooks for requests and responses.
plugin
Plugin hooks run after URL construction and auth, before request lifecycle hooks.
plugins
request
response
retry

Macros§

endpoint
Helper macro for simple endpoint definitions.

Structs§

CancellationToken
A token which can be used to signal a cancellation request to one or more tasks.
Client
Typed HTTP client built on reqwest.
ClientBuilder
Builder for Client.
ClientConfig
Shared client configuration.
EndpointRequestBuilder
Fluent builder for a typed Endpoint.
ErrorContext
Context when an error occurs.
Hooks
Lifecycle hooks for the HTTP client.
HttpRequest
Prepared HTTP request passed to a backend.
HttpResponse
Raw HTTP response from a backend.
LoggerPlugin
Tracing-based logger plugin (request, response, retry, error).
PluginRegistry
Ordered plugin list.
PreparedRequest
Prepared request state passed to plugin Plugin::init.
RequestBuilder
Fluent builder for a single HTTP request.
RequestContext
Context for an outgoing request.
ReqwestBackend
Reqwest-backed HTTP backend.
Response
HTTP response wrapper.
ResponseContext
Context after a response is received.
SuccessContext
Context after a successful HTTP response (2xx).

Enums§

Auth
Authentication configuration for a client or request.
Error
Error type for better-fetch operations.
HttpBody
Request body encoding for the transport layer.
QueryValue
Query parameter value (scalar or repeated).
RetryPolicy
Retry policy configuration.
TokenSource
Source for credential values (static, sync, or async).

Traits§

AsyncTokenProvider
Async token resolver.
Endpoint
Describes a typed API route.
EndpointParams
Applies path parameters to a RequestBuilder.
EndpointQuery
Applies query parameters to a RequestBuilder.
HttpBackend
Plugin
Plugin extension point for better-fetch.

Functions§

default_should_retry
json_parser
Wraps a custom JSON parse function for use with ClientBuilder::json_parser.
parse_retry_after
Parses Retry-After as a delay in seconds (integer values only).
serde_json_parser
Default parser using serde_json::from_slice (same semantics as the fast path, as a JsonParserFn).

Type Aliases§

JsonParserFn
Parses response bytes into serde_json::Value before deserializing to T.
Result
Result alias using Error.
ShouldRetryFn
Predicate for whether a response should be retried.