1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//! # Slack Morphism for Rust
//!
//! Slack Morphism is a modern client library for Slack Web/Events API and Block Kit.
//!
//! ## Slack Web API client
//!
//! ### Create a client instance:
//! ```ignore
//! use slack_morphism::prelude::*;
//!
//! let client = SlackClient::new(SlackClientHyperConnector::new());
//!
//! ```
//!
//! ### Make Web API methods calls
//!
//! For most of Slack Web API methods (except for OAuth methods, Incoming Webhooks and event replies)
//! you need a Slack token to make a call.
//! For simple bots you can have it in your config files, or you can obtain
//! workspace tokens using Slack OAuth.
//!
//! In the example below, we’re using a hardcoded Slack token, but don’t do that for your production bots and apps.
//! You should securely and properly store all of Slack tokens.
//!
//! ```ignore
//!
//! use slack_morphism::prelude::*;
//!
//!# async fn example() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//!
//! let client = SlackClient::new(SlackClientHyperConnector::new());
//!
//! // Create our Slack API token
//! let token_value: SlackApiTokenValue = "xoxb-89.....".into();
//! let token: SlackApiToken = SlackApiToken::new(token_value);
//!
//! // Create a Slack session with this token
//! // A session is just a lightweight wrapper around your token
//! // not to specify it all the time for series of calls.
//! let session = client.open_session(&token);
//!
//! // Make your first API call (which is `api.test` here)
//! let test: SlackApiTestResponse = session
//! .api_test(&SlackApiTestRequest::new().with_foo("Test".into()))
//! .await?;
//!
//! // Send a simple text message
//! let post_chat_req =
//! SlackApiChatPostMessageRequest::new("#general".into(),
//! SlackMessageContent::new().with_text("Hey there!".into())
//! );
//!
//! let post_chat_resp = session.chat_post_message(&post_chat_req).await?;
//!
//!# Ok(())
//!# }
//!
//! ```
//!
//! ## Block Kit
//!
//! Blocks, block elements, and views are modeled as typed structs and enums,
//! with the [`slack_blocks!`] macro (and [`md!`]/[`pt!`] for text objects)
//! to build the block lists they hold:
//!
//! ```
//! use slack_morphism::prelude::*;
//!
//! let show_footer = true;
//!
//! let blocks: Vec<SlackBlock> = slack_blocks![
//! SlackHeaderBlock::new(pt!("Deploy report")),
//! SlackSectionBlock::new()
//! .with_text(md!("Deployed *{}* to {}", "api", "us-east-1"))
//! .with_fields(vec![md!("*Duration:*\n42s"), md!("*Result:*\nsuccess")]),
//! SlackActionsBlock::new(slack_blocks![
//! SlackBlockButtonElement::new("rollback".into(), pt!("Rollback"))
//! .with_style(SlackBlockButtonStyle::Danger),
//! SlackBlockButtonElement::new("details".into(), pt!("View details")),
//! ]),
//! SlackRichTextBlock::new(vec![SlackRichTextSection::new(vec![
//! "Triggered by ".into(),
//! SlackRichTextText::new("the release bot".to_string()).bold().into(),
//! ])
//! .into()]),
//! SlackTableBlock::new(vec![
//! vec!["Service".into(), "Status".into()],
//! vec!["api".into(), "healthy".into()],
//! ]),
//! optionally(show_footer => SlackContextBlock::new(vec![md!("Posted automatically")])),
//! ];
//!
//! let content = SlackMessageContent::new().with_blocks(blocks);
//! # assert!(content.blocks.is_some());
//! ```
//!
//! See the [`blocks::block_kit`] module docs for a full guide covering text
//! objects, sections, actions and inputs, rich text, tables, templates, and
//! views.
//!
//! ## Events API and OAuth support for Hyper and Axum
//!
//! The library provides two different ways to work with Slack Events API:
//! - Using pure Hyper-based solution
//! - Using more high-level solution for axum web framework.
//!
//! Also the library provides Slack events signature verifier (`SlackEventSignatureVerifier`)
//! (which is already integrated in the routes implementation for you).
//! All you need is provide your client id and secret configuration to route implementation.
//!
//! ## Socket Mode support
//!
//! The library provides Socket Mode support additionally Events API leveraging Web-sockets
//! in cases you don't want/need to expose publicly available HTTP endpoint.
//!
//! # Docs and examples
//!
//! Please follow to the official [website](https://slack-rust.abdolence.dev).
//! Examples available on: [github](https://github.com/abdolence/slack-morphism-rust/tree/master/examples).
//!
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;