Skip to content

Commit

Permalink
Support sending and receiving message metadata (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
yan-zaretskiy authored Nov 12, 2024
1 parent 694adb7 commit ffc78e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/api/conversations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ where
("cursor", req.cursor.as_ref().map(|x| x.value())),
("limit", req.limit.map(|v| v.to_string()).as_ref()),
("inclusive", req.inclusive.map(|v| v.to_string()).as_ref()),
(
"include_all_metadata",
req.include_all_metadata.map(|v| v.to_string()).as_ref(),
),
("latest", req.latest.as_ref().map(|x| x.value())),
("oldest", req.oldest.as_ref().map(|x| x.value())),
],
Expand Down Expand Up @@ -386,6 +390,7 @@ pub struct SlackApiConversationsHistoryRequest {
pub limit: Option<u16>,
pub oldest: Option<SlackTs>,
pub inclusive: Option<bool>,
pub include_all_metadata: Option<bool>,
}

#[skip_serializing_none]
Expand Down
8 changes: 8 additions & 0 deletions src/models/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ pub struct SlackMessageOrigin {
pub client_msg_id: Option<SlackClientMessageId>,
}

#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackMessageMetadata {
pub event_type: String,
pub event_payload: Option<std::collections::HashMap<String, String>>,
}

#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackMessageContent {
Expand All @@ -29,6 +36,7 @@ pub struct SlackMessageContent {
pub upload: Option<bool>,
pub files: Option<Vec<SlackFile>>,
pub reactions: Option<Vec<SlackReaction>>,
pub metadata: Option<SlackMessageMetadata>,
}

#[skip_serializing_none]
Expand Down

0 comments on commit ffc78e8

Please sign in to comment.