Project import generated by Copybara.
GitOrigin-RevId: d9e9e3fb4e31372ec1fb43b178994ca78fa8fe70
diff --git a/api/v3/api_proto/user_objects.proto b/api/v3/api_proto/user_objects.proto
new file mode 100644
index 0000000..958efbc
--- /dev/null
+++ b/api/v3/api_proto/user_objects.proto
@@ -0,0 +1,183 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
+// This file defines protobufs for users and related business
+// objects, e.g., users, user preferences.
+
+syntax = "proto3";
+
+package monorail.v3;
+
+option go_package = "api/v3/api_proto";
+
+import "google/api/resource.proto";
+import "google/api/field_behavior.proto";
+
+// User represents a user of the Monorail site.
+// Next available tag: 5
+message User {
+ option (google.api.resource) = {
+ type: "api.crbug.com/User"
+ pattern: "users/{user_id}"
+ };
+ // Resource name of the user.
+ // The API will always return User names with format: users/<user_id>.
+ // However the API will accept User names with formats: users/<user_id> or users/<email>.
+ // To fetch the display_name for any users/<user_id> returned by the API,
+ // you can call {Batch}GetUser{s}.
+ // We represent deleted users within Monorail with `users/1` or `users/2103649657`.
+ string name = 1;
+ // User display_name to show other users using the site.
+ // By default this is the obscured or un-obscured email.
+ string display_name = 2;
+ // Obscured or un-obscured user email or empty if this represents
+ // a deleted user.
+ string email = 4 [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ // User-written indication of their availability or working hours.
+ string availability_message = 3;
+}
+
+
+// UserSettings represents preferences and account settings of a User.
+// Next available tag: 8
+message UserSettings {
+ option (google.api.resource) = {
+ type: "api.crbug.com/UserSettings"
+ pattern: "usersettings/{user_id}"
+ };
+
+ // Potential roles of a user.
+ // Next available tag: 3
+ enum SiteRole {
+ // Default value. This value is unused.
+ SITE_ROLE_UNSPECIFIED = 0;
+ // Normal site user with no special site-wide extra permissions.
+ NORMAL = 1;
+ // Site-wide admin role.
+ ADMIN = 2;
+ }
+
+ // The access the user has to the site.
+ // Next available tag: 3
+ message SiteAccess {
+ // Potential status of a user's access to the site.
+ // Next available tag: 3
+ enum Status {
+ // Default value. This value is unused.
+ STATUS_UNSPECIFIED = 0;
+ // The user has access to the site.
+ FULL_ACCESS = 1;
+ // The user is banned from the site.
+ BANNED = 2;
+ }
+
+ // The status of the user's access to the site.
+ Status status = 1;
+ // An explanation for the value of `status`.
+ string reason = 2;
+ }
+
+ // Trait options for notifications the user receives.
+ // Next available tag: 6;
+ enum NotificationTraits {
+ // Default value. This value is unused.
+ NOTIFICATION_TRAITS_UNSPECIFIED = 0;
+ // Send change notifications for issues where user is owner or cc.
+ NOTIFY_ON_OWNED_OR_CC_ISSUE_CHANGES = 1;
+ // Send change notifications for issues the user has starred.
+ NOTIFY_ON_STARRED_ISSUE_CHANGES = 2;
+ // Send date-type field notifications for issues the user has starred.
+ // See monorail/doc/userguide/email.md#why-did-i-get-a-follow_up-email-notification.
+ NOTIFY_ON_STARRED_NOTIFY_DATES = 3;
+ // Email subject lines should be compact.
+ COMPACT_SUBJECT_LINE = 4;
+ // Include a button link to the issue, in Gmail.
+ GMAIL_INCLUDE_ISSUE_LINK_BUTTON = 5;
+ }
+
+ // Privacy trait options for the user.
+ // Next available tag: 2
+ enum PrivacyTraits {
+ // Default value. This value is unused.
+ PRIVACY_TRAITS_UNSPECIFIED = 0;
+ // Obscure the user's email from non-project members throughout the site.
+ OBSCURE_EMAIL = 1;
+ }
+
+ // Site interaction trait options for the user.
+ // Next available tag: 3
+ enum SiteInteractionTraits {
+ // Default value. This value is unused.
+ SITE_INTERACTION_TRAITS_UNSPECIFIED = 0;
+ // Add 'Restrict-View-Google' labels to new issues the user reports.
+ // Issues will only be visible to the user (issue reporter)
+ // and users with the `Google` permission.
+ REPORT_RESTRICT_VIEW_GOOGLE_ISSUES = 1;
+ // When viewing public issues, show a banner to remind the user not
+ // to post sensitive information.
+ PUBLIC_ISSUE_BANNER = 2;
+ }
+
+ // Resource name of the user that has these settings.
+ string name = 1 [ (google.api.resource_reference) = {type: "api.crbug.com/UserSettings"} ];
+ // The global site role for the user.
+ SiteRole site_role = 2 [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ // Resource name of linked secondary users.
+ repeated string linked_secondary_users = 3 [
+ (google.api.resource_reference) = {type: "api.crbug.com/User"},
+ (google.api.field_behavior) = OUTPUT_ONLY ];
+ // The user's access to the site.
+ SiteAccess site_access = 4 [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ // Notification trait preferences of the user.
+ repeated NotificationTraits notification_traits = 5;
+ // Privacy trait preferences of the user.
+ repeated PrivacyTraits privacy_traits = 6;
+ // Site interaction trait preferences of the user.
+ repeated SiteInteractionTraits site_interaction_traits = 7;
+}
+
+// Defines saved queries that belong to a user.
+//
+// Next available tag: 6
+message UserSavedQuery {
+ option (google.api.resource) = {
+ type: "api.crbug.com/UserSavedQuery"
+ pattern: "users/{user_id}/savedQueries/{saved_query_id}"
+ };
+
+ // Resource name of this saved query.
+ string name = 1;
+ // Display name of this saved query, ie 'open issues'.
+ string display_name = 2;
+ // Search term of this saved query.
+ string query = 3;
+ // List of projects this query can be searched in.
+ repeated string projects = 4 [
+ (google.api.resource_reference) = { type: "api.crbug.com/Project" }
+ ];
+ // Subscription mode of this saved query
+ // Next available tag: 3
+ enum SubscriptionMode {
+ // Default API value. This value is unused.
+ SUBSCRIPTION_MODE_UNSPECIFIED = 0;
+ // Do not subscribe to notifications.
+ NO_NOTIFICATION = 1;
+ // Subscribe to notifications.
+ IMMEDIATE_NOTIFICATION = 2;
+ }
+ SubscriptionMode subscription_mode = 5;
+}
+
+// A project starred by a user.
+//
+// Next available tag: 2
+message ProjectStar {
+ option (google.api.resource) = {
+ type: "api.crbug.com/ProjectStar"
+ pattern: "users/{user_id}/projectStars/{project_name}"
+ };
+ // Resource name of the ProjectStar.
+ string name = 1;
+}
\ No newline at end of file