This commit is contained in:
2020-01-01 22:28:00 +08:00
parent 0448e22fbc
commit dbbbb66d22
3 changed files with 111 additions and 5 deletions

View File

@@ -25,9 +25,65 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```
Sample, send markdown message:
```rust
dt.send_markdown("markdown title 001", r#"# markdown content 001
* line 0
* line 1
* line 2"#)?;
```
Sample, send link message:
```rust
dt.send_link("link title 001", "link content 001", "https://hatter.ink/favicon.png", "https://hatter.ink/")?;
```
Sample, send feed card message:
```rust
dt.send_message(&DingTalkMessage::new_feed_card()
.add_feed_card_link(DingTalkMessageFeedCardLink{
title: "test feed card title 001".into(),
message_url: "https://hatter.ink/".into(),
pic_url: "https://hatter.ink/favicon.png".into(),
})
.add_feed_card_link(DingTalkMessageFeedCardLink{
title: "test feed card title 002".into(),
message_url: "https://hatter.ink/".into(),
pic_url: "https://hatter.ink/favicon.png".into(),
})
)?;
```
Sample, send action card message(single btn):
```rust
dt.send_message(&DingTalkMessage::new_action_card("action card 001", "action card text 001")
.set_action_card_signle_btn(DingTalkMessageActionCardBtn{
title: "test signle btn title".into(),
action_url: "https://hatter.ink/".into(),
})
)?;
```
Sample, send action card message(multi btns):
```rust
dt.send_message(&DingTalkMessage::new_action_card("action card 002", "action card text 002")
.add_action_card_btn(DingTalkMessageActionCardBtn{
title: "test signle btn title 01".into(),
action_url: "https://hatter.ink/".into(),
})
.add_action_card_btn(DingTalkMessageActionCardBtn{
title: "test signle btn title 02".into(),
action_url: "https://hatter.ink/".into(),
})
)?;
```
#### Changelog
* v1.0.1
* change two fn names
* Add readme sample codes
* v1.0.0
* `TEXT` -> `Text` ..., change enum caps
* Add `ActionCard` message, send action card message type