Struct slack_hook::AttachmentBuilder [−][src]
pub struct AttachmentBuilder { /* fields omitted */ }
AttachmentBuilder
is used to build a Attachment
Methods
impl AttachmentBuilder
[src]
impl AttachmentBuilder
pub fn new<S: Into<SlackText>>(fallback: S) -> AttachmentBuilder
[src]
pub 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.
pub fn text<S: Into<SlackText>>(self, text: S) -> AttachmentBuilder
[src]
pub fn text<S: Into<SlackText>>(self, text: S) -> AttachmentBuilder
Optional text that appears within the attachment
pub fn color<C: TryInto<HexColor, Err = Error>>(
self,
color: C
) -> AttachmentBuilder
[src]
pub fn color<C: TryInto<HexColor, Err = Error>>(
self,
color: C
) -> AttachmentBuilder
Set the color of the attachment
The color can be one of:
String
s:good
,warning
,danger
- The built-in enums:
SlackColor::Good
, etc. - Any valid hex color code: e.g.
#b13d41
or#000
.
hex color codes will be checked to ensure a valid hex number is provided
pub fn pretext<S: Into<SlackText>>(self, pretext: S) -> AttachmentBuilder
[src]
pub fn pretext<S: Into<SlackText>>(self, pretext: S) -> AttachmentBuilder
Optional text that appears above the attachment block
pub fn fields(self, fields: Vec<Field>) -> AttachmentBuilder
[src]
pub 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.
pub fn title<S: Into<SlackText>>(self, title: S) -> AttachmentBuilder
[src]
pub fn title<S: Into<SlackText>>(self, title: S) -> AttachmentBuilder
Optional larger, bolder text above the main body
pub fn title_link<U: TryInto<Url, Err = Error>>(
self,
title_link: U
) -> AttachmentBuilder
[src]
pub fn title_link<U: TryInto<Url, Err = Error>>(
self,
title_link: U
) -> AttachmentBuilder
Optional URL to link to from the title
pub fn image_url<U: TryInto<Url, Err = Error>>(
self,
image_url: U
) -> AttachmentBuilder
[src]
pub fn image_url<U: TryInto<Url, Err = Error>>(
self,
image_url: U
) -> AttachmentBuilder
Optional URL to an image that will be displayed in the body
pub fn thumb_url<U: TryInto<Url, Err = Error>>(
self,
thumb_url: U
) -> AttachmentBuilder
[src]
pub fn thumb_url<U: TryInto<Url, Err = Error>>(
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
pub fn ts(self, time: &NaiveDateTime) -> AttachmentBuilder
[src]
pub fn ts(self, time: &NaiveDateTime) -> AttachmentBuilder
Optional timestamp to be displayed with the attachment
pub fn markdown_in<'a, I: IntoIterator<Item = &'a Section>>(
self,
sections: I
) -> AttachmentBuilder
[src]
pub fn markdown_in<'a, I: IntoIterator<Item = &'a Section>>(
self,
sections: I
) -> AttachmentBuilder
Optional sections formatted as markdown.
pub fn build(self) -> Result<Attachment>
[src]
pub fn build(self) -> Result<Attachment>
Attempt to build the Attachment
Trait Implementations
impl Debug for AttachmentBuilder
[src]
impl Debug for AttachmentBuilder
Auto Trait Implementations
impl Send for AttachmentBuilder
impl Send for AttachmentBuilder
impl !Sync for AttachmentBuilder
impl !Sync for AttachmentBuilder