pub struct WechatIlinkClient { /* private fields */ }Expand description
WechatIlinkClient is the main entry point for the WeChat iLink protocol.
Implementations§
Source§impl WechatIlinkClient
impl WechatIlinkClient
Sourcepub fn builder() -> WechatIlinkClientBuilder
pub fn builder() -> WechatIlinkClientBuilder
Create a client builder.
Sourcepub async fn set_credentials(&self, creds: Credentials)
pub async fn set_credentials(&self, creds: Credentials)
Install externally loaded credentials into this client.
Sourcepub async fn credentials(&self) -> Option<Credentials>
pub async fn credentials(&self) -> Option<Credentials>
Return the currently installed credentials, if any.
Sourcepub fn login_qr(&self) -> LoginQrStream<'_>
pub fn login_qr(&self) -> LoginQrStream<'_>
Start QR login and return a stream of login events.
Applications display LoginQrEvent::QrCode, optionally answer
LoginQrEvent::NeedVerifyCode, and persist credentials from
LoginQrEvent::Confirmed.
Sourcepub fn events_from_cursor(
self: Arc<Self>,
cursor: Option<String>,
) -> WechatEventStream<'static>
pub fn events_from_cursor( self: Arc<Self>, cursor: Option<String>, ) -> WechatEventStream<'static>
Start polling from an externally persisted cursor and stream resulting events.
Sourcepub async fn reply(
&self,
msg: &IncomingMessage,
text: &str,
) -> Result<SendReceipt>
pub async fn reply( &self, msg: &IncomingMessage, text: &str, ) -> Result<SendReceipt>
Reply to an incoming message using its observed context.
Returns an error if the incoming message has no context (e.g. the context_token was empty in the wire message).
Sourcepub async fn send_text_with_context(
&self,
context: &WechatContext,
text: &str,
) -> Result<SendReceipt>
pub async fn send_text_with_context( &self, context: &WechatContext, text: &str, ) -> Result<SendReceipt>
Send text using an explicit WechatContext.
The caller is responsible for supplying a valid context. This is the
preferred way to send a reply when you already hold the context from an
IncomingMessage.
Sourcepub async fn send_media_with_context(
&self,
context: &WechatContext,
content: SendContent,
) -> Result<SendReceipt>
pub async fn send_media_with_context( &self, context: &WechatContext, content: SendContent, ) -> Result<SendReceipt>
Send media content using an explicit WechatContext.
The caller is responsible for supplying a valid context.
Sourcepub async fn send_typing_with_context(
&self,
context: &WechatContext,
) -> Result<()>
pub async fn send_typing_with_context( &self, context: &WechatContext, ) -> Result<()>
Show “typing…” indicator using an explicit WechatContext.
The caller is responsible for supplying a valid context.
Sourcepub async fn reply_media(
&self,
msg: &IncomingMessage,
content: SendContent,
) -> Result<SendReceipt>
pub async fn reply_media( &self, msg: &IncomingMessage, content: SendContent, ) -> Result<SendReceipt>
Reply with media content using the incoming message’s observed context.
Returns an error if the incoming message has no context.
Sourcepub async fn download(
&self,
msg: &IncomingMessage,
) -> Result<Option<DownloadedMedia>>
pub async fn download( &self, msg: &IncomingMessage, ) -> Result<Option<DownloadedMedia>>
Download media from an incoming message. Returns None if the message has no media. Priority: image > file > video > voice.
Sourcepub async fn download_raw(
&self,
media: &CDNMedia,
aeskey_override: Option<&str>,
) -> Result<Vec<u8>>
pub async fn download_raw( &self, media: &CDNMedia, aeskey_override: Option<&str>, ) -> Result<Vec<u8>>
Download and decrypt a raw CDN media reference.