Expand description
weixin-agent — Pure protocol SDK for the Weixin iLink Bot API.
This crate handles HTTP API calls, CDN upload/download, AES encryption, long-poll monitoring, and message parsing. It does not manage state persistence — that is the caller’s responsibility.
§Quick start
use weixin_agent::{WeixinClient, WeixinConfig, MessageHandler, MessageContext, Result};
struct EchoBot;
#[async_trait::async_trait]
impl MessageHandler for EchoBot {
async fn on_message(&self, ctx: &MessageContext) -> Result<()> {
if let Some(text) = &ctx.body {
ctx.reply_text(text).await?;
}
Ok(())
}
}Re-exports§
pub use config::WeixinConfig;pub use config::WeixinConfigBuilder;pub use error::Error;pub use error::Result;pub use messaging::inbound::ContextTokenStore;pub use messaging::inbound::MediaInfo;pub use messaging::inbound::MessageContext;pub use messaging::inbound::RefMessageInfo;pub use messaging::inbound::SendResult;pub use monitor::poll_loop::MessageHandler;pub use qr_login::login::LoginStatus;pub use qr_login::login::QrLoginApi;pub use qr_login::login::QrLoginSession;pub use qr_login::login::StandaloneQrLogin;pub use types::CdnMedia;pub use types::MediaType;pub use types::MessageItemType;pub use types::MessageState;pub use types::MessageType;pub use types::TypingStatus;pub use types::UploadMediaType;
Modules§
- api
- HTTP API client, session guard, and config cache.
- cdn
- CDN upload, download, encryption, and URL construction.
- config
- Protocol-level configuration for the SDK.
- error
- Unified error types for the weixin-agent SDK.
- media
- MIME type detection from file extensions.
- messaging
- Message parsing, construction, and sending.
- monitor
- Long-poll monitor loop.
- qr_
login - QR code login API.
- types
- Protocol types mirroring the Weixin iLink Bot API.
- util
- Utility helpers: log redaction and ID generation.
Structs§
- Weixin
Client - The main SDK client.
- Weixin
Client Builder - Builder for
WeixinClient.