wechat_minapp/
lib.rs

1//! 微信小程序服务端常用接口的 RUST SDK
2//!
3//! # 特性
4//! - 异步支持
5//! - 丰富的接口支持
6//! - HTTP 客户端和接口调用凭据存储读取方式分离,可以按自己的需求实现不同的 HTTP 客户端和接口调用凭据存储读取方式。
7//! - 支持稳定版和普通版访问令牌
8//! - 良好的错误处理
9//! - 简单易用的 API
10//! - 详细的文档
11//! - 单元测试覆盖
12//!
13//!
14//! # 快速开始
15//!
16//! ## 默认客户端和存储方式
17//! ```no_run
18//! use wechat_minapp::client::WechatMinappSDK;
19//! let client = WechatMinappSDK::new("your_app_id", "your_app_secret");
20//! ```   
21//!
22//! ## 自定义 HTTP 客户端和存储方式
23//! ```no_run
24//! use wechat_minapp::client::{MemoryTokenStorage, StableToken};
25//! use wechat_minapp::client::{ReqwestHttpClient, WechatMinappSDK};
26//!
27//! let http_client = Arc::new(ReqwestHttpClient::new());
28//! let token_type = Arc::new(StableToken::new(
29//!        &app_id,
30//!        &secret,
31//!        false,
32//!        http_client.clone(),
33//!    ));
34//! let token_storage = Arc::new(MemoryTokenStorage::new(token_type));
35//! let client = WechatMinappSDK::custom(http_client, token_storage)
36//!
37//! ```
38//!
39//! # 功能
40//!
41//! - 获取访问令牌
42//! - 用户登录凭证校验
43//! - 解析用户信息
44//! - 获取用户手机号
45//! - 生成小程序码
46//! - 内容安全检测  
47//! - 生成小程序链接
48//!         
49//!     
50
51mod response;
52
53pub mod client;
54pub mod constants;
55pub mod error;
56pub mod minapp_security;
57pub mod qr;
58pub mod user;
59pub mod link;
60pub type Result<T> = std::result::Result<T, error::Error>;