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