Interface ChatServiceGrpc.AsyncService (0.5.0)

public static interface ChatServiceGrpc.AsyncService

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

Methods

completeImportSpace(CompleteImportSpaceRequest request, StreamObserver<CompleteImportSpaceResponse> responseObserver)

public default void completeImportSpace(CompleteImportSpaceRequest request, StreamObserver<CompleteImportSpaceResponse> responseObserver)

Completes the import process 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.

Parameters
NameDescription
requestCompleteImportSpaceRequest
responseObserverio.grpc.stub.StreamObserver<CompleteImportSpaceResponse>

createMembership(CreateMembershipRequest request, StreamObserver<Membership> responseObserver)

public default void createMembership(CreateMembershipRequest request, StreamObserver<Membership> responseObserver)

Creates a human membership or app membership for the calling app. Creating memberships for other apps isn't supported. For an example, see Create a membership. 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. To specify the member to add, set the membership.member.name in the CreateMembershipRequest:

  • 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@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.
Parameters
NameDescription
requestCreateMembershipRequest
responseObserverio.grpc.stub.StreamObserver<Membership>

createMessage(CreateMessageRequest request, StreamObserver<Message> responseObserver)

public default void createMessage(CreateMessageRequest request, StreamObserver<Message> responseObserver)

Creates a message in a Google Chat space. For an example, see Create a message. Calling this method requires authentication 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.)
Parameters
NameDescription
requestCreateMessageRequest
responseObserverio.grpc.stub.StreamObserver<Message>

createReaction(CreateReactionRequest request, StreamObserver<Reaction> responseObserver)

public default void createReaction(CreateReactionRequest request, StreamObserver<Reaction> responseObserver)

Creates a reaction and adds it to a message. For an example, see Create a reaction. Requires user authentication. Only unicode emoji are supported.

Parameters
NameDescription
requestCreateReactionRequest
responseObserverio.grpc.stub.StreamObserver<Reaction>

createSpace(CreateSpaceRequest request, StreamObserver<Space> responseObserver)

public default void createSpace(CreateSpaceRequest request, StreamObserver<Space> responseObserver)

Creates a named space. Spaces grouped by topics aren't supported. For an example, see Create a space. 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.

Parameters
NameDescription
requestCreateSpaceRequest
responseObserverio.grpc.stub.StreamObserver<Space>

deleteMembership(DeleteMembershipRequest request, StreamObserver<Membership> responseObserver)

public default void deleteMembership(DeleteMembershipRequest request, StreamObserver<Membership> responseObserver)

Deletes a membership. For an example, see Delete a membership. Requires user authentication.

Parameters
NameDescription
requestDeleteMembershipRequest
responseObserverio.grpc.stub.StreamObserver<Membership>

deleteMessage(DeleteMessageRequest request, StreamObserver<Empty> responseObserver)

public default void deleteMessage(DeleteMessageRequest request, StreamObserver<Empty> responseObserver)

Deletes a message. For an example, see Delete a message. Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only delete messages created by the calling Chat app.

Parameters
NameDescription
requestDeleteMessageRequest
responseObserverio.grpc.stub.StreamObserver<Empty>

deleteReaction(DeleteReactionRequest request, StreamObserver<Empty> responseObserver)

public default void deleteReaction(DeleteReactionRequest request, StreamObserver<Empty> responseObserver)

Deletes a reaction to a message. For an example, see Delete a reaction. Requires user authentication.

Parameters
NameDescription
requestDeleteReactionRequest
responseObserverio.grpc.stub.StreamObserver<Empty>

deleteSpace(DeleteSpaceRequest request, StreamObserver<Empty> responseObserver)

public default void deleteSpace(DeleteSpaceRequest request, StreamObserver<Empty> responseObserver)

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. Requires user authentication from a user who has permission to delete the space.

Parameters
NameDescription
requestDeleteSpaceRequest
responseObserverio.grpc.stub.StreamObserver<Empty>

findDirectMessage(FindDirectMessageRequest request, StreamObserver<Space> responseObserver)

public default void findDirectMessage(FindDirectMessageRequest request, StreamObserver<Space> responseObserver)

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. With user authentication, returns the direct message space between the specified user and the authenticated user. With app authentication, returns the direct message space between the specified user and the calling Chat app. Requires user authentication or app authentication.

Parameters
NameDescription
requestFindDirectMessageRequest
responseObserverio.grpc.stub.StreamObserver<Space>

getAttachment(GetAttachmentRequest request, StreamObserver<Attachment> responseObserver)

public default void getAttachment(GetAttachmentRequest request, StreamObserver<Attachment> responseObserver)

Gets the metadata of a message attachment. The attachment data is fetched using the media API. For an example, see Get a message attachment. Requires app authentication.

Parameters
NameDescription
requestGetAttachmentRequest
responseObserverio.grpc.stub.StreamObserver<Attachment>

getMembership(GetMembershipRequest request, StreamObserver<Membership> responseObserver)

public default void getMembership(GetMembershipRequest request, StreamObserver<Membership> responseObserver)

Returns details about a membership. For an example, see Get a membership. Requires authentication. Supports app authentication and user authentication.

Parameters
NameDescription
requestGetMembershipRequest
responseObserverio.grpc.stub.StreamObserver<Membership>

getMessage(GetMessageRequest request, StreamObserver<Message> responseObserver)

public default void getMessage(GetMessageRequest request, StreamObserver<Message> responseObserver)

Returns details about a message. For an example, see Read a message. Requires authentication. Supports app authentication and user authentication. Note: Might return a message from a blocked member or space.

Parameters
NameDescription
requestGetMessageRequest
responseObserverio.grpc.stub.StreamObserver<Message>

getSpace(GetSpaceRequest request, StreamObserver<Space> responseObserver)

public default void getSpace(GetSpaceRequest request, StreamObserver<Space> responseObserver)

Returns details about a space. For an example, see Get a space. Requires authentication. Supports app authentication and user authentication.

Parameters
NameDescription
requestGetSpaceRequest
responseObserverio.grpc.stub.StreamObserver<Space>

listMemberships(ListMembershipsRequest request, StreamObserver<ListMembershipsResponse> responseObserver)

public default void listMemberships(ListMembershipsRequest request, StreamObserver<ListMembershipsResponse> responseObserver)

Lists memberships in a space. For an example, see List memberships. Listing memberships with app authentication lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, including its own. Listing memberships with User authentication lists memberships in spaces that the authenticated user has access to. Requires authentication. Supports app authentication and user authentication.

Parameters
NameDescription
requestListMembershipsRequest
responseObserverio.grpc.stub.StreamObserver<ListMembershipsResponse>

listMessages(ListMessagesRequest request, StreamObserver<ListMessagesResponse> responseObserver)

public default void listMessages(ListMessagesRequest request, StreamObserver<ListMessagesResponse> responseObserver)

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. Requires user authentication.

Parameters
NameDescription
requestListMessagesRequest
responseObserverio.grpc.stub.StreamObserver<ListMessagesResponse>

listReactions(ListReactionsRequest request, StreamObserver<ListReactionsResponse> responseObserver)

public default void listReactions(ListReactionsRequest request, StreamObserver<ListReactionsResponse> responseObserver)

Lists reactions to a message. For an example, see List reactions. Requires user authentication.

Parameters
NameDescription
requestListReactionsRequest
responseObserverio.grpc.stub.StreamObserver<ListReactionsResponse>

listSpaces(ListSpacesRequest request, StreamObserver<ListSpacesResponse> responseObserver)

public default void listSpaces(ListSpacesRequest request, StreamObserver<ListSpacesResponse> responseObserver)

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. Requires authentication. Supports app authentication and user authentication. Lists spaces visible to the caller or authenticated user. Group chats and DMs aren't listed until the first message is sent.

Parameters
NameDescription
requestListSpacesRequest
responseObserverio.grpc.stub.StreamObserver<ListSpacesResponse>

setUpSpace(SetUpSpaceRequest request, StreamObserver<Space> responseObserver)

public default void setUpSpace(SetUpSpaceRequest request, StreamObserver<Space> responseObserver)

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. To specify the human members to add, add memberships with the appropriate member.name in the SetUpSpaceRequest. 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. For a space or group chat, if the caller blocks or is blocked by 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 create a membership. 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.

Parameters
NameDescription
requestSetUpSpaceRequest
responseObserverio.grpc.stub.StreamObserver<Space>

updateMessage(UpdateMessageRequest request, StreamObserver<Message> responseObserver)

public default void updateMessage(UpdateMessageRequest request, StreamObserver<Message> responseObserver)

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. Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only update messages created by the calling Chat app.

Parameters
NameDescription
requestUpdateMessageRequest
responseObserverio.grpc.stub.StreamObserver<Message>

updateSpace(UpdateSpaceRequest request, StreamObserver<Space> responseObserver)

public default void updateSpace(UpdateSpaceRequest request, StreamObserver<Space> responseObserver)

Updates a space. For an example, see Update a space. 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.

Parameters
NameDescription
requestUpdateSpaceRequest
responseObserverio.grpc.stub.StreamObserver<Space>

uploadAttachment(UploadAttachmentRequest request, StreamObserver<UploadAttachmentResponse> responseObserver)

public default void uploadAttachment(UploadAttachmentRequest request, StreamObserver<UploadAttachmentResponse> responseObserver)

Uploads an attachment. For an example, see Upload media as a file attachment. Requires user authentication. You can upload attachments up to 200 MB. Certain file types aren't supported. For details, see File types blocked by Google Chat.

Parameters
NameDescription
requestUploadAttachmentRequest
responseObserverio.grpc.stub.StreamObserver<UploadAttachmentResponse>