wechat_minapp/client/
mod.rs

1//! 微信小程序服务端接口 Client 模块
2//!
3//! 分为使用普通接口调用凭据和稳定版接口调用凭据
4//!
5//! 普通接口调用凭据
6//!  ```no_run
7//! use wechat_minapp::client::NonStableTokenClient;
8//!
9//! let client = NonStableTokenClient::new("your_appid", "your_app_secret_here");
10//! ```
11//!稳定版接口调用凭据
12//! ```no_run
13//! use wechat_minapp::client::StableTokenClient;
14//!
15//! let client = StableTokenClient::new("your_appid", "your_app_secret_here");
16//! ```
17//!
18mod access_token;
19mod non_stable_token;
20mod stable_token;
21
22pub use access_token::AccessToken;
23pub use non_stable_token::NonStableTokenClient;
24pub use stable_token::StableTokenClient;
25
26use crate::Result;
27use async_trait::async_trait;
28
29#[async_trait]
30pub trait Client: Send + Sync {
31    async fn token(&self) -> Result<String>;
32    fn inner_client(&self) -> &ClientInner;
33}
34
35#[derive(Debug, Clone)]
36pub struct ClientInner {
37    pub app_id: String,
38    pub secret: String,
39    pub client: reqwest::Client,
40}