Message

Struct Message 

Source
pub struct Message<'a> { /* private fields */ }
Expand description

Main object representing a teams message.

Implementations§

Source§

impl<'a> Message<'a>

Source

pub fn new() -> Message<'a>

Create a new, empty message.

The message @type and @context are automatically set upon creation, since these always have the same values.

Source

pub fn summary(self, s: impl ToString) -> Self

Required if the card does not contain a text property, otherwise optional. The summary property is typically displayed in the list view in Outlook, as a way to quickly determine what the card is all about.

Do always include a summary.

Don’t include details in the summary. For example, for a Twitter post, a summary might simply read “New tweet from @someuser” without mentioning the content of the tweet itself.

Source

pub fn theme_color(self, c: impl ToString) -> Self

Specifies a custom brand color for the card. The color will be displayed in a non-obtrusive manner.

Source

pub fn correlation_id(self, id: usize) -> Self

The correlationId property simplifies the process of locating logs for troubleshooting issues. We recommend that when sending an actionable card, your service should set and log a unique UUID in this property.

When the user invokes an action on the card, Office 365 sends the Card-Correlation-Id and Action-Request-Id headers in the POST request to your service. Card-Correlation-Id contains the same value as the correlationId property in the card. Action-Request-Id is a unique UUID generated by Office 365 to help locate specific action performed by a user. Your service should log both of these values when receiving action POST requests.

Source

pub fn expected_actors<I>(self, v: I) -> Self
where I: IntoIterator, I::Item: ToString,

Optional. This contains a list of expected email addresses of the recipient for the action endpoint.

A user can have multiple email addresses and the action endpoint might not be expecting the particular email address presented in the sub claim of the bearer token. For example, a user could have both the john.doe@contoso.com or john@contoso.com email address, but the action endpoint expects to receive john@contoso.com in the sub claim of the bearer token. By setting this field to ["john@contoso.com"], the sub claim will have the expected email address.

Source

pub fn originator(self, s: impl ToString) -> Self

Required when sent via email, not applicable when sent via connector. For actionable email, MUST be set to the provider ID generated by the Actionable Email Developer Dashboard.

Source

pub fn hide_original_body(self, b: bool) -> Self

Only applies to cards in email messages

When set to true, causes the HTML body of the message to be hidden. This is very useful in scenarios where the card is a better or more useful representation of the content than the HTML body itself, which is especially true when the card contains actions (see below.)

Consider hiding the original HTML body:

  • If the card itself contains all the information a user would need
  • If the content of the card is redundant with the content of the body

Do always include a nice HTML body, even if it is going to be hidden. The HTML body is the only thing an email client that doesn’t support cards will be able to display. Furthermore, cards are not included when replying to or forwarding emails, only the HTML body.

Don’t hide the body when it is complementary to the information presented in the card. For example, the body of an expense report approval might describe the report in great details while the card just presents a quick summary along with approve/decline actions.

Source

pub fn title(self, s: impl ToString) -> Self

The title property is meant to be rendered in a prominent way, at the very top of the card. Use it to introduce the content of the card in such a way users will immediately know what to expect.

Examples:

  • Daily news
  • New bug opened
  • Task assigned

Do keep title short, don’t make it a long sentence.

Do mention the name of the entity being referenced in the title.

Don’t use hyperlinks (via Markdown) in the title.

Source

pub fn text(self, s: impl ToString) -> Self

Required if the card does not contain a summary property, otherwise optional. The text property is meant to be displayed in a normal font below the card’s title. Use it to display content, such as the description of the entity being referenced, or an abstract of a news article.

Do use simple Markdown, such as bold or italics to emphasize words, and links to external resources.

Don’t include any call to action in the text property. Users should be able to not read it and still understand what the card is all about.

Source

pub fn sections(self, v: Vec<Section>) -> Self

A collection of sections to include in the card.

Trait Implementations§

Source§

impl<'a> Clone for Message<'a>

Source§

fn clone(&self) -> Message<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Message<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for Message<'a>

Source§

fn default() -> Message<'a>

Returns the “default value” for a type. Read more
Source§

impl<'a> PartialEq for Message<'a>

Source§

fn eq(&self, other: &Message<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Serialize for Message<'a>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Eq for Message<'a>

Source§

impl<'a> StructuralPartialEq for Message<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Message<'a>

§

impl<'a> RefUnwindSafe for Message<'a>

§

impl<'a> Send for Message<'a>

§

impl<'a> Sync for Message<'a>

§

impl<'a> Unpin for Message<'a>

§

impl<'a> UnwindSafe for Message<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.