Skip to main content

SearchMessagesRequest

Struct SearchMessagesRequest 

Source
#[non_exhaustive]
pub struct SearchMessagesRequest { pub parent: String, pub filter: String, pub page_size: i32, pub page_token: String, pub order_by: String, pub markup_syntax: MarkupSyntax, pub view: SearchMessagesView, /* private fields */ }
Expand description

Request message for searching messages.

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.
§parent: String

Required. The resource name of the space to search within.

To search across all spaces the user has access to, set this field to spaces/-. Using any other value for parent results in an INVALID_ARGUMENT error.

To limit the search to one or more spaces, use space.name or space.display_name in the filter.

§filter: String

Required. A search query.

The query can specify one or more search keywords, which are used to filter the results,

You can also filter the results using the following message fields:

  • create_time: Accepts a timestamp in RFC-3339 format and the supported comparison operators are: < and >=.
  • sender.name: The resource name of the sender (users/{user}). Only supports =. You can use the e-mail as an alias for {user}. For example, users/example@gmail.com, where example@gmail.com is the e-mail of the Google Chat user.
  • space.name: The resource name of the space where the message is posted. (spaces/{space}). Only supports =. If this filter is not set, the search is performed across all direct messages and spaces the user has access to as a space member.
  • space.display_name: Supports the operator : (has) and filters spaces based on a partial match of their display name. Results are limited to the top five space matches. For example, space.display_name:Project searches for messages in the top five spaces that contain the word “Project” in their display names.
  • attachment: Supports the operator :* (has any) to check for the presence of attachments. If attachment:* is specified, only messages that have at least one attachment are returned.
  • annotations.user_mentions.user.name: The resource name of the mentioned user (users/{user}). Only supports : (has). For example: annotations.user_mentions.user.name:"users/1234567890" returns only messages that contain a mention to the specified user. Alternatively, the alias me can be used to filter for messages that mention the caller user, for example: annotations.user_mentions.user.name:users/me. You can also use the e-mail as an alias for {user}, for example, users/example@gmail.com.

For advanced filtering, the following functions are also available:

  • has_link(): Returns only messages that have at least one hyperlink in the message text.
  • is_unread(): Filters out messages that have been read by the calling user.

Using the space.display_name filter requires that the calling credentials include one of the following authorization scopes:

  • <https://www.googleapis.com/auth/chat.spaces.readonly>
  • <https://www.googleapis.com/auth/chat.spaces>

Using the is_unread() filter requires that the calling credentials include one of the following authorization scopes:

  • <https://www.googleapis.com/auth/chat.users.readstate.readonly>
  • <https://www.googleapis.com/auth/chat.users.readstate>

Across different fields, only AND operators are supported. A valid example is sender.name = "users/1234567890" AND is_unread(). The word AND is optional and is implied if omitted. For example, sender.name = "users/1234567890" is_unread() is valid and is equivalent to the previous example. An invalid example is sender.name = "users/1234567890" OR is_unread() because OR is not supported between different fields.

Among the same field:

  • create_time supports only AND, and can only be used to represent an interval, such as create_time >= "2022-01-01T00:00:00+00:00" AND create_time < "2023-01-01T00:00:00+00:00".
  • sender.name supports only the OR operator, for example: sender.name = "users/1234567890" OR sender.name = "users/0987654321".
  • space.name supports only the OR operator, for example: space.name = "spaces/ABCDEFGH" OR space.name = "spaces/QWERTYUI".
  • space.display_name supports the operators AND and OR, but not a mix of both. For example: space.display_name:Project AND space.display_name:Tasks returns messages that are in spaces with display names containing both Project and Tasks, whereas space.display_name:Project OR space.display_name:Tasks returns messages that are in spaces with display names containing either Project or Tasks or both.
  • annotations.user_mentions.user.name supports the operators AND and OR, but not a mix of both. For example: annotations.user_mentions.user.name:"users/1234567890" AND annotations.user_mentions.user.name:"users/0987654321" returns only messages that mentions both users, whereas annotations.user_mentions.user.name:"users/1234567890" OR annotations.user_mentions.user.name:"users/0987654321" returns messages that mention either user or both.

Parentheses are required to disambiguate operator precedence when combining AND and OR operators in the same query. For example: (sender.name="users/me" OR sender.name="users/123456") AND is_unread(). Otherwise, parentheses are optional.

The following example queries are valid:

"Pending reports" AND create_time >= "2023-01-01T00:00:00Z"

sender.name = "users/example@gmail.com"

annotations.user_mentions.user.name:"users/0987654321"

attachment:* AND space.name = "spaces/ABCDEFGH"

tasks AND is_unread() AND sender.name = "users/1234567890"

"things to do" "urgent"

(sender.name = "users/1234567890")
AND (create_time < "2023-05-01T00:00:00Z")

tasks AND space.name = "spaces/ABCDEFGH" AND has_link()

"project one" is_unread()

space.display_name:Project tasks

The maximum query length is 1,000 characters.

Invalid queries are rejected by the server with an INVALID_ARGUMENT error.

§page_size: i32

Optional. The maximum number of results to return. The service may return fewer than this value.

If unspecified, at most 25 are returned.

The maximum value is 100. If you use a value more than 100, it’s automatically changed to 100.

§page_token: String

Optional. A token, received from the previous search messages call. Provide this parameter to retrieve the subsequent page.

When paginating, all other parameters provided should match the call that provided the page token. Passing different values to the other parameters might lead to unexpected results.

§order_by: String

Optional. How the results list is ordered.

Supported attributes to order by are:

  • create_time: Sorts the results by the time of the message creation. Default value.
  • relevance: Sorts the results by relevance. Developer Preview.

The default ordering is create_time desc. Only a single order per query (create_time or relevance) is supported. Only descending order (desc) is supported, and it must be specified after the order attribute.

§markup_syntax: MarkupSyntax

Optional. Specifies the desired output syntax for the Chat message formatted_text field.

§view: SearchMessagesView

Optional. Specifies what kind of search results view to return. The default is SEARCH_MESSAGES_VIEW_BASIC.

Implementations§

Source§

impl SearchMessagesRequest

Source

pub fn new() -> Self

Creates a new default instance.

Source

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

Sets the value of parent.

§Example
let x = SearchMessagesRequest::new().set_parent(format!("spaces/{space_id}"));
Source

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

Sets the value of filter.

§Example
let x = SearchMessagesRequest::new().set_filter("example");
Source

pub fn set_page_size<T: Into<i32>>(self, v: T) -> Self

Sets the value of page_size.

§Example
let x = SearchMessagesRequest::new().set_page_size(42);
Source

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

Sets the value of page_token.

§Example
let x = SearchMessagesRequest::new().set_page_token("example");
Source

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

Sets the value of order_by.

§Example
let x = SearchMessagesRequest::new().set_order_by("example");
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 = SearchMessagesRequest::new().set_markup_syntax(MarkupSyntax::Chat);
let x1 = SearchMessagesRequest::new().set_markup_syntax(MarkupSyntax::Markdown);
Source

pub fn set_view<T: Into<SearchMessagesView>>(self, v: T) -> Self

Sets the value of view.

§Example
use google_chat_v1::model::search_messages_request::SearchMessagesView;
let x0 = SearchMessagesRequest::new().set_view(SearchMessagesView::Basic);
let x1 = SearchMessagesRequest::new().set_view(SearchMessagesView::Full);

Trait Implementations§

Source§

impl Clone for SearchMessagesRequest

Source§

fn clone(&self) -> SearchMessagesRequest

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 SearchMessagesRequest

Source§

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

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

impl Default for SearchMessagesRequest

Source§

fn default() -> SearchMessagesRequest

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

impl Message for SearchMessagesRequest

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for SearchMessagesRequest

Source§

fn eq(&self, other: &SearchMessagesRequest) -> 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 SearchMessagesRequest

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