pub struct WechatMpClient<T: SessionStore> { /* private fields */ }Implementations§
Source§impl<T: SessionStore> WechatMpClient<T>
impl<T: SessionStore> WechatMpClient<T>
Sourcepub fn new<S: Into<String>>(
appid: S,
secret: S,
) -> WechatMpClient<SimpleStorage>
pub fn new<S: Into<String>>( appid: S, secret: S, ) -> WechatMpClient<SimpleStorage>
get the wechat client
Sourcepub fn from_session<S: Into<String>>(
appid: S,
secret: S,
session: T,
) -> WechatMpClient<T>
pub fn from_session<S: Into<String>>( appid: S, secret: S, session: T, ) -> WechatMpClient<T>
get the wechat client
pub fn aes_key(self, aes_key: &str) -> Self
pub fn token(self, token: &str) -> Self
pub fn template_id(self, template_id: &str) -> Self
pub async fn access_token(&self, force_refresh: bool) -> LabradorResult<String>
Sourcepub async fn gen_shorten(
&self,
long_data: &str,
expire_seconds: u64,
) -> LabradorResult<String>
pub async fn gen_shorten( &self, long_data: &str, expire_seconds: u64, ) -> LabradorResult<String>
短key托管 类似于短链API. 详情请见: https://developers.weixin.qq.com/doc/offiaccount/Account_Management/KEY_Shortener.html
Sourcepub async fn fetch_shorten(
&self,
short_key: &str,
) -> LabradorResult<WechatMpShortKeyResponse>
pub async fn fetch_shorten( &self, short_key: &str, ) -> LabradorResult<WechatMpShortKeyResponse>
短key解析 将短key还原为长信息。 详情请见: https://developers.weixin.qq.com/doc/offiaccount/Account_Management/KEY_Shortener.html
Sourcepub async fn get_ticket(
&self,
ticket_type: TicketType,
) -> LabradorResult<String>
pub async fn get_ticket( &self, ticket_type: TicketType, ) -> LabradorResult<String>
获得ticket,不强制刷新ticket. 链接
Sourcepub async fn get_ticket_force(
&self,
ticket_type: TicketType,
force_refresh: bool,
) -> LabradorResult<String>
pub async fn get_ticket_force( &self, ticket_type: TicketType, force_refresh: bool, ) -> LabradorResult<String>
获得ticket. 获得时会检查 Token是否过期,如果过期了,那么就刷新一下,否则就什么都不干 链接
Sourcepub async fn create_jsapi_signature(
&self,
url: &str,
) -> LabradorResult<JsapiSignature>
pub async fn create_jsapi_signature( &self, url: &str, ) -> LabradorResult<JsapiSignature>
创建调用jsapi时所需要的签名. 详情请见:链接
Sourcepub async fn build_qr_connect_url(
&self,
redirect_url: &str,
scope: &str,
state: &str,
) -> LabradorResult<String>
pub async fn build_qr_connect_url( &self, redirect_url: &str, scope: &str, state: &str, ) -> LabradorResult<String>
构造第三方使用网站应用授权登录的url. 详情请见: 网站应用微信登录开发指南 URL格式为https://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
Sourcepub async fn get_callback_ip(
&self,
force_refresh: bool,
) -> LabradorResult<Vec<String>>
pub async fn get_callback_ip( &self, force_refresh: bool, ) -> LabradorResult<Vec<String>>
获取微信服务器的ip段 [文档](http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html)
Sourcepub async fn get_jsapi_ticket(
&self,
force_refresh: bool,
) -> LabradorResult<String>
pub async fn get_jsapi_ticket( &self, force_refresh: bool, ) -> LabradorResult<String>
获得jsapi_ticket. 获得时会检查jsapiToken是否过期,如果过期了,那么就刷新一下,否则就什么都不干 详情请见:链接
Sourcepub fn check_signature(
&self,
signature: &str,
timestamp: i64,
nonce: &str,
) -> LabradorResult<bool>
pub fn check_signature( &self, signature: &str, timestamp: i64, nonce: &str, ) -> LabradorResult<bool>
验证消息的确来自微信服务器. 详情(http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN)
Sourcepub fn user(&self) -> WechatMpUser<'_, T>
pub fn user(&self) -> WechatMpUser<'_, T>
用户相关服务
Sourcepub fn oauth2(&self) -> WechatMpOauth2<'_, T>
pub fn oauth2(&self) -> WechatMpOauth2<'_, T>
Oauth2授权相关服务
Sourcepub fn qrcode(&self) -> WechatMpQRCode<'_, T>
pub fn qrcode(&self) -> WechatMpQRCode<'_, T>
qrcode相关服务
Sourcepub fn custom_service(&self) -> WechatMpCustomService<'_, T>
pub fn custom_service(&self) -> WechatMpCustomService<'_, T>
客服相关服务
菜单相关服务
Sourcepub fn media(&self) -> WechatMpMedia<'_, T>
pub fn media(&self) -> WechatMpMedia<'_, T>
多媒体服务
Sourcepub fn template_msg(&self) -> WechatMpTemplateMessage<'_, T>
pub fn template_msg(&self) -> WechatMpTemplateMessage<'_, T>
模板消息服务
Sourcepub fn subscribe_msg(&self) -> WechatMpSubscribeMessage<'_, T>
pub fn subscribe_msg(&self) -> WechatMpSubscribeMessage<'_, T>
订阅消息服务
Sourcepub fn wifi(&self) -> WechatMpWifi<'_, T>
pub fn wifi(&self) -> WechatMpWifi<'_, T>
Wifi服务
Sourcepub fn ocr(&self) -> WechatMpOcr<'_, T>
pub fn ocr(&self) -> WechatMpOcr<'_, T>
OCR服务
Trait Implementations§
Source§impl<T: Clone + SessionStore> Clone for WechatMpClient<T>
impl<T: Clone + SessionStore> Clone for WechatMpClient<T>
Source§fn clone(&self) -> WechatMpClient<T>
fn clone(&self) -> WechatMpClient<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for WechatMpClient<T>where
T: Freeze,
impl<T> RefUnwindSafe for WechatMpClient<T>where
T: RefUnwindSafe,
impl<T> Send for WechatMpClient<T>where
T: Send,
impl<T> Sync for WechatMpClient<T>where
T: Sync,
impl<T> Unpin for WechatMpClient<T>where
T: Unpin,
impl<T> UnwindSafe for WechatMpClient<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more