pub struct AttachmentBuilder { /* private fields */ }Expand description
AttachmentBuilder is used to build a Attachment
Implementations§
Source§impl AttachmentBuilder
impl AttachmentBuilder
Sourcepub fn new<S: Into<SlackText>>(fallback: S) -> Self
pub fn new<S: Into<SlackText>>(fallback: S) -> Self
Make a new AttachmentBuilder
Fallback is the only required field which is a plain-text summary of the attachment.
Sourcepub fn text<S: Into<SlackText>>(self, text: S) -> Self
pub fn text<S: Into<SlackText>>(self, text: S) -> Self
Optional text that appears within the attachment
Sourcepub fn color<C: TryInto<HexColor, Error = Error>>(self, color: C) -> Self
pub fn color<C: TryInto<HexColor, Error = Error>>(self, color: C) -> Self
Set the color of the attachment
The color can be one of:
Strings:good,warning,danger- The built-in enums:
SlackColor::Good, etc. - Any valid hex color code: e.g.
#b13d41or#000.
hex color codes will be checked to ensure a valid hex number is provided
Sourcepub fn pretext<S: Into<SlackText>>(self, pretext: S) -> Self
pub fn pretext<S: Into<SlackText>>(self, pretext: S) -> Self
Optional text that appears above the attachment block
Sourcepub fn actions(self, actions: Vec<Action>) -> Self
pub fn actions(self, actions: Vec<Action>) -> Self
Actions are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.
Sourcepub fn fields(self, fields: Vec<Field>) -> Self
pub fn fields(self, fields: Vec<Field>) -> Self
Fields are defined as an array, and hashes contained within it will be displayed in a table inside the message attachment.
Optional small text used to display the author’s name.
Optional URL that will hyperlink the author_name.
Optional URL that displays a small 16x16px image to the left of the author_name text.
Sourcepub fn title<S: Into<SlackText>>(self, title: S) -> Self
pub fn title<S: Into<SlackText>>(self, title: S) -> Self
Optional larger, bolder text above the main body
Sourcepub fn callback_id<S: Into<SlackText>>(self, callback_id: S) -> Self
pub fn callback_id<S: Into<SlackText>>(self, callback_id: S) -> Self
Optional larger, bolder text above the main body
Sourcepub fn title_link<U: IntoUrl>(self, title_link: U) -> Self
pub fn title_link<U: IntoUrl>(self, title_link: U) -> Self
Optional URL to link to from the title
Sourcepub fn image_url<U: IntoUrl>(self, image_url: U) -> Self
pub fn image_url<U: IntoUrl>(self, image_url: U) -> Self
Optional URL to an image that will be displayed in the body
Sourcepub fn thumb_url<U: IntoUrl>(self, thumb_url: U) -> Self
pub fn thumb_url<U: IntoUrl>(self, thumb_url: U) -> Self
Optional URL to an image that will be displayed as a thumbnail to the right of the body
Optional text that will appear at the bottom of the attachment
Optional URL to an image that will be displayed at the bottom of the attachment
Sourcepub fn ts(self, time: &NaiveDateTime) -> Self
pub fn ts(self, time: &NaiveDateTime) -> Self
Optional timestamp to be displayed with the attachment
Sourcepub fn markdown_in<'a, I: IntoIterator<Item = &'a Section>>(
self,
sections: I,
) -> Self
pub fn markdown_in<'a, I: IntoIterator<Item = &'a Section>>( self, sections: I, ) -> Self
Optional sections formatted as markdown.
Sourcepub fn build(self) -> Result<Attachment>
pub fn build(self) -> Result<Attachment>
Attempt to build the Attachment