Struct slack_hook::AttachmentBuilder
[−]
[src]
pub struct AttachmentBuilder { /* fields omitted */ }AttachmentBuilder is used to build a Attachment
Methods
impl AttachmentBuilder[src]
fn new<S: Into<SlackText>>(fallback: S) -> AttachmentBuilder
Make a new AttachmentBuilder
Fallback is the only required field which is a plain-text summary of the attachment.
fn text<S: Into<SlackText>>(self, text: S) -> AttachmentBuilder
Optional text that appears within the attachment
fn color<C: TryInto<HexColor, Err = Error>>(self, color: C) -> AttachmentBuilder
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
fn pretext<S: Into<SlackText>>(self, pretext: S) -> AttachmentBuilder
Optional text that appears above the attachment block
fn fields(self, fields: Vec<Field>) -> AttachmentBuilder
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.
fn title<S: Into<SlackText>>(self, title: S) -> AttachmentBuilder
Optional larger, bolder text above the main body
fn title_link<U: TryInto<Url, Err = Error>>(
self,
title_link: U
) -> AttachmentBuilder
self,
title_link: U
) -> AttachmentBuilder
Optional URL to link to from the title
fn image_url<U: TryInto<Url, Err = Error>>(
self,
image_url: U
) -> AttachmentBuilder
self,
image_url: U
) -> AttachmentBuilder
Optional URL to an image that will be displayed in the body
fn thumb_url<U: TryInto<Url, Err = Error>>(
self,
thumb_url: U
) -> AttachmentBuilder
self,
thumb_url: U
) -> AttachmentBuilder
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
fn ts(self, time: &NaiveDateTime) -> AttachmentBuilder
Optional timestamp to be displayed with the attachment
fn markdown_in<'a, I: IntoIterator<Item = &'a Section>>(
self,
sections: I
) -> AttachmentBuilder
self,
sections: I
) -> AttachmentBuilder
Optional sections formatted as markdown.
fn build(self) -> Result<Attachment>
Attempt to build the Attachment