xref: /aosp_15_r20/external/googleapis/google/chat/v1/space.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.chat.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/chat/v1/history_state.proto";
22import "google/protobuf/field_mask.proto";
23import "google/protobuf/timestamp.proto";
24
25option csharp_namespace = "Google.Apps.Chat.V1";
26option go_package = "cloud.google.com/go/chat/apiv1/chatpb;chatpb";
27option java_multiple_files = true;
28option java_outer_classname = "SpaceProto";
29option java_package = "com.google.chat.v1";
30option php_namespace = "Google\\Apps\\Chat\\V1";
31option ruby_package = "Google::Apps::Chat::V1";
32
33// A space in Google Chat. Spaces are conversations between two or more users
34// or 1:1 messages between a user and a Chat app.
35message Space {
36  option (google.api.resource) = {
37    type: "chat.googleapis.com/Space"
38    pattern: "spaces/{space}"
39  };
40
41  // Deprecated: Use `SpaceType` instead.
42  enum Type {
43    // Reserved.
44    TYPE_UNSPECIFIED = 0;
45
46    // Conversations between two or more humans.
47    ROOM = 1;
48
49    // 1:1 Direct Message between a human and a Chat app, where all messages are
50    // flat. Note that this doesn't include direct messages between two humans.
51    DM = 2;
52  }
53
54  // The type of space. Required when creating or updating a space. Output only
55  // for other usage.
56  enum SpaceType {
57    // Reserved.
58    SPACE_TYPE_UNSPECIFIED = 0;
59
60    // A place where people send messages, share files, and collaborate.
61    // A `SPACE` can include Chat apps.
62    SPACE = 1;
63
64    // Group conversations between 3 or more people.
65    // A `GROUP_CHAT` can include Chat apps.
66    GROUP_CHAT = 2;
67
68    // 1:1 messages between two humans or a human and a Chat app.
69    DIRECT_MESSAGE = 3;
70  }
71
72  // Specifies the type of threading state in the Chat space.
73  enum SpaceThreadingState {
74    // Reserved.
75    SPACE_THREADING_STATE_UNSPECIFIED = 0;
76
77    // Named spaces that support message threads. When users respond to a
78    // message, they can reply in-thread, which keeps their response in the
79    // context of the original message.
80    THREADED_MESSAGES = 2;
81
82    // Named spaces where the conversation is organized by topic. Topics and
83    // their replies are grouped together.
84    GROUPED_MESSAGES = 3;
85
86    // Direct messages (DMs) between two people and group conversations between
87    // 3 or more people.
88    UNTHREADED_MESSAGES = 4;
89  }
90
91  // Details about the space including description and rules.
92  message SpaceDetails {
93    // Optional. A description of the space. For example, describe the space's
94    // discussion topic, functional purpose, or participants.
95    //
96    // Supports up to 150 characters.
97    string description = 1;
98
99    // Optional. The space's rules, expectations, and etiquette.
100    //
101    // Supports up to 5,000 characters.
102    string guidelines = 2;
103  }
104
105  // Resource name of the space.
106  //
107  // Format: `spaces/{space}`
108  string name = 1;
109
110  // Output only. Deprecated: Use `space_type` instead.
111  // The type of a space.
112  Type type = 2 [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY];
113
114  // The type of space. Required when creating a space or updating the space
115  // type of a space. Output only for other usage.
116  SpaceType space_type = 10;
117
118  // Optional. Whether the space is a DM between a Chat app and a single
119  // human.
120  bool single_user_bot_dm = 4 [(google.api.field_behavior) = OPTIONAL];
121
122  // Output only. Deprecated: Use `spaceThreadingState` instead.
123  // Whether messages are threaded in this space.
124  bool threaded = 5
125      [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY];
126
127  // The space's display name. Required when [creating a
128  // space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create).
129  // If you receive the error message `ALREADY_EXISTS` when creating a space or
130  // updating the `displayName`, try a different `displayName`. An
131  // existing space within the Google Workspace organization might already use
132  // this display name.
133  //
134  // For direct messages, this field might be empty.
135  //
136  // Supports up to 128 characters.
137  string display_name = 3;
138
139  // Immutable. Whether this space permits any Google Chat user as a member.
140  // Input when creating a space in a Google Workspace organization. Omit this
141  // field when creating spaces in the following conditions:
142  //
143  //   * The authenticated user uses a consumer account (unmanaged user
144  //     account). By default, a space created by a consumer account permits any
145  //     Google Chat user.
146  //
147  //   * The space is used to [import data to Google Chat]
148  //     (https://developers.google.com/chat/api/guides/import-data-overview)
149  //     because import mode spaces must only permit members from the same
150  //     Google Workspace organization. However, as part of the [Google
151  //     Workspace Developer Preview
152  //     Program](https://developers.google.com/workspace/preview), import mode
153  //     spaces can permit any Google Chat user so this field can then be set
154  //     for import mode spaces.
155  //
156  // For existing spaces, this field is output only.
157  bool external_user_allowed = 8 [(google.api.field_behavior) = IMMUTABLE];
158
159  // Output only. The threading state in the Chat space.
160  SpaceThreadingState space_threading_state = 9
161      [(google.api.field_behavior) = OUTPUT_ONLY];
162
163  // Details about the space including description and rules.
164  SpaceDetails space_details = 11;
165
166  // The message history state for messages and threads in this space.
167  HistoryState space_history_state = 13;
168
169  // Optional. Whether this space is created in `Import Mode` as part of a data
170  // migration into Google Workspace. While spaces are being imported, they
171  // aren't visible to users until the import is complete.
172  bool import_mode = 16 [(google.api.field_behavior) = OPTIONAL];
173
174  // Optional. Immutable. For spaces created in Chat, the time the space was
175  // created. This field is output only, except when used in import mode spaces.
176  //
177  // For import mode spaces, set this field to the historical timestamp at which
178  // the space was created in the source in order to preserve the original
179  // creation time.
180  //
181  // Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
182  google.protobuf.Timestamp create_time = 17 [
183    (google.api.field_behavior) = IMMUTABLE,
184    (google.api.field_behavior) = OPTIONAL
185  ];
186
187  // Output only. Whether the Chat app was installed by a Google Workspace
188  // administrator. Administrators can install a Chat app for their domain,
189  // organizational unit, or a group of users.
190  //
191  // Administrators can only install Chat apps for direct messaging between
192  // users and the app. To support admin install, your app must feature direct
193  // messaging.
194  bool admin_installed = 19 [(google.api.field_behavior) = OUTPUT_ONLY];
195}
196
197// A request to create a named space.
198message CreateSpaceRequest {
199  // Required. The `displayName` and `spaceType` fields must be populated.  Only
200  // `SpaceType.SPACE` is supported.
201  //
202  // If you receive the error message `ALREADY_EXISTS` when creating a space,
203  // try a different `displayName`. An existing space within the Google
204  // Workspace organization might already use this display name.
205  //
206  // The space `name` is assigned on the server so anything specified in this
207  // field will be ignored.
208  Space space = 1 [(google.api.field_behavior) = REQUIRED];
209
210  // Optional. A unique identifier for this request.
211  // A random UUID is recommended.
212  // Specifying an existing request ID returns the space created with that ID
213  // instead of creating a new space.
214  // Specifying an existing request ID from the same Chat app with a different
215  // authenticated user returns an error.
216  string request_id = 2 [(google.api.field_behavior) = OPTIONAL];
217}
218
219// A request to list the spaces the caller is a member of.
220message ListSpacesRequest {
221  // Optional. The maximum number of spaces to return. The service might return
222  // fewer than this value.
223  //
224  // If unspecified, at most 100 spaces are returned.
225  //
226  // The maximum value is 1000. If you use a value more than 1000, it's
227  // automatically changed to 1000.
228  //
229  // Negative values return an `INVALID_ARGUMENT` error.
230  int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
231
232  // Optional. A page token, received from a previous list spaces call.
233  // Provide this parameter to retrieve the subsequent page.
234  //
235  // When paginating, the filter value should match the call that provided the
236  // page token. Passing a different value may lead to unexpected results.
237  string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
238
239  // Optional. A query filter.
240  //
241  // You can filter spaces by the space type
242  // ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)).
243  //
244  // To filter by space type, you must specify valid enum value, such as
245  // `SPACE` or `GROUP_CHAT` (the `space_type` can't be
246  // `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR`
247  // operator.
248  //
249  // For example, the following queries are valid:
250  //
251  // ```
252  // space_type = "SPACE"
253  // spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE"
254  // ```
255  //
256  // Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
257  // error.
258  string filter = 3 [(google.api.field_behavior) = OPTIONAL];
259}
260
261// The response for a list spaces request.
262message ListSpacesResponse {
263  // List of spaces in the requested (or first) page.
264  repeated Space spaces = 1;
265
266  // You can send a token as `pageToken` to retrieve the next page of
267  // results. If empty, there are no subsequent pages.
268  string next_page_token = 2;
269}
270
271// A request to return a single space.
272message GetSpaceRequest {
273  // Required. Resource name of the space, in the form "spaces/*".
274  //
275  // Format: `spaces/{space}`
276  string name = 1 [
277    (google.api.field_behavior) = REQUIRED,
278    (google.api.resource_reference) = { type: "chat.googleapis.com/Space" }
279  ];
280}
281
282// A request to get direct message space based on the user resource.
283message FindDirectMessageRequest {
284  // Required. Resource name of the user to find direct message with.
285  //
286  // Format: `users/{user}`, where `{user}` is either the `id` for the
287  // [person](https://developers.google.com/people/api/rest/v1/people) from the
288  // People API, or the `id` for the
289  // [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
290  // in the Directory API. For example, if the People API profile ID is
291  // `123456789`, you can find a direct message with that person by using
292  // `users/123456789` as the `name`. When [authenticated as a
293  // user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
294  // you can use the email as an alias for `{user}`. For example,
295  // `users/example@gmail.com` where `[email protected]` is the email of the
296  // Google Chat user.
297  string name = 1 [(google.api.field_behavior) = REQUIRED];
298}
299
300// A request to update a single space.
301message UpdateSpaceRequest {
302  // Required. Space with fields to be updated. `Space.name` must be
303  // populated in the form of `spaces/{space}`. Only fields
304  // specified by `update_mask` are updated.
305  Space space = 1 [(google.api.field_behavior) = REQUIRED];
306
307  // Required. The updated field paths, comma separated if there are
308  // multiple.
309  //
310  // Currently supported field paths:
311  //
312  // - `display_name` (Only supports changing the display name of a space with
313  // the `SPACE` type, or when also including the `space_type` mask to change a
314  // `GROUP_CHAT` space type to `SPACE`. Trying to update the display name of a
315  // `GROUP_CHAT` or a `DIRECT_MESSAGE` space results in an invalid argument
316  // error. If you receive the error message `ALREADY_EXISTS` when updating the
317  // `displayName`, try a different `displayName`. An existing space within the
318  // Google Workspace organization might already use this display name.)
319  //
320  // - `space_type` (Only supports changing a `GROUP_CHAT` space type to
321  // `SPACE`. Include `display_name` together
322  // with `space_type` in the update mask and ensure that the specified space
323  // has a non-empty display name and the `SPACE` space type. Including the
324  // `space_type` mask and the `SPACE` type in the specified space when updating
325  // the display name is optional if the existing space already has the `SPACE`
326  // type. Trying to update the space type in other ways results in an invalid
327  // argument error).
328  //
329  // - `space_details`
330  //
331  // - `space_history_state` (Supports [turning history on or off for the
332  // space](https://support.google.com/chat/answer/7664687) if [the organization
333  // allows users to change their history
334  // setting](https://support.google.com/a/answer/7664184).
335  // Warning: mutually exclusive with all other field paths.)
336  //
337  // - Developer Preview: `access_settings.audience` (Supports changing the
338  // [access setting](https://support.google.com/chat/answer/11971020) of a
339  // space. If no audience is specified in the access setting, the space's
340  // access setting is updated to restricted. Warning: mutually exclusive with
341  // all other field paths.)
342  google.protobuf.FieldMask update_mask = 2;
343}
344
345// Request for deleting a space.
346message DeleteSpaceRequest {
347  // Required. Resource name of the space to delete.
348  //
349  // Format: `spaces/{space}`
350  string name = 1 [
351    (google.api.field_behavior) = REQUIRED,
352    (google.api.resource_reference) = { type: "chat.googleapis.com/Space" }
353  ];
354}
355
356// Request message for completing the import process for a space.
357message CompleteImportSpaceRequest {
358  // Required. Resource name of the import mode space.
359  //
360  // Format: `spaces/{space}`
361  string name = 1 [
362    (google.api.field_behavior) = REQUIRED,
363    (google.api.resource_reference) = { type: "chat.googleapis.com/Space" }
364  ];
365}
366
367// Response message for completing the import process for a space.
368message CompleteImportSpaceResponse {
369  // The import mode space.
370  Space space = 1;
371}
372