Skip to main content

WxOpenServiceImpl

Struct WxOpenServiceImpl 

Source
pub struct WxOpenServiceImpl { /* private fields */ }
Expand description

开放平台服务实现(reqwest HTTP 后端)。

Implementations§

Source§

impl WxOpenServiceImpl

Source

pub fn new_arc(config: Arc<dyn WxOpenConfigStorage>) -> Arc<Self>

构建服务(组件子服务注入 Weak<dyn WxOpenService> 打破循环引用)。

§参数
  • config:开放平台(第三方平台)配置存储

Trait Implementations§

Source§

impl WxOpenService for WxOpenServiceImpl

Source§

fn upload_minishop_media_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 str, file_path: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<WxMinishopImageUploadResult, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

上传图片到小程序/开放平台素材库(对应 Java uploadMinishopMediaFile(String url, File file))。

Wave 2 实现:经 MinishopUploadRequestExecutor(reqwest multipart, 字段名 media,对应 Java MinishopUploadRequestExecutor); ADAPTED:Java File 入参 → Rust 文件路径字符串。

Source§

fn wx_open_component_service(&self) -> Option<Arc<dyn WxOpenComponentService>>

组件子服务(对应 Java getWxOpenComponentService())。 Read more
Source§

fn wx_open_config_storage(&self) -> Arc<dyn WxOpenConfigStorage>

配置存储(对应 Java getWxOpenConfigStorage())。
Source§

fn set_wx_open_config_storage( &self, wx_open_config_storage: Arc<dyn WxOpenConfigStorage>, )

设置配置存储(对应 Java setWxOpenConfigStorage(WxOpenConfigStorage))。
Source§

fn http_client(&self) -> &Client

HTTP 客户端(对应 Java RequestHttp.getRequestHttpClient())。
Source§

fn get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 str, query_param: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

GET 请求(对应 Java get(String, String))。 Read more
Source§

fn post<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 str, post_data: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

POST 请求(对应 Java post(String, String))。 Read more
Source§

fn get_component_access_token<'life0, 'async_trait>( &'life0 self, force_refresh: bool, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

获取 component_access_token(对应 Java WxOpenComponentService.getComponentAccessToken(boolean), 开放平台接口调用凭据)。
Source§

fn get_pre_auth_code<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

获取预授权码(对应 Java WxOpenComponentServiceImpl.createPreAuthUrl 内部 POST API_CREATE_PREAUTHCODE_URLpre_auth_code 字段)。
Source§

fn get_pre_auth_url<'life0, 'life1, 'async_trait>( &'life0 self, redirect_uri: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

获取网页授权预授权链接(对应 Java WxOpenComponentService.getPreAuthUrl(String))。
Source§

fn get_pre_auth_url_with<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, redirect_uri: &'life1 str, auth_type: Option<&'life2 str>, biz_appid: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

获取网页授权预授权链接(对应 Java WxOpenComponentService.getPreAuthUrl(String, String, String))。
Source§

fn get_mobile_pre_auth_url<'life0, 'life1, 'async_trait>( &'life0 self, redirect_uri: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

获取移动端预授权链接(对应 Java WxOpenComponentService.getMobilePreAuthUrl(String))。
Source§

fn get_mobile_pre_auth_url_with<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, redirect_uri: &'life1 str, auth_type: Option<&'life2 str>, biz_appid: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

获取移动端预授权链接(对应 Java WxOpenComponentService.getMobilePreAuthUrl(String, String, String))。
Source§

fn get_authorizer_access_token<'life0, 'life1, 'async_trait>( &'life0 self, app_id: &'life1 str, force_refresh: bool, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

获取(刷新)授权方 access_token(对应 Java WxOpenComponentService.getAuthorizerAccessToken(String, boolean), 三方 token 刷新:component_access_token + authorizer refresh_token 换新 token)。
Source§

fn route<'life0, 'life1, 'async_trait>( &'life0 self, message: &'life1 WxOpenXmlMessage, ) -> Pin<Box<dyn Future<Output = Result<String, WxErrorException>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

路由第三方平台推送的加密回调消息(对应 Java WxOpenComponentService.route(WxOpenXmlMessage),POST 回调消息 解密 + 分发)。 Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more