1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
//! # wx-sdk API Documentation //! ## `wx-sdk` is a [WeChat SDK](https://mp.weixin.qq.com/) written in [Rust](https://www.rust-lang.org/). //! ## Features //! Fealtures can be checked at [README page](https://github.com/ilovelll/wx-sdk/blob/main/README.md) //! ## QuickStart //! First, please refer to this [page](https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html) to provide these values: `token`, `EncodingAESKey`,`EncodingMode`. //! ```ignore //! use wx_sdk::wechat::{WxSdk, ServerConfig, EncodingMode}; //! //! let config = ServerConfig::new("token", EncodingMode::Plain); //! let sdk = WxSdk::new_with_default_token_client("app_id", "app_secret", config); //! //! // Then, you can use the sdk functions, like get current menu info: //! let mpsdk = WxSdk::mp(&sdk); //! let menu = mpsdk.menu().get_current_selfmenu_info().await; //! ``` //! ## Contributing //! Issue reports and Pull Requests are always welcome! //! ## License //! wx-sdk is available under the [_MIT License_](https://github.com/ilovelll/wx-sdk/blob/main/LICENSE) pub mod access_token; pub use access_token::AccessToken; pub mod error; pub use error::SdkResult; pub(crate) mod cache; pub mod wechat; pub use access_token::TokenClient; pub use wechat::WxSdk; #[cfg(feature = "mp")] pub mod mp; // #[tokio::test] // async fn test_sdk() -> SdkResult<()> { // use crate::wechat::{WxSdk, ServerConfig, EncodingMode}; // let config = ServerConfig::new("token", EncodingMode::Plain); // let sdk = WxSdk::new_with_default_token_client("app_id", "app_secret", config); // let mpsdk = sdk.mp(); // let menu = mpsdk.menu().get_current_selfmenu_info().await; // Ok(()) // }