@@ -97,6 +97,15 @@ pub struct Message {
9797
9898 #[ serde( skip_serializing_if = "Option::is_none" ) ]
9999 channel : Option < String > ,
100+
101+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
102+ response_type : Option < ResponseType > ,
103+
104+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
105+ replace_original : Option < bool > ,
106+
107+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
108+ delete_original : Option < bool > ,
100109}
101110
102111impl Message {
@@ -416,4 +425,129 @@ impl Message {
416425 ..self
417426 }
418427 }
428+
429+ /// Sets response_type field.
430+ ///
431+ /// ```
432+ /// use slack_messaging::{Message, ResponseType};
433+ /// use serde_json::json;
434+ ///
435+ /// let message = Message::new()
436+ /// .set_response_type(ResponseType::InChannel);
437+ ///
438+ /// let expected = json!({
439+ /// "response_type": "in_channel",
440+ /// });
441+ ///
442+ /// let message_json = serde_json::to_value(message).unwrap();
443+ ///
444+ /// assert_eq!(message_json, expected);
445+ /// ```
446+ pub fn set_response_type ( self , response_type : ResponseType ) -> Self {
447+ Self {
448+ response_type : Some ( response_type) ,
449+ ..self
450+ }
451+ }
452+
453+ /// Sets replace_original field.
454+ ///
455+ /// ```
456+ /// use slack_messaging::Message;
457+ /// use serde_json::json;
458+ ///
459+ /// let message = Message::new().set_replace_original(true);
460+ ///
461+ /// let expected = json!({
462+ /// "replace_original": true,
463+ /// });
464+ ///
465+ /// let message_json = serde_json::to_value(message).unwrap();
466+ ///
467+ /// assert_eq!(message_json, expected);
468+ /// ```
469+ pub fn set_replace_original ( self , replace : bool ) -> Self {
470+ Self {
471+ replace_original : Some ( replace) ,
472+ ..self
473+ }
474+ }
475+
476+ /// Sets true to replace_original field.
477+ ///
478+ /// ```
479+ /// use slack_messaging::Message;
480+ /// use serde_json::json;
481+ ///
482+ /// let message = Message::new().replace_original();
483+ ///
484+ /// let expected = json!({
485+ /// "replace_original": true,
486+ /// });
487+ ///
488+ /// let message_json = serde_json::to_value(message).unwrap();
489+ ///
490+ /// assert_eq!(message_json, expected);
491+ /// ```
492+ pub fn replace_original ( self ) -> Self {
493+ Self {
494+ replace_original : Some ( true ) ,
495+ ..self
496+ }
497+ }
498+
499+ /// Sets delete_original field.
500+ ///
501+ /// ```
502+ /// use slack_messaging::Message;
503+ /// use serde_json::json;
504+ ///
505+ /// let message = Message::new().set_delete_original(true);
506+ ///
507+ /// let expected = json!({
508+ /// "delete_original": true,
509+ /// });
510+ ///
511+ /// let message_json = serde_json::to_value(message).unwrap();
512+ ///
513+ /// assert_eq!(message_json, expected);
514+ /// ```
515+ pub fn set_delete_original ( self , delete : bool ) -> Self {
516+ Self {
517+ delete_original : Some ( delete) ,
518+ ..self
519+ }
520+ }
521+
522+ /// Sets true to delete_original field.
523+ ///
524+ /// ```
525+ /// use slack_messaging::Message;
526+ /// use serde_json::json;
527+ ///
528+ /// let message = Message::new().delete_original();
529+ ///
530+ /// let expected = json!({
531+ /// "delete_original": true,
532+ /// });
533+ ///
534+ /// let message_json = serde_json::to_value(message).unwrap();
535+ ///
536+ /// assert_eq!(message_json, expected);
537+ /// ```
538+ pub fn delete_original ( self ) -> Self {
539+ Self {
540+ delete_original : Some ( true ) ,
541+ ..self
542+ }
543+ }
544+ }
545+
546+ /// Objects that can be set to response_type field in [Message](crate::message::Message).
547+ #[ derive( Debug , Clone , Serialize ) ]
548+ #[ serde( rename_all = "snake_case" ) ]
549+ pub enum ResponseType {
550+ /// Sets this if you want to publish a message to the same conversation as the interaction
551+ /// source.
552+ InChannel
419553}
0 commit comments