| Crates.io | jpush |
| lib.rs | jpush |
| version | 0.3.2 |
| created_at | 2024-11-05 06:22:06.948496+00 |
| updated_at | 2025-07-25 06:50:15.53495+00 |
| description | 集成极光App推送 |
| homepage | |
| repository | https://gitea.1000duo.cn/qianduo/jpush.git |
| max_upload_size | |
| id | 1436073 |
| size | 103,099 |
App Push SDK for Rust
[jpush]
url = "https://api.jpush.cn/v3/push"
app_key = "your app key"
secret = "your secret"
use jpush::JPushClient;
use jpush::config::JPushConfig;
use jpush::msg::{JPushMessage, AndroidNotification, HarmonyOSNotification, IosNotification, Message, Platform, PlatformType};
async fn push() {
let config = JPushConfig {
url: "https://api.jpush.cn/v3/push".to_string(),
app_key: "your app key".to_string(),
secret: "your secret".to_string(),
};
let client = JPushClient::new(config);
let mut msg = JPushMessage::simple_normal_message("TS订单通知","TS 订单通知内容,请前往App查看!", "WORK");
msg.add_alias(vec!["1355".to_string(), "1356".to_string()]);
println!("{:?}", message);
let res = client.send(message).await;
match res {
Ok(res) => {
println!("{:?}", res)
}
Err(e) => {
println!("{}", e)
}
}
}
[dependencies]
jpush = { version = "0.3", features = ["spring-rs"] }
use jpush::JPushPlugin;
use jpush::client::JPushClient;
use jpush::msg::{JPushMessage, AndroidNotification, HarmonyOSNotification, IosNotification, Message, Platform, PlatformType};
use spring::App;
#[tokio::main]
async fn main() {
App::new()
.use_config_file("./config/job.toml")
.add_plugin(JPushPlugin)
.run()
.await;
}
async fn push(Component(client): Component<JPushClient>) -> Result<(), Box<dyn std::error::Error>> {
let mut msg = JPushMessage::simple_normal_message("TS订单通知", "TS 订单通知内容,请前往App查看!", "WORK");
msg.add_alias(vec!["1355".to_string(), "1356".to_string()]);
println!("{:?}", message);
let res = client.send(message).await;
match res {
Ok(res) => {
println!("{:?}", res)
}
Err(e) => {
println!("{}", e)
}
}
}