Crates.io | wx-work |
lib.rs | wx-work |
version | 0.2.0 |
source | src |
created_at | 2020-10-01 11:00:38.919018 |
updated_at | 2021-05-27 03:43:32.989868 |
description | 企业微信 sdk |
homepage | https://github.com/nooberfsh/wx-work |
repository | https://github.com/nooberfsh/wx-work |
max_upload_size | |
id | 294980 |
size | 96,000 |
# Cargo.toml
[dependencies]
wx-work = "0.2"
use wx_work::client::Client;
use wx_work::media::FileType;
#[tokio::main]
async fn main() {
let corp_id = "";
let secret_id = "";
let cli = Client::new(corp_id, secret_id).unwrap();
cli.upload_file(FileType::Video, "path/to/file")
.await
.unwrap();
}
use async_trait::async_trait;
use wx_work::server::{App, Builder, RecvMessage, RecvMessageType, SendMessage};
struct MyApp;
#[async_trait]
impl App for MyApp {
async fn handle(&self, msg: RecvMessage) -> Option<SendMessage> {
match msg.msg_ty {
RecvMessageType::Text(x) => Some(SendMessage::new_text(x, msg.from_user_name, msg.to_user_name)),
_ => None,
}
}
}
#[tokio::main]
async fn main() {
let token = "";
let aes_key = "";
let server = Builder::new(MyApp, token, aes_key).build().unwrap();
server.run().await.unwrap();
}
MIT