1#![warn(missing_docs)]
2#![warn(clippy::missing_docs_in_private_items)]
3#![doc = include_str!("./../README.md")]
4
5use sfr_types as st;
6
7mod app_credentials;
8mod config;
9mod inner;
10mod validation;
11
12pub use crate::app_credentials::AppCredentials;
13pub use crate::config::Config;
14pub use st::SlashCommandBody;
15pub use st::TextObject;
16pub use st::{Block, SectionBlock};
17pub use st::{OauthRedirectQuery, OauthV2AccessResponse};
18
19use validation::Validator;
20
21#[derive(Clone)]
23pub struct Slack(inner::Inner);
24
25impl Slack {
26 pub fn new(creds: AppCredentials, config: Config) -> Self {
28 Self(inner::Inner::new(creds, config))
29 }
30
31 pub fn client_id(&self) -> &str {
33 self.0.client_id()
34 }
35
36 pub fn client_secret(&self) -> &str {
38 self.0.client_secret()
39 }
40
41 pub fn verification_token(&self, body: &SlashCommandBody) -> Result<(), st::Error> {
43 self.0.verification_token(&body.token)
44 }
45
46 pub fn validate_request(
50 &self,
51 signature: &str,
52 timestamp: &str,
53 body: &[u8],
54 ) -> Result<(), st::Error> {
55 self.0.validate_request(signature, timestamp, body)
56 }
57}