wechat_minapp/
lib.rs

1//! 微信小程序服务端常用接口的 RUST SDK
2
3//! # 功能
4//!
5//! - 获取访问令牌
6//! - 用户登录凭证校验
7//! - 解析用户信息
8//! - 获取用户手机号
9//! - 生成小程序码
10//! - 内容安全检测  
11//! - 生成小程序链接
12//!
13//! # 特性
14//! - 异步支持
15//! - 丰富的接口支持
16//! - HTTP 客户端和接口调用凭据存储读取方式分离,可以按自己的需求实现不同的 HTTP 客户端和接口调用凭据存储读取方式。
17//! - 支持稳定版和普通版访问令牌
18//! - 良好的错误处理
19//! - 简单易用的 API
20//! - 详细的文档
21//! - 单元测试覆盖
22//!
23//!
24//! # 快速开始
25//!
26//! ## 默认客户端和存储方式
27//! ```no_run
28//! use wechat_minapp::client::WechatMinappSDK;
29//! let client = WechatMinappSDK::new("your_app_id", "your_app_secret");
30//! ```   
31//!
32//! ## 自定义 HTTP 客户端和存储方式
33//! ```no_run
34//! use wechat_minapp::client::{MemoryTokenStorage, StableToken};
35//! use wechat_minapp::client::{ReqwestHttpClient, WechatMinappSDK};
36//!
37//! let http_client = Arc::new(ReqwestHttpClient::new());
38//! let token_type = Arc::new(StableToken::new(
39//!        &app_id,
40//!        &secret,
41//!        false,
42//!        http_client.clone(),
43//!    ));
44//! let token_storage = Arc::new(MemoryTokenStorage::new(token_type));
45//! let client = WechatMinappSDK::custom(http_client, token_storage)
46//!
47//! ```
48//! [`actix web + 小程序端 完整示例`](https://github.com/ikeeplearn/wechat-minapp/tree/master/examples)
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>;