pub struct Message {
Show 26 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 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>,
}
Expand description

A message in a Google Chat space.

Fields§

§name: String

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

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 text 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, and bulleted list.

  • 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.

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>

An array of cards.

Only Chat apps can create cards. If your Chat app authenticates as a user, the messages can’t contain cards.

To learn about cards and how to create them, see Send card messages.

Card builder

§annotations: Vec<Annotation>

Output only. Annotations associated with the text in this message.

§thread: Option<Thread>

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

§space: Option<Space>

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

§fallback_text: String

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>

User-uploaded attachment.

§matched_url: Option<MatchedUrl>

Output only. A URL in spaces.messages.text 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.

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

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. Link previews and attachments aren’t supported for private messages.

Only Chat apps can send private messages. If your Chat app authenticates as a user to send a message, the message can’t be private and must omit this field.

For details, see Send private messages to Google Chat users.

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

Output only. Information about a message that’s quoted by a Google Chat user in a space. Google Chat users can quote a message to reply to it.

§attached_gifs: Vec<AttachedGif>

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

§accessory_widgets: Vec<AccessoryWidget>

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).

Trait Implementations§

source§

impl Clone for Message

source§

fn clone(&self) -> Message

Returns a copy 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 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() -> Self

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

impl Message for Message

source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

fn decode<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes an instance of the message from a buffer. Read more
source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes a length-delimited instance of the message from the buffer.
source§

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
source§

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
source§

impl PartialEq for Message

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

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

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

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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

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

§

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>,

§

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>,

§

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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