mirror of
https://github.com/System-End/slack-morphism-rust.git
synced 2026-04-19 22:05:15 +00:00
Slack Client Views API
This commit is contained in:
parent
d436a72fbb
commit
5cf622fad1
2 changed files with 112 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ mod team;
|
|||
mod test;
|
||||
mod users;
|
||||
mod webhook;
|
||||
mod views;
|
||||
|
||||
pub use bots::*;
|
||||
pub use chat::*;
|
||||
|
|
@ -15,3 +16,4 @@ pub use team::*;
|
|||
pub use test::*;
|
||||
pub use users::*;
|
||||
pub use webhook::*;
|
||||
pub use views::*;
|
||||
|
|
|
|||
110
src/client/src/api/views.rs
Normal file
110
src/client/src/api/views.rs
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
//!
|
||||
//! Support for Slack Views API methods
|
||||
//!
|
||||
|
||||
use rsb_derive::Builder;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
|
||||
use crate::ClientResult;
|
||||
use crate::SlackClientSession;
|
||||
use slack_morphism_models::*;
|
||||
use slack_morphism_models::blocks::*;
|
||||
|
||||
impl<'a> SlackClientSession<'a> {
|
||||
///
|
||||
/// https://api.slack.com/methods/views.open
|
||||
///
|
||||
pub async fn views_open(
|
||||
&self,
|
||||
req: &SlackApiViewsOpenRequest,
|
||||
) -> ClientResult<SlackApiViewsOpenResponse> {
|
||||
self.http_api.http_post("views.open", req).await
|
||||
}
|
||||
|
||||
///
|
||||
/// https://api.slack.com/methods/views.publish
|
||||
///
|
||||
pub async fn views_publish(
|
||||
&self,
|
||||
req: &SlackApiViewsPublishRequest,
|
||||
) -> ClientResult<SlackApiViewsPublishResponse> {
|
||||
self.http_api.http_post("views.publish", req).await
|
||||
}
|
||||
|
||||
///
|
||||
/// https://api.slack.com/methods/views.push
|
||||
///
|
||||
pub async fn views_push(
|
||||
&self,
|
||||
req: &SlackApiViewsPushRequest,
|
||||
) -> ClientResult<SlackApiViewsPushResponse> {
|
||||
self.http_api.http_post("views.push", req).await
|
||||
}
|
||||
|
||||
///
|
||||
/// https://api.slack.com/methods/views.update
|
||||
///
|
||||
pub async fn views_update(
|
||||
&self,
|
||||
req: &SlackApiViewsUpdateRequest,
|
||||
) -> ClientResult<SlackApiViewsUpdateResponse> {
|
||||
self.http_api.http_post("views.update", req).await
|
||||
}
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
|
||||
pub struct SlackApiViewsOpenRequest {
|
||||
pub trigger_id: SlackTriggerId,
|
||||
pub view: SlackView
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
|
||||
pub struct SlackApiViewsOpenResponse {
|
||||
pub view: SlackStatefulView
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
|
||||
pub struct SlackApiViewsPublishRequest {
|
||||
pub user_id: SlackUserId,
|
||||
pub view: SlackView,
|
||||
pub hash: Option<String>
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
|
||||
pub struct SlackApiViewsPublishResponse {
|
||||
pub view: SlackStatefulView
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
|
||||
pub struct SlackApiViewsPushRequest {
|
||||
pub trigger_id: SlackTriggerId,
|
||||
pub view: SlackView
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
|
||||
pub struct SlackApiViewsPushResponse {
|
||||
pub view: SlackStatefulView
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
|
||||
pub struct SlackApiViewsUpdateRequest {
|
||||
pub view: SlackView,
|
||||
pub external_id: Option<String>,
|
||||
pub hash: Option<String>,
|
||||
pub view_id: Option<SlackViewId>
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
|
||||
pub struct SlackApiViewsUpdateResponse {
|
||||
pub view: SlackStatefulView
|
||||
}
|
||||
|
||||
Loading…
Add table
Reference in a new issue