All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.chat.v1.ChatServiceClient Maven / Gradle / Ivy

Go to download

Google Chat API The Google Chat API lets you build Chat apps to integrate your services with Google Chat and manage Chat resources such as spaces, members, and messages.

There is a newer version: 0.19.0
Show newest version
/*
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.chat.v1;

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.chat.v1.stub.ChatServiceStub;
import com.google.chat.v1.stub.ChatServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * Service Description: Enables developers to build Chat apps and integrations on Google Chat
 * Platform.
 *
 * 

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
 *   SpaceName parent = SpaceName.of("[SPACE]");
 *   Message message = Message.newBuilder().build();
 *   String messageId = "messageId-1440013438";
 *   Message response = chatServiceClient.createMessage(parent, message, messageId);
 * }
 * }
* *

Note: close() needs to be called on the ChatServiceClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Methods
MethodDescriptionMethod Variants

CreateMessage

Creates a message in a Google Chat space. The maximum message size, including text and cards, is 32,000 bytes. For an example, see [Send a message](https://developers.google.com/workspace/chat/create-messages). *

Calling this method requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and supports the following authentication types: *

- For text messages, user authentication or app authentication are supported. - For card messages, only app authentication is supported. (Only Chat apps can create card messages.)

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • createMessage(CreateMessageRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • createMessage(SpaceName parent, Message message, String messageId) *

  • createMessage(String parent, Message message, String messageId) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • createMessageCallable() *

*

ListMessages

Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listMessages(ListMessagesRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listMessages(SpaceName parent) *

  • listMessages(String parent) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listMessagesPagedCallable() *

  • listMessagesCallable() *

*

ListMemberships

Lists memberships in a space. For an example, see [List users and Google Chat apps in a space](https://developers.google.com/workspace/chat/list-members). Listing memberships with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, including its own. Listing memberships with [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) lists memberships in spaces that the authenticated user has access to. *

Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listMemberships(ListMembershipsRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listMemberships(SpaceName parent) *

  • listMemberships(String parent) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listMembershipsPagedCallable() *

  • listMembershipsCallable() *

*

GetMembership

Returns details about a membership. For an example, see [Get details about a user's or Google Chat app's membership](https://developers.google.com/workspace/chat/get-members). *

Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getMembership(GetMembershipRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getMembership(MembershipName name) *

  • getMembership(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getMembershipCallable() *

*

GetMessage

Returns details about a message. For an example, see [Get details about a message](https://developers.google.com/workspace/chat/get-messages). *

Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). *

Note: Might return a message from a blocked member or space.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getMessage(GetMessageRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getMessage(MessageName name) *

  • getMessage(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getMessageCallable() *

*

UpdateMessage

Updates a message. There's a difference between the `patch` and `update` methods. The `patch` method uses a `patch` request while the `update` method uses a `put` request. We recommend using the `patch` method. For an example, see [Update a message](https://developers.google.com/workspace/chat/update-messages). *

Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). When using app authentication, requests can only update messages created by the calling Chat app.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • updateMessage(UpdateMessageRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • updateMessage(Message message, FieldMask updateMask) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • updateMessageCallable() *

*

DeleteMessage

Deletes a message. For an example, see [Delete a message](https://developers.google.com/workspace/chat/delete-messages). *

Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). When using app authentication, requests can only delete messages created by the calling Chat app.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • deleteMessage(DeleteMessageRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • deleteMessage(MessageName name) *

  • deleteMessage(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • deleteMessageCallable() *

*

GetAttachment

Gets the metadata of a message attachment. The attachment data is fetched using the [media API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download). For an example, see [Get metadata about a message attachment](https://developers.google.com/workspace/chat/get-media-attachments). Requires [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getAttachment(GetAttachmentRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getAttachment(AttachmentName name) *

  • getAttachment(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getAttachmentCallable() *

*

UploadAttachment

Uploads an attachment. For an example, see [Upload media as a file attachment](https://developers.google.com/workspace/chat/upload-media-attachments). Requires user [authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). *

You can upload attachments up to 200 MB. Certain file types aren't supported. For details, see [File types blocked by Google Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • uploadAttachment(UploadAttachmentRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • uploadAttachmentCallable() *

*

ListSpaces

Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see [List spaces](https://developers.google.com/workspace/chat/list-spaces). *

Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). *

Lists spaces visible to the caller or authenticated user. Group chats and DMs aren't listed until the first message is sent. *

To list all named spaces by Google Workspace organization, use the [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) method using Workspace administrator privileges instead.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listSpaces(ListSpacesRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listSpaces() *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listSpacesPagedCallable() *

  • listSpacesCallable() *

*

SearchSpaces

Returns a list of spaces in a Google Workspace organization based on an administrator's search. Requires [user authentication with administrator privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). In the request, set `use_admin_access` to `true`.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • searchSpaces(SearchSpacesRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • searchSpaces() *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • searchSpacesPagedCallable() *

  • searchSpacesCallable() *

*

GetSpace

Returns details about a space. For an example, see [Get details about a space](https://developers.google.com/workspace/chat/get-spaces). *

Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getSpace(GetSpaceRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getSpace(SpaceName name) *

  • getSpace(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getSpaceCallable() *

*

CreateSpace

Creates a named space. Spaces grouped by topics aren't supported. For an example, see [Create a space](https://developers.google.com/workspace/chat/create-spaces). *

If you receive the error message `ALREADY_EXISTS` when creating a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • createSpace(CreateSpaceRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • createSpace(Space space) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • createSpaceCallable() *

*

SetUpSpace

Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified as a membership in the request. For an example, see [Set up a space with initial members](https://developers.google.com/workspace/chat/set-up-spaces). *

To specify the human members to add, add memberships with the appropriate `membership.member.name`. To add a human user, use `users/{user}`, where `{user}` can be the email address for the user. For users in the same Workspace organization `{user}` can also be the `id` for the person from the People API, or the `id` for the user in the Directory API. For example, if the People API Person profile ID for `user{@literal @}example.com` is `123456789`, you can add the user to the space by setting the `membership.member.name` to `users/user{@literal @}example.com` or `users/123456789`. *

To specify the Google groups to add, add memberships with the appropriate `membership.group_member.name`. To add or invite a Google group, use `groups/{group}`, where `{group}` is the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud Identity Groups lookup API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID `123456789` for group email `group{@literal @}example.com`, then you can add the group to the space by setting the `membership.group_member.name` to `groups/123456789`. Group email is not supported, and Google groups can only be added as members in named spaces. *

For a named space or group chat, if the caller blocks, or is blocked by some members, or doesn't have permission to add some members, then those members aren't added to the created space. *

To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn't created. *

To create a DM between the calling user and the calling app, set `Space.singleUserBotDm` to `true` and don't specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see [Invite or add a user or app to a space](https://developers.google.com/workspace/chat/create-members). *

If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned. *

Spaces with threaded replies aren't supported. If you receive the error message `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • setUpSpace(SetUpSpaceRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • setUpSpaceCallable() *

*

UpdateSpace

Updates a space. For an example, see [Update a space](https://developers.google.com/workspace/chat/update-spaces). *

If you're updating the `displayName` field and receive the error message `ALREADY_EXISTS`, try a different display name.. An existing space within the Google Workspace organization might already use this display name. *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • updateSpace(UpdateSpaceRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • updateSpace(Space space, FieldMask updateMask) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • updateSpaceCallable() *

*

DeleteSpace

Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) from a user who has permission to delete the space.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • deleteSpace(DeleteSpaceRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • deleteSpace(SpaceName name) *

  • deleteSpace(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • deleteSpaceCallable() *

*

CompleteImportSpace

Completes the [import process](https://developers.google.com/workspace/chat/import-data) for the specified space and makes it visible to users. Requires app authentication and domain-wide delegation. For more information, see [Authorize Google Chat apps to import data](https://developers.google.com/workspace/chat/authorize-import).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • completeImportSpace(CompleteImportSpaceRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • completeImportSpaceCallable() *

*

FindDirectMessage

Returns the existing direct message with the specified user. If no direct message space is found, returns a `404 NOT_FOUND` error. For an example, see [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message). *

With [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), returns the direct message space between the specified user and the authenticated user. *

With [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), returns the direct message space between the specified user and the calling Chat app. *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) or [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • findDirectMessage(FindDirectMessageRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • findDirectMessageCallable() *

*

CreateMembership

Creates a human membership or app membership for the calling app. Creating memberships for other apps isn't supported. For an example, see [Invite or add a user or a Google Chat app to a space](https://developers.google.com/workspace/chat/create-members). When creating a membership, if the specified member has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified space. Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). *

To specify the member to add, set the `membership.member.name` for the human or app member, or set the `membership.group_member.name` for the group member. *

- To add the calling app to a space or a direct message between two human users, use `users/app`. Unable to add other apps to the space. *

- To add a human user, use `users/{user}`, where `{user}` can be the email address for the user. For users in the same Workspace organization `{user}` can also be the `id` for the person from the People API, or the `id` for the user in the Directory API. For example, if the People API Person profile ID for `user{@literal @}example.com` is `123456789`, you can add the user to the space by setting the `membership.member.name` to `users/user{@literal @}example.com` or `users/123456789`. *

- To add or invite a Google group in a named space, use `groups/{group}`, where `{group}` is the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud Identity Groups lookup API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID `123456789` for group email `group{@literal @}example.com`, then you can add or invite the group to a named space by setting the `membership.group_member.name` to `groups/123456789`. Group email is not supported, and Google groups can only be added as members in named spaces.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • createMembership(CreateMembershipRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • createMembership(SpaceName parent, Membership membership) *

  • createMembership(String parent, Membership membership) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • createMembershipCallable() *

*

UpdateMembership

Updates a membership. For an example, see [Update a user's membership in a space](https://developers.google.com/workspace/chat/update-members). *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • updateMembership(UpdateMembershipRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • updateMembership(Membership membership, FieldMask updateMask) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • updateMembershipCallable() *

*

DeleteMembership

Deletes a membership. For an example, see [Remove a user or a Google Chat app from a space](https://developers.google.com/workspace/chat/delete-members). *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • deleteMembership(DeleteMembershipRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • deleteMembership(MembershipName name) *

  • deleteMembership(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • deleteMembershipCallable() *

*

CreateReaction

Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, see [Add a reaction to a message](https://developers.google.com/workspace/chat/create-reactions). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • createReaction(CreateReactionRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • createReaction(MessageName parent, Reaction reaction) *

  • createReaction(String parent, Reaction reaction) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • createReactionCallable() *

*

ListReactions

Lists reactions to a message. For an example, see [List reactions for a message](https://developers.google.com/workspace/chat/list-reactions). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listReactions(ListReactionsRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listReactions(MessageName parent) *

  • listReactions(String parent) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listReactionsPagedCallable() *

  • listReactionsCallable() *

*

DeleteReaction

Deletes a reaction to a message. Only unicode emojis are supported. For an example, see [Delete a reaction](https://developers.google.com/workspace/chat/delete-reactions). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • deleteReaction(DeleteReactionRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • deleteReaction(ReactionName name) *

  • deleteReaction(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • deleteReactionCallable() *

*

GetSpaceReadState

Returns details about a user's read state within a space, used to identify read and unread messages. For an example, see [Get details about a user's space read state](https://developers.google.com/workspace/chat/get-space-read-state). *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getSpaceReadState(GetSpaceReadStateRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getSpaceReadState(SpaceReadStateName name) *

  • getSpaceReadState(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getSpaceReadStateCallable() *

*

UpdateSpaceReadState

Updates a user's read state within a space, used to identify read and unread messages. For an example, see [Update a user's space read state](https://developers.google.com/workspace/chat/update-space-read-state). *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • updateSpaceReadState(UpdateSpaceReadStateRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • updateSpaceReadState(SpaceReadState spaceReadState, FieldMask updateMask) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • updateSpaceReadStateCallable() *

*

GetThreadReadState

Returns details about a user's read state within a thread, used to identify read and unread messages. For an example, see [Get details about a user's thread read state](https://developers.google.com/workspace/chat/get-thread-read-state). *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getThreadReadState(GetThreadReadStateRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getThreadReadState(ThreadReadStateName name) *

  • getThreadReadState(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getThreadReadStateCallable() *

*

GetSpaceEvent

Returns an event from a Google Chat space. The [event payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) contains the most recent version of the resource that changed. For example, if you request an event about a new message but the message was later updated, the server returns the updated `Message` resource in the event payload. *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). To get an event, the authenticated user must be a member of the space. *

For an example, see [Get details about an event from a Google Chat space](https://developers.google.com/workspace/chat/get-space-event).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getSpaceEvent(GetSpaceEventRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getSpaceEvent(SpaceEventName name) *

  • getSpaceEvent(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getSpaceEventCallable() *

*

ListSpaceEvents

Lists events from a Google Chat space. For each event, the [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) contains the most recent version of the Chat resource. For example, if you list events about new space members, the server returns `Membership` resources that contain the latest membership details. If new members were removed during the requested period, the event payload contains an empty `Membership` resource. *

Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). To list events, the authenticated user must be a member of the space. *

For an example, see [List events from a Google Chat space](https://developers.google.com/workspace/chat/list-space-events).

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listSpaceEvents(ListSpaceEventsRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listSpaceEvents(SpaceName parent, String filter) *

  • listSpaceEvents(String parent, String filter) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listSpaceEventsPagedCallable() *

  • listSpaceEventsCallable() *

*
* *

See the individual methods for example code. * *

Many parameters require resource names to be formatted in a particular way. To assist with * these names, this class includes a format method for each type of name, and additionally a parse * method to extract the individual identifiers contained within names that are returned. * *

This class can be customized by passing in a custom instance of ChatServiceSettings to * create(). For example: * *

To customize credentials: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * ChatServiceSettings chatServiceSettings =
 *     ChatServiceSettings.newBuilder()
 *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
 *         .build();
 * ChatServiceClient chatServiceClient = ChatServiceClient.create(chatServiceSettings);
 * }
* *

To customize the endpoint: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * ChatServiceSettings chatServiceSettings =
 *     ChatServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 * ChatServiceClient chatServiceClient = ChatServiceClient.create(chatServiceSettings);
 * }
* *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over * the wire: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * ChatServiceSettings chatServiceSettings = ChatServiceSettings.newHttpJsonBuilder().build();
 * ChatServiceClient chatServiceClient = ChatServiceClient.create(chatServiceSettings);
 * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class ChatServiceClient implements BackgroundResource { private final ChatServiceSettings settings; private final ChatServiceStub stub; /** Constructs an instance of ChatServiceClient with default settings. */ public static final ChatServiceClient create() throws IOException { return create(ChatServiceSettings.newBuilder().build()); } /** * Constructs an instance of ChatServiceClient, using the given settings. The channels are created * based on the settings passed in, or defaults for any settings that are not set. */ public static final ChatServiceClient create(ChatServiceSettings settings) throws IOException { return new ChatServiceClient(settings); } /** * Constructs an instance of ChatServiceClient, using the given stub for making calls. This is for * advanced usage - prefer using create(ChatServiceSettings). */ public static final ChatServiceClient create(ChatServiceStub stub) { return new ChatServiceClient(stub); } /** * Constructs an instance of ChatServiceClient, using the given settings. This is protected so * that it is easy to make a subclass, but otherwise, the static factory methods should be * preferred. */ protected ChatServiceClient(ChatServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((ChatServiceStubSettings) settings.getStubSettings()).createStub(); } protected ChatServiceClient(ChatServiceStub stub) { this.settings = null; this.stub = stub; } public final ChatServiceSettings getSettings() { return settings; } public ChatServiceStub getStub() { return stub; } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a message in a Google Chat space. The maximum message size, including text and cards, * is 32,000 bytes. For an example, see [Send a * message](https://developers.google.com/workspace/chat/create-messages). * *

Calling this method requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and * supports the following authentication types: * *

- For text messages, user authentication or app authentication are supported. - For card * messages, only app authentication is supported. (Only Chat apps can create card messages.) * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceName parent = SpaceName.of("[SPACE]");
   *   Message message = Message.newBuilder().build();
   *   String messageId = "messageId-1440013438";
   *   Message response = chatServiceClient.createMessage(parent, message, messageId);
   * }
   * }
* * @param parent Required. The resource name of the space in which to create a message. *

Format: `spaces/{space}` * @param message Required. Message body. * @param messageId Optional. A custom ID for a message. Lets Chat apps get, update, or delete a * message without needing to store the system-assigned ID in the message's resource name * (represented in the message `name` field). *

The value for this field must meet the following requirements: *

    *
  • Begins with `client-`. For example, `client-custom-name` is a valid custom ID, but * `custom-name` is not. *
  • Contains up to 63 characters and only lowercase letters, numbers, and hyphens. *
  • Is unique within a space. A Chat app can't use the same custom ID for different * messages. *
*

For details, see [Name a * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Message createMessage(SpaceName parent, Message message, String messageId) { CreateMessageRequest request = CreateMessageRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setMessage(message) .setMessageId(messageId) .build(); return createMessage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a message in a Google Chat space. The maximum message size, including text and cards, * is 32,000 bytes. For an example, see [Send a * message](https://developers.google.com/workspace/chat/create-messages). * *

Calling this method requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and * supports the following authentication types: * *

- For text messages, user authentication or app authentication are supported. - For card * messages, only app authentication is supported. (Only Chat apps can create card messages.) * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String parent = SpaceName.of("[SPACE]").toString();
   *   Message message = Message.newBuilder().build();
   *   String messageId = "messageId-1440013438";
   *   Message response = chatServiceClient.createMessage(parent, message, messageId);
   * }
   * }
* * @param parent Required. The resource name of the space in which to create a message. *

Format: `spaces/{space}` * @param message Required. Message body. * @param messageId Optional. A custom ID for a message. Lets Chat apps get, update, or delete a * message without needing to store the system-assigned ID in the message's resource name * (represented in the message `name` field). *

The value for this field must meet the following requirements: *

    *
  • Begins with `client-`. For example, `client-custom-name` is a valid custom ID, but * `custom-name` is not. *
  • Contains up to 63 characters and only lowercase letters, numbers, and hyphens. *
  • Is unique within a space. A Chat app can't use the same custom ID for different * messages. *
*

For details, see [Name a * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Message createMessage(String parent, Message message, String messageId) { CreateMessageRequest request = CreateMessageRequest.newBuilder() .setParent(parent) .setMessage(message) .setMessageId(messageId) .build(); return createMessage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a message in a Google Chat space. The maximum message size, including text and cards, * is 32,000 bytes. For an example, see [Send a * message](https://developers.google.com/workspace/chat/create-messages). * *

Calling this method requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and * supports the following authentication types: * *

- For text messages, user authentication or app authentication are supported. - For card * messages, only app authentication is supported. (Only Chat apps can create card messages.) * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CreateMessageRequest request =
   *       CreateMessageRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setMessage(Message.newBuilder().build())
   *           .setThreadKey("threadKey-1562254347")
   *           .setRequestId("requestId693933066")
   *           .setMessageId("messageId-1440013438")
   *           .build();
   *   Message response = chatServiceClient.createMessage(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Message createMessage(CreateMessageRequest request) { return createMessageCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a message in a Google Chat space. The maximum message size, including text and cards, * is 32,000 bytes. For an example, see [Send a * message](https://developers.google.com/workspace/chat/create-messages). * *

Calling this method requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and * supports the following authentication types: * *

- For text messages, user authentication or app authentication are supported. - For card * messages, only app authentication is supported. (Only Chat apps can create card messages.) * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CreateMessageRequest request =
   *       CreateMessageRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setMessage(Message.newBuilder().build())
   *           .setThreadKey("threadKey-1562254347")
   *           .setRequestId("requestId693933066")
   *           .setMessageId("messageId-1440013438")
   *           .build();
   *   ApiFuture future = chatServiceClient.createMessageCallable().futureCall(request);
   *   // Do something.
   *   Message response = future.get();
   * }
   * }
*/ public final UnaryCallable createMessageCallable() { return stub.createMessageCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists messages in a space that the caller is a member of, including messages from blocked * members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list). * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceName parent = SpaceName.of("[SPACE]");
   *   for (Message element : chatServiceClient.listMessages(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the space to list messages from. *

Format: `spaces/{space}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListMessagesPagedResponse listMessages(SpaceName parent) { ListMessagesRequest request = ListMessagesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listMessages(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists messages in a space that the caller is a member of, including messages from blocked * members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list). * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String parent = SpaceName.of("[SPACE]").toString();
   *   for (Message element : chatServiceClient.listMessages(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the space to list messages from. *

Format: `spaces/{space}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListMessagesPagedResponse listMessages(String parent) { ListMessagesRequest request = ListMessagesRequest.newBuilder().setParent(parent).build(); return listMessages(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists messages in a space that the caller is a member of, including messages from blocked * members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list). * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListMessagesRequest request =
   *       ListMessagesRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .setOrderBy("orderBy-1207110587")
   *           .setShowDeleted(true)
   *           .build();
   *   for (Message element : chatServiceClient.listMessages(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListMessagesPagedResponse listMessages(ListMessagesRequest request) { return listMessagesPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists messages in a space that the caller is a member of, including messages from blocked * members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list). * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListMessagesRequest request =
   *       ListMessagesRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .setOrderBy("orderBy-1207110587")
   *           .setShowDeleted(true)
   *           .build();
   *   ApiFuture future = chatServiceClient.listMessagesPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Message element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listMessagesPagedCallable() { return stub.listMessagesPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists messages in a space that the caller is a member of, including messages from blocked * members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list). * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListMessagesRequest request =
   *       ListMessagesRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .setOrderBy("orderBy-1207110587")
   *           .setShowDeleted(true)
   *           .build();
   *   while (true) {
   *     ListMessagesResponse response = chatServiceClient.listMessagesCallable().call(request);
   *     for (Message element : response.getMessagesList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listMessagesCallable() { return stub.listMessagesCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists memberships in a space. For an example, see [List users and Google Chat apps in a * space](https://developers.google.com/workspace/chat/list-members). Listing memberships with * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, * including its own. Listing memberships with [User * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * lists memberships in spaces that the authenticated user has access to. * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceName parent = SpaceName.of("[SPACE]");
   *   for (Membership element : chatServiceClient.listMemberships(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the space for which to fetch a membership list. *

Format: spaces/{space} * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListMembershipsPagedResponse listMemberships(SpaceName parent) { ListMembershipsRequest request = ListMembershipsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listMemberships(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists memberships in a space. For an example, see [List users and Google Chat apps in a * space](https://developers.google.com/workspace/chat/list-members). Listing memberships with * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, * including its own. Listing memberships with [User * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * lists memberships in spaces that the authenticated user has access to. * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String parent = SpaceName.of("[SPACE]").toString();
   *   for (Membership element : chatServiceClient.listMemberships(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the space for which to fetch a membership list. *

Format: spaces/{space} * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListMembershipsPagedResponse listMemberships(String parent) { ListMembershipsRequest request = ListMembershipsRequest.newBuilder().setParent(parent).build(); return listMemberships(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists memberships in a space. For an example, see [List users and Google Chat apps in a * space](https://developers.google.com/workspace/chat/list-members). Listing memberships with * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, * including its own. Listing memberships with [User * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * lists memberships in spaces that the authenticated user has access to. * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListMembershipsRequest request =
   *       ListMembershipsRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .setShowGroups(true)
   *           .setShowInvited(true)
   *           .setUseAdminAccess(true)
   *           .build();
   *   for (Membership element : chatServiceClient.listMemberships(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListMembershipsPagedResponse listMemberships(ListMembershipsRequest request) { return listMembershipsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists memberships in a space. For an example, see [List users and Google Chat apps in a * space](https://developers.google.com/workspace/chat/list-members). Listing memberships with * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, * including its own. Listing memberships with [User * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * lists memberships in spaces that the authenticated user has access to. * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListMembershipsRequest request =
   *       ListMembershipsRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .setShowGroups(true)
   *           .setShowInvited(true)
   *           .setUseAdminAccess(true)
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.listMembershipsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Membership element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listMembershipsPagedCallable() { return stub.listMembershipsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists memberships in a space. For an example, see [List users and Google Chat apps in a * space](https://developers.google.com/workspace/chat/list-members). Listing memberships with * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, * including its own. Listing memberships with [User * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * lists memberships in spaces that the authenticated user has access to. * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListMembershipsRequest request =
   *       ListMembershipsRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .setShowGroups(true)
   *           .setShowInvited(true)
   *           .setUseAdminAccess(true)
   *           .build();
   *   while (true) {
   *     ListMembershipsResponse response =
   *         chatServiceClient.listMembershipsCallable().call(request);
   *     for (Membership element : response.getMembershipsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listMembershipsCallable() { return stub.listMembershipsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a membership. For an example, see [Get details about a user's or Google * Chat app's membership](https://developers.google.com/workspace/chat/get-members). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   MembershipName name = MembershipName.of("[SPACE]", "[MEMBER]");
   *   Membership response = chatServiceClient.getMembership(name);
   * }
   * }
* * @param name Required. Resource name of the membership to retrieve. *

To get the app's own membership [by using user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), * you can optionally use `spaces/{space}/members/app`. *

Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app` *

When [authenticated as a * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), you * can use the user's email as an alias for `{member}`. For example, * `spaces/{space}/members/example{@literal @}gmail.com` where `example{@literal @}gmail.com` * is the email of the Google Chat user. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership getMembership(MembershipName name) { GetMembershipRequest request = GetMembershipRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getMembership(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a membership. For an example, see [Get details about a user's or Google * Chat app's membership](https://developers.google.com/workspace/chat/get-members). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = MembershipName.of("[SPACE]", "[MEMBER]").toString();
   *   Membership response = chatServiceClient.getMembership(name);
   * }
   * }
* * @param name Required. Resource name of the membership to retrieve. *

To get the app's own membership [by using user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), * you can optionally use `spaces/{space}/members/app`. *

Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app` *

When [authenticated as a * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), you * can use the user's email as an alias for `{member}`. For example, * `spaces/{space}/members/example{@literal @}gmail.com` where `example{@literal @}gmail.com` * is the email of the Google Chat user. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership getMembership(String name) { GetMembershipRequest request = GetMembershipRequest.newBuilder().setName(name).build(); return getMembership(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a membership. For an example, see [Get details about a user's or Google * Chat app's membership](https://developers.google.com/workspace/chat/get-members). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetMembershipRequest request =
   *       GetMembershipRequest.newBuilder()
   *           .setName(MembershipName.of("[SPACE]", "[MEMBER]").toString())
   *           .setUseAdminAccess(true)
   *           .build();
   *   Membership response = chatServiceClient.getMembership(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership getMembership(GetMembershipRequest request) { return getMembershipCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a membership. For an example, see [Get details about a user's or Google * Chat app's membership](https://developers.google.com/workspace/chat/get-members). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetMembershipRequest request =
   *       GetMembershipRequest.newBuilder()
   *           .setName(MembershipName.of("[SPACE]", "[MEMBER]").toString())
   *           .setUseAdminAccess(true)
   *           .build();
   *   ApiFuture future = chatServiceClient.getMembershipCallable().futureCall(request);
   *   // Do something.
   *   Membership response = future.get();
   * }
   * }
*/ public final UnaryCallable getMembershipCallable() { return stub.getMembershipCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a message. For an example, see [Get details about a * message](https://developers.google.com/workspace/chat/get-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Note: Might return a message from a blocked member or space. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   MessageName name = MessageName.of("[SPACE]", "[MESSAGE]");
   *   Message response = chatServiceClient.getMessage(name);
   * }
   * }
* * @param name Required. Resource name of the message. *

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

If you've set a custom ID for your message, you can use the value from the * `clientAssignedMessageId` field for `{message}`. For details, see [Name a message] * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Message getMessage(MessageName name) { GetMessageRequest request = GetMessageRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getMessage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a message. For an example, see [Get details about a * message](https://developers.google.com/workspace/chat/get-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Note: Might return a message from a blocked member or space. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = MessageName.of("[SPACE]", "[MESSAGE]").toString();
   *   Message response = chatServiceClient.getMessage(name);
   * }
   * }
* * @param name Required. Resource name of the message. *

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

If you've set a custom ID for your message, you can use the value from the * `clientAssignedMessageId` field for `{message}`. For details, see [Name a message] * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Message getMessage(String name) { GetMessageRequest request = GetMessageRequest.newBuilder().setName(name).build(); return getMessage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a message. For an example, see [Get details about a * message](https://developers.google.com/workspace/chat/get-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Note: Might return a message from a blocked member or space. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetMessageRequest request =
   *       GetMessageRequest.newBuilder()
   *           .setName(MessageName.of("[SPACE]", "[MESSAGE]").toString())
   *           .build();
   *   Message response = chatServiceClient.getMessage(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Message getMessage(GetMessageRequest request) { return getMessageCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a message. For an example, see [Get details about a * message](https://developers.google.com/workspace/chat/get-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Note: Might return a message from a blocked member or space. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetMessageRequest request =
   *       GetMessageRequest.newBuilder()
   *           .setName(MessageName.of("[SPACE]", "[MESSAGE]").toString())
   *           .build();
   *   ApiFuture future = chatServiceClient.getMessageCallable().futureCall(request);
   *   // Do something.
   *   Message response = future.get();
   * }
   * }
*/ public final UnaryCallable getMessageCallable() { return stub.getMessageCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a message. There's a difference between the `patch` and `update` methods. The `patch` * method uses a `patch` request while the `update` method uses a `put` request. We recommend * using the `patch` method. For an example, see [Update a * message](https://developers.google.com/workspace/chat/update-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * When using app authentication, requests can only update messages created by the calling Chat * app. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   Message message = Message.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   Message response = chatServiceClient.updateMessage(message, updateMask);
   * }
   * }
* * @param message Required. Message with fields updated. * @param updateMask Required. The field paths to update. Separate multiple values with commas or * use `*` to update all field paths. *

Currently supported field paths: *

- `text` *

- `attachment` *

- `cards` (Requires [app authentication](/chat/api/guides/auth/service-accounts).) *

- `cards_v2` (Requires [app authentication](/chat/api/guides/auth/service-accounts).) *

- `accessory_widgets` (Requires [app * authentication](/chat/api/guides/auth/service-accounts).) * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Message updateMessage(Message message, FieldMask updateMask) { UpdateMessageRequest request = UpdateMessageRequest.newBuilder().setMessage(message).setUpdateMask(updateMask).build(); return updateMessage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a message. There's a difference between the `patch` and `update` methods. The `patch` * method uses a `patch` request while the `update` method uses a `put` request. We recommend * using the `patch` method. For an example, see [Update a * message](https://developers.google.com/workspace/chat/update-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * When using app authentication, requests can only update messages created by the calling Chat * app. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UpdateMessageRequest request =
   *       UpdateMessageRequest.newBuilder()
   *           .setMessage(Message.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .setAllowMissing(true)
   *           .build();
   *   Message response = chatServiceClient.updateMessage(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Message updateMessage(UpdateMessageRequest request) { return updateMessageCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a message. There's a difference between the `patch` and `update` methods. The `patch` * method uses a `patch` request while the `update` method uses a `put` request. We recommend * using the `patch` method. For an example, see [Update a * message](https://developers.google.com/workspace/chat/update-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * When using app authentication, requests can only update messages created by the calling Chat * app. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UpdateMessageRequest request =
   *       UpdateMessageRequest.newBuilder()
   *           .setMessage(Message.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .setAllowMissing(true)
   *           .build();
   *   ApiFuture future = chatServiceClient.updateMessageCallable().futureCall(request);
   *   // Do something.
   *   Message response = future.get();
   * }
   * }
*/ public final UnaryCallable updateMessageCallable() { return stub.updateMessageCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a message. For an example, see [Delete a * message](https://developers.google.com/workspace/chat/delete-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * When using app authentication, requests can only delete messages created by the calling Chat * app. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   MessageName name = MessageName.of("[SPACE]", "[MESSAGE]");
   *   chatServiceClient.deleteMessage(name);
   * }
   * }
* * @param name Required. Resource name of the message. *

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

If you've set a custom ID for your message, you can use the value from the * `clientAssignedMessageId` field for `{message}`. For details, see [Name a message] * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteMessage(MessageName name) { DeleteMessageRequest request = DeleteMessageRequest.newBuilder().setName(name == null ? null : name.toString()).build(); deleteMessage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a message. For an example, see [Delete a * message](https://developers.google.com/workspace/chat/delete-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * When using app authentication, requests can only delete messages created by the calling Chat * app. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = MessageName.of("[SPACE]", "[MESSAGE]").toString();
   *   chatServiceClient.deleteMessage(name);
   * }
   * }
* * @param name Required. Resource name of the message. *

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

If you've set a custom ID for your message, you can use the value from the * `clientAssignedMessageId` field for `{message}`. For details, see [Name a message] * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteMessage(String name) { DeleteMessageRequest request = DeleteMessageRequest.newBuilder().setName(name).build(); deleteMessage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a message. For an example, see [Delete a * message](https://developers.google.com/workspace/chat/delete-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * When using app authentication, requests can only delete messages created by the calling Chat * app. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   DeleteMessageRequest request =
   *       DeleteMessageRequest.newBuilder()
   *           .setName(MessageName.of("[SPACE]", "[MESSAGE]").toString())
   *           .setForce(true)
   *           .build();
   *   chatServiceClient.deleteMessage(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteMessage(DeleteMessageRequest request) { deleteMessageCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a message. For an example, see [Delete a * message](https://developers.google.com/workspace/chat/delete-messages). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * When using app authentication, requests can only delete messages created by the calling Chat * app. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   DeleteMessageRequest request =
   *       DeleteMessageRequest.newBuilder()
   *           .setName(MessageName.of("[SPACE]", "[MESSAGE]").toString())
   *           .setForce(true)
   *           .build();
   *   ApiFuture future = chatServiceClient.deleteMessageCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteMessageCallable() { return stub.deleteMessageCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the metadata of a message attachment. The attachment data is fetched using the [media * API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download). For an * example, see [Get metadata about a message * attachment](https://developers.google.com/workspace/chat/get-media-attachments). Requires [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   AttachmentName name = AttachmentName.of("[SPACE]", "[MESSAGE]", "[ATTACHMENT]");
   *   Attachment response = chatServiceClient.getAttachment(name);
   * }
   * }
* * @param name Required. Resource name of the attachment, in the form * `spaces/{space}/messages/{message}/attachments/{attachment}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Attachment getAttachment(AttachmentName name) { GetAttachmentRequest request = GetAttachmentRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getAttachment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the metadata of a message attachment. The attachment data is fetched using the [media * API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download). For an * example, see [Get metadata about a message * attachment](https://developers.google.com/workspace/chat/get-media-attachments). Requires [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = AttachmentName.of("[SPACE]", "[MESSAGE]", "[ATTACHMENT]").toString();
   *   Attachment response = chatServiceClient.getAttachment(name);
   * }
   * }
* * @param name Required. Resource name of the attachment, in the form * `spaces/{space}/messages/{message}/attachments/{attachment}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Attachment getAttachment(String name) { GetAttachmentRequest request = GetAttachmentRequest.newBuilder().setName(name).build(); return getAttachment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the metadata of a message attachment. The attachment data is fetched using the [media * API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download). For an * example, see [Get metadata about a message * attachment](https://developers.google.com/workspace/chat/get-media-attachments). Requires [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetAttachmentRequest request =
   *       GetAttachmentRequest.newBuilder()
   *           .setName(AttachmentName.of("[SPACE]", "[MESSAGE]", "[ATTACHMENT]").toString())
   *           .build();
   *   Attachment response = chatServiceClient.getAttachment(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Attachment getAttachment(GetAttachmentRequest request) { return getAttachmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the metadata of a message attachment. The attachment data is fetched using the [media * API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download). For an * example, see [Get metadata about a message * attachment](https://developers.google.com/workspace/chat/get-media-attachments). Requires [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetAttachmentRequest request =
   *       GetAttachmentRequest.newBuilder()
   *           .setName(AttachmentName.of("[SPACE]", "[MESSAGE]", "[ATTACHMENT]").toString())
   *           .build();
   *   ApiFuture future = chatServiceClient.getAttachmentCallable().futureCall(request);
   *   // Do something.
   *   Attachment response = future.get();
   * }
   * }
*/ public final UnaryCallable getAttachmentCallable() { return stub.getAttachmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Uploads an attachment. For an example, see [Upload media as a file * attachment](https://developers.google.com/workspace/chat/upload-media-attachments). Requires * user * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

You can upload attachments up to 200 MB. Certain file types aren't supported. For details, * see [File types blocked by Google * Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UploadAttachmentRequest request =
   *       UploadAttachmentRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setFilename("filename-734768633")
   *           .build();
   *   UploadAttachmentResponse response = chatServiceClient.uploadAttachment(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final UploadAttachmentResponse uploadAttachment(UploadAttachmentRequest request) { return uploadAttachmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Uploads an attachment. For an example, see [Upload media as a file * attachment](https://developers.google.com/workspace/chat/upload-media-attachments). Requires * user * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

You can upload attachments up to 200 MB. Certain file types aren't supported. For details, * see [File types blocked by Google * Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UploadAttachmentRequest request =
   *       UploadAttachmentRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setFilename("filename-734768633")
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.uploadAttachmentCallable().futureCall(request);
   *   // Do something.
   *   UploadAttachmentResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable uploadAttachmentCallable() { return stub.uploadAttachmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first * message is sent. For an example, see [List * spaces](https://developers.google.com/workspace/chat/list-spaces). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Lists spaces visible to the caller or authenticated user. Group chats and DMs aren't listed * until the first message is sent. * *

To list all named spaces by Google Workspace organization, use the * [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) * method using Workspace administrator privileges instead. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   for (Space element : chatServiceClient.listSpaces().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListSpacesPagedResponse listSpaces() { ListSpacesRequest request = ListSpacesRequest.newBuilder().build(); return listSpaces(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first * message is sent. For an example, see [List * spaces](https://developers.google.com/workspace/chat/list-spaces). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Lists spaces visible to the caller or authenticated user. Group chats and DMs aren't listed * until the first message is sent. * *

To list all named spaces by Google Workspace organization, use the * [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) * method using Workspace administrator privileges instead. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListSpacesRequest request =
   *       ListSpacesRequest.newBuilder()
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   for (Space element : chatServiceClient.listSpaces(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListSpacesPagedResponse listSpaces(ListSpacesRequest request) { return listSpacesPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first * message is sent. For an example, see [List * spaces](https://developers.google.com/workspace/chat/list-spaces). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Lists spaces visible to the caller or authenticated user. Group chats and DMs aren't listed * until the first message is sent. * *

To list all named spaces by Google Workspace organization, use the * [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) * method using Workspace administrator privileges instead. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListSpacesRequest request =
   *       ListSpacesRequest.newBuilder()
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   ApiFuture future = chatServiceClient.listSpacesPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Space element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listSpacesPagedCallable() { return stub.listSpacesPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first * message is sent. For an example, see [List * spaces](https://developers.google.com/workspace/chat/list-spaces). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Lists spaces visible to the caller or authenticated user. Group chats and DMs aren't listed * until the first message is sent. * *

To list all named spaces by Google Workspace organization, use the * [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) * method using Workspace administrator privileges instead. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListSpacesRequest request =
   *       ListSpacesRequest.newBuilder()
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   while (true) {
   *     ListSpacesResponse response = chatServiceClient.listSpacesCallable().call(request);
   *     for (Space element : response.getSpacesList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listSpacesCallable() { return stub.listSpacesCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of spaces in a Google Workspace organization based on an administrator's search. * Requires [user authentication with administrator * privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). * In the request, set `use_admin_access` to `true`. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   for (Space element : chatServiceClient.searchSpaces().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SearchSpacesPagedResponse searchSpaces() { SearchSpacesRequest request = SearchSpacesRequest.newBuilder().build(); return searchSpaces(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of spaces in a Google Workspace organization based on an administrator's search. * Requires [user authentication with administrator * privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). * In the request, set `use_admin_access` to `true`. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SearchSpacesRequest request =
   *       SearchSpacesRequest.newBuilder()
   *           .setUseAdminAccess(true)
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setQuery("query107944136")
   *           .setOrderBy("orderBy-1207110587")
   *           .build();
   *   for (Space element : chatServiceClient.searchSpaces(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SearchSpacesPagedResponse searchSpaces(SearchSpacesRequest request) { return searchSpacesPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of spaces in a Google Workspace organization based on an administrator's search. * Requires [user authentication with administrator * privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). * In the request, set `use_admin_access` to `true`. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SearchSpacesRequest request =
   *       SearchSpacesRequest.newBuilder()
   *           .setUseAdminAccess(true)
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setQuery("query107944136")
   *           .setOrderBy("orderBy-1207110587")
   *           .build();
   *   ApiFuture future = chatServiceClient.searchSpacesPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Space element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable searchSpacesPagedCallable() { return stub.searchSpacesPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of spaces in a Google Workspace organization based on an administrator's search. * Requires [user authentication with administrator * privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). * In the request, set `use_admin_access` to `true`. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SearchSpacesRequest request =
   *       SearchSpacesRequest.newBuilder()
   *           .setUseAdminAccess(true)
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setQuery("query107944136")
   *           .setOrderBy("orderBy-1207110587")
   *           .build();
   *   while (true) {
   *     SearchSpacesResponse response = chatServiceClient.searchSpacesCallable().call(request);
   *     for (Space element : response.getSpacesList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable searchSpacesCallable() { return stub.searchSpacesCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a space. For an example, see [Get details about a * space](https://developers.google.com/workspace/chat/get-spaces). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceName name = SpaceName.of("[SPACE]");
   *   Space response = chatServiceClient.getSpace(name);
   * }
   * }
* * @param name Required. Resource name of the space, in the form `spaces/{space}`. *

Format: `spaces/{space}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Space getSpace(SpaceName name) { GetSpaceRequest request = GetSpaceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getSpace(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a space. For an example, see [Get details about a * space](https://developers.google.com/workspace/chat/get-spaces). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = SpaceName.of("[SPACE]").toString();
   *   Space response = chatServiceClient.getSpace(name);
   * }
   * }
* * @param name Required. Resource name of the space, in the form `spaces/{space}`. *

Format: `spaces/{space}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Space getSpace(String name) { GetSpaceRequest request = GetSpaceRequest.newBuilder().setName(name).build(); return getSpace(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a space. For an example, see [Get details about a * space](https://developers.google.com/workspace/chat/get-spaces). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetSpaceRequest request =
   *       GetSpaceRequest.newBuilder()
   *           .setName(SpaceName.of("[SPACE]").toString())
   *           .setUseAdminAccess(true)
   *           .build();
   *   Space response = chatServiceClient.getSpace(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Space getSpace(GetSpaceRequest request) { return getSpaceCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a space. For an example, see [Get details about a * space](https://developers.google.com/workspace/chat/get-spaces). * *

Requires * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports * [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * and [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetSpaceRequest request =
   *       GetSpaceRequest.newBuilder()
   *           .setName(SpaceName.of("[SPACE]").toString())
   *           .setUseAdminAccess(true)
   *           .build();
   *   ApiFuture future = chatServiceClient.getSpaceCallable().futureCall(request);
   *   // Do something.
   *   Space response = future.get();
   * }
   * }
*/ public final UnaryCallable getSpaceCallable() { return stub.getSpaceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a named space. Spaces grouped by topics aren't supported. For an example, see [Create a * space](https://developers.google.com/workspace/chat/create-spaces). * *

If you receive the error message `ALREADY_EXISTS` when creating a space, try a different * `displayName`. An existing space within the Google Workspace organization might already use * this display name. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   Space space = Space.newBuilder().build();
   *   Space response = chatServiceClient.createSpace(space);
   * }
   * }
* * @param space Required. The `displayName` and `spaceType` fields must be populated. Only * `SpaceType.SPACE` is supported. *

If you receive the error message `ALREADY_EXISTS` when creating a space, try a different * `displayName`. An existing space within the Google Workspace organization might already use * this display name. *

The space `name` is assigned on the server so anything specified in this field will be * ignored. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Space createSpace(Space space) { CreateSpaceRequest request = CreateSpaceRequest.newBuilder().setSpace(space).build(); return createSpace(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a named space. Spaces grouped by topics aren't supported. For an example, see [Create a * space](https://developers.google.com/workspace/chat/create-spaces). * *

If you receive the error message `ALREADY_EXISTS` when creating a space, try a different * `displayName`. An existing space within the Google Workspace organization might already use * this display name. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CreateSpaceRequest request =
   *       CreateSpaceRequest.newBuilder()
   *           .setSpace(Space.newBuilder().build())
   *           .setRequestId("requestId693933066")
   *           .build();
   *   Space response = chatServiceClient.createSpace(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Space createSpace(CreateSpaceRequest request) { return createSpaceCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a named space. Spaces grouped by topics aren't supported. For an example, see [Create a * space](https://developers.google.com/workspace/chat/create-spaces). * *

If you receive the error message `ALREADY_EXISTS` when creating a space, try a different * `displayName`. An existing space within the Google Workspace organization might already use * this display name. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CreateSpaceRequest request =
   *       CreateSpaceRequest.newBuilder()
   *           .setSpace(Space.newBuilder().build())
   *           .setRequestId("requestId693933066")
   *           .build();
   *   ApiFuture future = chatServiceClient.createSpaceCallable().futureCall(request);
   *   // Do something.
   *   Space response = future.get();
   * }
   * }
*/ public final UnaryCallable createSpaceCallable() { return stub.createSpaceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a space and adds specified users to it. The calling user is automatically added to the * space, and shouldn't be specified as a membership in the request. For an example, see [Set up a * space with initial members](https://developers.google.com/workspace/chat/set-up-spaces). * *

To specify the human members to add, add memberships with the appropriate * `membership.member.name`. To add a human user, use `users/{user}`, where `{user}` can be the * email address for the user. For users in the same Workspace organization `{user}` can also be * the `id` for the person from the People API, or the `id` for the user in the Directory API. For * example, if the People API Person profile ID for `user{@literal @}example.com` is `123456789`, * you can add the user to the space by setting the `membership.member.name` to * `users/user{@literal @}example.com` or `users/123456789`. * *

To specify the Google groups to add, add memberships with the appropriate * `membership.group_member.name`. To add or invite a Google group, use `groups/{group}`, where * `{group}` is the `id` for the group from the Cloud Identity Groups API. For example, you can * use [Cloud Identity Groups lookup * API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID * `123456789` for group email `group{@literal @}example.com`, then you can add the group to the * space by setting the `membership.group_member.name` to `groups/123456789`. Group email is not * supported, and Google groups can only be added as members in named spaces. * *

For a named space or group chat, if the caller blocks, or is blocked by some members, or * doesn't have permission to add some members, then those members aren't added to the created * space. * *

To create a direct message (DM) between the calling user and another human user, specify * exactly one membership to represent the human user. If one user blocks the other, the request * fails and the DM isn't created. * *

To create a DM between the calling user and the calling app, set `Space.singleUserBotDm` to * `true` and don't specify any memberships. You can only use this method to set up a DM with the * calling app. To add the calling app as a member of a space or an existing DM between two human * users, see [Invite or add a user or app to a * space](https://developers.google.com/workspace/chat/create-members). * *

If a DM already exists between two users, even when one user blocks the other at the time a * request is made, then the existing DM is returned. * *

Spaces with threaded replies aren't supported. If you receive the error message * `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space * within the Google Workspace organization might already use this display name. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SetUpSpaceRequest request =
   *       SetUpSpaceRequest.newBuilder()
   *           .setSpace(Space.newBuilder().build())
   *           .setRequestId("requestId693933066")
   *           .addAllMemberships(new ArrayList())
   *           .build();
   *   Space response = chatServiceClient.setUpSpace(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Space setUpSpace(SetUpSpaceRequest request) { return setUpSpaceCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a space and adds specified users to it. The calling user is automatically added to the * space, and shouldn't be specified as a membership in the request. For an example, see [Set up a * space with initial members](https://developers.google.com/workspace/chat/set-up-spaces). * *

To specify the human members to add, add memberships with the appropriate * `membership.member.name`. To add a human user, use `users/{user}`, where `{user}` can be the * email address for the user. For users in the same Workspace organization `{user}` can also be * the `id` for the person from the People API, or the `id` for the user in the Directory API. For * example, if the People API Person profile ID for `user{@literal @}example.com` is `123456789`, * you can add the user to the space by setting the `membership.member.name` to * `users/user{@literal @}example.com` or `users/123456789`. * *

To specify the Google groups to add, add memberships with the appropriate * `membership.group_member.name`. To add or invite a Google group, use `groups/{group}`, where * `{group}` is the `id` for the group from the Cloud Identity Groups API. For example, you can * use [Cloud Identity Groups lookup * API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID * `123456789` for group email `group{@literal @}example.com`, then you can add the group to the * space by setting the `membership.group_member.name` to `groups/123456789`. Group email is not * supported, and Google groups can only be added as members in named spaces. * *

For a named space or group chat, if the caller blocks, or is blocked by some members, or * doesn't have permission to add some members, then those members aren't added to the created * space. * *

To create a direct message (DM) between the calling user and another human user, specify * exactly one membership to represent the human user. If one user blocks the other, the request * fails and the DM isn't created. * *

To create a DM between the calling user and the calling app, set `Space.singleUserBotDm` to * `true` and don't specify any memberships. You can only use this method to set up a DM with the * calling app. To add the calling app as a member of a space or an existing DM between two human * users, see [Invite or add a user or app to a * space](https://developers.google.com/workspace/chat/create-members). * *

If a DM already exists between two users, even when one user blocks the other at the time a * request is made, then the existing DM is returned. * *

Spaces with threaded replies aren't supported. If you receive the error message * `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space * within the Google Workspace organization might already use this display name. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SetUpSpaceRequest request =
   *       SetUpSpaceRequest.newBuilder()
   *           .setSpace(Space.newBuilder().build())
   *           .setRequestId("requestId693933066")
   *           .addAllMemberships(new ArrayList())
   *           .build();
   *   ApiFuture future = chatServiceClient.setUpSpaceCallable().futureCall(request);
   *   // Do something.
   *   Space response = future.get();
   * }
   * }
*/ public final UnaryCallable setUpSpaceCallable() { return stub.setUpSpaceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a space. For an example, see [Update a * space](https://developers.google.com/workspace/chat/update-spaces). * *

If you're updating the `displayName` field and receive the error message `ALREADY_EXISTS`, * try a different display name.. An existing space within the Google Workspace organization might * already use this display name. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   Space space = Space.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   Space response = chatServiceClient.updateSpace(space, updateMask);
   * }
   * }
* * @param space Required. Space with fields to be updated. `Space.name` must be populated in the * form of `spaces/{space}`. Only fields specified by `update_mask` are updated. * @param updateMask Required. The updated field paths, comma separated if there are multiple. *

Currently supported field paths: *

- `display_name` (Only supports changing the display name of a space with the `SPACE` * type, or when also including the `space_type` mask to change a `GROUP_CHAT` space type to * `SPACE`. Trying to update the display name of a `GROUP_CHAT` or a `DIRECT_MESSAGE` space * results in an invalid argument error. If you receive the error message `ALREADY_EXISTS` * when updating the `displayName`, try a different `displayName`. An existing space within * the Google Workspace organization might already use this display name.) *

- `space_type` (Only supports changing a `GROUP_CHAT` space type to `SPACE`. Include * `display_name` together with `space_type` in the update mask and ensure that the specified * space has a non-empty display name and the `SPACE` space type. Including the `space_type` * mask and the `SPACE` type in the specified space when updating the display name is optional * if the existing space already has the `SPACE` type. Trying to update the space type in * other ways results in an invalid argument error). `space_type` is not supported with admin * access. *

- `space_details` *

- `space_history_state` (Supports [turning history on or off for the * space](https://support.google.com/chat/answer/7664687) if [the organization allows users to * change their history setting](https://support.google.com/a/answer/7664184). Warning: * mutually exclusive with all other field paths.) `space_history_state` is not supported with * admin access. *

- `access_settings.audience` (Supports changing the [access * setting](https://support.google.com/chat/answer/11971020) of who can discover the space, * join the space, and preview the messages in space. If no audience is specified in the * access setting, the space's access setting is updated to private. Warning: mutually * exclusive with all other field paths.) `access_settings.audience` is not supported with * admin access. *

- Developer Preview: Supports changing the [permission * settings](https://support.google.com/chat/answer/13340792) of a space, supported field * paths include: `permission_settings.manage_members_and_groups`, * `permission_settings.modify_space_details`, `permission_settings.toggle_history`, * `permission_settings.use_at_mention_all`, `permission_settings.manage_apps`, * `permission_settings.manage_webhooks`, `permission_settings.reply_messages` (Warning: * mutually exclusive with all other non-permission settings field paths). * `permission_settings` is not supported with admin access. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Space updateSpace(Space space, FieldMask updateMask) { UpdateSpaceRequest request = UpdateSpaceRequest.newBuilder().setSpace(space).setUpdateMask(updateMask).build(); return updateSpace(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a space. For an example, see [Update a * space](https://developers.google.com/workspace/chat/update-spaces). * *

If you're updating the `displayName` field and receive the error message `ALREADY_EXISTS`, * try a different display name.. An existing space within the Google Workspace organization might * already use this display name. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UpdateSpaceRequest request =
   *       UpdateSpaceRequest.newBuilder()
   *           .setSpace(Space.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .setUseAdminAccess(true)
   *           .build();
   *   Space response = chatServiceClient.updateSpace(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Space updateSpace(UpdateSpaceRequest request) { return updateSpaceCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a space. For an example, see [Update a * space](https://developers.google.com/workspace/chat/update-spaces). * *

If you're updating the `displayName` field and receive the error message `ALREADY_EXISTS`, * try a different display name.. An existing space within the Google Workspace organization might * already use this display name. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UpdateSpaceRequest request =
   *       UpdateSpaceRequest.newBuilder()
   *           .setSpace(Space.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .setUseAdminAccess(true)
   *           .build();
   *   ApiFuture future = chatServiceClient.updateSpaceCallable().futureCall(request);
   *   // Do something.
   *   Space response = future.get();
   * }
   * }
*/ public final UnaryCallable updateSpaceCallable() { return stub.updateSpaceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a named space. Always performs a cascading delete, which means that the space's child * resources—like messages posted in the space and memberships in the space—are also deleted. For * an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * from a user who has permission to delete the space. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceName name = SpaceName.of("[SPACE]");
   *   chatServiceClient.deleteSpace(name);
   * }
   * }
* * @param name Required. Resource name of the space to delete. *

Format: `spaces/{space}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteSpace(SpaceName name) { DeleteSpaceRequest request = DeleteSpaceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); deleteSpace(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a named space. Always performs a cascading delete, which means that the space's child * resources—like messages posted in the space and memberships in the space—are also deleted. For * an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * from a user who has permission to delete the space. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = SpaceName.of("[SPACE]").toString();
   *   chatServiceClient.deleteSpace(name);
   * }
   * }
* * @param name Required. Resource name of the space to delete. *

Format: `spaces/{space}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteSpace(String name) { DeleteSpaceRequest request = DeleteSpaceRequest.newBuilder().setName(name).build(); deleteSpace(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a named space. Always performs a cascading delete, which means that the space's child * resources—like messages posted in the space and memberships in the space—are also deleted. For * an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * from a user who has permission to delete the space. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   DeleteSpaceRequest request =
   *       DeleteSpaceRequest.newBuilder()
   *           .setName(SpaceName.of("[SPACE]").toString())
   *           .setUseAdminAccess(true)
   *           .build();
   *   chatServiceClient.deleteSpace(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteSpace(DeleteSpaceRequest request) { deleteSpaceCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a named space. Always performs a cascading delete, which means that the space's child * resources—like messages posted in the space and memberships in the space—are also deleted. For * an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * from a user who has permission to delete the space. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   DeleteSpaceRequest request =
   *       DeleteSpaceRequest.newBuilder()
   *           .setName(SpaceName.of("[SPACE]").toString())
   *           .setUseAdminAccess(true)
   *           .build();
   *   ApiFuture future = chatServiceClient.deleteSpaceCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteSpaceCallable() { return stub.deleteSpaceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Completes the [import process](https://developers.google.com/workspace/chat/import-data) for * the specified space and makes it visible to users. Requires app authentication and domain-wide * delegation. For more information, see [Authorize Google Chat apps to import * data](https://developers.google.com/workspace/chat/authorize-import). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CompleteImportSpaceRequest request =
   *       CompleteImportSpaceRequest.newBuilder()
   *           .setName(SpaceName.of("[SPACE]").toString())
   *           .build();
   *   CompleteImportSpaceResponse response = chatServiceClient.completeImportSpace(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final CompleteImportSpaceResponse completeImportSpace(CompleteImportSpaceRequest request) { return completeImportSpaceCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Completes the [import process](https://developers.google.com/workspace/chat/import-data) for * the specified space and makes it visible to users. Requires app authentication and domain-wide * delegation. For more information, see [Authorize Google Chat apps to import * data](https://developers.google.com/workspace/chat/authorize-import). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CompleteImportSpaceRequest request =
   *       CompleteImportSpaceRequest.newBuilder()
   *           .setName(SpaceName.of("[SPACE]").toString())
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.completeImportSpaceCallable().futureCall(request);
   *   // Do something.
   *   CompleteImportSpaceResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable completeImportSpaceCallable() { return stub.completeImportSpaceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the existing direct message with the specified user. If no direct message space is * found, returns a `404 NOT_FOUND` error. For an example, see [Find a direct * message](/chat/api/guides/v1/spaces/find-direct-message). * *

With [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), * returns the direct message space between the specified user and the authenticated user. * *

With [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), * returns the direct message space between the specified user and the calling Chat app. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * or [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   FindDirectMessageRequest request =
   *       FindDirectMessageRequest.newBuilder().setName("name3373707").build();
   *   Space response = chatServiceClient.findDirectMessage(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Space findDirectMessage(FindDirectMessageRequest request) { return findDirectMessageCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the existing direct message with the specified user. If no direct message space is * found, returns a `404 NOT_FOUND` error. For an example, see [Find a direct * message](/chat/api/guides/v1/spaces/find-direct-message). * *

With [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), * returns the direct message space between the specified user and the authenticated user. * *

With [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), * returns the direct message space between the specified user and the calling Chat app. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * or [app * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   FindDirectMessageRequest request =
   *       FindDirectMessageRequest.newBuilder().setName("name3373707").build();
   *   ApiFuture future = chatServiceClient.findDirectMessageCallable().futureCall(request);
   *   // Do something.
   *   Space response = future.get();
   * }
   * }
*/ public final UnaryCallable findDirectMessageCallable() { return stub.findDirectMessageCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a human membership or app membership for the calling app. Creating memberships for * other apps isn't supported. For an example, see [Invite or add a user or a Google Chat app to a * space](https://developers.google.com/workspace/chat/create-members). When creating a * membership, if the specified member has their auto-accept policy turned off, then they're * invited, and must accept the space invitation before joining. Otherwise, creating a membership * adds the member directly to the specified space. Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

To specify the member to add, set the `membership.member.name` for the human or app member, * or set the `membership.group_member.name` for the group member. * *

- To add the calling app to a space or a direct message between two human users, use * `users/app`. Unable to add other apps to the space. * *

- To add a human user, use `users/{user}`, where `{user}` can be the email address for the * user. For users in the same Workspace organization `{user}` can also be the `id` for the person * from the People API, or the `id` for the user in the Directory API. For example, if the People * API Person profile ID for `user{@literal @}example.com` is `123456789`, you can add the user to * the space by setting the `membership.member.name` to `users/user{@literal @}example.com` or * `users/123456789`. * *

- To add or invite a Google group in a named space, use `groups/{group}`, where `{group}` is * the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud * Identity Groups lookup * API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID * `123456789` for group email `group{@literal @}example.com`, then you can add or invite the * group to a named space by setting the `membership.group_member.name` to `groups/123456789`. * Group email is not supported, and Google groups can only be added as members in named spaces. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceName parent = SpaceName.of("[SPACE]");
   *   Membership membership = Membership.newBuilder().build();
   *   Membership response = chatServiceClient.createMembership(parent, membership);
   * }
   * }
* * @param parent Required. The resource name of the space for which to create the membership. *

Format: spaces/{space} * @param membership Required. The membership relation to create. The `memberType` field must * contain a user with the `user.name` and `user.type` fields populated. The server will * assign a resource name and overwrite anything specified. When a Chat app creates a * membership relation for a human user, it must use the `chat.memberships` scope, set * `user.type` to `HUMAN`, and set `user.name` with format `users/{user}`, where `{user}` can * be the email address for the user. For users in the same Workspace organization `{user}` * can also be the `id` of the * [person](https://developers.google.com/people/api/rest/v1/people) from the People API, or * the `id` for the user in the Directory API. For example, if the People API Person profile * ID for `user{@literal @}example.com` is `123456789`, you can add the user to the space by * setting the `membership.member.name` to `users/user{@literal @}example.com` or * `users/123456789`. When a Chat app creates a membership relation for itself, it must use * the `chat.memberships.app` scope, set `user.type` to `BOT`, and set `user.name` to * `users/app`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership createMembership(SpaceName parent, Membership membership) { CreateMembershipRequest request = CreateMembershipRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setMembership(membership) .build(); return createMembership(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a human membership or app membership for the calling app. Creating memberships for * other apps isn't supported. For an example, see [Invite or add a user or a Google Chat app to a * space](https://developers.google.com/workspace/chat/create-members). When creating a * membership, if the specified member has their auto-accept policy turned off, then they're * invited, and must accept the space invitation before joining. Otherwise, creating a membership * adds the member directly to the specified space. Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

To specify the member to add, set the `membership.member.name` for the human or app member, * or set the `membership.group_member.name` for the group member. * *

- To add the calling app to a space or a direct message between two human users, use * `users/app`. Unable to add other apps to the space. * *

- To add a human user, use `users/{user}`, where `{user}` can be the email address for the * user. For users in the same Workspace organization `{user}` can also be the `id` for the person * from the People API, or the `id` for the user in the Directory API. For example, if the People * API Person profile ID for `user{@literal @}example.com` is `123456789`, you can add the user to * the space by setting the `membership.member.name` to `users/user{@literal @}example.com` or * `users/123456789`. * *

- To add or invite a Google group in a named space, use `groups/{group}`, where `{group}` is * the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud * Identity Groups lookup * API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID * `123456789` for group email `group{@literal @}example.com`, then you can add or invite the * group to a named space by setting the `membership.group_member.name` to `groups/123456789`. * Group email is not supported, and Google groups can only be added as members in named spaces. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String parent = SpaceName.of("[SPACE]").toString();
   *   Membership membership = Membership.newBuilder().build();
   *   Membership response = chatServiceClient.createMembership(parent, membership);
   * }
   * }
* * @param parent Required. The resource name of the space for which to create the membership. *

Format: spaces/{space} * @param membership Required. The membership relation to create. The `memberType` field must * contain a user with the `user.name` and `user.type` fields populated. The server will * assign a resource name and overwrite anything specified. When a Chat app creates a * membership relation for a human user, it must use the `chat.memberships` scope, set * `user.type` to `HUMAN`, and set `user.name` with format `users/{user}`, where `{user}` can * be the email address for the user. For users in the same Workspace organization `{user}` * can also be the `id` of the * [person](https://developers.google.com/people/api/rest/v1/people) from the People API, or * the `id` for the user in the Directory API. For example, if the People API Person profile * ID for `user{@literal @}example.com` is `123456789`, you can add the user to the space by * setting the `membership.member.name` to `users/user{@literal @}example.com` or * `users/123456789`. When a Chat app creates a membership relation for itself, it must use * the `chat.memberships.app` scope, set `user.type` to `BOT`, and set `user.name` to * `users/app`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership createMembership(String parent, Membership membership) { CreateMembershipRequest request = CreateMembershipRequest.newBuilder().setParent(parent).setMembership(membership).build(); return createMembership(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a human membership or app membership for the calling app. Creating memberships for * other apps isn't supported. For an example, see [Invite or add a user or a Google Chat app to a * space](https://developers.google.com/workspace/chat/create-members). When creating a * membership, if the specified member has their auto-accept policy turned off, then they're * invited, and must accept the space invitation before joining. Otherwise, creating a membership * adds the member directly to the specified space. Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

To specify the member to add, set the `membership.member.name` for the human or app member, * or set the `membership.group_member.name` for the group member. * *

- To add the calling app to a space or a direct message between two human users, use * `users/app`. Unable to add other apps to the space. * *

- To add a human user, use `users/{user}`, where `{user}` can be the email address for the * user. For users in the same Workspace organization `{user}` can also be the `id` for the person * from the People API, or the `id` for the user in the Directory API. For example, if the People * API Person profile ID for `user{@literal @}example.com` is `123456789`, you can add the user to * the space by setting the `membership.member.name` to `users/user{@literal @}example.com` or * `users/123456789`. * *

- To add or invite a Google group in a named space, use `groups/{group}`, where `{group}` is * the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud * Identity Groups lookup * API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID * `123456789` for group email `group{@literal @}example.com`, then you can add or invite the * group to a named space by setting the `membership.group_member.name` to `groups/123456789`. * Group email is not supported, and Google groups can only be added as members in named spaces. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CreateMembershipRequest request =
   *       CreateMembershipRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setMembership(Membership.newBuilder().build())
   *           .setUseAdminAccess(true)
   *           .build();
   *   Membership response = chatServiceClient.createMembership(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership createMembership(CreateMembershipRequest request) { return createMembershipCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a human membership or app membership for the calling app. Creating memberships for * other apps isn't supported. For an example, see [Invite or add a user or a Google Chat app to a * space](https://developers.google.com/workspace/chat/create-members). When creating a * membership, if the specified member has their auto-accept policy turned off, then they're * invited, and must accept the space invitation before joining. Otherwise, creating a membership * adds the member directly to the specified space. Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

To specify the member to add, set the `membership.member.name` for the human or app member, * or set the `membership.group_member.name` for the group member. * *

- To add the calling app to a space or a direct message between two human users, use * `users/app`. Unable to add other apps to the space. * *

- To add a human user, use `users/{user}`, where `{user}` can be the email address for the * user. For users in the same Workspace organization `{user}` can also be the `id` for the person * from the People API, or the `id` for the user in the Directory API. For example, if the People * API Person profile ID for `user{@literal @}example.com` is `123456789`, you can add the user to * the space by setting the `membership.member.name` to `users/user{@literal @}example.com` or * `users/123456789`. * *

- To add or invite a Google group in a named space, use `groups/{group}`, where `{group}` is * the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud * Identity Groups lookup * API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID * `123456789` for group email `group{@literal @}example.com`, then you can add or invite the * group to a named space by setting the `membership.group_member.name` to `groups/123456789`. * Group email is not supported, and Google groups can only be added as members in named spaces. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CreateMembershipRequest request =
   *       CreateMembershipRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setMembership(Membership.newBuilder().build())
   *           .setUseAdminAccess(true)
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.createMembershipCallable().futureCall(request);
   *   // Do something.
   *   Membership response = future.get();
   * }
   * }
*/ public final UnaryCallable createMembershipCallable() { return stub.createMembershipCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a membership. For an example, see [Update a user's membership in a * space](https://developers.google.com/workspace/chat/update-members). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   Membership membership = Membership.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   Membership response = chatServiceClient.updateMembership(membership, updateMask);
   * }
   * }
* * @param membership Required. The membership to update. Only fields specified by `update_mask` * are updated. * @param updateMask Required. The field paths to update. Separate multiple values with commas or * use `*` to update all field paths. *

Currently supported field paths: *

- `role` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership updateMembership(Membership membership, FieldMask updateMask) { UpdateMembershipRequest request = UpdateMembershipRequest.newBuilder() .setMembership(membership) .setUpdateMask(updateMask) .build(); return updateMembership(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a membership. For an example, see [Update a user's membership in a * space](https://developers.google.com/workspace/chat/update-members). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UpdateMembershipRequest request =
   *       UpdateMembershipRequest.newBuilder()
   *           .setMembership(Membership.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .setUseAdminAccess(true)
   *           .build();
   *   Membership response = chatServiceClient.updateMembership(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership updateMembership(UpdateMembershipRequest request) { return updateMembershipCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a membership. For an example, see [Update a user's membership in a * space](https://developers.google.com/workspace/chat/update-members). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UpdateMembershipRequest request =
   *       UpdateMembershipRequest.newBuilder()
   *           .setMembership(Membership.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .setUseAdminAccess(true)
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.updateMembershipCallable().futureCall(request);
   *   // Do something.
   *   Membership response = future.get();
   * }
   * }
*/ public final UnaryCallable updateMembershipCallable() { return stub.updateMembershipCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a membership. For an example, see [Remove a user or a Google Chat app from a * space](https://developers.google.com/workspace/chat/delete-members). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   MembershipName name = MembershipName.of("[SPACE]", "[MEMBER]");
   *   Membership response = chatServiceClient.deleteMembership(name);
   * }
   * }
* * @param name Required. Resource name of the membership to delete. Chat apps can delete human * users' or their own memberships. Chat apps can't delete other apps' memberships. *

When deleting a human membership, requires the `chat.memberships` scope and * `spaces/{space}/members/{member}` format. You can use the email as an alias for `{member}`. * For example, `spaces/{space}/members/example{@literal @}gmail.com` where * `example{@literal @}gmail.com` is the email of the Google Chat user. *

When deleting an app membership, requires the `chat.memberships.app` scope and * `spaces/{space}/members/app` format. *

Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership deleteMembership(MembershipName name) { DeleteMembershipRequest request = DeleteMembershipRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return deleteMembership(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a membership. For an example, see [Remove a user or a Google Chat app from a * space](https://developers.google.com/workspace/chat/delete-members). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = MembershipName.of("[SPACE]", "[MEMBER]").toString();
   *   Membership response = chatServiceClient.deleteMembership(name);
   * }
   * }
* * @param name Required. Resource name of the membership to delete. Chat apps can delete human * users' or their own memberships. Chat apps can't delete other apps' memberships. *

When deleting a human membership, requires the `chat.memberships` scope and * `spaces/{space}/members/{member}` format. You can use the email as an alias for `{member}`. * For example, `spaces/{space}/members/example{@literal @}gmail.com` where * `example{@literal @}gmail.com` is the email of the Google Chat user. *

When deleting an app membership, requires the `chat.memberships.app` scope and * `spaces/{space}/members/app` format. *

Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership deleteMembership(String name) { DeleteMembershipRequest request = DeleteMembershipRequest.newBuilder().setName(name).build(); return deleteMembership(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a membership. For an example, see [Remove a user or a Google Chat app from a * space](https://developers.google.com/workspace/chat/delete-members). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   DeleteMembershipRequest request =
   *       DeleteMembershipRequest.newBuilder()
   *           .setName(MembershipName.of("[SPACE]", "[MEMBER]").toString())
   *           .setUseAdminAccess(true)
   *           .build();
   *   Membership response = chatServiceClient.deleteMembership(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Membership deleteMembership(DeleteMembershipRequest request) { return deleteMembershipCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a membership. For an example, see [Remove a user or a Google Chat app from a * space](https://developers.google.com/workspace/chat/delete-members). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   DeleteMembershipRequest request =
   *       DeleteMembershipRequest.newBuilder()
   *           .setName(MembershipName.of("[SPACE]", "[MEMBER]").toString())
   *           .setUseAdminAccess(true)
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.deleteMembershipCallable().futureCall(request);
   *   // Do something.
   *   Membership response = future.get();
   * }
   * }
*/ public final UnaryCallable deleteMembershipCallable() { return stub.deleteMembershipCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, * see [Add a reaction to a * message](https://developers.google.com/workspace/chat/create-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   MessageName parent = MessageName.of("[SPACE]", "[MESSAGE]");
   *   Reaction reaction = Reaction.newBuilder().build();
   *   Reaction response = chatServiceClient.createReaction(parent, reaction);
   * }
   * }
* * @param parent Required. The message where the reaction is created. *

Format: `spaces/{space}/messages/{message}` * @param reaction Required. The reaction to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Reaction createReaction(MessageName parent, Reaction reaction) { CreateReactionRequest request = CreateReactionRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setReaction(reaction) .build(); return createReaction(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, * see [Add a reaction to a * message](https://developers.google.com/workspace/chat/create-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String parent = MessageName.of("[SPACE]", "[MESSAGE]").toString();
   *   Reaction reaction = Reaction.newBuilder().build();
   *   Reaction response = chatServiceClient.createReaction(parent, reaction);
   * }
   * }
* * @param parent Required. The message where the reaction is created. *

Format: `spaces/{space}/messages/{message}` * @param reaction Required. The reaction to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Reaction createReaction(String parent, Reaction reaction) { CreateReactionRequest request = CreateReactionRequest.newBuilder().setParent(parent).setReaction(reaction).build(); return createReaction(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, * see [Add a reaction to a * message](https://developers.google.com/workspace/chat/create-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CreateReactionRequest request =
   *       CreateReactionRequest.newBuilder()
   *           .setParent(MessageName.of("[SPACE]", "[MESSAGE]").toString())
   *           .setReaction(Reaction.newBuilder().build())
   *           .build();
   *   Reaction response = chatServiceClient.createReaction(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Reaction createReaction(CreateReactionRequest request) { return createReactionCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, * see [Add a reaction to a * message](https://developers.google.com/workspace/chat/create-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   CreateReactionRequest request =
   *       CreateReactionRequest.newBuilder()
   *           .setParent(MessageName.of("[SPACE]", "[MESSAGE]").toString())
   *           .setReaction(Reaction.newBuilder().build())
   *           .build();
   *   ApiFuture future = chatServiceClient.createReactionCallable().futureCall(request);
   *   // Do something.
   *   Reaction response = future.get();
   * }
   * }
*/ public final UnaryCallable createReactionCallable() { return stub.createReactionCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists reactions to a message. For an example, see [List reactions for a * message](https://developers.google.com/workspace/chat/list-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   MessageName parent = MessageName.of("[SPACE]", "[MESSAGE]");
   *   for (Reaction element : chatServiceClient.listReactions(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The message users reacted to. *

Format: `spaces/{space}/messages/{message}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListReactionsPagedResponse listReactions(MessageName parent) { ListReactionsRequest request = ListReactionsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listReactions(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists reactions to a message. For an example, see [List reactions for a * message](https://developers.google.com/workspace/chat/list-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String parent = MessageName.of("[SPACE]", "[MESSAGE]").toString();
   *   for (Reaction element : chatServiceClient.listReactions(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The message users reacted to. *

Format: `spaces/{space}/messages/{message}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListReactionsPagedResponse listReactions(String parent) { ListReactionsRequest request = ListReactionsRequest.newBuilder().setParent(parent).build(); return listReactions(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists reactions to a message. For an example, see [List reactions for a * message](https://developers.google.com/workspace/chat/list-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListReactionsRequest request =
   *       ListReactionsRequest.newBuilder()
   *           .setParent(MessageName.of("[SPACE]", "[MESSAGE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   for (Reaction element : chatServiceClient.listReactions(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListReactionsPagedResponse listReactions(ListReactionsRequest request) { return listReactionsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists reactions to a message. For an example, see [List reactions for a * message](https://developers.google.com/workspace/chat/list-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListReactionsRequest request =
   *       ListReactionsRequest.newBuilder()
   *           .setParent(MessageName.of("[SPACE]", "[MESSAGE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.listReactionsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Reaction element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listReactionsPagedCallable() { return stub.listReactionsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists reactions to a message. For an example, see [List reactions for a * message](https://developers.google.com/workspace/chat/list-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListReactionsRequest request =
   *       ListReactionsRequest.newBuilder()
   *           .setParent(MessageName.of("[SPACE]", "[MESSAGE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   while (true) {
   *     ListReactionsResponse response = chatServiceClient.listReactionsCallable().call(request);
   *     for (Reaction element : response.getReactionsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listReactionsCallable() { return stub.listReactionsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a reaction to a message. Only unicode emojis are supported. For an example, see [Delete * a reaction](https://developers.google.com/workspace/chat/delete-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ReactionName name = ReactionName.of("[SPACE]", "[MESSAGE]", "[REACTION]");
   *   chatServiceClient.deleteReaction(name);
   * }
   * }
* * @param name Required. Name of the reaction to delete. *

Format: `spaces/{space}/messages/{message}/reactions/{reaction}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteReaction(ReactionName name) { DeleteReactionRequest request = DeleteReactionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); deleteReaction(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a reaction to a message. Only unicode emojis are supported. For an example, see [Delete * a reaction](https://developers.google.com/workspace/chat/delete-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = ReactionName.of("[SPACE]", "[MESSAGE]", "[REACTION]").toString();
   *   chatServiceClient.deleteReaction(name);
   * }
   * }
* * @param name Required. Name of the reaction to delete. *

Format: `spaces/{space}/messages/{message}/reactions/{reaction}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteReaction(String name) { DeleteReactionRequest request = DeleteReactionRequest.newBuilder().setName(name).build(); deleteReaction(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a reaction to a message. Only unicode emojis are supported. For an example, see [Delete * a reaction](https://developers.google.com/workspace/chat/delete-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   DeleteReactionRequest request =
   *       DeleteReactionRequest.newBuilder()
   *           .setName(ReactionName.of("[SPACE]", "[MESSAGE]", "[REACTION]").toString())
   *           .build();
   *   chatServiceClient.deleteReaction(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteReaction(DeleteReactionRequest request) { deleteReactionCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a reaction to a message. Only unicode emojis are supported. For an example, see [Delete * a reaction](https://developers.google.com/workspace/chat/delete-reactions). Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   DeleteReactionRequest request =
   *       DeleteReactionRequest.newBuilder()
   *           .setName(ReactionName.of("[SPACE]", "[MESSAGE]", "[REACTION]").toString())
   *           .build();
   *   ApiFuture future = chatServiceClient.deleteReactionCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteReactionCallable() { return stub.deleteReactionCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a user's read state within a space, used to identify read and unread * messages. For an example, see [Get details about a user's space read * state](https://developers.google.com/workspace/chat/get-space-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceReadStateName name = SpaceReadStateName.of("[USER]", "[SPACE]");
   *   SpaceReadState response = chatServiceClient.getSpaceReadState(name);
   * }
   * }
* * @param name Required. Resource name of the space read state to retrieve. *

Only supports getting read state for the calling user. *

To refer to the calling user, set one of the following: *

- The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`. *

- Their Workspace email address. For example, * `users/user{@literal @}example.com/spaces/{space}/spaceReadState`. *

- Their user id. For example, `users/123456789/spaces/{space}/spaceReadState`. *

Format: users/{user}/spaces/{space}/spaceReadState * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SpaceReadState getSpaceReadState(SpaceReadStateName name) { GetSpaceReadStateRequest request = GetSpaceReadStateRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); return getSpaceReadState(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a user's read state within a space, used to identify read and unread * messages. For an example, see [Get details about a user's space read * state](https://developers.google.com/workspace/chat/get-space-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = SpaceReadStateName.of("[USER]", "[SPACE]").toString();
   *   SpaceReadState response = chatServiceClient.getSpaceReadState(name);
   * }
   * }
* * @param name Required. Resource name of the space read state to retrieve. *

Only supports getting read state for the calling user. *

To refer to the calling user, set one of the following: *

- The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`. *

- Their Workspace email address. For example, * `users/user{@literal @}example.com/spaces/{space}/spaceReadState`. *

- Their user id. For example, `users/123456789/spaces/{space}/spaceReadState`. *

Format: users/{user}/spaces/{space}/spaceReadState * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SpaceReadState getSpaceReadState(String name) { GetSpaceReadStateRequest request = GetSpaceReadStateRequest.newBuilder().setName(name).build(); return getSpaceReadState(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a user's read state within a space, used to identify read and unread * messages. For an example, see [Get details about a user's space read * state](https://developers.google.com/workspace/chat/get-space-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetSpaceReadStateRequest request =
   *       GetSpaceReadStateRequest.newBuilder()
   *           .setName(SpaceReadStateName.of("[USER]", "[SPACE]").toString())
   *           .build();
   *   SpaceReadState response = chatServiceClient.getSpaceReadState(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SpaceReadState getSpaceReadState(GetSpaceReadStateRequest request) { return getSpaceReadStateCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a user's read state within a space, used to identify read and unread * messages. For an example, see [Get details about a user's space read * state](https://developers.google.com/workspace/chat/get-space-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetSpaceReadStateRequest request =
   *       GetSpaceReadStateRequest.newBuilder()
   *           .setName(SpaceReadStateName.of("[USER]", "[SPACE]").toString())
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.getSpaceReadStateCallable().futureCall(request);
   *   // Do something.
   *   SpaceReadState response = future.get();
   * }
   * }
*/ public final UnaryCallable getSpaceReadStateCallable() { return stub.getSpaceReadStateCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a user's read state within a space, used to identify read and unread messages. For an * example, see [Update a user's space read * state](https://developers.google.com/workspace/chat/update-space-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceReadState spaceReadState = SpaceReadState.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   SpaceReadState response = chatServiceClient.updateSpaceReadState(spaceReadState, updateMask);
   * }
   * }
* * @param spaceReadState Required. The space read state and fields to update. *

Only supports updating read state for the calling user. *

To refer to the calling user, set one of the following: *

- The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`. *

- Their Workspace email address. For example, * `users/user{@literal @}example.com/spaces/{space}/spaceReadState`. *

- Their user id. For example, `users/123456789/spaces/{space}/spaceReadState`. *

Format: users/{user}/spaces/{space}/spaceReadState * @param updateMask Required. The field paths to update. Currently supported field paths: *

- `last_read_time` *

When the `last_read_time` is before the latest message create time, the space appears as * unread in the UI. *

To mark the space as read, set `last_read_time` to any value later (larger) than the * latest message create time. The `last_read_time` is coerced to match the latest message * create time. Note that the space read state only affects the read state of messages that * are visible in the space's top-level conversation. Replies in threads are unaffected by * this timestamp, and instead rely on the thread read state. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SpaceReadState updateSpaceReadState( SpaceReadState spaceReadState, FieldMask updateMask) { UpdateSpaceReadStateRequest request = UpdateSpaceReadStateRequest.newBuilder() .setSpaceReadState(spaceReadState) .setUpdateMask(updateMask) .build(); return updateSpaceReadState(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a user's read state within a space, used to identify read and unread messages. For an * example, see [Update a user's space read * state](https://developers.google.com/workspace/chat/update-space-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UpdateSpaceReadStateRequest request =
   *       UpdateSpaceReadStateRequest.newBuilder()
   *           .setSpaceReadState(SpaceReadState.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   SpaceReadState response = chatServiceClient.updateSpaceReadState(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SpaceReadState updateSpaceReadState(UpdateSpaceReadStateRequest request) { return updateSpaceReadStateCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a user's read state within a space, used to identify read and unread messages. For an * example, see [Update a user's space read * state](https://developers.google.com/workspace/chat/update-space-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   UpdateSpaceReadStateRequest request =
   *       UpdateSpaceReadStateRequest.newBuilder()
   *           .setSpaceReadState(SpaceReadState.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.updateSpaceReadStateCallable().futureCall(request);
   *   // Do something.
   *   SpaceReadState response = future.get();
   * }
   * }
*/ public final UnaryCallable updateSpaceReadStateCallable() { return stub.updateSpaceReadStateCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a user's read state within a thread, used to identify read and unread * messages. For an example, see [Get details about a user's thread read * state](https://developers.google.com/workspace/chat/get-thread-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ThreadReadStateName name = ThreadReadStateName.of("[USER]", "[SPACE]", "[THREAD]");
   *   ThreadReadState response = chatServiceClient.getThreadReadState(name);
   * }
   * }
* * @param name Required. Resource name of the thread read state to retrieve. *

Only supports getting read state for the calling user. *

To refer to the calling user, set one of the following: *

- The `me` alias. For example, * `users/me/spaces/{space}/threads/{thread}/threadReadState`. *

- Their Workspace email address. For example, * `users/user{@literal @}example.com/spaces/{space}/threads/{thread}/threadReadState`. *

- Their user id. For example, * `users/123456789/spaces/{space}/threads/{thread}/threadReadState`. *

Format: users/{user}/spaces/{space}/threads/{thread}/threadReadState * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ThreadReadState getThreadReadState(ThreadReadStateName name) { GetThreadReadStateRequest request = GetThreadReadStateRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); return getThreadReadState(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a user's read state within a thread, used to identify read and unread * messages. For an example, see [Get details about a user's thread read * state](https://developers.google.com/workspace/chat/get-thread-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = ThreadReadStateName.of("[USER]", "[SPACE]", "[THREAD]").toString();
   *   ThreadReadState response = chatServiceClient.getThreadReadState(name);
   * }
   * }
* * @param name Required. Resource name of the thread read state to retrieve. *

Only supports getting read state for the calling user. *

To refer to the calling user, set one of the following: *

- The `me` alias. For example, * `users/me/spaces/{space}/threads/{thread}/threadReadState`. *

- Their Workspace email address. For example, * `users/user{@literal @}example.com/spaces/{space}/threads/{thread}/threadReadState`. *

- Their user id. For example, * `users/123456789/spaces/{space}/threads/{thread}/threadReadState`. *

Format: users/{user}/spaces/{space}/threads/{thread}/threadReadState * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ThreadReadState getThreadReadState(String name) { GetThreadReadStateRequest request = GetThreadReadStateRequest.newBuilder().setName(name).build(); return getThreadReadState(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a user's read state within a thread, used to identify read and unread * messages. For an example, see [Get details about a user's thread read * state](https://developers.google.com/workspace/chat/get-thread-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetThreadReadStateRequest request =
   *       GetThreadReadStateRequest.newBuilder()
   *           .setName(ThreadReadStateName.of("[USER]", "[SPACE]", "[THREAD]").toString())
   *           .build();
   *   ThreadReadState response = chatServiceClient.getThreadReadState(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ThreadReadState getThreadReadState(GetThreadReadStateRequest request) { return getThreadReadStateCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns details about a user's read state within a thread, used to identify read and unread * messages. For an example, see [Get details about a user's thread read * state](https://developers.google.com/workspace/chat/get-thread-read-state). * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetThreadReadStateRequest request =
   *       GetThreadReadStateRequest.newBuilder()
   *           .setName(ThreadReadStateName.of("[USER]", "[SPACE]", "[THREAD]").toString())
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.getThreadReadStateCallable().futureCall(request);
   *   // Do something.
   *   ThreadReadState response = future.get();
   * }
   * }
*/ public final UnaryCallable getThreadReadStateCallable() { return stub.getThreadReadStateCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns an event from a Google Chat space. The [event * payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) * contains the most recent version of the resource that changed. For example, if you request an * event about a new message but the message was later updated, the server returns the updated * `Message` resource in the event payload. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * To get an event, the authenticated user must be a member of the space. * *

For an example, see [Get details about an event from a Google Chat * space](https://developers.google.com/workspace/chat/get-space-event). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceEventName name = SpaceEventName.of("[SPACE]", "[SPACE_EVENT]");
   *   SpaceEvent response = chatServiceClient.getSpaceEvent(name);
   * }
   * }
* * @param name Required. The resource name of the space event. *

Format: `spaces/{space}/spaceEvents/{spaceEvent}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SpaceEvent getSpaceEvent(SpaceEventName name) { GetSpaceEventRequest request = GetSpaceEventRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getSpaceEvent(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns an event from a Google Chat space. The [event * payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) * contains the most recent version of the resource that changed. For example, if you request an * event about a new message but the message was later updated, the server returns the updated * `Message` resource in the event payload. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * To get an event, the authenticated user must be a member of the space. * *

For an example, see [Get details about an event from a Google Chat * space](https://developers.google.com/workspace/chat/get-space-event). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String name = SpaceEventName.of("[SPACE]", "[SPACE_EVENT]").toString();
   *   SpaceEvent response = chatServiceClient.getSpaceEvent(name);
   * }
   * }
* * @param name Required. The resource name of the space event. *

Format: `spaces/{space}/spaceEvents/{spaceEvent}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SpaceEvent getSpaceEvent(String name) { GetSpaceEventRequest request = GetSpaceEventRequest.newBuilder().setName(name).build(); return getSpaceEvent(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns an event from a Google Chat space. The [event * payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) * contains the most recent version of the resource that changed. For example, if you request an * event about a new message but the message was later updated, the server returns the updated * `Message` resource in the event payload. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * To get an event, the authenticated user must be a member of the space. * *

For an example, see [Get details about an event from a Google Chat * space](https://developers.google.com/workspace/chat/get-space-event). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetSpaceEventRequest request =
   *       GetSpaceEventRequest.newBuilder()
   *           .setName(SpaceEventName.of("[SPACE]", "[SPACE_EVENT]").toString())
   *           .build();
   *   SpaceEvent response = chatServiceClient.getSpaceEvent(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SpaceEvent getSpaceEvent(GetSpaceEventRequest request) { return getSpaceEventCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns an event from a Google Chat space. The [event * payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) * contains the most recent version of the resource that changed. For example, if you request an * event about a new message but the message was later updated, the server returns the updated * `Message` resource in the event payload. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * To get an event, the authenticated user must be a member of the space. * *

For an example, see [Get details about an event from a Google Chat * space](https://developers.google.com/workspace/chat/get-space-event). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   GetSpaceEventRequest request =
   *       GetSpaceEventRequest.newBuilder()
   *           .setName(SpaceEventName.of("[SPACE]", "[SPACE_EVENT]").toString())
   *           .build();
   *   ApiFuture future = chatServiceClient.getSpaceEventCallable().futureCall(request);
   *   // Do something.
   *   SpaceEvent response = future.get();
   * }
   * }
*/ public final UnaryCallable getSpaceEventCallable() { return stub.getSpaceEventCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists events from a Google Chat space. For each event, the * [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) * contains the most recent version of the Chat resource. For example, if you list events about * new space members, the server returns `Membership` resources that contain the latest membership * details. If new members were removed during the requested period, the event payload contains an * empty `Membership` resource. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * To list events, the authenticated user must be a member of the space. * *

For an example, see [List events from a Google Chat * space](https://developers.google.com/workspace/chat/list-space-events). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   SpaceName parent = SpaceName.of("[SPACE]");
   *   String filter = "filter-1274492040";
   *   for (SpaceEvent element : chatServiceClient.listSpaceEvents(parent, filter).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. Resource name of the [Google Chat * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) where the * events occurred. *

Format: `spaces/{space}`. * @param filter Required. A query filter. *

You must specify at least one event type (`event_type`) using the has `:` operator. To * filter by multiple event types, use the `OR` operator. Omit batch event types in your * filter. The request automatically returns any related batch events. For example, if you * filter by new reactions (`google.workspace.chat.reaction.v1.created`), the server also * returns batch new reactions events (`google.workspace.chat.reaction.v1.batchCreated`). For * a list of supported event types, see the [`SpaceEvents` reference * documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type). *

Optionally, you can also filter by start time (`start_time`) and end time (`end_time`): *

    *
  • `start_time`: Exclusive timestamp from which to start listing space events. You can * list events that occurred up to 28 days ago. If unspecified, lists space events from * the past 28 days. *
  • `end_time`: Inclusive timestamp until which space events are listed. If unspecified, * lists events up to the time of the request. *
*

To specify a start or end time, use the equals `=` operator and format in * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both `start_time` and * `end_time`, use the `AND` operator. *

For example, the following queries are valid: *

``` start_time="2023-08-23T19:20:33+00:00" AND end_time="2023-08-23T19:21:54+00:00" ``` * ``` start_time="2023-08-23T19:20:33+00:00" AND * (event_types:"google.workspace.chat.space.v1.updated" OR * event_types:"google.workspace.chat.message.v1.created") ``` *

The following queries are invalid: *

``` start_time="2023-08-23T19:20:33+00:00" OR end_time="2023-08-23T19:21:54+00:00" ``` * ``` event_types:"google.workspace.chat.space.v1.updated" AND * event_types:"google.workspace.chat.message.v1.created" ``` *

Invalid queries are rejected by the server with an `INVALID_ARGUMENT` error. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListSpaceEventsPagedResponse listSpaceEvents(SpaceName parent, String filter) { ListSpaceEventsRequest request = ListSpaceEventsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); return listSpaceEvents(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists events from a Google Chat space. For each event, the * [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) * contains the most recent version of the Chat resource. For example, if you list events about * new space members, the server returns `Membership` resources that contain the latest membership * details. If new members were removed during the requested period, the event payload contains an * empty `Membership` resource. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * To list events, the authenticated user must be a member of the space. * *

For an example, see [List events from a Google Chat * space](https://developers.google.com/workspace/chat/list-space-events). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   String parent = SpaceName.of("[SPACE]").toString();
   *   String filter = "filter-1274492040";
   *   for (SpaceEvent element : chatServiceClient.listSpaceEvents(parent, filter).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. Resource name of the [Google Chat * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) where the * events occurred. *

Format: `spaces/{space}`. * @param filter Required. A query filter. *

You must specify at least one event type (`event_type`) using the has `:` operator. To * filter by multiple event types, use the `OR` operator. Omit batch event types in your * filter. The request automatically returns any related batch events. For example, if you * filter by new reactions (`google.workspace.chat.reaction.v1.created`), the server also * returns batch new reactions events (`google.workspace.chat.reaction.v1.batchCreated`). For * a list of supported event types, see the [`SpaceEvents` reference * documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type). *

Optionally, you can also filter by start time (`start_time`) and end time (`end_time`): *

    *
  • `start_time`: Exclusive timestamp from which to start listing space events. You can * list events that occurred up to 28 days ago. If unspecified, lists space events from * the past 28 days. *
  • `end_time`: Inclusive timestamp until which space events are listed. If unspecified, * lists events up to the time of the request. *
*

To specify a start or end time, use the equals `=` operator and format in * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both `start_time` and * `end_time`, use the `AND` operator. *

For example, the following queries are valid: *

``` start_time="2023-08-23T19:20:33+00:00" AND end_time="2023-08-23T19:21:54+00:00" ``` * ``` start_time="2023-08-23T19:20:33+00:00" AND * (event_types:"google.workspace.chat.space.v1.updated" OR * event_types:"google.workspace.chat.message.v1.created") ``` *

The following queries are invalid: *

``` start_time="2023-08-23T19:20:33+00:00" OR end_time="2023-08-23T19:21:54+00:00" ``` * ``` event_types:"google.workspace.chat.space.v1.updated" AND * event_types:"google.workspace.chat.message.v1.created" ``` *

Invalid queries are rejected by the server with an `INVALID_ARGUMENT` error. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListSpaceEventsPagedResponse listSpaceEvents(String parent, String filter) { ListSpaceEventsRequest request = ListSpaceEventsRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listSpaceEvents(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists events from a Google Chat space. For each event, the * [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) * contains the most recent version of the Chat resource. For example, if you list events about * new space members, the server returns `Membership` resources that contain the latest membership * details. If new members were removed during the requested period, the event payload contains an * empty `Membership` resource. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * To list events, the authenticated user must be a member of the space. * *

For an example, see [List events from a Google Chat * space](https://developers.google.com/workspace/chat/list-space-events). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListSpaceEventsRequest request =
   *       ListSpaceEventsRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   for (SpaceEvent element : chatServiceClient.listSpaceEvents(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListSpaceEventsPagedResponse listSpaceEvents(ListSpaceEventsRequest request) { return listSpaceEventsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists events from a Google Chat space. For each event, the * [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) * contains the most recent version of the Chat resource. For example, if you list events about * new space members, the server returns `Membership` resources that contain the latest membership * details. If new members were removed during the requested period, the event payload contains an * empty `Membership` resource. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * To list events, the authenticated user must be a member of the space. * *

For an example, see [List events from a Google Chat * space](https://developers.google.com/workspace/chat/list-space-events). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListSpaceEventsRequest request =
   *       ListSpaceEventsRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   ApiFuture future =
   *       chatServiceClient.listSpaceEventsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (SpaceEvent element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listSpaceEventsPagedCallable() { return stub.listSpaceEventsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists events from a Google Chat space. For each event, the * [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) * contains the most recent version of the Chat resource. For example, if you list events about * new space members, the server returns `Membership` resources that contain the latest membership * details. If new members were removed during the requested period, the event payload contains an * empty `Membership` resource. * *

Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). * To list events, the authenticated user must be a member of the space. * *

For an example, see [List events from a Google Chat * space](https://developers.google.com/workspace/chat/list-space-events). * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
   *   ListSpaceEventsRequest request =
   *       ListSpaceEventsRequest.newBuilder()
   *           .setParent(SpaceName.of("[SPACE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   while (true) {
   *     ListSpaceEventsResponse response =
   *         chatServiceClient.listSpaceEventsCallable().call(request);
   *     for (SpaceEvent element : response.getSpaceEventsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listSpaceEventsCallable() { return stub.listSpaceEventsCallable(); } @Override public final void close() { stub.close(); } @Override public void shutdown() { stub.shutdown(); } @Override public boolean isShutdown() { return stub.isShutdown(); } @Override public boolean isTerminated() { return stub.isTerminated(); } @Override public void shutdownNow() { stub.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } public static class ListMessagesPagedResponse extends AbstractPagedListResponse< ListMessagesRequest, ListMessagesResponse, Message, ListMessagesPage, ListMessagesFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListMessagesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListMessagesPagedResponse(input), MoreExecutors.directExecutor()); } private ListMessagesPagedResponse(ListMessagesPage page) { super(page, ListMessagesFixedSizeCollection.createEmptyCollection()); } } public static class ListMessagesPage extends AbstractPage { private ListMessagesPage( PageContext context, ListMessagesResponse response) { super(context, response); } private static ListMessagesPage createEmptyPage() { return new ListMessagesPage(null, null); } @Override protected ListMessagesPage createPage( PageContext context, ListMessagesResponse response) { return new ListMessagesPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListMessagesFixedSizeCollection extends AbstractFixedSizeCollection< ListMessagesRequest, ListMessagesResponse, Message, ListMessagesPage, ListMessagesFixedSizeCollection> { private ListMessagesFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListMessagesFixedSizeCollection createEmptyCollection() { return new ListMessagesFixedSizeCollection(null, 0); } @Override protected ListMessagesFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListMessagesFixedSizeCollection(pages, collectionSize); } } public static class ListMembershipsPagedResponse extends AbstractPagedListResponse< ListMembershipsRequest, ListMembershipsResponse, Membership, ListMembershipsPage, ListMembershipsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListMembershipsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListMembershipsPagedResponse(input), MoreExecutors.directExecutor()); } private ListMembershipsPagedResponse(ListMembershipsPage page) { super(page, ListMembershipsFixedSizeCollection.createEmptyCollection()); } } public static class ListMembershipsPage extends AbstractPage< ListMembershipsRequest, ListMembershipsResponse, Membership, ListMembershipsPage> { private ListMembershipsPage( PageContext context, ListMembershipsResponse response) { super(context, response); } private static ListMembershipsPage createEmptyPage() { return new ListMembershipsPage(null, null); } @Override protected ListMembershipsPage createPage( PageContext context, ListMembershipsResponse response) { return new ListMembershipsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListMembershipsFixedSizeCollection extends AbstractFixedSizeCollection< ListMembershipsRequest, ListMembershipsResponse, Membership, ListMembershipsPage, ListMembershipsFixedSizeCollection> { private ListMembershipsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListMembershipsFixedSizeCollection createEmptyCollection() { return new ListMembershipsFixedSizeCollection(null, 0); } @Override protected ListMembershipsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListMembershipsFixedSizeCollection(pages, collectionSize); } } public static class ListSpacesPagedResponse extends AbstractPagedListResponse< ListSpacesRequest, ListSpacesResponse, Space, ListSpacesPage, ListSpacesFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListSpacesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListSpacesPagedResponse(input), MoreExecutors.directExecutor()); } private ListSpacesPagedResponse(ListSpacesPage page) { super(page, ListSpacesFixedSizeCollection.createEmptyCollection()); } } public static class ListSpacesPage extends AbstractPage { private ListSpacesPage( PageContext context, ListSpacesResponse response) { super(context, response); } private static ListSpacesPage createEmptyPage() { return new ListSpacesPage(null, null); } @Override protected ListSpacesPage createPage( PageContext context, ListSpacesResponse response) { return new ListSpacesPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListSpacesFixedSizeCollection extends AbstractFixedSizeCollection< ListSpacesRequest, ListSpacesResponse, Space, ListSpacesPage, ListSpacesFixedSizeCollection> { private ListSpacesFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListSpacesFixedSizeCollection createEmptyCollection() { return new ListSpacesFixedSizeCollection(null, 0); } @Override protected ListSpacesFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListSpacesFixedSizeCollection(pages, collectionSize); } } public static class SearchSpacesPagedResponse extends AbstractPagedListResponse< SearchSpacesRequest, SearchSpacesResponse, Space, SearchSpacesPage, SearchSpacesFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = SearchSpacesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new SearchSpacesPagedResponse(input), MoreExecutors.directExecutor()); } private SearchSpacesPagedResponse(SearchSpacesPage page) { super(page, SearchSpacesFixedSizeCollection.createEmptyCollection()); } } public static class SearchSpacesPage extends AbstractPage { private SearchSpacesPage( PageContext context, SearchSpacesResponse response) { super(context, response); } private static SearchSpacesPage createEmptyPage() { return new SearchSpacesPage(null, null); } @Override protected SearchSpacesPage createPage( PageContext context, SearchSpacesResponse response) { return new SearchSpacesPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class SearchSpacesFixedSizeCollection extends AbstractFixedSizeCollection< SearchSpacesRequest, SearchSpacesResponse, Space, SearchSpacesPage, SearchSpacesFixedSizeCollection> { private SearchSpacesFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static SearchSpacesFixedSizeCollection createEmptyCollection() { return new SearchSpacesFixedSizeCollection(null, 0); } @Override protected SearchSpacesFixedSizeCollection createCollection( List pages, int collectionSize) { return new SearchSpacesFixedSizeCollection(pages, collectionSize); } } public static class ListReactionsPagedResponse extends AbstractPagedListResponse< ListReactionsRequest, ListReactionsResponse, Reaction, ListReactionsPage, ListReactionsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListReactionsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListReactionsPagedResponse(input), MoreExecutors.directExecutor()); } private ListReactionsPagedResponse(ListReactionsPage page) { super(page, ListReactionsFixedSizeCollection.createEmptyCollection()); } } public static class ListReactionsPage extends AbstractPage< ListReactionsRequest, ListReactionsResponse, Reaction, ListReactionsPage> { private ListReactionsPage( PageContext context, ListReactionsResponse response) { super(context, response); } private static ListReactionsPage createEmptyPage() { return new ListReactionsPage(null, null); } @Override protected ListReactionsPage createPage( PageContext context, ListReactionsResponse response) { return new ListReactionsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListReactionsFixedSizeCollection extends AbstractFixedSizeCollection< ListReactionsRequest, ListReactionsResponse, Reaction, ListReactionsPage, ListReactionsFixedSizeCollection> { private ListReactionsFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListReactionsFixedSizeCollection createEmptyCollection() { return new ListReactionsFixedSizeCollection(null, 0); } @Override protected ListReactionsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListReactionsFixedSizeCollection(pages, collectionSize); } } public static class ListSpaceEventsPagedResponse extends AbstractPagedListResponse< ListSpaceEventsRequest, ListSpaceEventsResponse, SpaceEvent, ListSpaceEventsPage, ListSpaceEventsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListSpaceEventsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListSpaceEventsPagedResponse(input), MoreExecutors.directExecutor()); } private ListSpaceEventsPagedResponse(ListSpaceEventsPage page) { super(page, ListSpaceEventsFixedSizeCollection.createEmptyCollection()); } } public static class ListSpaceEventsPage extends AbstractPage< ListSpaceEventsRequest, ListSpaceEventsResponse, SpaceEvent, ListSpaceEventsPage> { private ListSpaceEventsPage( PageContext context, ListSpaceEventsResponse response) { super(context, response); } private static ListSpaceEventsPage createEmptyPage() { return new ListSpaceEventsPage(null, null); } @Override protected ListSpaceEventsPage createPage( PageContext context, ListSpaceEventsResponse response) { return new ListSpaceEventsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListSpaceEventsFixedSizeCollection extends AbstractFixedSizeCollection< ListSpaceEventsRequest, ListSpaceEventsResponse, SpaceEvent, ListSpaceEventsPage, ListSpaceEventsFixedSizeCollection> { private ListSpaceEventsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListSpaceEventsFixedSizeCollection createEmptyCollection() { return new ListSpaceEventsFixedSizeCollection(null, 0); } @Override protected ListSpaceEventsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListSpaceEventsFixedSizeCollection(pages, collectionSize); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy