Expand description
HTTP client for the Wikimedia Enterprise API.
This crate provides a robust, production-ready client for accessing the Wikimedia Enterprise API. It includes automatic authentication management, retry logic with circuit breakers, and support for all API endpoints including metadata, on-demand, snapshots, and realtime streaming.
§Quick Start
use wme_client::WmeClient;
// Create a client with authentication
let client = WmeClient::builder()
.credentials("username", "password")
.build()
.await?;
// List available projects
let projects = client.metadata().list_projects().await?;§Architecture
The client is organized into sub-clients for different API areas:
WmeClient- Main entry point and builderMetadataClient- Discovery endpoints (projects, languages, namespaces)OnDemandClient- Single article lookupsSnapshotClient- Bulk data downloadsRealtimeClient- Streaming and batch endpoints
§Authentication
Authentication is handled automatically via the TokenManager. Tokens are refreshed
automatically before expiration. See the auth module for details.
§Resilience
The client includes several resilience features:
- Retry Logic: Configurable exponential backoff with jitter (
RetryConfig) - Circuit Breaker: Prevents cascading failures (
CircuitState) - Timeout Handling: Configurable request timeouts
§Error Handling
All operations return a Result<T> which uses ClientError for error cases.
The error type includes specific variants for common failure modes like authentication
failures, rate limiting, and not-found errors.
Re-exports§
pub use auth::TokenManager;pub use auth::Tokens;pub use client::ClientConfig;pub use client::WmeClient;pub use client::WmeClientBuilder;pub use error::ClientError;pub use metadata::MetadataClient;pub use ondemand::OnDemandClient;pub use realtime::RealtimeClient;pub use realtime::RealtimeConnectOptions;pub use retry::RetryConfig;pub use retry_transport::CircuitState;pub use retry_transport::RetryTransport;pub use snapshot::SnapshotClient;pub use transport::BoxStream;pub use transport::HttpTransport;pub use transport::ReqwestTransport;
Modules§
Structs§
- Auth
Tokens - Authentication tokens returned from login.
- Base
Urls - Base URL configuration for API endpoints.
- Request
Params - Request parameters for API endpoints that support filtering, field selection, and limits.
Functions§
- parse_
response - Parse JSON response body with debug logging.
Type Aliases§
- Result
- Result type alias for client operations.