xref: /aosp_15_r20/external/googleapis/google/apps/drive/activity/v2/action.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2022 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.apps.drive.activity.v2;
18
19import "google/apps/drive/activity/v2/actor.proto";
20import "google/apps/drive/activity/v2/common.proto";
21import "google/apps/drive/activity/v2/target.proto";
22import "google/protobuf/timestamp.proto";
23
24option csharp_namespace = "Google.Apps.Drive.Activity.V2";
25option go_package = "google.golang.org/genproto/googleapis/apps/drive/activity/v2;activity";
26option java_multiple_files = true;
27option java_outer_classname = "ActionProto";
28option java_package = "com.google.apps.drive.activity.v2";
29option objc_class_prefix = "GADA";
30option php_namespace = "Google\\Apps\\Drive\\Activity\\V2";
31
32// Information about the action.
33message Action {
34  // The type and detailed information about the action.
35  ActionDetail detail = 1;
36
37  // The actor responsible for this action (or empty if all actors are
38  // responsible).
39  Actor actor = 3;
40
41  // The target this action affects (or empty if affecting all targets). This
42  // represents the state of the target immediately after this action occurred.
43  Target target = 4;
44
45  // When the action occurred (or empty if same time as entire activity).
46  oneof time {
47    // The action occurred at this specific time.
48    google.protobuf.Timestamp timestamp = 5;
49
50    // The action occurred over this time range.
51    TimeRange time_range = 6;
52  }
53}
54
55// Data describing the type and additional information of an action.
56message ActionDetail {
57  // Data describing the type and additional information of an action.
58  oneof action_detail {
59    // An object was created.
60    Create create = 1;
61
62    // An object was edited.
63    Edit edit = 2;
64
65    // An object was moved.
66    Move move = 3;
67
68    // An object was renamed.
69    Rename rename = 4;
70
71    // An object was deleted.
72    Delete delete = 5;
73
74    // A deleted object was restored.
75    Restore restore = 6;
76
77    // The permission on an object was changed.
78    PermissionChange permission_change = 7;
79
80    // A change about comments was made.
81    Comment comment = 8;
82
83    // A change happened in data leak prevention status.
84    DataLeakPreventionChange dlp_change = 9;
85
86    // An object was referenced in an application outside of Drive/Docs.
87    ApplicationReference reference = 12;
88
89    // Settings were changed.
90    SettingsChange settings_change = 13;
91
92    // Label was changed.
93    AppliedLabelChange applied_label_change = 19;
94  }
95}
96
97// An object was created.
98message Create {
99  // An object was created from scratch.
100  message New {}
101
102  // An object was uploaded into Drive.
103  message Upload {}
104
105  // An object was created by copying an existing object.
106  message Copy {
107    // The original object.
108    TargetReference original_object = 1;
109  }
110
111  // The origin of the new object.
112  oneof origin {
113    // If present, indicates the object was newly created (e.g. as a blank
114    // document), not derived from a Drive object or external object.
115    New new = 1;
116
117    // If present, indicates the object originated externally and was uploaded
118    // to Drive.
119    Upload upload = 2;
120
121    // If present, indicates the object was created by copying an existing Drive
122    // object.
123    Copy copy = 3;
124  }
125}
126
127// An empty message indicating an object was edited.
128message Edit {}
129
130// An object was moved.
131message Move {
132  // The added parent object(s).
133  repeated TargetReference added_parents = 1;
134
135  // The removed parent object(s).
136  repeated TargetReference removed_parents = 2;
137}
138
139// An object was renamed.
140message Rename {
141  // The previous title of the drive object.
142  string old_title = 1;
143
144  // The new title of the drive object.
145  string new_title = 2;
146}
147
148// An object was deleted.
149message Delete {
150  // The type of deletion.
151  enum Type {
152    // Deletion type is not available.
153    TYPE_UNSPECIFIED = 0;
154
155    // An object was put into the trash.
156    TRASH = 1;
157
158    // An object was deleted permanently.
159    PERMANENT_DELETE = 2;
160  }
161
162  // The type of delete action taken.
163  Type type = 1;
164}
165
166// A deleted object was restored.
167message Restore {
168  // The type of restoration.
169  enum Type {
170    // The type is not available.
171    TYPE_UNSPECIFIED = 0;
172
173    // An object was restored from the trash.
174    UNTRASH = 1;
175  }
176
177  // The type of restore action taken.
178  Type type = 1;
179}
180
181// A change of the permission setting on an item.
182message PermissionChange {
183  // The set of permissions added by this change.
184  repeated Permission added_permissions = 1;
185
186  // The set of permissions removed by this change.
187  repeated Permission removed_permissions = 2;
188}
189
190// The permission setting of an object.
191message Permission {
192  // The [Google Drive permissions
193  // roles](https://developers.google.com/drive/web/manage-sharing#roles).
194  enum Role {
195    // The role is not available.
196    ROLE_UNSPECIFIED = 0;
197
198    // A role granting full access.
199    OWNER = 1;
200
201    // A role granting the ability to manage people and settings.
202    ORGANIZER = 2;
203
204    // A role granting the ability to contribute and manage content.
205    FILE_ORGANIZER = 3;
206
207    // A role granting the ability to contribute content. This role is sometimes
208    // also known as "writer".
209    EDITOR = 4;
210
211    // A role granting the ability to view and comment on content.
212    COMMENTER = 5;
213
214    // A role granting the ability to view content. This role is sometimes also
215    // known as "reader".
216    VIEWER = 6;
217
218    // A role granting the ability to view content only after it has been
219    // published to the web. This role is sometimes also known as "published
220    // reader". See https://support.google.com/sites/answer/6372880 for more
221    // information.
222    PUBLISHED_VIEWER = 7;
223  }
224
225  // Represents any user (including a logged out user).
226  message Anyone {}
227
228  // Indicates the
229  // [Google Drive permissions
230  // role](https://developers.google.com/drive/web/manage-sharing#roles). The
231  // role determines a user's ability to read, write, and comment on items.
232  Role role = 1;
233
234  // The entity granted the role.
235  oneof scope {
236    // The user to whom this permission applies.
237    User user = 2;
238
239    // The group to whom this permission applies.
240    Group group = 3;
241
242    // The domain to whom this permission applies.
243    Domain domain = 4;
244
245    // If set, this permission applies to anyone, even logged out users.
246    Anyone anyone = 5;
247  }
248
249  // If true, the item can be discovered (e.g. in the user's "Shared with me"
250  // collection) without needing a link to the item.
251  bool allow_discovery = 6;
252}
253
254// A change about comments on an object.
255message Comment {
256  // A regular posted comment.
257  message Post {
258    // More detailed information about the change.
259    enum Subtype {
260      // Subtype not available.
261      SUBTYPE_UNSPECIFIED = 0;
262
263      // A post was added.
264      ADDED = 1;
265
266      // A post was deleted.
267      DELETED = 2;
268
269      // A reply was added.
270      REPLY_ADDED = 3;
271
272      // A reply was deleted.
273      REPLY_DELETED = 4;
274
275      // A posted comment was resolved.
276      RESOLVED = 5;
277
278      // A posted comment was reopened.
279      REOPENED = 6;
280    }
281
282    // The sub-type of this event.
283    Subtype subtype = 1;
284  }
285
286  // A comment with an assignment.
287  message Assignment {
288    // More detailed information about the change.
289    enum Subtype {
290      // Subtype not available.
291      SUBTYPE_UNSPECIFIED = 0;
292
293      // An assignment was added.
294      ADDED = 1;
295
296      // An assignment was deleted.
297      DELETED = 2;
298
299      // An assignment reply was added.
300      REPLY_ADDED = 3;
301
302      // An assignment reply was deleted.
303      REPLY_DELETED = 4;
304
305      // An assignment was resolved.
306      RESOLVED = 5;
307
308      // A resolved assignment was reopened.
309      REOPENED = 6;
310
311      // An assignment was reassigned.
312      REASSIGNED = 7;
313    }
314
315    // The sub-type of this event.
316    Subtype subtype = 1;
317
318    // The user to whom the comment was assigned.
319    User assigned_user = 7;
320  }
321
322  // A suggestion.
323  message Suggestion {
324    // More detailed information about the change.
325    enum Subtype {
326      // Subtype not available.
327      SUBTYPE_UNSPECIFIED = 0;
328
329      // A suggestion was added.
330      ADDED = 1;
331
332      // A suggestion was deleted.
333      DELETED = 2;
334
335      // A suggestion reply was added.
336      REPLY_ADDED = 3;
337
338      // A suggestion reply was deleted.
339      REPLY_DELETED = 4;
340
341      // A suggestion was accepted.
342      ACCEPTED = 7;
343
344      // A suggestion was rejected.
345      REJECTED = 8;
346
347      // An accepted suggestion was deleted.
348      ACCEPT_DELETED = 9;
349
350      // A rejected suggestion was deleted.
351      REJECT_DELETED = 10;
352    }
353
354    // The sub-type of this event.
355    Subtype subtype = 1;
356  }
357
358  // The type of changed comment.
359  oneof type {
360    // A change on a regular posted comment.
361    Post post = 1;
362
363    // A change on an assignment.
364    Assignment assignment = 2;
365
366    // A change on a suggestion.
367    Suggestion suggestion = 3;
368  }
369
370  // Users who are mentioned in this comment.
371  repeated User mentioned_users = 7;
372}
373
374// A change in the object's data leak prevention status.
375message DataLeakPreventionChange {
376  // The type of the change.
377  enum Type {
378    // An update to the DLP state that is neither FLAGGED or CLEARED.
379    TYPE_UNSPECIFIED = 0;
380
381    // Document has been flagged as containing sensitive content.
382    FLAGGED = 1;
383
384    // Document is no longer flagged as containing sensitive content.
385    CLEARED = 2;
386  }
387
388  // The type of Data Leak Prevention (DLP) change.
389  Type type = 1;
390}
391
392// Activity in applications other than Drive.
393message ApplicationReference {
394  // The type of the action.
395  enum Type {
396    // The type is not available.
397    UNSPECIFIED_REFERENCE_TYPE = 0;
398
399    // The links of one or more Drive items were posted.
400    LINK = 1;
401
402    // Comments were made regarding a Drive item.
403    DISCUSS = 2;
404  }
405
406  // The reference type corresponding to this event.
407  Type type = 1;
408}
409
410// Information about settings changes.
411message SettingsChange {
412  // Information about restriction policy changes to a feature.
413  message RestrictionChange {
414    // The feature which had changes to its restriction policy.
415    enum Feature {
416      // The feature which changed restriction settings was not available.
417      FEATURE_UNSPECIFIED = 0;
418
419      // When restricted, this prevents items from being shared outside the
420      // domain.
421      SHARING_OUTSIDE_DOMAIN = 1;
422
423      // When restricted, this prevents direct sharing of individual items.
424      DIRECT_SHARING = 2;
425
426      // When restricted, this prevents actions like copy, download, and print
427      // that might result in uncontrolled duplicates of items.
428      ITEM_DUPLICATION = 3;
429
430      // When restricted, this prevents use of Drive File Stream.
431      DRIVE_FILE_STREAM = 4;
432
433      // When restricted, this limits sharing of folders to managers only.
434      FILE_ORGANIZER_CAN_SHARE_FOLDERS = 5;
435    }
436
437    // The restriction applicable to a feature.
438    enum Restriction {
439      // The type of restriction is not available.
440      RESTRICTION_UNSPECIFIED = 0;
441
442      // The feature is available without restriction.
443      UNRESTRICTED = 1;
444
445      // The use of this feature is fully restricted.
446      FULLY_RESTRICTED = 2;
447    }
448
449    // The feature which had a change in restriction policy.
450    Feature feature = 1;
451
452    // The restriction in place after the change.
453    Restriction new_restriction = 2;
454  }
455
456  // The set of changes made to restrictions.
457  repeated RestrictionChange restriction_changes = 1;
458}
459
460// Label changes that were made on the Target.
461message AppliedLabelChange {
462  // A change made to a Label on the Target.
463  message AppliedLabelChangeDetail {
464    // Change to a Field value.
465    message FieldValueChange {
466      // Contains a value of a Field.
467      message FieldValue {
468        // Wrapper for Text Field value.
469        message Text {
470          // Value of Text Field.
471          optional string value = 1;
472        }
473
474        // Wrapper for Text List Field value.
475        message TextList {
476          // Text values.
477          repeated Text values = 1;
478        }
479
480        // Wrapper for Selection Field value as combined value/display_name
481        // pair for selected choice.
482        message Selection {
483          // Selection value as Field Choice ID.
484          optional string value = 1;
485
486          // Selection value as human-readable display string.
487          optional string display_name = 2;
488        }
489
490        // Wrapper for SelectionList Field value.
491        message SelectionList {
492          // Selection values.
493          repeated Selection values = 1;
494        }
495
496        // Wrapper for Integer Field value.
497        message Integer {
498          // Integer value.
499          optional int64 value = 1;
500        }
501
502        // Wrapper for User Field value.
503        message SingleUser {
504          // User value as email.
505          optional string value = 1;
506        }
507
508        // Wrapper for UserList Field value.
509        message UserList {
510          // User values.
511          repeated SingleUser values = 1;
512        }
513
514        // Wrapper for Date Field value.
515        message Date {
516          // Date value.
517          optional google.protobuf.Timestamp value = 1;
518        }
519
520        // Field values for all Field types.
521        oneof value {
522          // Text Field value.
523          Text text = 1;
524
525          // Text List Field value.
526          TextList text_list = 3;
527
528          // Selection Field value.
529          Selection selection = 4;
530
531          // Selection List Field value.
532          SelectionList selection_list = 5;
533
534          // Integer Field value.
535          Integer integer = 6;
536
537          // User Field value.
538          SingleUser user = 7;
539
540          // User List Field value.
541          UserList user_list = 8;
542
543          // Date Field value.
544          Date date = 9;
545        }
546      }
547
548      // The ID of this field. Field IDs are unique within a Label.
549      optional string field_id = 1;
550
551      // The value that was previously set on the field. If not present,
552      // the field was newly set. At least one of {old_value|new_value} is
553      // always set.
554      optional FieldValue old_value = 2;
555
556      // The value that is now set on the field. If not present, the field was
557      // cleared. At least one of {old_value|new_value} is always set.
558      optional FieldValue new_value = 3;
559
560      // The human-readable display name for this field.
561      optional string display_name = 4;
562    }
563
564    // The type of Label change
565    enum Type {
566      // The type of change to this Label is not available.
567      TYPE_UNSPECIFIED = 0;
568
569      // The identified Label was added to the Target.
570      LABEL_ADDED = 1;
571
572      // The identified Label was removed from the Target.
573      LABEL_REMOVED = 2;
574
575      // Field values were changed on the Target.
576      LABEL_FIELD_VALUE_CHANGED = 3;
577
578      // The Label was applied as a side-effect of Drive item creation.
579      LABEL_APPLIED_BY_ITEM_CREATE = 4;
580    }
581
582    // The Label name representing the Label that changed.
583    // This name always contains the revision of the Label that was used
584    // when this Action occurred. The format is
585    // `labels/id@revision`.
586    string label = 1;
587
588    // The types of changes made to the Label on the Target.
589    repeated Type types = 2;
590
591    // The human-readable title of the label that changed.
592    string title = 3;
593
594    // Field Changes. Only present if `types` contains
595    // `LABEL_FIELD_VALUE_CHANGED`.
596    repeated FieldValueChange field_changes = 4;
597  }
598
599  // Changes that were made to the Label on the Target.
600  repeated AppliedLabelChangeDetail changes = 1;
601}
602