pub struct WechatMinappSDK {
pub client: Arc<dyn HttpClient>,
pub token_storage: Arc<dyn TokenStorage>,
}Expand description
微信小程序 SDK 主客户端结构。
封装了 HttpClient 和 TokenStorage,提供发送请求和获取 Access Token 的方法。
Fields§
§client: Arc<dyn HttpClient>§token_storage: Arc<dyn TokenStorage>Implementations§
Source§impl WechatMinappSDK
impl WechatMinappSDK
Sourcepub fn new(app_id: &str, secret: &str) -> Self
pub fn new(app_id: &str, secret: &str) -> Self
使用默认配置(ReqwestHttpClient 和 MemoryTokenStorage 与 StableToken)创建客户端。
§参数
app_id: 小程序 App ID。secret: 小程序 App Secret。
Sourcepub fn custom(
http_client: Arc<dyn HttpClient>,
token_storage: Arc<dyn TokenStorage>,
) -> Self
pub fn custom( http_client: Arc<dyn HttpClient>, token_storage: Arc<dyn TokenStorage>, ) -> Self
使用自定义的 HttpClient 和 TokenStorage 创建客户端。
§参数
http_client: 实现HttpClientTrait 的实例。token_storage: 实现TokenStorageTrait 的实例。
Sourcepub fn app_config(&self) -> AppConfig
pub fn app_config(&self) -> AppConfig
获取当前客户端的 App ID 和 Secret 配置。
Trait Implementations§
Source§impl Clone for WechatMinappSDK
impl Clone for WechatMinappSDK
Auto Trait Implementations§
impl Freeze for WechatMinappSDK
impl !RefUnwindSafe for WechatMinappSDK
impl Send for WechatMinappSDK
impl Sync for WechatMinappSDK
impl Unpin for WechatMinappSDK
impl UnsafeUnpin for WechatMinappSDK
impl !UnwindSafe for WechatMinappSDK
Blanket Implementations§
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