Skip to content

Commit 13ca8db

Browse files
Google APIscopybara-github
authored andcommitted
feat: Addition of ChatService.FindGroupChats
PiperOrigin-RevId: 900283522
1 parent bcfcbda commit 13ca8db

4 files changed

Lines changed: 113 additions & 1 deletion

File tree

‎google/chat/v1/chat_grpc_service_config.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
{ "service": "google.chat.v1.ChatService", "method": "ListCustomEmojis" },
2727
{ "service": "google.chat.v1.ChatService", "method": "UploadAttachment" },
2828
{ "service": "google.chat.v1.ChatService", "method": "FindDirectMessage" },
29+
{ "service": "google.chat.v1.ChatService", "method": "FindGroupChats" },
2930
{ "service": "google.chat.v1.ChatService", "method": "CompleteImportSpace" },
3031
{ "service": "google.chat.v1.ChatService", "method": "UpdateMembership" },
3132
{ "service": "google.chat.v1.ChatService", "method": "UpdateSpaceReadState" },

‎google/chat/v1/chat_service.proto‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,32 @@ service ChatService {
717717
};
718718
}
719719

720+
// Returns all spaces with `spaceType == GROUP_CHAT`, whose
721+
// human memberships contain exactly the calling user, and the users specified
722+
// in `FindGroupChatsRequest.users`. Only members that have joined the
723+
// conversation are supported. For an example, see [Find group
724+
// chats](https://developers.google.com/workspace/chat/find-group-chats).
725+
//
726+
// If the calling user blocks, or is blocked by, some users, and no spaces
727+
// with the entire specified set of users are found, this method returns
728+
// spaces that don't include the blocked or blocking users.
729+
//
730+
// The specified set of users must contain only human (non-app) memberships.
731+
// A request that contains non-human users doesn't return any spaces.
732+
//
733+
// Requires [user
734+
// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
735+
// with one of the following [authorization
736+
// scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
737+
//
738+
// - `https://www.googleapis.com/auth/chat.memberships.readonly`
739+
// - `https://www.googleapis.com/auth/chat.memberships`
740+
rpc FindGroupChats(FindGroupChatsRequest) returns (FindGroupChatsResponse) {
741+
option (google.api.http) = {
742+
get: "/v1/spaces:findGroupChats"
743+
};
744+
}
745+
720746
// Creates a membership for the calling Chat app, a user, or a Google Group.
721747
// Creating memberships for other Chat apps isn't supported.
722748
// When creating a membership, if the specified member has their auto-accept

‎google/chat/v1/chat_v1.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ authentication:
9797
https://www.googleapis.com/auth/chat.bot,
9898
https://www.googleapis.com/auth/chat.spaces,
9999
https://www.googleapis.com/auth/chat.spaces.readonly
100+
- selector: google.chat.v1.ChatService.FindGroupChats
101+
oauth:
102+
canonical_scopes: |-
103+
https://www.googleapis.com/auth/chat.memberships,
104+
https://www.googleapis.com/auth/chat.memberships.readonly
100105
- selector: google.chat.v1.ChatService.GetAttachment
101106
oauth:
102107
canonical_scopes: |-

‎google/chat/v1/space.proto‎

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Google LLC
1+
// Copyright 2026 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -552,6 +552,65 @@ message FindDirectMessageRequest {
552552
string name = 1 [(google.api.field_behavior) = REQUIRED];
553553
}
554554

555+
// A request to get group chat spaces based on user resources.
556+
message FindGroupChatsRequest {
557+
// Optional. Resource names of all human users in group chat with the calling
558+
// user. Chat apps can't be included in the request.
559+
//
560+
// The maximum number of users that can be specified in a single request is
561+
// `49`.
562+
//
563+
// Format: `users/{user}`, where `{user}` is either the `id` for the
564+
// [person](https://developers.google.com/people/api/rest/v1/people) from the
565+
// People API, or the `id` for the
566+
// [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
567+
// in the Directory API. For example, to find all group chats with the calling
568+
// user and two other users, with People API profile IDs `123456789` and
569+
// `987654321`, you can use `users/123456789` and `users/987654321`.
570+
// You can also use the email as an alias for `{user}`. For example,
571+
// `users/[email protected]` where `[email protected]` is the email of the
572+
// Google Chat user.
573+
repeated string users = 5 [(google.api.field_behavior) = OPTIONAL];
574+
575+
// Optional. The maximum number of spaces to return. The service might return
576+
// fewer than this value.
577+
//
578+
// If unspecified, at most 10 spaces are returned.
579+
//
580+
// The maximum value is 30. If you use a value more than 30, it's
581+
// automatically changed to 30.
582+
//
583+
// Negative values return an `INVALID_ARGUMENT` error.
584+
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
585+
586+
// Optional. A page token, received from a previous call to find group chats.
587+
// Provide this parameter to retrieve the subsequent page.
588+
//
589+
// When paginating, all other parameters provided should match the call that
590+
// provided the token. Passing different values may lead to unexpected
591+
// results.
592+
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
593+
594+
// Requested space view type. If unset, defaults to
595+
// `SPACE_VIEW_RESOURCE_NAME_ONLY`. Requests that specify
596+
// `SPACE_VIEW_EXPANDED` must include scopes that allow reading space data,
597+
// for example,
598+
// https://www.googleapis.com/auth/chat.spaces or
599+
// https://www.googleapis.com/auth/chat.spaces.readonly.
600+
SpaceView space_view = 4;
601+
}
602+
603+
// A response containing group chat spaces with exactly the calling user and the
604+
// requested users.
605+
message FindGroupChatsResponse {
606+
// List of spaces in the requested (or first) page.
607+
repeated Space spaces = 1;
608+
609+
// A token that you can send as `pageToken` to retrieve the next page of
610+
// results. If empty, there are no subsequent pages.
611+
string next_page_token = 2;
612+
}
613+
555614
// A request to update a single space.
556615
message UpdateSpaceRequest {
557616
// Required. Space with fields to be updated. `Space.name` must be
@@ -822,3 +881,24 @@ message CompleteImportSpaceResponse {
822881
// The import mode space.
823882
Space space = 1;
824883
}
884+
885+
// A view that specifies which fields should be populated on the
886+
// [`Space`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces)
887+
// resource.
888+
// To ensure compatibility with future releases, we recommend that your code
889+
// account for additional values.
890+
enum SpaceView {
891+
// The default / unset value.
892+
SPACE_VIEW_UNSPECIFIED = 0;
893+
894+
// Populates only the Space resource name.
895+
SPACE_VIEW_RESOURCE_NAME_ONLY = 3;
896+
897+
// Populates Space resource fields. Note: the `permissionSettings` field
898+
// will not be populated.
899+
// Requests that specify SPACE_VIEW_EXPANDED must include scopes that allow
900+
// reading space data, for example,
901+
// https://www.googleapis.com/auth/chat.spaces or
902+
// https://www.googleapis.com/auth/chat.spaces.readonly.
903+
SPACE_VIEW_EXPANDED = 4;
904+
}

0 commit comments

Comments
 (0)