# Class ChatServiceGrpc.ChatServiceBlockingStub (0.57.0)

0.57.0 (latest) 0.55.0 0.52.0 0.51.0 0.49.0 0.47.0 0.46.0 0.45.0 0.44.0 0.42.0 0.40.0 0.39.0 0.38.0 0.37.0 0.36.0 0.34.0 0.32.0 0.31.0 0.28.0 0.27.0 0.26.0 0.24.0 0.23.0 0.22.0 0.21.0 0.20.0 0.19.0 0.18.0 0.17.0 0.16.0 0.15.0 0.13.0 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.0 0.6.0 0.5.0 0.4.0 0.3.0 0.1.0

    public static final class ChatServiceGrpc.ChatServiceBlockingStub extends AbstractBlockingStub<ChatServiceGrpc.ChatServiceBlockingStub>

A stub to allow clients to do limited synchronous rpc calls to service ChatService.

Enables developers to build Chat apps and
integrations on Google Chat Platform.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> io.grpc.stub.AbstractStub \> io.grpc.stub.AbstractBlockingStub \> ChatServiceGrpc.ChatServiceBlockingStub

## Inherited Members

io.grpc.stub.AbstractBlockingStub.\<T\>newStub(io.grpc.stub.AbstractStub.StubFactory\<T\>,io.grpc.Channel) io.grpc.stub.AbstractBlockingStub.\<T\>newStub(io.grpc.stub.AbstractStub.StubFactory\<T\>,io.grpc.Channel,io.grpc.CallOptions) io.grpc.stub.AbstractStub.\<T\>withOption(io.grpc.CallOptions.Key\<T\>,T) io.grpc.stub.AbstractStub.build(io.grpc.Channel,io.grpc.CallOptions) io.grpc.stub.AbstractStub.getCallOptions() io.grpc.stub.AbstractStub.getChannel() io.grpc.stub.AbstractStub.withCallCredentials(io.grpc.CallCredentials) io.grpc.stub.AbstractStub.withChannel(io.grpc.Channel) io.grpc.stub.AbstractStub.withCompression(java.lang.String) io.grpc.stub.AbstractStub.withDeadline(io.grpc.Deadline) io.grpc.stub.AbstractStub.withDeadlineAfter(java.time.Duration) io.grpc.stub.AbstractStub.withDeadlineAfter(long,java.util.concurrent.TimeUnit) io.grpc.stub.AbstractStub.withExecutor(java.util.concurrent.Executor) io.grpc.stub.AbstractStub.withInterceptors(io.grpc.ClientInterceptor...) io.grpc.stub.AbstractStub.withMaxInboundMessageSize(int) io.grpc.stub.AbstractStub.withMaxOutboundMessageSize(int) io.grpc.stub.AbstractStub.withOnReadyThreshold(int) io.grpc.stub.AbstractStub.withWaitForReady() [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Methods

### build(Channel channel, CallOptions callOptions)

    protected ChatServiceGrpc.ChatServiceBlockingStub build(Channel channel, CallOptions callOptions)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `channel` | `io.grpc.Channel` |
| `callOptions` | `io.grpc.CallOptions` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ChatServiceGrpc.ChatServiceBlockingStub` |   |

**Overrides** io.grpc.stub.AbstractStub.build(io.grpc.Channel,io.grpc.CallOptions)

### completeImportSpace(CompleteImportSpaceRequest request)

    public CompleteImportSpaceResponse completeImportSpace(CompleteImportSpaceRequest request)

Completes the
[import process](https://developers.google.com/workspace/chat/import-data)
for the specified space and makes it visible to users.
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
and domain-wide delegation with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.import` For more information, see [Authorize Google
  Chat apps to import
  data](https://developers.google.com/workspace/chat/authorize-import).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CompleteImportSpaceRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CompleteImportSpaceResponse` |   |

### createCustomEmoji(CreateCustomEmojiRequest request)

    public CustomEmoji createCustomEmoji(CreateCustomEmojiRequest request)

Creates a custom emoji.
Custom emojis are only available for Google Workspace accounts, and the
administrator must turn custom emojis on for the organization. For more
information, see [Learn about custom emojis in Google
Chat](https://support.google.com/chat/answer/12800149) and
[Manage custom emoji
permissions](https://support.google.com/a/answer/12850085).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.customemojis`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CreateCustomEmojiRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CustomEmoji` |   |

### createMembership(CreateMembershipRequest request)

    public Membership createMembership(CreateMembershipRequest request)

Creates a membership for the calling Chat app, a user, or a Google Group.
Creating memberships for other Chat apps isn't supported.
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.
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and the authorization scope:
  - `https://www.googleapis.com/auth/chat.app.memberships`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.memberships`
  - `https://www.googleapis.com/auth/chat.memberships.app` (to add the calling app to the space)
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)
  - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and the following authorization scope is used:
    - `https://www.googleapis.com/auth/chat.admin.memberships` App authentication is not supported for the following use cases:
- Inviting users external to the Workspace organization that owns the space.
- Adding a Google Group to a space.
- Adding a Chat app to a space. For example usage, see:
- [Invite or add a user to a
  space](https://developers.google.com/workspace/chat/create-members#create-user-membership).
- [Invite or add a Google Group to a
  space](https://developers.google.com/workspace/chat/create-members#create-group-membership).
- [Add the Chat app to a
  space](https://developers.google.com/workspace/chat/create-members#create-membership-calling-api).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CreateMembershipRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Membership` |   |

### createMessage(CreateMessageRequest request)

    public Message createMessage(CreateMessageRequest request)

Creates a message in a Google Chat space. For an example, see [Send a
message](https://developers.google.com/workspace/chat/create-messages).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope:
  - `https://www.googleapis.com/auth/chat.bot`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.messages.create`
  - `https://www.googleapis.com/auth/chat.messages`
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) Chat attributes the message sender differently depending on the type of authentication that you use in your request. The following image shows how Chat attributes a message when you use app authentication. Chat displays the Chat app as the message sender. The content of the message can contain text (`text`), cards (`cardsV2`), and accessory widgets (`accessoryWidgets`). ![Message sent with app
    authentication](https://developers.google.com/workspace/chat/images/message-app-auth.svg) The following image shows how Chat attributes a message when you use user authentication. Chat displays the user as the message sender and attributes the Chat app to the message by displaying its name. The content of message can only contain text (`text`). ![Message sent with user
    authentication](https://developers.google.com/workspace/chat/images/message-user-auth.svg) The maximum message size, including the message contents, is 32,000 bytes. For [webhook](https://developers.google.com/workspace/chat/quickstart/webhooks) requests, the response doesn't contain the full message. The response only populates the `name` and `thread.name` fields in addition to the information that was in the request.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CreateMessageRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Message` |   |

### createReaction(CreateReactionRequest request)

    public Reaction createReaction(CreateReactionRequest request)

Creates a reaction and adds it to a message. 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)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.messages.reactions.create`
- `https://www.googleapis.com/auth/chat.messages.reactions`
- `https://www.googleapis.com/auth/chat.messages`
- `https://www.googleapis.com/auth/chat.import` (import mode spaces only)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CreateReactionRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Reaction` |   |

### createSection(CreateSectionRequest request)

    public Section createSection(CreateSectionRequest request)

Creates a section in Google Chat. Sections help users group conversations
and customize the list of spaces displayed in Chat navigation panel. Only
sections of type `CUSTOM_SECTION` can be created. For details, see [Create
and organize sections in Google
Chat](https://support.google.com/chat/answer/16059854).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.sections`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CreateSectionRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Section` |   |

### createSpace(CreateSpaceRequest request)

    public Space createSpace(CreateSpaceRequest request)

Creates a space. Can be used to create a named space, or a
group chat in `Import mode`. For an example, see [Create a
space](https://developers.google.com/workspace/chat/create-spaces).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.app.spaces.create`
  - `https://www.googleapis.com/auth/chat.app.spaces`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.spaces.create`
  - `https://www.googleapis.com/auth/chat.spaces`
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) When authenticating as an app, the `space.customer` field must be set in the request. When authenticating as an app, the Chat app is added as a member of the space. However, unlike human authentication, the Chat app is not added as a space manager. By default, the Chat app can be removed from the space by all space members. To allow only space managers to remove the app from a space, set `space.permission_settings.manage_apps` to `managers_allowed`. Space membership upon creation depends on whether the space is created in `Import mode`:
- **Import mode:** No members are created.
- **All other modes:** The calling user is added as a member. This is:
  - The app itself when using app authentication.
  - The human user when using user authentication. 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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CreateSpaceRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Space` |   |

### deleteCustomEmoji(DeleteCustomEmojiRequest request)

    public Empty deleteCustomEmoji(DeleteCustomEmojiRequest request)

Deletes a custom emoji. By default, users can only delete custom emoji they
created. [Emoji managers](https://support.google.com/a/answer/12850085)
assigned by the administrator can delete any custom emoji in the
organization. See [Learn about custom emojis in Google
Chat](https://support.google.com/chat/answer/12800149).
Custom emojis are only available for Google Workspace accounts, and the
administrator must turn custom emojis on for the organization. For more
information, see [Learn about custom emojis in Google
Chat](https://support.google.com/chat/answer/12800149) and
[Manage custom emoji
permissions](https://support.google.com/a/answer/12850085).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.customemojis`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.DeleteCustomEmojiRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html` |   |

### deleteMembership(DeleteMembershipRequest request)

    public Membership deleteMembership(DeleteMembershipRequest request)

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).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and the authorization scope:
  - `https://www.googleapis.com/auth/chat.app.memberships`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.memberships`
  - `https://www.googleapis.com/auth/chat.memberships.app` (to remove the calling app from the space)
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)
  - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and the following authorization scope is used:
    - `https://www.googleapis.com/auth/chat.admin.memberships` App authentication is not supported for the following use cases:
- Removing a Google Group from a space.
- Removing a Chat app from a space. To delete memberships for space managers, the requester must be a space manager. If you're using [app
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) the Chat app must be the space creator.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.DeleteMembershipRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Membership` |   |

### deleteMessage(DeleteMessageRequest request)

    public Empty deleteMessage(DeleteMessageRequest request)

Deletes a message.
For an example, see [Delete a
message](https://developers.google.com/workspace/chat/delete-messages).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope:
  - `https://www.googleapis.com/auth/chat.bot`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.messages`
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) When using app authentication, requests can only delete messages created by the calling Chat app.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.DeleteMessageRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html` |   |

### deleteReaction(DeleteReactionRequest request)

    public Empty deleteReaction(DeleteReactionRequest request)

Deletes a reaction to a message. 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)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.messages.reactions`
- `https://www.googleapis.com/auth/chat.messages`
- `https://www.googleapis.com/auth/chat.import` (import mode spaces only)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.DeleteReactionRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html` |   |

### deleteSection(DeleteSectionRequest request)

    public Empty deleteSection(DeleteSectionRequest request)

Deletes a section of type `CUSTOM_SECTION`.
If the section contains items, such as spaces, the items are moved to
Google Chat's default sections and are not deleted.
For details, see [Create and organize sections in Google
Chat](https://support.google.com/chat/answer/16059854).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.sections`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.DeleteSectionRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html` |   |

### deleteSpace(DeleteSpaceRequest request)

    public Empty deleteSpace(DeleteSpaceRequest request)

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).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator
  approval](https://support.google.com/a?p=chat-app-auth) and the authorization scope:
  - `https://www.googleapis.com/auth/chat.app.delete` (only in spaces the app created)
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.delete`
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)
  - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and the following authorization scope is used:
    - `https://www.googleapis.com/auth/chat.admin.delete`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.DeleteSpaceRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html` |   |

### findDirectMessage(FindDirectMessageRequest request)

    public Space findDirectMessage(FindDirectMessageRequest request)

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](https://docs.cloud.google.com/chat/api/guides/v1/spaces/find-direct-message).
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.
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.
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope:
  - `https://www.googleapis.com/auth/chat.bot`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.spaces.readonly`
  - `https://www.googleapis.com/auth/chat.spaces`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.FindDirectMessageRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Space` |   |

### findGroupChats(FindGroupChatsRequest request)

    public FindGroupChatsResponse findGroupChats(FindGroupChatsRequest request)

Returns all spaces with `spaceType == GROUP_CHAT`, whose
human memberships contain exactly the calling user, and the users specified
in `FindGroupChatsRequest.users`. Only members that have joined the
conversation are supported. For an example, see [Find group
chats](https://developers.google.com/workspace/chat/find-group-chats).
If the calling user blocks, or is blocked by, some users, and no spaces
with the entire specified set of users are found, this method returns
spaces that don't include the blocked or blocking users.
The specified set of users must contain only human (non-app) memberships.
A request that contains non-human users doesn't return any spaces.
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.memberships.readonly`
- `https://www.googleapis.com/auth/chat.memberships`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.FindGroupChatsRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.FindGroupChatsResponse` |   |

### getAttachment(GetAttachmentRequest request)

    public Attachment getAttachment(GetAttachmentRequest request)

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)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.bot`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.GetAttachmentRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Attachment` |   |

### getCustomEmoji(GetCustomEmojiRequest request)

    public CustomEmoji getCustomEmoji(GetCustomEmojiRequest request)

Returns details about a custom emoji.
Custom emojis are only available for Google Workspace accounts, and the
administrator must turn custom emojis on for the organization. For more
information, see [Learn about custom emojis in Google
Chat](https://support.google.com/chat/answer/12800149) and
[Manage custom emoji
permissions](https://support.google.com/a/answer/12850085).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.customemojis.readonly`
- `https://www.googleapis.com/auth/chat.customemojis`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.GetCustomEmojiRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.CustomEmoji` |   |

### getMembership(GetMembershipRequest request)

    public Membership getMembership(GetMembershipRequest request)

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).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.bot`
  - `https://www.googleapis.com/auth/chat.app.memberships` (requires [administrator approval](https://support.google.com/a?p=chat-app-auth))
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.memberships.readonly`
  - `https://www.googleapis.com/auth/chat.memberships`
  - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and one of the following authorization scopes is used:
    - `https://www.googleapis.com/auth/chat.admin.memberships.readonly`
    - `https://www.googleapis.com/auth/chat.admin.memberships`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.GetMembershipRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Membership` |   |

### getMessage(GetMessageRequest request)

    public Message getMessage(GetMessageRequest request)

Returns details about a message.
For an example, see [Get details about a
message](https://developers.google.com/workspace/chat/get-messages).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.bot`: When using this authorization scope, this method returns details about a message the Chat app has access to, like direct messages and [slash
    commands](https://developers.google.com/workspace/chat/slash-commands) that invoke the Chat app.
  - `https://www.googleapis.com/auth/chat.app.messages.readonly` with [administrator
    approval](https://support.google.com/a?p=chat-app-auth). When using this authentication scope, this method returns details about a public message in a space.
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.messages.readonly`
  - `https://www.googleapis.com/auth/chat.messages` Note: Might return a message from a blocked member or space.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.GetMessageRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Message` |   |

### getSpace(GetSpaceRequest request)

    public Space getSpace(GetSpaceRequest request)

Returns details about a space. For an example, see
[Get details about a
space](https://developers.google.com/workspace/chat/get-spaces).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.bot`
  - `https://www.googleapis.com/auth/chat.app.spaces` with [administrator
    approval](https://support.google.com/a?p=chat-app-auth)
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.spaces.readonly`
  - `https://www.googleapis.com/auth/chat.spaces`
  - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and one of the following authorization scopes is used:
    - `https://www.googleapis.com/auth/chat.admin.spaces.readonly`
    - `https://www.googleapis.com/auth/chat.admin.spaces` App authentication has the following limitations:
- `space.access_settings` is only populated when using the `chat.app.spaces` scope.
- `space.predefind_permission_settings` and `space.permission_settings` are only populated when using the `chat.app.spaces` scope, and only for spaces the app created.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.GetSpaceRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Space` |   |

### getSpaceEvent(GetSpaceEventRequest request)

    public SpaceEvent getSpaceEvent(GetSpaceEventRequest request)

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.
Note: The `permissionSettings` field is not returned in the Space
object of the Space event data for this request.
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize)
with an
[authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes)
appropriate for reading the requested data:

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator
  approval](https://support.google.com/a?p=chat-app-auth) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.app.spaces`
  - `https://www.googleapis.com/auth/chat.app.spaces.readonly`
  - `https://www.googleapis.com/auth/chat.app.messages.readonly`
  - `https://www.googleapis.com/auth/chat.app.memberships`
  - `https://www.googleapis.com/auth/chat.app.memberships.readonly`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.spaces.readonly`
  - `https://www.googleapis.com/auth/chat.spaces`
  - `https://www.googleapis.com/auth/chat.messages.readonly`
  - `https://www.googleapis.com/auth/chat.messages`
  - `https://www.googleapis.com/auth/chat.messages.reactions.readonly`
  - `https://www.googleapis.com/auth/chat.messages.reactions`
  - `https://www.googleapis.com/auth/chat.memberships.readonly`
  - `https://www.googleapis.com/auth/chat.memberships` To get an event, the authenticated caller 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).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.GetSpaceEventRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.SpaceEvent` |   |

### getSpaceNotificationSetting(GetSpaceNotificationSettingRequest request)

    public SpaceNotificationSetting getSpaceNotificationSetting(GetSpaceNotificationSettingRequest request)

Gets the space notification setting. For an example, see [Get the
caller's space notification
setting](https://developers.google.com/workspace/chat/get-space-notification-setting).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.spacesettings`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.GetSpaceNotificationSettingRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.SpaceNotificationSetting` |   |

### getSpaceReadState(GetSpaceReadStateRequest request)

    public SpaceReadState getSpaceReadState(GetSpaceReadStateRequest request)

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)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.readstate.readonly`
- `https://www.googleapis.com/auth/chat.users.readstate`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.GetSpaceReadStateRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.SpaceReadState` |   |

### getThreadReadState(GetThreadReadStateRequest request)

    public ThreadReadState getThreadReadState(GetThreadReadStateRequest request)

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)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.readstate.readonly`
- `https://www.googleapis.com/auth/chat.users.readstate`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.GetThreadReadStateRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ThreadReadState` |   |

### listCustomEmojis(ListCustomEmojisRequest request)

    public ListCustomEmojisResponse listCustomEmojis(ListCustomEmojisRequest request)

Lists custom emojis visible to the authenticated user.
Custom emojis are only available for Google Workspace accounts, and the
administrator must turn custom emojis on for the organization. For more
information, see [Learn about custom emojis in Google
Chat](https://support.google.com/chat/answer/12800149) and
[Manage custom emoji
permissions](https://support.google.com/a/answer/12850085).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.customemojis.readonly`
- `https://www.googleapis.com/auth/chat.customemojis`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListCustomEmojisRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListCustomEmojisResponse` |   |

### listMemberships(ListMembershipsRequest request)

    public ListMembershipsResponse listMemberships(ListMembershipsRequest request)

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.
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.bot`
  - `https://www.googleapis.com/auth/chat.app.memberships` (requires [administrator approval](https://support.google.com/a?p=chat-app-auth))
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.memberships.readonly`
  - `https://www.googleapis.com/auth/chat.memberships`
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)
  - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and one of the following authorization scopes is used:
    - `https://www.googleapis.com/auth/chat.admin.memberships.readonly`
    - `https://www.googleapis.com/auth/chat.admin.memberships`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListMembershipsRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListMembershipsResponse` |   |

### listMessages(ListMessagesRequest request)

    public ListMessagesResponse listMessages(ListMessagesRequest request)

Lists messages in a space that the caller is a member of, including
messages from blocked members and spaces. System messages, like those
announcing new space members, aren't included. If you list messages from a
space with no messages, the response is an empty object. When using a
REST/HTTP interface, the response contains an empty JSON object, `{}`.
For an example, see
[List
messages](https://developers.google.com/workspace/chat/api/guides/v1/messages/list).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator
  approval](https://support.google.com/a?p=chat-app-auth) with the authorization scope:
  - `https://www.googleapis.com/auth/chat.app.messages.readonly`. When using this authentication scope, this method only returns public messages in a space. It doesn't include private messages.
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.messages.readonly`
  - `https://www.googleapis.com/auth/chat.messages`
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListMessagesRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListMessagesResponse` |   |

### listReactions(ListReactionsRequest request)

    public ListReactionsResponse listReactions(ListReactionsRequest request)

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)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.messages.reactions.readonly`
- `https://www.googleapis.com/auth/chat.messages.reactions`
- `https://www.googleapis.com/auth/chat.messages.readonly`
- `https://www.googleapis.com/auth/chat.messages`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListReactionsRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListReactionsResponse` |   |

### listSectionItems(ListSectionItemsRequest request)

    public ListSectionItemsResponse listSectionItems(ListSectionItemsRequest request)

Lists items in a section.
Only spaces can be section items. For details, see [Create and organize
sections in Google Chat](https://support.google.com/chat/answer/16059854).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.sections`
- `https://www.googleapis.com/auth/chat.users.sections.readonly`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListSectionItemsRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListSectionItemsResponse` |   |

### listSections(ListSectionsRequest request)

    public ListSectionsResponse listSections(ListSectionsRequest request)

Lists sections available to the Chat user. Sections help users group their
conversations and customize the list of spaces displayed in Chat
navigation panel. For details, see [Create and organize sections in Google
Chat](https://support.google.com/chat/answer/16059854).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.sections`
- `https://www.googleapis.com/auth/chat.users.sections.readonly`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListSectionsRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListSectionsResponse` |   |

### listSpaceEvents(ListSpaceEventsRequest request)

    public ListSpaceEventsResponse listSpaceEvents(ListSpaceEventsRequest request)

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.
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize)
with an
[authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes)
appropriate for reading the requested data:

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator
  approval](https://support.google.com/a?p=chat-app-auth) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.app.spaces`
  - `https://www.googleapis.com/auth/chat.app.spaces.readonly`
  - `https://www.googleapis.com/auth/chat.app.messages.readonly`
  - `https://www.googleapis.com/auth/chat.app.memberships`
  - `https://www.googleapis.com/auth/chat.app.memberships.readonly`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.spaces.readonly`
  - `https://www.googleapis.com/auth/chat.spaces`
  - `https://www.googleapis.com/auth/chat.messages.readonly`
  - `https://www.googleapis.com/auth/chat.messages`
  - `https://www.googleapis.com/auth/chat.messages.reactions.readonly`
  - `https://www.googleapis.com/auth/chat.messages.reactions`
  - `https://www.googleapis.com/auth/chat.memberships.readonly`
  - `https://www.googleapis.com/auth/chat.memberships` To list events, the authenticated caller 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).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListSpaceEventsRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListSpaceEventsResponse` |   |

### listSpaces(ListSpacesRequest request)

    public ListSpacesResponse listSpaces(ListSpacesRequest request)

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).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope:
  - `https://www.googleapis.com/auth/chat.bot`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.spaces.readonly`
  - `https://www.googleapis.com/auth/chat.spaces` 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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListSpacesRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.ListSpacesResponse` |   |

### moveSectionItem(MoveSectionItemRequest request)

    public MoveSectionItemResponse moveSectionItem(MoveSectionItemRequest request)

Moves an item from one section to another. For example, if a section
contains spaces, this method can be used to move a space to a different
section. For details, see [Create and organize sections in Google
Chat](https://support.google.com/chat/answer/16059854).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.sections`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.MoveSectionItemRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.MoveSectionItemResponse` |   |

### positionSection(PositionSectionRequest request)

    public PositionSectionResponse positionSection(PositionSectionRequest request)

Changes the sort order of a section. For details, see [Create and organize
sections in Google Chat](https://support.google.com/chat/answer/16059854).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.sections`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.PositionSectionRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.PositionSectionResponse` |   |

### searchSpaces(SearchSpacesRequest request)

    public SearchSpacesResponse searchSpaces(SearchSpacesRequest request)

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

- `https://www.googleapis.com/auth/chat.admin.spaces.readonly`
- `https://www.googleapis.com/auth/chat.admin.spaces`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.SearchSpacesRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.SearchSpacesResponse` |   |

### setUpSpace(SetUpSpaceRequest request)

    public Space setUpSpace(SetUpSpaceRequest request)

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@example.com` is `123456789`,
you can add the user to the space by setting the `membership.member.name`
to `users/user@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@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)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.spaces.create`
- `https://www.googleapis.com/auth/chat.spaces`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.SetUpSpaceRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Space` |   |

### updateMembership(UpdateMembershipRequest request)

    public Membership updateMembership(UpdateMembershipRequest request)

Updates a membership. For an example, see [Update a user's membership in
a space](https://developers.google.com/workspace/chat/update-members).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator
  approval](https://support.google.com/a?p=chat-app-auth) and the authorization scope:
  - `https://www.googleapis.com/auth/chat.app.memberships` (only in spaces the app created)
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.memberships`
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)
  - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and the following authorization scope is used:
    - `https://www.googleapis.com/auth/chat.admin.memberships`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.UpdateMembershipRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Membership` |   |

### updateMessage(UpdateMessageRequest request)

    public Message updateMessage(UpdateMessageRequest request)

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).
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope:
  - `https://www.googleapis.com/auth/chat.bot`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.messages`
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only) When using app authentication, requests can only update messages created by the calling Chat app.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.UpdateMessageRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Message` |   |

### updateSection(UpdateSectionRequest request)

    public Section updateSection(UpdateSectionRequest request)

Updates a section. Only sections of type `CUSTOM_SECTION` can be updated.
For details, see [Create and organize sections in Google
Chat](https://support.google.com/chat/answer/16059854).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.sections`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.UpdateSectionRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Section` |   |

### updateSpace(UpdateSpaceRequest request)

    public Space updateSpace(UpdateSpaceRequest request)

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.
Supports the following types of
[authentication](https://developers.google.com/workspace/chat/authenticate-authorize):

- [App
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.app.spaces`
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:
  - `https://www.googleapis.com/auth/chat.spaces`
  - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)
  - User authentication grants administrator privileges when an administrator account authenticates, `use_admin_access` is `true`, and the following authorization scopes is used:
    - `https://www.googleapis.com/auth/chat.admin.spaces` App authentication has the following limitations:
- To update either `space.predefined_permission_settings` or `space.permission_settings`, the app must be the space creator.
- Updating the `space.access_settings.audience` is not supported for app authentication.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.UpdateSpaceRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Space` |   |

### updateSpaceNotificationSetting(UpdateSpaceNotificationSettingRequest request)

    public SpaceNotificationSetting updateSpaceNotificationSetting(UpdateSpaceNotificationSettingRequest request)

Updates the space notification setting. For an example, see [Update
the caller's space notification
setting](https://developers.google.com/workspace/chat/update-space-notification-setting).
Requires [user
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.spacesettings`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.UpdateSpaceNotificationSettingRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.SpaceNotificationSetting` |   |

### updateSpaceReadState(UpdateSpaceReadStateRequest request)

    public SpaceReadState updateSpaceReadState(UpdateSpaceReadStateRequest request)

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)
with the [authorization
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.users.readstate`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.UpdateSpaceReadStateRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.SpaceReadState` |   |

### uploadAttachment(UploadAttachmentRequest request)

    public UploadAttachmentResponse uploadAttachment(UploadAttachmentRequest request)

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)
with one of the following [authorization
scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):

- `https://www.googleapis.com/auth/chat.messages.create`
- `https://www.googleapis.com/auth/chat.messages`
- `https://www.googleapis.com/auth/chat.import` (import mode spaces only) 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).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.UploadAttachmentRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.UploadAttachmentResponse` |   |