Project import generated by Copybara.

GitOrigin-RevId: d9e9e3fb4e31372ec1fb43b178994ca78fa8fe70
diff --git a/api/api_proto/issues.proto b/api/api_proto/issues.proto
new file mode 100644
index 0000000..7c39884
--- /dev/null
+++ b/api/api_proto/issues.proto
@@ -0,0 +1,417 @@
+// Copyright 2018 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
+
+syntax = "proto3";
+
+package monorail;
+
+import "google/protobuf/empty.proto";
+import "api/api_proto/common.proto";
+import "api/api_proto/issue_objects.proto";
+import "api/api_proto/project_objects.proto";
+
+
+service Issues {
+  rpc CreateIssue (CreateIssueRequest) returns (IssueResponse) {}
+  rpc GetIssue (GetIssueRequest) returns (IssueResponse) {}
+  rpc ListIssues (ListIssuesRequest) returns (ListIssuesResponse) {}
+  rpc ListReferencedIssues(ListReferencedIssuesRequest) returns (ListReferencedIssuesResponse) {}
+  rpc ListApplicableFieldDefs(ListApplicableFieldDefsRequest) returns (ListApplicableFieldDefsResponse) {}
+  rpc UpdateIssue (UpdateIssueRequest) returns (IssueResponse) {}
+  rpc StarIssue (StarIssueRequest) returns (StarIssueResponse) {}
+  rpc IsIssueStarred (IsIssueStarredRequest) returns (IsIssueStarredResponse) {}
+  rpc ListStarredIssues (ListStarredIssuesRequest) returns (ListStarredIssuesResponse) {}
+  // There is no CreateComment method because comments are created by updates,
+  // which may have just comment content and no delta.
+  // There is no GetComment method, clients should use ListComments.
+  rpc ListComments (ListCommentsRequest) returns (ListCommentsResponse) {}
+  rpc ListActivities (ListActivitiesRequest) returns (ListActivitiesResponse) {}
+  rpc DeleteComment (DeleteCommentRequest) returns (google.protobuf.Empty) {}
+  rpc BulkUpdateApprovals (BulkUpdateApprovalsRequest) returns (BulkUpdateApprovalsResponse) {}
+  rpc UpdateApproval (UpdateApprovalRequest) returns (UpdateApprovalResponse) {}
+  rpc ConvertIssueApprovalsTemplate (ConvertIssueApprovalsTemplateRequest) returns (ConvertIssueApprovalsTemplateResponse) {}
+  rpc IssueSnapshot (IssueSnapshotRequest) returns (IssueSnapshotResponse) {}
+  rpc PresubmitIssue (PresubmitIssueRequest) returns (PresubmitIssueResponse) {}
+  rpc RerankBlockedOnIssues (RerankBlockedOnIssuesRequest) returns (RerankBlockedOnIssuesResponse) {}
+  rpc DeleteIssue (DeleteIssueRequest) returns (DeleteIssueResponse) {}
+  rpc DeleteIssueComment (DeleteIssueCommentRequest) returns (DeleteIssueCommentResponse) {}
+  rpc DeleteAttachment (DeleteAttachmentRequest) returns (DeleteAttachmentResponse) {}
+  rpc FlagIssues (FlagIssuesRequest) returns (FlagIssuesResponse) {}
+  rpc FlagComment (FlagCommentRequest) returns (FlagCommentResponse) {}
+  rpc ListIssuePermissions (ListIssuePermissionsRequest) returns (ListIssuePermissionsResponse) {}
+  rpc MoveIssue (MoveIssueRequest) returns (MoveIssueResponse) {}
+  rpc CopyIssue (CopyIssueRequest) returns (CopyIssueResponse) {}
+}
+
+
+// Next available tag: 4
+message CreateIssueRequest {
+  string project_name = 2;
+  Issue issue = 3;
+}
+
+
+// Next available tag: 3
+message GetIssueRequest {
+  IssueRef issue_ref = 2;
+}
+
+
+// Next available tag: 3
+message IssueResponse {
+  Issue issue = 1;
+  IssueRef moved_to_ref = 2;
+}
+
+
+// Next available tag: 8
+message ListIssuesRequest {
+  string query = 2;
+  uint32 canned_query = 3;
+  repeated string project_names = 4;
+  Pagination pagination = 5;
+  string group_by_spec = 6;
+  string sort_spec = 7;
+}
+
+
+// Next available tag: 3
+message ListIssuesResponse {
+  repeated Issue issues = 1;
+  uint32 total_results = 2;
+}
+
+
+// Next available tag: 3
+message ListReferencedIssuesRequest {
+  repeated IssueRef issue_refs = 2;
+}
+
+
+// Next available tag: 2
+message ListReferencedIssuesResponse {
+  // TODO(ehmaldonado): monorail:4033 Rename these fields to issues rather than
+  // refs.
+  repeated Issue open_refs = 1;
+  repeated Issue closed_refs = 2;
+}
+
+
+// Next available tag: 3
+message ListApplicableFieldDefsRequest {
+  repeated IssueRef issue_refs = 2;
+}
+
+
+// Next available tag: 2
+message ListApplicableFieldDefsResponse {
+  repeated FieldDef field_defs = 1;
+}
+
+
+// Next available tag: 9
+message UpdateIssueRequest {
+  IssueRef issue_ref = 2;
+  bool send_email = 3;
+  IssueDelta delta = 4;
+  string comment_content = 5;
+  bool is_description = 6;
+  repeated AttachmentUpload uploads = 7;
+  repeated int64 kept_attachments = 8;
+}
+
+
+// Next available tag: 4
+message StarIssueRequest {
+  IssueRef issue_ref = 2;
+  bool starred = 3;  // True to add a star, False to remove one.
+}
+
+
+// Next available tag: 2
+message StarIssueResponse {
+  uint32 star_count = 1;
+}
+
+
+// Next available tag: 3
+message IsIssueStarredRequest {
+  IssueRef issue_ref = 2;
+}
+
+
+// Next available tag: 2
+message IsIssueStarredResponse {
+  bool is_starred = 1;
+}
+
+
+// Next available tag: 1
+message ListStarredIssuesRequest {
+}
+
+
+// Next available tag: 2
+message ListStarredIssuesResponse {
+  repeated IssueRef starred_issue_refs = 1;
+}
+
+
+// Next available tag: 3
+message ListCommentsRequest {
+  IssueRef issue_ref = 2;
+}
+
+
+// Next available tag: 2
+message ListCommentsResponse {
+  // Comments are in chronological order.  The list of comments may
+  // include deleted, spam, and description comments.  Spam and
+  // deleted comments will only have content supplied if the user is
+  // allowed to see it.
+  repeated Comment comments = 1;
+}
+
+
+// Next available tag: 5
+message ListActivitiesRequest {
+  // TODO(tyreej) description
+  UserRef user_ref = 2;
+  fixed32 before = 3;
+  fixed32 after = 4;
+}
+
+
+// Next available tag: 3
+message ListActivitiesResponse {
+  // TODO(tyreej) description
+  repeated Comment comments = 1;
+  repeated IssueSummary issue_summaries = 2;
+}
+
+
+// Next available tag: 5
+message DeleteCommentRequest {
+  IssueRef issue_ref = 2;
+  int64 sequence_num = 3;
+  bool delete = 4;  // True to delete, False to undelete.
+}
+
+
+// TODO: Consider eventually replacing calls to UpdateApprovalRequest
+// with BulkUpdateApprovalsRequest.
+// TODO: For now, block bulk attaching uploads and survey editing.
+// Next available tag: 7
+message BulkUpdateApprovalsRequest {
+  repeated IssueRef issue_refs = 2;
+  FieldRef field_ref = 3;
+  ApprovalDelta approval_delta = 4;
+  string comment_content = 5;
+  bool send_email = 6;
+}
+
+
+// Next available tag: 2
+message BulkUpdateApprovalsResponse {
+  repeated IssueRef issue_refs = 1;
+}
+
+
+// Next available tag: 10
+message UpdateApprovalRequest {
+  IssueRef issue_ref = 2;
+  FieldRef field_ref = 3;
+  ApprovalDelta approval_delta = 4;
+  string comment_content = 5;
+  bool send_email = 6;
+  bool is_description = 7;
+  repeated AttachmentUpload uploads = 8;
+  repeated int64 kept_attachments = 9;
+}
+
+
+// Next available tag: 2
+message UpdateApprovalResponse {
+  Approval approval = 1;
+  // TODO(jojwang): monorail:3895, add new_comment field.
+}
+
+
+// Next available tag: 6
+message ConvertIssueApprovalsTemplateRequest {
+  IssueRef issue_ref = 2;
+  string template_name = 3;
+  string comment_content = 4;
+  bool send_email = 5;
+}
+
+
+// Next available tag: 2
+message ConvertIssueApprovalsTemplateResponse {
+  Issue issue = 1;
+}
+
+
+// Next available tag: 9
+message IssueSnapshotRequest {
+  int32 timestamp = 2;
+  string query = 3;
+  int32 canned_query = 4;
+  string group_by = 5;
+  string label_prefix = 6;
+  string project_name = 7;
+  int32 hotlist_id = 8;
+}
+
+
+// Next available tag: 3
+message IssueSnapshotCount {
+  string dimension = 1;
+  int32 count = 2;
+}
+
+
+// Next available tag: 3
+message IssueSnapshotResponse {
+  repeated IssueSnapshotCount snapshot_count = 1;
+  repeated string unsupported_field = 2;
+  bool search_limit_reached = 3;
+}
+
+
+// Next available tag: 4
+message PresubmitIssueRequest {
+  IssueRef issue_ref = 2;
+  IssueDelta issue_delta = 3;
+}
+
+
+// Next available tag: 8
+message PresubmitIssueResponse {
+  string owner_availability = 1;
+  string owner_availability_state = 2;
+  repeated ValueAndWhy derived_labels = 3;
+  repeated ValueAndWhy derived_owners = 4;
+  repeated ValueAndWhy derived_ccs = 5;
+  repeated ValueAndWhy warnings = 6;
+  repeated ValueAndWhy errors = 7;
+}
+
+
+// Next available tag: 6
+message RerankBlockedOnIssuesRequest {
+  IssueRef issue_ref = 2;
+  IssueRef moved_ref = 3;
+  IssueRef target_ref = 4;
+  bool split_above = 5;
+}
+
+
+// Next available tag: 2
+message RerankBlockedOnIssuesResponse {
+  repeated IssueRef blocked_on_issue_refs = 1;
+}
+
+
+// Next available tag: 4
+message DeleteIssueRequest {
+  IssueRef issue_ref = 2;
+  bool delete = 3;
+}
+
+
+// Next available tag: 1
+message DeleteIssueResponse {
+}
+
+
+// Next available tag: 5
+message DeleteIssueCommentRequest {
+  IssueRef issue_ref = 2;
+  uint32 sequence_num = 3;
+  bool delete = 4;
+}
+
+
+// Next available tag: 1
+message DeleteIssueCommentResponse {
+}
+
+
+// Next available tag: 6
+message DeleteAttachmentRequest {
+  IssueRef issue_ref = 2;
+  uint32 sequence_num = 3;
+  uint32 attachment_id = 4;
+  bool delete = 5;
+}
+
+
+// Next available tag: 1
+message DeleteAttachmentResponse {
+}
+
+
+// Next available tag: 4
+message FlagIssuesRequest {
+  repeated IssueRef issue_refs = 2;
+  bool flag = 3;
+}
+
+
+// Next available tag: 1
+message FlagIssuesResponse {
+}
+
+
+// Next available tag: 5
+message FlagCommentRequest {
+  IssueRef issue_ref = 2;
+  uint32 sequence_num = 3;
+  bool flag = 4;
+}
+
+
+// Next available tag: 1
+message FlagCommentResponse {
+}
+
+
+// Next available tag: 3
+message ListIssuePermissionsRequest {
+  IssueRef issue_ref = 2;
+}
+
+
+// Next available tag: 2
+message ListIssuePermissionsResponse {
+  repeated string permissions = 1;
+}
+
+
+// Next available tag: 4
+message MoveIssueRequest {
+  IssueRef issue_ref = 2;
+  string target_project_name = 3;
+}
+
+
+// Next available tag: 2
+message MoveIssueResponse {
+  IssueRef new_issue_ref = 1;
+}
+
+
+// Next available tag: 4
+message CopyIssueRequest {
+  IssueRef issue_ref = 2;
+  string target_project_name = 3;
+}
+
+
+// Next available tag: 2
+message CopyIssueResponse {
+  IssueRef new_issue_ref = 1;
+}