Class ChatService.ChatServiceBase
Base class for server-side implementations of ChatService
Namespace: Google.Apps.Chat.V1
Assembly: Google.Apps.Chat.V1.dll
Syntax
[BindServiceMethod(typeof(ChatService), "BindService")]
public abstract class ChatService.ChatServiceBase
Methods
CompleteImportSpace(CompleteImportSpaceRequest, ServerCallContext)
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.
Declaration
public virtual Task<CompleteImportSpaceResponse> CompleteImportSpace(CompleteImportSpaceRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| CompleteImportSpaceRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<CompleteImportSpaceResponse> | The response to send back to the client (wrapped by a task). |
CreateMembership(CreateMembershipRequest, ServerCallContext)
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. 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 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 theidfor the person from the People API, or theidfor the user in the Directory API. For example, if the People API Person profile ID foruser@example.comis123456789, you can add the user to the space by setting themembership.member.nametousers/user@example.comorusers/123456789.To add or invite a Google group in a named space, use
groups/{group}, where{group}is theidfor the group from the Cloud Identity Groups API. For example, you can use Cloud Identity Groups lookup API to retrieve the ID123456789for group emailgroup@example.com, then you can add or invite the group to a named space by setting themembership.group_member.nametogroups/123456789. Group email is not supported, and Google groups can only be added as members in named spaces.
Declaration
public virtual Task<Membership> CreateMembership(CreateMembershipRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateMembershipRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Membership> | The response to send back to the client (wrapped by a task). |
CreateMessage(CreateMessageRequest, ServerCallContext)
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.
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.)
Declaration
public virtual Task<Message> CreateMessage(CreateMessageRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateMessageRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Message> | The response to send back to the client (wrapped by a task). |
CreateReaction(CreateReactionRequest, ServerCallContext)
Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, see Add a reaction to a message. Requires user authentication.
Declaration
public virtual Task<Reaction> CreateReaction(CreateReactionRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateReactionRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Reaction> | The response to send back to the client (wrapped by a task). |
CreateSpace(CreateSpaceRequest, ServerCallContext)
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.
Declaration
public virtual Task<Space> CreateSpace(CreateSpaceRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateSpaceRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Space> | The response to send back to the client (wrapped by a task). |
DeleteMembership(DeleteMembershipRequest, ServerCallContext)
Deletes a membership. For an example, see Remove a user or a Google Chat app from a space.
Requires user authentication.
Declaration
public virtual Task<Membership> DeleteMembership(DeleteMembershipRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| DeleteMembershipRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Membership> | The response to send back to the client (wrapped by a task). |
DeleteMessage(DeleteMessageRequest, ServerCallContext)
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.
Declaration
public virtual Task<Empty> DeleteMessage(DeleteMessageRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| DeleteMessageRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Empty> | The response to send back to the client (wrapped by a task). |
DeleteReaction(DeleteReactionRequest, ServerCallContext)
Deletes a reaction to a message. Only unicode emojis are supported. For an example, see Delete a reaction. Requires user authentication.
Declaration
public virtual Task<Empty> DeleteReaction(DeleteReactionRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| DeleteReactionRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Empty> | The response to send back to the client (wrapped by a task). |
DeleteSpace(DeleteSpaceRequest, ServerCallContext)
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.
Declaration
public virtual Task<Empty> DeleteSpace(DeleteSpaceRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| DeleteSpaceRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Empty> | The response to send back to the client (wrapped by a task). |
FindDirectMessage(FindDirectMessageRequest, ServerCallContext)
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.
Declaration
public virtual Task<Space> FindDirectMessage(FindDirectMessageRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| FindDirectMessageRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Space> | The response to send back to the client (wrapped by a task). |
GetAttachment(GetAttachmentRequest, ServerCallContext)
Gets the metadata of a message attachment. The attachment data is fetched using the media API. For an example, see Get metadata about a message attachment. Requires app authentication.
Declaration
public virtual Task<Attachment> GetAttachment(GetAttachmentRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| GetAttachmentRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Attachment> | The response to send back to the client (wrapped by a task). |
GetMembership(GetMembershipRequest, ServerCallContext)
Returns details about a membership. For an example, see Get details about a user's or Google Chat app's membership.
Requires authentication. Supports app authentication and user authentication.
Declaration
public virtual Task<Membership> GetMembership(GetMembershipRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| GetMembershipRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Membership> | The response to send back to the client (wrapped by a task). |
GetMessage(GetMessageRequest, ServerCallContext)
Returns details about a message. For an example, see Get details about a message.
Requires authentication. Supports app authentication and user authentication.
Note: Might return a message from a blocked member or space.
Declaration
public virtual Task<Message> GetMessage(GetMessageRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| GetMessageRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Message> | The response to send back to the client (wrapped by a task). |
GetSpace(GetSpaceRequest, ServerCallContext)
Returns details about a space. For an example, see Get details about a space.
Requires authentication. Supports app authentication and user authentication.
Declaration
public virtual Task<Space> GetSpace(GetSpaceRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| GetSpaceRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Space> | The response to send back to the client (wrapped by a task). |
GetSpaceEvent(GetSpaceEventRequest, ServerCallContext)
Returns an event from a Google Chat space. The event
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. 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.
Declaration
public virtual Task<SpaceEvent> GetSpaceEvent(GetSpaceEventRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| GetSpaceEventRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<SpaceEvent> | The response to send back to the client (wrapped by a task). |
GetSpaceReadState(GetSpaceReadStateRequest, ServerCallContext)
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.
Requires user authentication.
Declaration
public virtual Task<SpaceReadState> GetSpaceReadState(GetSpaceReadStateRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| GetSpaceReadStateRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<SpaceReadState> | The response to send back to the client (wrapped by a task). |
GetThreadReadState(GetThreadReadStateRequest, ServerCallContext)
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.
Requires user authentication.
Declaration
public virtual Task<ThreadReadState> GetThreadReadState(GetThreadReadStateRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| GetThreadReadStateRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<ThreadReadState> | The response to send back to the client (wrapped by a task). |
ListMemberships(ListMembershipsRequest, ServerCallContext)
Lists memberships in a space. For an example, see List users and Google Chat apps in a space. 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.
Declaration
public virtual Task<ListMembershipsResponse> ListMemberships(ListMembershipsRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ListMembershipsRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<ListMembershipsResponse> | The response to send back to the client (wrapped by a task). |
ListMessages(ListMessagesRequest, ServerCallContext)
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.
Declaration
public virtual Task<ListMessagesResponse> ListMessages(ListMessagesRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ListMessagesRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<ListMessagesResponse> | The response to send back to the client (wrapped by a task). |
ListReactions(ListReactionsRequest, ServerCallContext)
Lists reactions to a message. For an example, see List reactions for a message. Requires user authentication.
Declaration
public virtual Task<ListReactionsResponse> ListReactions(ListReactionsRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ListReactionsRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<ListReactionsResponse> | The response to send back to the client (wrapped by a task). |
ListSpaceEvents(ListSpaceEventsRequest, ServerCallContext)
Lists events from a Google Chat space. For each event, the
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. To list events, the authenticated user must be a member of the space.
For an example, see List events from a Google Chat space.
Declaration
public virtual Task<ListSpaceEventsResponse> ListSpaceEvents(ListSpaceEventsRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ListSpaceEventsRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<ListSpaceEventsResponse> | The response to send back to the client (wrapped by a task). |
ListSpaces(ListSpacesRequest, ServerCallContext)
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.
To list all named spaces by Google Workspace organization, use the
spaces.search()
method using Workspace administrator privileges instead.
Declaration
public virtual Task<ListSpacesResponse> ListSpaces(ListSpacesRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ListSpacesRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<ListSpacesResponse> | The response to send back to the client (wrapped by a task). |
SearchSpaces(SearchSpacesRequest, ServerCallContext)
Returns a list of spaces in a Google Workspace organization based on an
administrator's search. Requires user
authentication with administrator
privileges.
In the request, set use_admin_access to true.
Declaration
public virtual Task<SearchSpacesResponse> SearchSpaces(SearchSpacesRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| SearchSpacesRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<SearchSpacesResponse> | The response to send back to the client (wrapped by a task). |
SetUpSpace(SetUpSpaceRequest, ServerCallContext)
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.
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
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.
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.
Declaration
public virtual Task<Space> SetUpSpace(SetUpSpaceRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| SetUpSpaceRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Space> | The response to send back to the client (wrapped by a task). |
UpdateMembership(UpdateMembershipRequest, ServerCallContext)
Updates a membership. For an example, see Update a user's membership in a space.
Requires user authentication.
Declaration
public virtual Task<Membership> UpdateMembership(UpdateMembershipRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| UpdateMembershipRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Membership> | The response to send back to the client (wrapped by a task). |
UpdateMessage(UpdateMessageRequest, ServerCallContext)
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.
Declaration
public virtual Task<Message> UpdateMessage(UpdateMessageRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| UpdateMessageRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Message> | The response to send back to the client (wrapped by a task). |
UpdateSpace(UpdateSpaceRequest, ServerCallContext)
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.
Declaration
public virtual Task<Space> UpdateSpace(UpdateSpaceRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| UpdateSpaceRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Space> | The response to send back to the client (wrapped by a task). |
UpdateSpaceReadState(UpdateSpaceReadStateRequest, ServerCallContext)
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.
Requires user authentication.
Declaration
public virtual Task<SpaceReadState> UpdateSpaceReadState(UpdateSpaceReadStateRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| UpdateSpaceReadStateRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<SpaceReadState> | The response to send back to the client (wrapped by a task). |
UploadAttachment(UploadAttachmentRequest, ServerCallContext)
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.
Declaration
public virtual Task<UploadAttachmentResponse> UploadAttachment(UploadAttachmentRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| UploadAttachmentRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<UploadAttachmentResponse> | The response to send back to the client (wrapped by a task). |