Skip to main content

Message

Struct Message 

Source
#[non_exhaustive]
pub struct Message {
Show 28 fields pub name: String, pub sender: Option<User>, pub create_time: Option<Timestamp>, pub last_update_time: Option<Timestamp>, pub delete_time: Option<Timestamp>, pub text: String, pub formatted_text: String, pub cards: Vec<Card>, pub cards_v2: Vec<CardWithId>, pub annotations: Vec<Annotation>, pub thread: Option<Thread>, pub space: Option<Space>, pub fallback_text: String, pub action_response: Option<ActionResponse>, pub argument_text: String, pub slash_command: Option<SlashCommand>, pub attachment: Vec<Attachment>, pub matched_url: Option<MatchedUrl>, pub thread_reply: bool, pub silent: bool, pub client_assigned_message_id: String, pub emoji_reaction_summaries: Vec<EmojiReactionSummary>, pub private_message_viewer: Option<User>, pub deletion_metadata: Option<DeletionMetadata>, pub quoted_message_metadata: Option<QuotedMessageMetadata>, pub attached_gifs: Vec<AttachedGif>, pub accessory_widgets: Vec<AccessoryWidget>, pub markup_syntax: MarkupSyntax, /* private fields */
}
Expand description

A message in a Google Chat space.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Identifier. Resource name of the message.

Format: spaces/{space}/messages/{message}

Where {space} is the ID of the space where the message is posted and {message} is a system-assigned ID for the message. For example, spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB.

If you set a custom ID when you create a message, you can use this ID to specify the message in a request by replacing {message} with the value from the clientAssignedMessageId field. For example, spaces/AAAAAAAAAAA/messages/client-custom-name. For details, see Name a message.

§sender: Option<User>

Output only. The user who created the message. If your Chat app authenticates as a user, the output populates the user name and type.

§create_time: Option<Timestamp>

Optional. Immutable. For spaces created in Chat, the time at which the message was created. This field is output only, except when used in import mode spaces.

For import mode spaces, set this field to the historical timestamp at which the message was created in the source in order to preserve the original creation time.

§last_update_time: Option<Timestamp>

Output only. The time at which the message was last edited by a user. If the message has never been edited, this field is empty.

§delete_time: Option<Timestamp>

Output only. The time at which the message was deleted in Google Chat. If the message is never deleted, this field is empty.

§text: String

Optional. Plain-text body of the message. The first link to an image, video, or web page generates a preview chip. You can also @mention a Google Chat user, or everyone in the space.

To learn about creating text messages, see Send a message.

§formatted_text: String

Output only. Contains the message text with markups added to communicate formatting. This field might not capture all formatting visible in the UI, but includes the following:

  • Markup syntax for bold, italic, strikethrough, monospace, monospace block, bulleted list, and block quote.

  • User mentions using the format <users/{user}>.

  • Custom hyperlinks using the format <{url}|{rendered_text}> where the first string is the URL and the second is the rendered text—for example, <<http://example.com>|custom text>.

  • Custom emoji using the format :{emoji_name}:—for example, :smile:. This doesn’t apply to Unicode emoji, such as U+1F600 for a grinning face emoji.

  • Bullet list items using asterisks (*)—for example, * item.

For more information, see View text formatting sent in a message

§cards: Vec<Card>
👎Deprecated

Deprecated: Use cards_v2 instead.

Rich, formatted, and interactive cards that you can use to display UI elements such as: formatted texts, buttons, and clickable images. Cards are normally displayed below the plain-text body of the message. cards and cards_v2 can have a maximum size of 32 KB.

§cards_v2: Vec<CardWithId>

Optional. An array of cards.

Chat apps can create cards with app authentication. As part of the Developer Preview Program, if your Chat app authenticates as a user, it can create card messages. If your Chat app is not part of Developer Preview Program, it can’t create cards with user authentication.

To learn how to create a message that contains cards, see Send a message.

Card builder

§annotations: Vec<Annotation>

Output only. Annotations can be associated with the plain-text body of the message or with chips that link to Google Workspace resources like Google Docs or Sheets with start_index and length of 0.

§thread: Option<Thread>

The thread the message belongs to. For example usage, see Start or reply to a message thread.

§space: Option<Space>

Output only. If your Chat app authenticates as a user, the output only populates the space name.

§fallback_text: String

Optional. A plain-text description of the message’s cards, used when the actual cards can’t be displayed—for example, mobile notifications.

§action_response: Option<ActionResponse>

Input only. Parameters that a Chat app can use to configure how its response is posted.

§argument_text: String

Output only. Plain-text body of the message with all Chat app mentions stripped out.

§slash_command: Option<SlashCommand>

Output only. Slash command information, if applicable.

§attachment: Vec<Attachment>

Optional. User-uploaded attachment.

§matched_url: Option<MatchedUrl>

Output only. A URL in the Chat message text field that matches a link preview pattern. For more information, see Preview links.

§thread_reply: bool

Output only. When true, the message is a response in a reply thread. When false, the message is visible in the space’s top-level conversation as either the first message of a thread or a message with no threaded replies.

If the space doesn’t support reply in threads, this field is always false.

§silent: bool

Output only. Whether this is a silent message. Silent messages are messages where Chat suppresses push notifications for recipients.

§client_assigned_message_id: String

Optional. A custom ID for the message. You can use field to identify a message, or to get, delete, or update a message. To set a custom ID, specify the messageId field when you create the message. For details, see Name a message.

§emoji_reaction_summaries: Vec<EmojiReactionSummary>

Output only. The list of emoji reaction summaries on the message.

§private_message_viewer: Option<User>

Optional. Immutable. Input for creating a message, otherwise output only. The user that can view the message. When set, the message is private and only visible to the specified user and the Chat app. To include this field in your request, you must call the Chat API using app authentication and omit the following:

For details, see Send a message privately.

§deletion_metadata: Option<DeletionMetadata>

Output only. Information about a deleted message. A message is deleted when delete_time is set.

§quoted_message_metadata: Option<QuotedMessageMetadata>

Optional. Information about a message that another message quotes.

When you create a message, you can quote messages within the same thread, or quote a root message to create a new root message. However, you can’t quote a message reply from a different thread.

When you update a message, you can’t add or replace the quotedMessageMetadata field, but you can remove it.

For example usage, see Quote another message.

§attached_gifs: Vec<AttachedGif>

Output only. GIF images that are attached to the message.

§accessory_widgets: Vec<AccessoryWidget>

Optional. One or more interactive widgets that appear at the bottom of a message. You can add accessory widgets to messages that contain text, cards, or both text and cards. Not supported for messages that contain dialogs. For details, see Add interactive widgets at the bottom of a message.

Creating a message with accessory widgets requires [app authentication] (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).

§markup_syntax: MarkupSyntax

Optional. Specifies how the server interprets the message text field content.

Implementations§

Source§

impl Message

Source

pub fn new() -> Self

Creates a new default instance.

Source

pub fn set_name<T: Into<String>>(self, v: T) -> Self

Sets the value of name.

§Example
let x = Message::new().set_name(format!("spaces/{space_id}/messages/{message_id}"));
Source

pub fn set_sender<T>(self, v: T) -> Self
where T: Into<User>,

Sets the value of sender.

§Example
use google_chat_v1::model::User;
let x = Message::new().set_sender(User::default()/* use setters */);
Source

pub fn set_or_clear_sender<T>(self, v: Option<T>) -> Self
where T: Into<User>,

Sets or clears the value of sender.

§Example
use google_chat_v1::model::User;
let x = Message::new().set_or_clear_sender(Some(User::default()/* use setters */));
let x = Message::new().set_or_clear_sender(None::<User>);
Source

pub fn set_create_time<T>(self, v: T) -> Self
where T: Into<Timestamp>,

Sets the value of create_time.

§Example
use wkt::Timestamp;
let x = Message::new().set_create_time(Timestamp::default()/* use setters */);
Source

pub fn set_or_clear_create_time<T>(self, v: Option<T>) -> Self
where T: Into<Timestamp>,

Sets or clears the value of create_time.

§Example
use wkt::Timestamp;
let x = Message::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
let x = Message::new().set_or_clear_create_time(None::<Timestamp>);
Source

pub fn set_last_update_time<T>(self, v: T) -> Self
where T: Into<Timestamp>,

Sets the value of last_update_time.

§Example
use wkt::Timestamp;
let x = Message::new().set_last_update_time(Timestamp::default()/* use setters */);
Source

pub fn set_or_clear_last_update_time<T>(self, v: Option<T>) -> Self
where T: Into<Timestamp>,

Sets or clears the value of last_update_time.

§Example
use wkt::Timestamp;
let x = Message::new().set_or_clear_last_update_time(Some(Timestamp::default()/* use setters */));
let x = Message::new().set_or_clear_last_update_time(None::<Timestamp>);
Source

pub fn set_delete_time<T>(self, v: T) -> Self
where T: Into<Timestamp>,

Sets the value of delete_time.

§Example
use wkt::Timestamp;
let x = Message::new().set_delete_time(Timestamp::default()/* use setters */);
Source

pub fn set_or_clear_delete_time<T>(self, v: Option<T>) -> Self
where T: Into<Timestamp>,

Sets or clears the value of delete_time.

§Example
use wkt::Timestamp;
let x = Message::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
let x = Message::new().set_or_clear_delete_time(None::<Timestamp>);
Source

pub fn set_text<T: Into<String>>(self, v: T) -> Self

Sets the value of text.

§Example
let x = Message::new().set_text("example");
Source

pub fn set_formatted_text<T: Into<String>>(self, v: T) -> Self

Sets the value of formatted_text.

§Example
let x = Message::new().set_formatted_text("example");
Source

pub fn set_cards<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Card>,

👎Deprecated

Sets the value of cards.

§Example
use google_chat_v1::model::contextual_add_on_markup::Card;
let x = Message::new()
    .set_cards([
        Card::default()/* use setters */,
        Card::default()/* use (different) setters */,
    ]);
Source

pub fn set_cards_v2<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<CardWithId>,

Sets the value of cards_v2.

§Example
use google_chat_v1::model::CardWithId;
let x = Message::new()
    .set_cards_v2([
        CardWithId::default()/* use setters */,
        CardWithId::default()/* use (different) setters */,
    ]);
Source

pub fn set_annotations<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Annotation>,

Sets the value of annotations.

§Example
use google_chat_v1::model::Annotation;
let x = Message::new()
    .set_annotations([
        Annotation::default()/* use setters */,
        Annotation::default()/* use (different) setters */,
    ]);
Source

pub fn set_thread<T>(self, v: T) -> Self
where T: Into<Thread>,

Sets the value of thread.

§Example
use google_chat_v1::model::Thread;
let x = Message::new().set_thread(Thread::default()/* use setters */);
Source

pub fn set_or_clear_thread<T>(self, v: Option<T>) -> Self
where T: Into<Thread>,

Sets or clears the value of thread.

§Example
use google_chat_v1::model::Thread;
let x = Message::new().set_or_clear_thread(Some(Thread::default()/* use setters */));
let x = Message::new().set_or_clear_thread(None::<Thread>);
Source

pub fn set_space<T>(self, v: T) -> Self
where T: Into<Space>,

Sets the value of space.

§Example
use google_chat_v1::model::Space;
let x = Message::new().set_space(Space::default()/* use setters */);
Source

pub fn set_or_clear_space<T>(self, v: Option<T>) -> Self
where T: Into<Space>,

Sets or clears the value of space.

§Example
use google_chat_v1::model::Space;
let x = Message::new().set_or_clear_space(Some(Space::default()/* use setters */));
let x = Message::new().set_or_clear_space(None::<Space>);
Source

pub fn set_fallback_text<T: Into<String>>(self, v: T) -> Self

Sets the value of fallback_text.

§Example
let x = Message::new().set_fallback_text("example");
Source

pub fn set_action_response<T>(self, v: T) -> Self
where T: Into<ActionResponse>,

Sets the value of action_response.

§Example
use google_chat_v1::model::ActionResponse;
let x = Message::new().set_action_response(ActionResponse::default()/* use setters */);
Source

pub fn set_or_clear_action_response<T>(self, v: Option<T>) -> Self
where T: Into<ActionResponse>,

Sets or clears the value of action_response.

§Example
use google_chat_v1::model::ActionResponse;
let x = Message::new().set_or_clear_action_response(Some(ActionResponse::default()/* use setters */));
let x = Message::new().set_or_clear_action_response(None::<ActionResponse>);
Source

pub fn set_argument_text<T: Into<String>>(self, v: T) -> Self

Sets the value of argument_text.

§Example
let x = Message::new().set_argument_text("example");
Source

pub fn set_slash_command<T>(self, v: T) -> Self
where T: Into<SlashCommand>,

Sets the value of slash_command.

§Example
use google_chat_v1::model::SlashCommand;
let x = Message::new().set_slash_command(SlashCommand::default()/* use setters */);
Source

pub fn set_or_clear_slash_command<T>(self, v: Option<T>) -> Self
where T: Into<SlashCommand>,

Sets or clears the value of slash_command.

§Example
use google_chat_v1::model::SlashCommand;
let x = Message::new().set_or_clear_slash_command(Some(SlashCommand::default()/* use setters */));
let x = Message::new().set_or_clear_slash_command(None::<SlashCommand>);
Source

pub fn set_attachment<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Attachment>,

Sets the value of attachment.

§Example
use google_chat_v1::model::Attachment;
let x = Message::new()
    .set_attachment([
        Attachment::default()/* use setters */,
        Attachment::default()/* use (different) setters */,
    ]);
Source

pub fn set_matched_url<T>(self, v: T) -> Self
where T: Into<MatchedUrl>,

Sets the value of matched_url.

§Example
use google_chat_v1::model::MatchedUrl;
let x = Message::new().set_matched_url(MatchedUrl::default()/* use setters */);
Source

pub fn set_or_clear_matched_url<T>(self, v: Option<T>) -> Self
where T: Into<MatchedUrl>,

Sets or clears the value of matched_url.

§Example
use google_chat_v1::model::MatchedUrl;
let x = Message::new().set_or_clear_matched_url(Some(MatchedUrl::default()/* use setters */));
let x = Message::new().set_or_clear_matched_url(None::<MatchedUrl>);
Source

pub fn set_thread_reply<T: Into<bool>>(self, v: T) -> Self

Sets the value of thread_reply.

§Example
let x = Message::new().set_thread_reply(true);
Source

pub fn set_silent<T: Into<bool>>(self, v: T) -> Self

Sets the value of silent.

§Example
let x = Message::new().set_silent(true);
Source

pub fn set_client_assigned_message_id<T: Into<String>>(self, v: T) -> Self

Sets the value of client_assigned_message_id.

§Example
let x = Message::new().set_client_assigned_message_id("example");
Source

pub fn set_emoji_reaction_summaries<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<EmojiReactionSummary>,

Sets the value of emoji_reaction_summaries.

§Example
use google_chat_v1::model::EmojiReactionSummary;
let x = Message::new()
    .set_emoji_reaction_summaries([
        EmojiReactionSummary::default()/* use setters */,
        EmojiReactionSummary::default()/* use (different) setters */,
    ]);
Source

pub fn set_private_message_viewer<T>(self, v: T) -> Self
where T: Into<User>,

Sets the value of private_message_viewer.

§Example
use google_chat_v1::model::User;
let x = Message::new().set_private_message_viewer(User::default()/* use setters */);
Source

pub fn set_or_clear_private_message_viewer<T>(self, v: Option<T>) -> Self
where T: Into<User>,

Sets or clears the value of private_message_viewer.

§Example
use google_chat_v1::model::User;
let x = Message::new().set_or_clear_private_message_viewer(Some(User::default()/* use setters */));
let x = Message::new().set_or_clear_private_message_viewer(None::<User>);
Source

pub fn set_deletion_metadata<T>(self, v: T) -> Self

Sets the value of deletion_metadata.

§Example
use google_chat_v1::model::DeletionMetadata;
let x = Message::new().set_deletion_metadata(DeletionMetadata::default()/* use setters */);
Source

pub fn set_or_clear_deletion_metadata<T>(self, v: Option<T>) -> Self

Sets or clears the value of deletion_metadata.

§Example
use google_chat_v1::model::DeletionMetadata;
let x = Message::new().set_or_clear_deletion_metadata(Some(DeletionMetadata::default()/* use setters */));
let x = Message::new().set_or_clear_deletion_metadata(None::<DeletionMetadata>);
Source

pub fn set_quoted_message_metadata<T>(self, v: T) -> Self

Sets the value of quoted_message_metadata.

§Example
use google_chat_v1::model::QuotedMessageMetadata;
let x = Message::new().set_quoted_message_metadata(QuotedMessageMetadata::default()/* use setters */);
Source

pub fn set_or_clear_quoted_message_metadata<T>(self, v: Option<T>) -> Self

Sets or clears the value of quoted_message_metadata.

§Example
use google_chat_v1::model::QuotedMessageMetadata;
let x = Message::new().set_or_clear_quoted_message_metadata(Some(QuotedMessageMetadata::default()/* use setters */));
let x = Message::new().set_or_clear_quoted_message_metadata(None::<QuotedMessageMetadata>);
Source

pub fn set_attached_gifs<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<AttachedGif>,

Sets the value of attached_gifs.

§Example
use google_chat_v1::model::AttachedGif;
let x = Message::new()
    .set_attached_gifs([
        AttachedGif::default()/* use setters */,
        AttachedGif::default()/* use (different) setters */,
    ]);
Source

pub fn set_accessory_widgets<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<AccessoryWidget>,

Sets the value of accessory_widgets.

§Example
use google_chat_v1::model::AccessoryWidget;
let x = Message::new()
    .set_accessory_widgets([
        AccessoryWidget::default()/* use setters */,
        AccessoryWidget::default()/* use (different) setters */,
    ]);
Source

pub fn set_markup_syntax<T: Into<MarkupSyntax>>(self, v: T) -> Self

Sets the value of markup_syntax.

§Example
use google_chat_v1::model::MarkupSyntax;
let x0 = Message::new().set_markup_syntax(MarkupSyntax::Chat);
let x1 = Message::new().set_markup_syntax(MarkupSyntax::Markdown);

Trait Implementations§

Source§

impl Clone for Message

Source§

fn clone(&self) -> Message

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Message

Source§

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

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

impl Default for Message

Source§

fn default() -> Message

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

impl Message for Message

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Message

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Message

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more