企业微信 sdk

使用

```toml

Cargo.toml

[dependencies] wx-work = "0.2" ```

Example: 上传文件

```rust use wxwork::client::Client; use wxwork::media::FileType;

[tokio::main]

async fn main() { let corpid = ""; let secretid = "";

let cli = Client::new(corp_id, secret_id).unwrap();
cli.upload_file(FileType::Video, "path/to/file")
    .await
    .unwrap();

} ```

Example: echo 服务器

```rust use asynctrait::asynctrait; use wx_work::server::{App, Builder, RecvMessage, RecvMessageType, SendMessage};

struct MyApp;

[async_trait]

impl App for MyApp { async fn handle(&self, msg: RecvMessage) -> Option { match msg.msgty { RecvMessageType::Text(x) => Some(SendMessage::newtext(x, msg.fromusername, msg.tousername)), _ => None, } } }

[tokio::main]

async fn main() { let token = ""; let aeskey = ""; let server = Builder::new(MyApp, token, aeskey).build().unwrap(); server.run().await.unwrap(); } ```

License

MIT