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::WechatMinapp;
31//! let client = WechatMinapp::new("your_app_id", "your_app_secret");
32//! ```
33//!
34//! ## 自定义 HTTP 客户端和存储方式
35//! ```no_run
36//! use wechat_minapp::client::{MemoryTokenStorage, NormalToken};
37//! use wechat_minapp::client::{ReqwestHttpClient, WechatMinapp};
38//!
39//! let http_client = Arc::new(ReqwestHttpClient::new());
40//! let token_type = Arc::new(Normal::new(
41//! &app_id,
42//! &secret,
43//! http_client.clone(),
44//! ));
45//! let token_storage = Arc::new(MemoryTokenStorage::new(token_type));
46//! let client = WechatMinapp::custom(http_client, token_storage)
47//!
48//! ```
49//!
50//!
51
52mod response;
53mod utils;
54
55pub mod client;
56pub mod constants;
57pub mod error;
58pub mod link;
59pub mod minapp_security;
60pub mod new_type;
61pub mod qr;
62pub mod user;
63pub type Result<T> = std::result::Result<T, error::Error>;