Skip to content

Commit 7bc49b6

Browse files
authored
Merge pull request #7 from kaicoh/release/v0.3.0
v0.3.0
2 parents 5f75a14 + 0b52276 commit 7bc49b6

File tree

140 files changed

+20402
-11279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+20402
-11279
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [0.3.0][] - 2024-04-09
4+
5+
- https://github.com/kaicoh/slack-messaging/pull/8 Builder pattern.
6+
- https://github.com/kaicoh/slack-messaging/pull/8 Remove `Attachment` (since it's a deprecated legacy feature).
7+
- https://github.com/kaicoh/slack-messaging/pull/8 Support `Rich text` block.
8+
39
## [0.2.2][] - 2023-03-02
410

511
- https://github.com/kaicoh/slack-messaging/pull/6 Add `mrkdwn` and `plain_text` macros.
@@ -16,6 +22,7 @@
1622

1723
- pre-release
1824

25+
[0.3.0]: https://github.com/kaicoh/slack-messaging/releases/v0.3.0
1926
[0.2.2]: https://github.com/kaicoh/slack-messaging/releases/v0.2.2
2027
[0.2.1]: https://github.com/kaicoh/slack-messaging/releases/v0.2.1
2128
[0.2.0]: https://github.com/kaicoh/slack-messaging/releases/v0.2.0

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "slack-messaging"
3-
version = "0.2.2"
3+
version = "0.3.0"
44
authors = ["kaicoh <[email protected]>"]
55
edition = "2021"
66
keywords = ["slack", "messaging", "webhook"]
@@ -17,10 +17,10 @@ all-features = true
1717
chrono = { version = "0.4", optional = true }
1818
regex = { version = "1.7", optional = true }
1919
serde = { version = "1.0", features = ["derive"] }
20+
serde_json = "1.0"
2021

2122
[dev-dependencies]
2223
reqwest = { version = "0.11", features = ["json"] }
23-
serde_json = "1.0"
2424
tokio = { version = "1", features = ["full"] }
2525

2626
[features]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Kanji Tanaka
3+
Copyright (c) 2024 Kanji Tanaka
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,42 @@ This is a library for [Rust](https://www.rust-lang.org/) to support building mes
88
Using this, you can build any messages in type-safe way like following.
99

1010
```rust
11-
use slack_messaging::Message;
11+
use slack_messaging::{mrkdwn, Message};
1212
use slack_messaging::blocks::{elements::Button, Actions, Section};
1313

1414
#[tokio::main]
1515
async fn main() {
16-
let message = Message::new()
17-
.push_block(
18-
Section::new()
19-
.set_text_mrkdwn("You have a new request:\n*<fakeLink.toEmployeeProfile.com|Fred Enriquez - New device request>*")
16+
let message = Message::builder()
17+
.block(
18+
Section::builder()
19+
.text(mrkdwn!("You have a new request:\n*<fakeLink.toEmployeeProfile.com|Fred Enriquez - New device request>*"))
20+
.build()
2021
)
21-
.push_block(
22-
Section::new()
23-
.push_field_mrkdwn("*Type:*\nComputer (laptop)")
24-
.push_field_mrkdwn("*When:*\nSubmitted Aut 10")
22+
.block(
23+
Section::builder()
24+
.field(mrkdwn!("*Type:*\nComputer (laptop)"))
25+
.field(mrkdwn!("*When:*\nSubmitted Aug 10"))
26+
.build()
2527
)
26-
.push_block(
27-
Actions::new()
28-
.push_element(
29-
Button::new()
28+
.block(
29+
Actions::builder()
30+
.element(
31+
Button::builder()
3032
.text("Approve")
31-
.set_value("approve")
32-
.set_primary()
33+
.value("approve")
34+
.primary()
35+
.build()
3336
)
34-
.push_element(
35-
Button::new()
37+
.element(
38+
Button::builder()
3639
.text("Deny")
37-
.set_value("deny")
38-
.set_danger()
40+
.value("deny")
41+
.danger()
42+
.build()
3943
)
40-
);
44+
.build()
45+
)
46+
.build();
4147

4248
let req = reqwest::Client::new()
4349
.post("https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX")
@@ -70,7 +76,7 @@ The message payload of the above example is following.
7076
},
7177
{
7278
"type": "mrkdwn",
73-
"text": "*When:*\nSubmitted Aut 10"
79+
"text": "*When:*\nSubmitted Aug 10"
7480
}
7581
]
7682
},
@@ -81,8 +87,7 @@ The message payload of the above example is following.
8187
"type": "button",
8288
"text": {
8389
"type": "plain_text",
84-
"text": "Approve",
85-
"emoji": true
90+
"text": "Approve"
8691
},
8792
"value": "approve",
8893
"style": "primary"
@@ -91,8 +96,7 @@ The message payload of the above example is following.
9196
"type": "button",
9297
"text": {
9398
"type": "plain_text",
94-
"text": "Deny",
95-
"emoji": true
99+
"text": "Deny"
96100
},
97101
"value": "deny",
98102
"style": "danger"

src/attachment.rs

Lines changed: 0 additions & 250 deletions
This file was deleted.

0 commit comments

Comments
 (0)