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
//! # 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::*;
//!
//! let client_connector = SlackClientHyperConnector::new(); // with Tokio/Hyper support
//! let client = SlackClient::new(client_connector);
//!
//! ```
//!
//! ### 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::*;
//! use slack_morphism::api::*;
//! use slack_morphism_models::*;
//!
//! use slack_morphism_hyper::*;
//!
//!# async fn example() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//!
//! let client_connector: SlackClientHyperConnector::new();
//! let client = SlackClient::new(client_connector);
//!
//! // 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
//! 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(())
//!# }
//!
//! ```
//!
//! ## Events API and OAuth support
//!
//! The library provides route implementation in `SlackClientEventsListener` based on Hyper/Tokio for:
//! - Push Events
//! - Interaction Events
//! - Command Events
//! - OAuth v2 redirects and client functions
//!
//! You can chain all of the routes using `chain_service_routes_fn` from the library.
//!
//! 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.
//!
//! Look at the examples/test_server sources for the details.
//!
//! # Docs
//!
//! Please follow to the official website: https://slack-rust.abdolence.dev
//!

#![allow(clippy::new_without_default)]

pub use client::*;
pub use scroller::*;
pub use token::*;

pub mod api;
mod client;
pub mod errors;
pub mod listener;
mod scroller;
pub mod signature_verifier;
mod token;

pub mod prelude;