1 unstable release
0.1.2 | Nov 5, 2024 |
---|
#810 in Data structures
119 downloads per month
11KB
168 lines
spring-sms
基于spring-rs 0.2.1 版,简单实现了短信发送功能,未来将完善,目前只支持阿里云短信发送。
#[cfg(test)]
mod tests {
use std::collections::HashMap;
use spring_sms::config::AliyunSmsConfig;
#[tokio::test]
async fn test() {
assert_eq!(1, 1);
let config = AliyunSmsConfig {
access_key_id: "xxxxx".to_string(),
access_key_secret: "xxxxxx".to_string(),
sign_name: "短信签名".to_string(),
domain: None,
region_id: None,
version: None,
};
let sms_config = spring_sms::config::SmsConfig {
aliyun: Some(config),
};
let sms_client = spring_sms::client::SmsClient::new(sms_config);
let mut params: HashMap<&str, &str> = HashMap::new();
params.insert("code", "123456");
let res = sms_client.send_sms_by_aliyun("13000000000", "SMS_10000000", Some(params)).await;
println!("{:?}", res)
}
}
Dependencies
~15–29MB
~400K SLoC