Skip to main content

Crate wechat_ilink

Crate wechat_ilink 

Source
Expand description

WeChat iLink protocol client for Rust.

§Quick Start

use std::sync::Arc;

use wechat_ilink::{LoginQrEvent, WechatIlinkClient};

#[tokio::main]
async fn main() -> wechat_ilink::Result<()> {
    let client = Arc::new(WechatIlinkClient::builder().build());

    let mut login = client.login_qr();
    while let Some(event) = login.next().await {
        match event? {
            LoginQrEvent::QrCode { content } => eprintln!("scan QR: {content}"),
            LoginQrEvent::Confirmed { credentials } => {
                // Persist credentials in your application store.
                let _ = credentials;
                break;
            }
            LoginQrEvent::NeedVerifyCode { responder, .. } => {
                let _ = responder.cancel();
            }
            LoginQrEvent::StatusChanged { .. } => {}
        }
    }

    drop(login);

    let mut events = client.events_from_cursor(None);
    while let Some(event) = events.next().await {
        println!("{:?}", event?);
    }
    Ok(())
}

Re-exports§

pub use bot::LoginQrEvent;
pub use bot::LoginQrStream;
pub use bot::SendContent;
pub use bot::SendReceipt;
pub use bot::UserInteractionReason;
pub use bot::VerifyCodeResponder;
pub use bot::WechatEvent;
pub use bot::WechatEventStream;
pub use bot::WechatIlinkClient;
pub use bot::WechatIlinkClientBuilder;
pub use bot::WechatRateLimitOptions;
pub use cdn::CdnClient;
pub use crypto::decode_aes_key;
pub use crypto::decrypt_aes_ecb;
pub use crypto::decrypt_aes_ecb as download_decrypt;
pub use crypto::encode_aes_key_base64;
pub use crypto::encode_aes_key_hex;
pub use crypto::encrypt_aes_ecb;
pub use crypto::generate_aes_key;
pub use error::Result;
pub use error::WechatIlinkError;
pub use protocol::build_cdn_upload_url;
pub use protocol::BaseInfo;
pub use protocol::GetConfigResponse;
pub use protocol::GetUpdatesResponse;
pub use protocol::GetUploadUrlParams;
pub use protocol::GetUploadUrlResponse;
pub use protocol::ILinkClientOptions;
pub use protocol::NotifyStartResponse;
pub use protocol::NotifyStopResponse;
pub use types::*;

Modules§

bot
Main WechatIlinkClient.
cdn
Low-level CDN client for direct media download.
crypto
AES-128-ECB encryption for WeChat CDN media files.
error
protocol
Raw iLink Bot API HTTP calls.
types

Functions§

filter_markdown