api_client library

Declarative API client with typed responses, retries, and interceptors.

Classes

ApiClient
Declarative API client with interceptors, middleware, and retry support.
ApiRequest
An HTTP request configuration.
ApiResponse
An HTTP response with typed accessors.
AuthMiddleware
Middleware that adds an Authorization header to every request.
CacheInterceptor
Interceptor that caches GET responses in memory.
HeaderInterceptor
Interceptor that adds headers to every request.
Interceptor
Intercepts requests and responses for cross-cutting concerns.
LoggingMiddleware
Middleware that logs request method/URI and response status/duration.
LogInterceptor
Interceptor that logs requests and responses to a callback.
Middleware
Abstract middleware for composable request/response processing.
MultipartFile
A file to include in a multipart form request.
RetryConfig
Configuration for automatic request retries.

Typedefs

Next = Future<ApiResponse> Function(ApiRequest request)
Function type for the next step in the middleware pipeline.

Exceptions / Errors

ApiError
Base error for API operations.
HttpError
Thrown when the server returns a non-2xx status.
RetryExhaustedError
Thrown when all retry attempts are exhausted.
TimeoutError
Thrown when a request times out.