slack-blocks 0.25.0

Models + clientside validation for Slack's JSON Block Kit
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use pretty_assertions::assert_eq;
use serde_json::json;
use slack_blocks::{blocks, blox::*};

#[test]
pub fn docs_ex_1() {
  let block: blocks::Block = blox! {<file_block external_id="ABCD1" />}.into();
  let actual = serde_json::to_value(block).unwrap();
  let expected = json!({
    "type": "file",
    "external_id": "ABCD1",
    "source": "remote",
  });

  assert_eq!(actual, expected);
}