public static final class SearchMessagesRequest.Builder extends GeneratedMessage.Builder<SearchMessagesRequest.Builder> implements SearchMessagesRequestOrBuilderRequest message for searching messages.
Protobuf type google.chat.v1.SearchMessagesRequest
Inheritance
java.lang.Object > AbstractMessageLite.Builder<MessageType,BuilderType> > AbstractMessage.Builder<BuilderType> > GeneratedMessage.Builder > SearchMessagesRequest.BuilderImplements
SearchMessagesRequestOrBuilderStatic Methods
getDescriptor()
public static final Descriptors.Descriptor getDescriptor()| Returns | |
|---|---|
| Type | Description |
Descriptor |
|
Methods
build()
public SearchMessagesRequest build()| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest |
|
buildPartial()
public SearchMessagesRequest buildPartial()| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest |
|
clear()
public SearchMessagesRequest.Builder clear()| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
|
clearFilter()
public SearchMessagesRequest.Builder clearFilter()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, whereexample@gmail.comis 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:Projectsearches for messages in the top five spaces that contain the word "Project" in their display names.space.space_type: The type of the space. Only supports=. For example,space.space_type="DIRECT_MESSAGE"returns only messages from direct messages. The possible values areDIRECT_MESSAGE,GROUP_CHAT, andSPACE.attachment: Supports the operator:(has any) to check for the presence of attachments. Ifattachment: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 aliasmecan 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_nameor thespace.space_typefilters requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.spacesUsing the
is_unread()filter requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.users.readstate.readonlyhttps://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_timesupports onlyAND, and can only be used to represent an interval, such ascreate_time >= "2022-01-01T00:00:00+00:00" AND create_time < "2023-01-01T00:00:00+00:00".sender.namesupports only theORoperator, for example:sender.name = "users/1234567890" OR sender.name = "users/0987654321".space.namesupports only theORoperator, for example:space.name = "spaces/ABCDEFGH" OR space.name = "spaces/QWERTYUI".space.display_namesupports the operatorsANDandOR, but not a mix of both. For example:space.display_name:Project AND space.display_name:Tasksreturns messages that are in spaces with display names containing bothProjectandTasks, whereasspace.display_name:Project OR space.display_name:Tasksreturns messages that are in spaces with display names containing eitherProjectorTasksor both.space.space_typesupports only theORoperator, for example:space.space_type = "DIRECT_MESSAGE" OR space.space_type = "GROUP_CHAT".annotations.user_mentions.user.namesupports the operatorsANDandOR, 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, whereasannotations.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
ANDandORoperators 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 tasksThe maximum query length is 1,000 characters.Invalid queries are rejected by the server with anINVALID_ARGUMENT` error.
string filter = 2 [(.google.api.field_behavior) = REQUIRED];
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
clearMarkupSyntax()
public SearchMessagesRequest.Builder clearMarkupSyntax() Optional. Specifies the desired output syntax for the Chat message
formatted_text field.
.google.chat.v1.MarkupSyntax markup_syntax = 6 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
clearOrderBy()
public SearchMessagesRequest.Builder clearOrderBy()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_timeorrelevance) is supported. Only descending order (desc) is supported, and it must be specified after the order attribute.
string order_by = 5 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
clearPageSize()
public SearchMessagesRequest.Builder clearPageSize()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.
int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
clearPageToken()
public SearchMessagesRequest.Builder clearPageToken()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.
string page_token = 4 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
clearParent()
public SearchMessagesRequest.Builder clearParent()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.
string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
clearView()
public SearchMessagesRequest.Builder clearView() Optional. Specifies what kind of search results view to return. The default
is SEARCH_MESSAGES_VIEW_BASIC.
.google.chat.v1.SearchMessagesRequest.SearchMessagesView view = 7 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
getDefaultInstanceForType()
public SearchMessagesRequest getDefaultInstanceForType()| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest |
|
getDescriptorForType()
public Descriptors.Descriptor getDescriptorForType()| Returns | |
|---|---|
| Type | Description |
Descriptor |
|
getFilter()
public String getFilter()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, whereexample@gmail.comis 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:Projectsearches for messages in the top five spaces that contain the word "Project" in their display names.space.space_type: The type of the space. Only supports=. For example,space.space_type="DIRECT_MESSAGE"returns only messages from direct messages. The possible values areDIRECT_MESSAGE,GROUP_CHAT, andSPACE.attachment: Supports the operator:(has any) to check for the presence of attachments. Ifattachment: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 aliasmecan 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_nameor thespace.space_typefilters requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.spacesUsing the
is_unread()filter requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.users.readstate.readonlyhttps://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_timesupports onlyAND, and can only be used to represent an interval, such ascreate_time >= "2022-01-01T00:00:00+00:00" AND create_time < "2023-01-01T00:00:00+00:00".sender.namesupports only theORoperator, for example:sender.name = "users/1234567890" OR sender.name = "users/0987654321".space.namesupports only theORoperator, for example:space.name = "spaces/ABCDEFGH" OR space.name = "spaces/QWERTYUI".space.display_namesupports the operatorsANDandOR, but not a mix of both. For example:space.display_name:Project AND space.display_name:Tasksreturns messages that are in spaces with display names containing bothProjectandTasks, whereasspace.display_name:Project OR space.display_name:Tasksreturns messages that are in spaces with display names containing eitherProjectorTasksor both.space.space_typesupports only theORoperator, for example:space.space_type = "DIRECT_MESSAGE" OR space.space_type = "GROUP_CHAT".annotations.user_mentions.user.namesupports the operatorsANDandOR, 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, whereasannotations.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
ANDandORoperators 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 tasksThe maximum query length is 1,000 characters.Invalid queries are rejected by the server with anINVALID_ARGUMENT` error.
string filter = 2 [(.google.api.field_behavior) = REQUIRED];
| Returns | |
|---|---|
| Type | Description |
String |
The filter. |
getFilterBytes()
public ByteString getFilterBytes()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, whereexample@gmail.comis 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:Projectsearches for messages in the top five spaces that contain the word "Project" in their display names.space.space_type: The type of the space. Only supports=. For example,space.space_type="DIRECT_MESSAGE"returns only messages from direct messages. The possible values areDIRECT_MESSAGE,GROUP_CHAT, andSPACE.attachment: Supports the operator:(has any) to check for the presence of attachments. Ifattachment: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 aliasmecan 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_nameor thespace.space_typefilters requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.spacesUsing the
is_unread()filter requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.users.readstate.readonlyhttps://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_timesupports onlyAND, and can only be used to represent an interval, such ascreate_time >= "2022-01-01T00:00:00+00:00" AND create_time < "2023-01-01T00:00:00+00:00".sender.namesupports only theORoperator, for example:sender.name = "users/1234567890" OR sender.name = "users/0987654321".space.namesupports only theORoperator, for example:space.name = "spaces/ABCDEFGH" OR space.name = "spaces/QWERTYUI".space.display_namesupports the operatorsANDandOR, but not a mix of both. For example:space.display_name:Project AND space.display_name:Tasksreturns messages that are in spaces with display names containing bothProjectandTasks, whereasspace.display_name:Project OR space.display_name:Tasksreturns messages that are in spaces with display names containing eitherProjectorTasksor both.space.space_typesupports only theORoperator, for example:space.space_type = "DIRECT_MESSAGE" OR space.space_type = "GROUP_CHAT".annotations.user_mentions.user.namesupports the operatorsANDandOR, 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, whereasannotations.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
ANDandORoperators 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 tasksThe maximum query length is 1,000 characters.Invalid queries are rejected by the server with anINVALID_ARGUMENT` error.
string filter = 2 [(.google.api.field_behavior) = REQUIRED];
| Returns | |
|---|---|
| Type | Description |
ByteString |
The bytes for filter. |
getMarkupSyntax()
public MarkupSyntax getMarkupSyntax() Optional. Specifies the desired output syntax for the Chat message
formatted_text field.
.google.chat.v1.MarkupSyntax markup_syntax = 6 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
MarkupSyntax |
The markupSyntax. |
getMarkupSyntaxValue()
public int getMarkupSyntaxValue() Optional. Specifies the desired output syntax for the Chat message
formatted_text field.
.google.chat.v1.MarkupSyntax markup_syntax = 6 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
int |
The enum numeric value on the wire for markupSyntax. |
getOrderBy()
public String getOrderBy()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_timeorrelevance) is supported. Only descending order (desc) is supported, and it must be specified after the order attribute.
string order_by = 5 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
String |
The orderBy. |
getOrderByBytes()
public ByteString getOrderByBytes()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_timeorrelevance) is supported. Only descending order (desc) is supported, and it must be specified after the order attribute.
string order_by = 5 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
ByteString |
The bytes for orderBy. |
getPageSize()
public int getPageSize()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.
int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
int |
The pageSize. |
getPageToken()
public String getPageToken()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.
string page_token = 4 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
String |
The pageToken. |
getPageTokenBytes()
public ByteString getPageTokenBytes()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.
string page_token = 4 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
ByteString |
The bytes for pageToken. |
getParent()
public String getParent()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.
string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
| Returns | |
|---|---|
| Type | Description |
String |
The parent. |
getParentBytes()
public ByteString getParentBytes()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.
string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
| Returns | |
|---|---|
| Type | Description |
ByteString |
The bytes for parent. |
getView()
public SearchMessagesRequest.SearchMessagesView getView() Optional. Specifies what kind of search results view to return. The default
is SEARCH_MESSAGES_VIEW_BASIC.
.google.chat.v1.SearchMessagesRequest.SearchMessagesView view = 7 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.SearchMessagesView |
The view. |
getViewValue()
public int getViewValue() Optional. Specifies what kind of search results view to return. The default
is SEARCH_MESSAGES_VIEW_BASIC.
.google.chat.v1.SearchMessagesRequest.SearchMessagesView view = 7 [(.google.api.field_behavior) = OPTIONAL];
| Returns | |
|---|---|
| Type | Description |
int |
The enum numeric value on the wire for view. |
internalGetFieldAccessorTable()
protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()| Returns | |
|---|---|
| Type | Description |
FieldAccessorTable |
|
isInitialized()
public final boolean isInitialized()| Returns | |
|---|---|
| Type | Description |
boolean |
|
mergeFrom(SearchMessagesRequest other)
public SearchMessagesRequest.Builder mergeFrom(SearchMessagesRequest other)| Parameter | |
|---|---|
| Name | Description |
other |
SearchMessagesRequest |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
|
mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
public SearchMessagesRequest.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)| Parameters | |
|---|---|
| Name | Description |
input |
CodedInputStream |
extensionRegistry |
ExtensionRegistryLite |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
mergeFrom(Message other)
public SearchMessagesRequest.Builder mergeFrom(Message other)| Parameter | |
|---|---|
| Name | Description |
other |
Message |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
|
setFilter(String value)
public SearchMessagesRequest.Builder setFilter(String value)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, whereexample@gmail.comis 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:Projectsearches for messages in the top five spaces that contain the word "Project" in their display names.space.space_type: The type of the space. Only supports=. For example,space.space_type="DIRECT_MESSAGE"returns only messages from direct messages. The possible values areDIRECT_MESSAGE,GROUP_CHAT, andSPACE.attachment: Supports the operator:(has any) to check for the presence of attachments. Ifattachment: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 aliasmecan 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_nameor thespace.space_typefilters requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.spacesUsing the
is_unread()filter requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.users.readstate.readonlyhttps://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_timesupports onlyAND, and can only be used to represent an interval, such ascreate_time >= "2022-01-01T00:00:00+00:00" AND create_time < "2023-01-01T00:00:00+00:00".sender.namesupports only theORoperator, for example:sender.name = "users/1234567890" OR sender.name = "users/0987654321".space.namesupports only theORoperator, for example:space.name = "spaces/ABCDEFGH" OR space.name = "spaces/QWERTYUI".space.display_namesupports the operatorsANDandOR, but not a mix of both. For example:space.display_name:Project AND space.display_name:Tasksreturns messages that are in spaces with display names containing bothProjectandTasks, whereasspace.display_name:Project OR space.display_name:Tasksreturns messages that are in spaces with display names containing eitherProjectorTasksor both.space.space_typesupports only theORoperator, for example:space.space_type = "DIRECT_MESSAGE" OR space.space_type = "GROUP_CHAT".annotations.user_mentions.user.namesupports the operatorsANDandOR, 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, whereasannotations.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
ANDandORoperators 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 tasksThe maximum query length is 1,000 characters.Invalid queries are rejected by the server with anINVALID_ARGUMENT` error.
string filter = 2 [(.google.api.field_behavior) = REQUIRED];
| Parameter | |
|---|---|
| Name | Description |
value |
StringThe filter to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setFilterBytes(ByteString value)
public SearchMessagesRequest.Builder setFilterBytes(ByteString value)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, whereexample@gmail.comis 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:Projectsearches for messages in the top five spaces that contain the word "Project" in their display names.space.space_type: The type of the space. Only supports=. For example,space.space_type="DIRECT_MESSAGE"returns only messages from direct messages. The possible values areDIRECT_MESSAGE,GROUP_CHAT, andSPACE.attachment: Supports the operator:(has any) to check for the presence of attachments. Ifattachment: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 aliasmecan 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_nameor thespace.space_typefilters requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.spacesUsing the
is_unread()filter requires that the calling credentials include one of the following authorization scopes:https://www.googleapis.com/auth/chat.users.readstate.readonlyhttps://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_timesupports onlyAND, and can only be used to represent an interval, such ascreate_time >= "2022-01-01T00:00:00+00:00" AND create_time < "2023-01-01T00:00:00+00:00".sender.namesupports only theORoperator, for example:sender.name = "users/1234567890" OR sender.name = "users/0987654321".space.namesupports only theORoperator, for example:space.name = "spaces/ABCDEFGH" OR space.name = "spaces/QWERTYUI".space.display_namesupports the operatorsANDandOR, but not a mix of both. For example:space.display_name:Project AND space.display_name:Tasksreturns messages that are in spaces with display names containing bothProjectandTasks, whereasspace.display_name:Project OR space.display_name:Tasksreturns messages that are in spaces with display names containing eitherProjectorTasksor both.space.space_typesupports only theORoperator, for example:space.space_type = "DIRECT_MESSAGE" OR space.space_type = "GROUP_CHAT".annotations.user_mentions.user.namesupports the operatorsANDandOR, 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, whereasannotations.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
ANDandORoperators 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 tasksThe maximum query length is 1,000 characters.Invalid queries are rejected by the server with anINVALID_ARGUMENT` error.
string filter = 2 [(.google.api.field_behavior) = REQUIRED];
| Parameter | |
|---|---|
| Name | Description |
value |
ByteStringThe bytes for filter to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setMarkupSyntax(MarkupSyntax value)
public SearchMessagesRequest.Builder setMarkupSyntax(MarkupSyntax value) Optional. Specifies the desired output syntax for the Chat message
formatted_text field.
.google.chat.v1.MarkupSyntax markup_syntax = 6 [(.google.api.field_behavior) = OPTIONAL];
| Parameter | |
|---|---|
| Name | Description |
value |
MarkupSyntaxThe markupSyntax to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setMarkupSyntaxValue(int value)
public SearchMessagesRequest.Builder setMarkupSyntaxValue(int value) Optional. Specifies the desired output syntax for the Chat message
formatted_text field.
.google.chat.v1.MarkupSyntax markup_syntax = 6 [(.google.api.field_behavior) = OPTIONAL];
| Parameter | |
|---|---|
| Name | Description |
value |
intThe enum numeric value on the wire for markupSyntax to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setOrderBy(String value)
public SearchMessagesRequest.Builder setOrderBy(String value)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_timeorrelevance) is supported. Only descending order (desc) is supported, and it must be specified after the order attribute.
string order_by = 5 [(.google.api.field_behavior) = OPTIONAL];
| Parameter | |
|---|---|
| Name | Description |
value |
StringThe orderBy to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setOrderByBytes(ByteString value)
public SearchMessagesRequest.Builder setOrderByBytes(ByteString value)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_timeorrelevance) is supported. Only descending order (desc) is supported, and it must be specified after the order attribute.
string order_by = 5 [(.google.api.field_behavior) = OPTIONAL];
| Parameter | |
|---|---|
| Name | Description |
value |
ByteStringThe bytes for orderBy to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setPageSize(int value)
public SearchMessagesRequest.Builder setPageSize(int value)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.
int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL];
| Parameter | |
|---|---|
| Name | Description |
value |
intThe pageSize to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setPageToken(String value)
public SearchMessagesRequest.Builder setPageToken(String value)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.
string page_token = 4 [(.google.api.field_behavior) = OPTIONAL];
| Parameter | |
|---|---|
| Name | Description |
value |
StringThe pageToken to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setPageTokenBytes(ByteString value)
public SearchMessagesRequest.Builder setPageTokenBytes(ByteString value)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.
string page_token = 4 [(.google.api.field_behavior) = OPTIONAL];
| Parameter | |
|---|---|
| Name | Description |
value |
ByteStringThe bytes for pageToken to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setParent(String value)
public SearchMessagesRequest.Builder setParent(String value)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.
string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
| Parameter | |
|---|---|
| Name | Description |
value |
StringThe parent to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setParentBytes(ByteString value)
public SearchMessagesRequest.Builder setParentBytes(ByteString value)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.
string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
| Parameter | |
|---|---|
| Name | Description |
value |
ByteStringThe bytes for parent to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setView(SearchMessagesRequest.SearchMessagesView value)
public SearchMessagesRequest.Builder setView(SearchMessagesRequest.SearchMessagesView value) Optional. Specifies what kind of search results view to return. The default
is SEARCH_MESSAGES_VIEW_BASIC.
.google.chat.v1.SearchMessagesRequest.SearchMessagesView view = 7 [(.google.api.field_behavior) = OPTIONAL];
| Parameter | |
|---|---|
| Name | Description |
value |
SearchMessagesRequest.SearchMessagesViewThe view to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |
setViewValue(int value)
public SearchMessagesRequest.Builder setViewValue(int value) Optional. Specifies what kind of search results view to return. The default
is SEARCH_MESSAGES_VIEW_BASIC.
.google.chat.v1.SearchMessagesRequest.SearchMessagesView view = 7 [(.google.api.field_behavior) = OPTIONAL];
| Parameter | |
|---|---|
| Name | Description |
value |
intThe enum numeric value on the wire for view to set. |
| Returns | |
|---|---|
| Type | Description |
SearchMessagesRequest.Builder |
This builder for chaining. |