go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/common/proto/gerrit/gerrit.proto (about)

     1  // Copyright 2018 The LUCI Authors.
     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  
    15  syntax = "proto3";
    16  
    17  package gerrit;
    18  
    19  import "google/protobuf/empty.proto";
    20  import "google/protobuf/timestamp.proto";
    21  
    22  option go_package = "go.chromium.org/luci/common/proto/gerrit;gerritpb";
    23  
    24  service Gerrit {
    25    /////////////////////////////////////////////////////////////////////////////
    26    //                            Non-Change RPCs.
    27    //
    28  
    29    // Lists the projects on a Gerrit host
    30    //
    31    // https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-projects
    32    rpc ListProjects(ListProjectsRequest) returns (ListProjectsResponse);
    33  
    34    // Retrieve information about a ref of a project.
    35    //
    36    // https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-branch
    37    rpc GetRefInfo(RefInfoRequest) returns (RefInfo);
    38  
    39    // Lists the code owners for a file/folder in a branch
    40    //
    41    // https://chromium-review.googlesource.com/plugins/code-owners/Documentation/rest-api.html#list-code-owners-for-path-in-branch
    42    rpc ListFileOwners(ListFileOwnersRequest) returns (ListOwnersResponse);
    43  
    44  
    45    /////////////////////////////////////////////////////////////////////////////
    46    //                            Change read-only RPCs.
    47    //
    48  
    49    // Lists changes that match a query.
    50    //
    51    // TODO(tandrii): recommend a paging query.
    52    //
    53    // Note, although the Gerrit API supports multiple queries, for which
    54    // it can return multiple lists of changes, this is not a foreseen use-case
    55    // so this API just includes one query with one returned list of changes.
    56    //
    57    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
    58    rpc ListChanges(ListChangesRequest) returns (ListChangesResponse);
    59  
    60    // Loads a change by id.
    61    //
    62    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change
    63    rpc GetChange(GetChangeRequest) returns (ChangeInfo);
    64  
    65    // Gets Mergeable status for a change.
    66    //
    67    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-mergeable
    68    rpc GetMergeable(GetMergeableRequest) returns (MergeableInfo);
    69  
    70    // Lists the files that were modified, added or deleted in a revision.
    71    //
    72    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-files
    73    rpc ListFiles(ListFilesRequest) returns (ListFilesResponse);
    74  
    75    // Retrieves related changes of a revision.
    76    //
    77    // Related changes are changes that either depend on, or are dependencies of
    78    // the revision.
    79    //
    80    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-related-changes
    81    rpc GetRelatedChanges(GetRelatedChangesRequest) returns (GetRelatedChangesResponse);
    82  
    83    // Check if the given change is a pure revert of the change it references in
    84    // revertOf. See also ChangeInfo.revert_of.
    85    //
    86    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-pure-revert
    87    rpc GetPureRevert(GetPureRevertRequest) returns (PureRevertInfo);
    88  
    89    // Retrieves the difference between two historical states of a change.
    90    //
    91    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-meta-diff
    92    rpc GetMetaDiff(GetMetaDiffRequest) returns (MetaDiff);
    93  
    94    /////////////////////////////////////////////////////////////////////////////
    95    //                            Change mutation RPCs.
    96    //
    97  
    98    // Create a new empty change.
    99    //
   100    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#create-change
   101    rpc CreateChange(CreateChangeRequest) returns (ChangeInfo);
   102  
   103    // Edit a single file within an existing change edit.
   104    //
   105    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#put-edit-file
   106    rpc ChangeEditFileContent(ChangeEditFileContentRequest)
   107        returns (google.protobuf.Empty);
   108  
   109    // Delete a single file within an existing change edit.
   110    //
   111    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-edit-file
   112    rpc DeleteEditFileContent(DeleteEditFileContentRequest)
   113        returns (google.protobuf.Empty);
   114  
   115    // Publish all changes in a a change edit.
   116    //
   117    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-edit
   118    rpc ChangeEditPublish(ChangeEditPublishRequest)
   119        returns (google.protobuf.Empty);
   120  
   121    // Add a reviewer to a change
   122    //
   123    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-reviewer
   124    rpc AddReviewer(AddReviewerRequest) returns (AddReviewerResult);
   125  
   126    // Deletes a reviewer from a change.
   127    //
   128    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-reviewer
   129    rpc DeleteReviewer(DeleteReviewerRequest) returns (google.protobuf.Empty);
   130  
   131    // Set various review bits on a change.
   132    //
   133    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
   134    rpc SetReview(SetReviewRequest) returns (ReviewResult);
   135  
   136    // Adds a single user to the attention set of a change.
   137    //
   138    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-to-attention-set
   139    rpc AddToAttentionSet(AttentionSetRequest) returns (AccountInfo);
   140  
   141    // Submit a change.
   142    //
   143    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-change
   144    rpc SubmitChange(SubmitChangeRequest) returns (ChangeInfo);
   145  
   146    // Revert a change.
   147    //
   148    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revert-change
   149    rpc RevertChange(RevertChangeRequest) returns (ChangeInfo);
   150  
   151    // Abandon a change.
   152    //
   153    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#abandon-change
   154    rpc AbandonChange(AbandonChangeRequest) returns (ChangeInfo);
   155  
   156    // Submit a revision.
   157    //
   158    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-revision
   159    rpc SubmitRevision(SubmitRevisionRequest) returns (SubmitInfo);
   160  }
   161  
   162  // Specifies what extra information to include in the response.
   163  //
   164  // Source of truth:
   165  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#query-options
   166  enum QueryOption {
   167    OPTION_UNSPECIFIED = 0x0;
   168    // A summary of each label required for submit, and approvers that have
   169    // granted (or rejected) with that label.
   170    LABELS = 0x1;
   171    // Detailed label information, including numeric values of all existing
   172    // approvals, recognized label values, values permitted to be set by the
   173    // current user, all reviewers by state, and reviewers that may be removed by
   174    // the current user.
   175    DETAILED_LABELS = 0x2;
   176    // Describe the current revision (patch set) of the change, including the
   177    // commit SHA-1 and URLs to fetch from.
   178    CURRENT_REVISION = 0x4;
   179    // Describe all revisions, not just current.
   180    ALL_REVISIONS = 0x8;
   181    // Parse and output all header fields from the commit object, including
   182    // message. Only valid when the CURRENT_REVISION or ALL_REVISIONS option is
   183    // selected.
   184    CURRENT_COMMIT = 0x10;
   185    // Parse and output all header fields from the output revisions. If only
   186    // CURRENT_REVISION was requested then only the current revision’s commit data
   187    // will be output.
   188    ALL_COMMITS = 0x20;
   189    // List files modified by the commit and magic files, including basic line
   190    // counts inserted/deleted per file. Only valid when the CURRENT_REVISION or
   191    // ALL_REVISIONS option is selected.
   192    CURRENT_FILES = 0x40;
   193    // List files modified by the commit and magic files, including basic line
   194    // counts inserted/deleted per file. If only the CURRENT_REVISION was
   195    // requested then only that commit’s modified files will be output.
   196    ALL_FILES = 0x80;
   197    // Include _account_id, email and username fields when referencing accounts.
   198    DETAILED_ACCOUNTS = 0x100;
   199    // Include updates to reviewers set as ReviewerUpdateInfo entities.
   200    REVIEWER_UPDATES = 0x200;
   201    // Include messages associated with the change.
   202    MESSAGES = 0x400;
   203    // Include information on available actions for the change and its current
   204    // revision. Ignored if the caller is not authenticated.
   205    CURRENT_ACTIONS = 0x800;
   206    // Include information on available change actions for the change. Ignored if
   207    // the caller is not authenticated.
   208    CHANGE_ACTIONS = 0x1000;
   209    // Include the reviewed field if all of the following are true:
   210    // - the change is open
   211    // - the caller is authenticated
   212    // - the caller has commented on the change more recently than the last update
   213    //   from the change owner, i.e. this change would show up in the results of
   214    //   reviewedby:self.
   215    REVIEWED = 0x2000;
   216    // Skip the mergeable field in ChangeInfo. For fast moving projects, this
   217    // field must be recomputed often, which is slow for projects with big trees.
   218    SKIP_MERGEABLE = 0x4000;
   219    // Include the submittable field in ChangeInfo, which can be used to tell if
   220    // the change is reviewed and ready for submit.
   221    SUBMITTABLE = 0x8000;
   222    // Include the web_links field in CommitInfo, therefore only valid in
   223    // combination with CURRENT_COMMIT or ALL_COMMITS.
   224    WEB_LINKS = 0x10000;
   225    // Include potential problems with the change.
   226    CHECK = 0x20000;
   227    // Include the full commit message with Gerrit-specific commit footers in the
   228    // RevisionInfo.
   229    COMMIT_FOOTERS = 0x40000;
   230    // Include push certificate information in the RevisionInfo. Ignored if signed
   231    // push is not enabled on the server.
   232    PUSH_CERTIFICATES = 0x80000;
   233    // Include references to external tracking systems as TrackingIdInfo.
   234    TRACKING_IDS = 0x100000;
   235    // Include the commands field in the FetchInfo for revisions. Only valid when
   236    // the CURRENT_REVISION or ALL_REVISIONS option is selected.
   237    DOWNLOAD_COMMANDS = 0x200000;
   238    // Include the submit_requirements field in ChangeInfo.
   239    SUBMIT_REQUIREMENTS = 0x400000;
   240  
   241    // MAX_QUERY_OPTION is the largest possible number in QueryOption.
   242    //
   243    // This is not meant to be used, but to indicate the upper bound of the valid
   244    // enum value set.
   245    //
   246    // QueryOption is typed as int32, and the largest possible value is
   247    // pow(2,31) - 1. MAX_QUERY_OPTION is the largest power of 2 allowed in
   248    // QueryOption.
   249    MAX_QUERY_OPTION = 0x40000000;
   250  }
   251  
   252  // Specify the notification options for an action.
   253  // Different endpoints support different subsets of this enum.
   254  enum Notify {
   255  
   256    NOTIFY_UNSPECIFIED = 0;
   257  
   258    // Do not send email notifications.
   259    NOTIFY_NONE = 1;
   260  
   261    // Notify all OWNERS.
   262    NOTIFY_OWNER = 2;
   263  
   264    // Notify OWNERS who are also reviewers
   265    NOTIFY_OWNER_REVIEWERS = 3;
   266  
   267    // Notify all OWNERS and reviewers
   268    NOTIFY_ALL = 4;
   269  }
   270  
   271  // Detailed information about whom to notify about the update.
   272  message NotifyDetails {
   273    // Specify how recipient will be notified.
   274    //
   275    // Source of truth:
   276    // https://gerrit-review.googlesource.com/Documentation/user-notify.html#recipient-types
   277    enum RecipientType {
   278      RECIPIENT_TYPE_UNSPECIFIED = 0;
   279      // The standard To field is used; addresses are visible to all.
   280      RECIPIENT_TYPE_TO = 1;
   281      // The standard CC field is used; addresses are visible to all.
   282      RECIPIENT_TYPE_CC = 2;
   283      // SMTP RCPT TO is used to hide the address.
   284      RECIPIENT_TYPE_BCC = 3;
   285    }
   286  
   287    // Source of truth:
   288    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#notify-info
   289    message Info {
   290      // IDs of the accounts that will be notified.
   291      repeated int64 accounts = 1;
   292    }
   293  
   294    message Recipient {
   295      RecipientType recipient_type = 1;
   296      Info info = 2;
   297    }
   298    // Recipients of the same RecipientType will be merged. Duplicate
   299    // accountIDs in `notify_info` will be removed.
   300    repeated Recipient recipients = 1;
   301  }
   302  
   303  // Request to list changes based on a query.
   304  message ListChangesRequest {
   305    // The query used to filter the changes.
   306    //
   307    // This is the same as the query that can be used in the Gerrit web UI. It is
   308    // space-separated and can include filters like "label:Commit-Queue" or
   309    // "status:open". The possible search operators are described at:
   310    // https://gerrit-review.googlesource.com/Documentation/user-search.html
   311    //
   312    // An empty query matches all changes.
   313    string query = 1;
   314  
   315    // What to include in the response.
   316    repeated QueryOption options = 2;
   317  
   318    // Caps the number of results to return. Required.
   319    //
   320    // Defaults to 25 if not provided; maximum value 1000.
   321    //
   322    // Use luci/common/api/gerrit:PagingListChanges wrapper if you need to fetch
   323    // more or all changes.
   324    int64 limit = 3;
   325  
   326    // The number of changes to skip from the start, for pagination.
   327    //
   328    // Note that without using offset, it's also possible to do paging by
   329    // including a "before:" time in the query, and querying for changes before
   330    // the earliest change in the current page. This may be preferred but is not
   331    // very trivial to implement correctly.
   332    int64 offset = 4;
   333  }
   334  
   335  // A list of changes that matched the query.
   336  message ListChangesResponse {
   337    // The changes that matched the query, with the fields requested.
   338    //
   339    // The order of the changes is expected to be decreasing by update time,
   340    // however the The Gerrit API doc doesn't explicitly specify the order:
   341    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html
   342    repeated ChangeInfo changes = 1;
   343  
   344    // True if there are more changes not returned.
   345    //
   346    // This will be set if the number of changes matching the query exceeds the
   347    // limit supplied; however, it's possible that if the number exceeds some
   348    // internal Gerrit maximum, this will not be set.
   349    //
   350    // Specifically (as of Dec 2018) Google's Gerrit instance will not look
   351    // beyond a maximum hardcoded in Gerrit backend of 10k changes in the index
   352    // of changes, and so if a query matches more than that many changes, Gerrit
   353    // backend may not know and may not set "_more_changes".
   354    bool more_changes = 2;
   355  }
   356  
   357  // Request to get information for a single change.
   358  //
   359  // Encodes path arguments and query options described at
   360  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change
   361  message GetChangeRequest {
   362    // Change number.
   363    int64 number = 1;
   364  
   365    // What to include in the response.
   366    repeated QueryOption options = 2;
   367  
   368    // The Gerrit project.
   369    // Specifying this field is optional, but encouraged because it requires less
   370    // work on the Gerrit side.
   371    string project = 3;
   372  
   373    // The SHA-1 of a historical NoteDB snapshot of the change to retrieve.
   374    //
   375    // If the SHA-1 is not reachable from the serving Gerrit replica,
   376    // status code 412 is returned.
   377    // If the given value is not a valid NoteDB SHA-1,
   378    // status code 400 is returned.
   379    //
   380    // If omitted, GetChange will return the latest snapshot known by the serving
   381    // Gerrit replica.
   382    string meta = 4;
   383  }
   384  
   385  // Information about an account.
   386  //
   387  // Source of truth:
   388  // https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-info
   389  message AccountInfo {
   390    // The full name of the user.
   391    // Only set if detailed account information is requested.
   392    // See option DETAILED_ACCOUNTS for change queries
   393    // and option DETAILS for account queries.
   394    string name = 1;
   395  
   396    // The email address the user prefers to be contacted through.
   397    // Only set if detailed account information is requested.
   398    // See option DETAILED_ACCOUNTS for change queries
   399    // and options DETAILS and ALL_EMAILS for account queries.
   400    string email = 2;
   401  
   402    // A list of the secondary email addresses of the user.
   403    // Only set for account queries when the ALL_EMAILS option or the suggest
   404    // parameter is set. Secondary emails are only included if the calling user
   405    // has the Modify Account, and hence is allowed to see secondary emails of
   406    // other users.
   407    repeated string secondary_emails = 3;
   408  
   409    // The username of the user.
   410    // Only set if detailed account information is requested.
   411    // See option DETAILED_ACCOUNTS for change queries
   412    // and option DETAILS for account queries.
   413    string username = 4;
   414  
   415    // The numeric ID of the account
   416    int64 account_id = 5;
   417  
   418    // List of additional tags that this account has.
   419    //
   420    // The only current tag an account can have is SERVICE_USER.
   421    // Only set if detailed account information is requested.
   422    // See option DETAILED_ACCOUNTS
   423    repeated string tags = 6;
   424  }
   425  
   426  // The GitPersonInfo entity contains information about the author/committer of a commit.
   427  //
   428  // Fields are a subset of:
   429  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#git-person-info
   430  message GitPersonInfo {
   431    // The name of the author/committer.
   432    string name = 1;
   433  
   434    // The email address of the author/committer.
   435    string email = 2;
   436  }
   437  
   438  // Information about a change.
   439  //
   440  // Source of truth:
   441  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-info
   442  //
   443  // Next tag: 24.
   444  message ChangeInfo {
   445    // The change number.
   446    int64 number = 1;
   447  
   448    // The owner of the change.
   449    AccountInfo owner = 2;
   450  
   451    // The project of this change. For example, "chromium/src".
   452    string project = 3;
   453  
   454    // Ref that this change targets, e.g.: refs/heads/master
   455    //
   456    // Note that the gerrit API may return short branch name (master instead of
   457    // refs/heads/master) but we convert it to a ref for consistency across the
   458    // API.
   459    string ref = 4;
   460  
   461    ChangeStatus status = 5;
   462  
   463    // Current revision of the change.
   464    //
   465    // See:
   466    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
   467    string current_revision = 6;
   468  
   469    // A map of patch set commit IDs to RevisionInfos.
   470    //
   471    // Only set if revision information is requested.
   472    map<string, RevisionInfo> revisions = 7;
   473  
   474    // A map of label names to LabelInfos.
   475    //
   476    // Only set if label info is requested.
   477    map<string, LabelInfo> labels = 8;
   478  
   479    // Messages associated with the change.
   480    //
   481    // Only set if messages are requested.
   482    repeated ChangeMessageInfo messages = 9;
   483  
   484    // List of the requirements to be met before this change can be submitted.
   485    //
   486    // Deprecated: use `submit_requirements` instead.
   487    repeated Requirement requirements = 14 [deprecated = true];
   488  
   489    // Whether the change is approved
   490    // by the project submit rules.
   491    //
   492    // Only set if submittable is requested.
   493    bool submittable = 10;
   494  
   495    // Whether change is private.
   496    bool is_private = 13;
   497  
   498    // List of hashtags that are set on the change.
   499    repeated string hashtags = 19;
   500  
   501    // Timestamp of when the change was created
   502    google.protobuf.Timestamp created = 11;
   503  
   504    // Timestamp of when the change was last updated
   505    google.protobuf.Timestamp updated = 12;
   506  
   507    // Timestamp of when the change was submitted.
   508    //
   509    // Only set for merged changes.
   510    google.protobuf.Timestamp submitted = 21;
   511  
   512    // The numeric Change-Id of the change that this change reverts.
   513    int64 revert_of = 15;
   514  
   515    // The numeric Change-Id of the change that this change was cherry-picked from.
   516    int64 cherry_pick_of_change = 16;
   517  
   518    // The users who have been added in and removed from the change.
   519    ReviewerStatusMap reviewers = 17;
   520  
   521    // The SHA-1 of the NoteDb meta ref.
   522    string meta_rev_id = 18;
   523  
   524    // The evaluation results of the submit requirements for this change.
   525    repeated SubmitRequirementResultInfo submit_requirements = 20;
   526  
   527    // The subject of the change (header line of the commit message).
   528    string subject = 22;
   529  
   530    // The name of the target branch. The refs/heads/ prefix is omitted.
   531    string branch = 23;
   532  }
   533  
   534  enum ChangeStatus {
   535    CHANGE_STATUS_INVALID = 0;
   536    NEW = 1;
   537    MERGED = 2;
   538    ABANDONED = 3;
   539  }
   540  
   541  // ReviewerStatusMap is a map that maps a reviewer state to a list of
   542  // AccountInfo(s).
   543  //
   544  // ReviewerState includes REVIEWER, CC, and REMOVED, and this struct
   545  // defines a field for each of then.
   546  message ReviewerStatusMap {
   547    // The users who have been added to the change and voted.
   548    repeated AccountInfo reviewers = 1;
   549    // The users who have been added to the change but haven't voted yet.
   550    repeated AccountInfo ccs = 2;
   551    // The users who have been removed from the change.
   552    repeated AccountInfo removed = 3;
   553  }
   554  
   555  // Information about a patch set.
   556  //
   557  // Source of truth:
   558  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-info
   559  message RevisionInfo {
   560    // The kind of change for this revision.
   561    enum Kind {
   562      KIND_INVALID = 0;
   563      REWORK = 1;
   564      TRIVIAL_REBASE = 2;
   565      MERGE_FIRST_PARENT_UPDATE = 3;
   566      NO_CODE_CHANGE = 4;
   567      NO_CHANGE = 5;
   568    }
   569  
   570    // The kind of this patch set.
   571    Kind kind = 1;
   572  
   573    // The patch set number.
   574    int32 number = 2;
   575  
   576    // The uploader of this patch set.
   577    AccountInfo uploader = 3;
   578  
   579    // The Git reference for the patch set.
   580    string ref = 4;
   581  
   582    // The timestamp of when the patch set was created.
   583    google.protobuf.Timestamp created = 7;
   584  
   585    // The description (aka title) of this patchset, as displayed in the patchset
   586    // selector menu.
   587    //
   588    // Gerrit distinguishes empty string and no value, but here both are clamped
   589    // into "".
   590    //
   591    // This is not CL description, aka Git commit message, which is stored in
   592    // `commit.message`.
   593    string description = 8;
   594  
   595    // The commit metadata for the patchset.
   596    //
   597    // Only set if commit information is requested.
   598    CommitInfo commit = 5;
   599  
   600    // A map of file paths to FileInfos.
   601    //
   602    // Only set if file information is requested.
   603    map<string, FileInfo> files = 6;
   604  }
   605  
   606  // The CommitInfo entity contains information about a commit.
   607  //
   608  // Source of truth:
   609  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info
   610  message CommitInfo {
   611    // The commit ID. Not set if included in a RevisionInfo entity that is
   612    // contained in a map which has the commit ID as key.
   613    string id = 1;
   614  
   615    message Parent {
   616      string id = 1;
   617      // TODO(tandrii): add subject when necessary.
   618    }
   619    repeated Parent parents = 2;
   620  
   621    // The commit message.
   622    // It is not set when CommitInfo is part of the GetRelatedChangesResponse.
   623    string message = 3;
   624  
   625    // The author of the commit as a GitPersonInfo entity.
   626    GitPersonInfo author = 4;
   627  
   628    // TODO(tandrii): add other fields when necessary.
   629  }
   630  
   631  // Information about a Label.
   632  //
   633  // Source of truth:
   634  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#label-info
   635  message LabelInfo {
   636    // Whether the label is optional.
   637    bool optional = 1;
   638  
   639    // One user who approved this label on the change.
   640    //
   641    // Only set if LABELS are requested.
   642    AccountInfo approved = 2;
   643  
   644    // One user who rejected this label on the change.
   645    //
   646    // Only set if LABELS are requested.
   647    AccountInfo rejected = 3;
   648  
   649    // One user who recommended this label on the change.
   650    //
   651    // Only set if LABELS are requested.
   652    AccountInfo recommended = 4;
   653  
   654    // One user who disliked this label on the change.
   655    //
   656    // Only set if LABELS are requested.
   657    AccountInfo disliked = 5;
   658  
   659    // If true, the label blocks submit operation.
   660    //
   661    // Only set if LABELS are requested.
   662    bool blocking = 6;
   663  
   664    // The voting value of the user who recommended/disliked this label on the
   665    // change if it is not "+1"/"-1".
   666    //
   667    // Only set if LABELS are requested.
   668    int32 value = 7;
   669  
   670    // The default voting value for the label.
   671    //
   672    // Only set if LABELS are requested.
   673    int32 default_value = 8;
   674  
   675    // List of all votes for this label.
   676    //
   677    // Items in this list may not represent actual votes cast by users; if a user
   678    // votes on any label, a corresponding ApprovalInfo will appear in this list
   679    // for all labels.
   680    //
   681    // Only set if DETAILED_LABELS are requested.
   682    repeated ApprovalInfo all = 9;
   683  
   684    // A map of all values that are allowed for this label to their descriptions.
   685    //
   686    // Only set if DETAILED_LABELS are requested.
   687    map<int32, string> values = 10;
   688  }
   689  
   690  // Information about an approval from a user for a label on a change.
   691  //
   692  // Source of truth:
   693  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#approval-info
   694  message ApprovalInfo {
   695    // User who did the approval.
   696    AccountInfo user = 1;
   697  
   698    // The vote that the user has given for the label.
   699    int32 value = 2;
   700    // The range of votes the user is authorized to vote on that label.
   701    //
   702    // If absent, the user is not permitted to vote on that label.
   703    VotingRangeInfo permitted_voting_range = 3;
   704    // The time and date describing when the approval was made.
   705    google.protobuf.Timestamp date = 4;
   706    // Value of the tag field from ReviewInput set while posting the review.
   707    string tag = 5;
   708    // If true, this vote was made after the change was submitted.
   709    bool post_submit = 6;
   710  }
   711  
   712  // VotingRangeInfo describes the continuous voting range from min to max values.
   713  //
   714  // Source of truth:
   715  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#voting-range-info
   716  message VotingRangeInfo {
   717    // The minimum voting value, inclusive.
   718    int32 min = 1;
   719    // The maximum voting value, inclusive.
   720    int32 max = 2;
   721  }
   722  
   723  // Information about a message attached to change.
   724  //
   725  // Source of truth:
   726  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-message-info
   727  message ChangeMessageInfo {
   728    // The ID of the message
   729    string id = 1;
   730  
   731    // Author of the message.
   732    //
   733    // Unset if written by the Gerrit system.
   734    AccountInfo author = 2;
   735  
   736    // Real author of the message.
   737    //
   738    // Set if the message was posted on behalf of another user.
   739    AccountInfo real_author = 3;
   740  
   741    // The timestamp this message was posted.
   742    google.protobuf.Timestamp date = 4;
   743  
   744    // The text left by the user.
   745    string message = 5;
   746  
   747    // Value of the tag field from ReviewInput set while posting the review
   748    string tag = 6;
   749  }
   750  
   751  // The Requirement entity contains information about a requirement relative to a
   752  // change.
   753  //
   754  // The requirement explains what has to happen before the change will be
   755  // submittable, e.g. owners CR+2 vote.
   756  //
   757  // Source of truth:
   758  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#requirement
   759  message Requirement {
   760    enum Status {
   761      REQUIREMENT_STATUS_UNSPECIFIED = 0;
   762      REQUIREMENT_STATUS_OK = 1;
   763      REQUIREMENT_STATUS_NOT_READY = 2;
   764      REQUIREMENT_STATUS_RULE_ERROR = 3;
   765    }
   766    Status status = 1;
   767  
   768    // A human readable reason.
   769    string fallback_text = 2;
   770  
   771    // Alphanumerical (plus hyphens or underscores) string to identify what the
   772    // requirement is and why it was triggered. Can be seen as a class:
   773    // requirements sharing the same type were created for a similar reason, and
   774    // the data structure will follow one set of rules.
   775    string type = 3;
   776  }
   777  
   778  // Information about a file in a patch set.
   779  //
   780  // Source of truth:
   781  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#file-info
   782  message FileInfo {
   783    enum Status {
   784      M = 0;  // Modified (default; omitted)
   785      A = 1;  // Added
   786      D = 2;  // Deleted
   787      R = 3;  // Renamed
   788      C = 4;  // Copied
   789      W = 5;  // Rewritten
   790    }
   791  
   792    // Status of the file.
   793    Status status = 1;
   794  
   795    // Whether the file is binary.
   796    bool binary = 2;
   797  
   798    // The old file path; only set if renamed or copied.
   799    string old_path = 3;
   800  
   801    // Number of lines inserted.
   802    int32 lines_inserted = 4;
   803  
   804    // Number of lines deleted.
   805    int32 lines_deleted = 5;
   806  
   807    // Number of bytes by which the file size increased/decreased.
   808    int64 size_delta = 6;
   809  
   810    // File size in bytes.
   811    int64 size = 7;
   812  }
   813  
   814  // Information for creating a new change.
   815  //
   816  // Fields are a subset of:
   817  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-input
   818  message CreateChangeRequest {
   819    string project = 1;
   820  
   821    // Ref to base the new change at. e.g. refs/heads/master
   822    string ref = 2;
   823  
   824    string subject = 3;
   825  
   826    // 40-digit hex SHA-1 of the git commit which will be the parent commit of the
   827    // newly created change. If set, it must be a merged commit on the destination
   828    // branch.
   829    string base_commit = 4;
   830  
   831    Notify notify = 5;
   832  }
   833  
   834  // Information to submit a change.
   835  //
   836  // This is a placeholder to support the arguments from:
   837  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-change
   838  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-input
   839  message SubmitChangeRequest {
   840    // The change number.
   841    int64 number = 1;
   842  
   843    // The project of this change. For example, "chromium/src".
   844    //
   845    // Optional, but recommended for better routing and faster RPC execution.
   846    string project = 2;
   847  }
   848  
   849  // Information to submit a specific revision of a change.
   850  //
   851  // Fields encode the path arguments of
   852  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-revision
   853  message SubmitRevisionRequest {
   854    // The change number.
   855    int64 number = 1;
   856  
   857    // Unique ID that identifies one revision of this change.
   858    //
   859    // Source of truth:
   860    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
   861    string revision_id = 2;
   862  
   863    // The project of this change. For example, "chromium/src".
   864    //
   865    // Optional, but recommended for better routing and faster RPC execution.
   866    string project = 5;
   867  }
   868  
   869  // Information about the change status after submitting.
   870  //
   871  // Source of truth:
   872  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-info
   873  message SubmitInfo {
   874    // The status of the change after submitting is MERGED.
   875    ChangeStatus status = 1;
   876  }
   877  // Information for changing contents of single file in a change edit.
   878  //
   879  // Fields encode the path arguments of
   880  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#put-edit-file
   881  message ChangeEditFileContentRequest {
   882    // The change number.
   883    int64 number = 1;
   884  
   885    // The project of this change. For example, "chromium/src".
   886    //
   887    // Optional, but recommended for better routing and faster RPC execution.
   888    string project = 2;
   889  
   890    // Path to the file to edit inside the project.
   891    string file_path = 3;
   892  
   893    // New content of the file. Overwrites existing contents entirely.
   894    bytes content = 4;
   895  }
   896  
   897  // Information for deleting contents of single file in a change edit.
   898  //
   899  // Fields encode the path arguments of
   900  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-edit-file
   901  message DeleteEditFileContentRequest {
   902    // The change number.
   903    int64 number = 1;
   904  
   905    // The project of this change. For example, "chromium/src".
   906    //
   907    // Optional, but recommended for better routing and faster RPC execution.
   908    string project = 2;
   909  
   910    // Path to the file to edit inside the project.
   911    string file_path = 3;
   912  }
   913  
   914  // Information for publishing a change edit.
   915  //
   916  // This is a placeholder to support the arguments from:
   917  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-edit
   918  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-change-edit-input
   919  message ChangeEditPublishRequest {
   920    // The change number.
   921    int64 number = 1;
   922  
   923    // The project of this change. For example, "chromium/src".
   924    //
   925    // Optional, but recommended for better routing and faster RPC execution.
   926    string project = 2;
   927  }
   928  
   929  // Information for reverting a change.
   930  //
   931  // Fields are a subset of arguments from:
   932  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revert-change
   933  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revert-input
   934  message RevertChangeRequest {
   935    // The change number.
   936    int64 number = 1;
   937  
   938    // The project of this change. For example, "chromium/src".
   939    //
   940    // Optional, but recommended for better routing and faster RPC execution.
   941    string project = 2;
   942  
   943    // Message to be added as review comment to the change when reverting the change.
   944    //
   945    // Optional
   946    string message = 3;
   947  }
   948  
   949  // Information for abandoning a change.
   950  //
   951  // Fields are a subset of arguments from:
   952  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#abandon-change
   953  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#abandon-input
   954  message AbandonChangeRequest {
   955    // The change number.
   956    int64 number = 1;
   957  
   958    // The project of this change. For example, "chromium/src".
   959    //
   960    // Optional, but recommended for better routing and faster RPC execution.
   961    string project = 2;
   962  
   963    string message = 3;
   964  }
   965  
   966  // Information for adding a reviewer.
   967  //
   968  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-reviewer
   969  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#reviewer-input
   970  message AddReviewerRequest {
   971    // The change number.
   972    int64 number = 1;
   973  
   974    // The project of this change. For example, "chromium/src".
   975    //
   976    // Optional, but recommended for better routing and faster RPC execution.
   977    string project = 2;
   978  
   979    // The ID of a single account or group to review the change.
   980    //
   981    // https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
   982    string reviewer = 3;
   983  
   984    enum State {
   985      ADD_REVIEWER_STATE_UNSPECIFIED = 0;
   986      ADD_REVIEWER_STATE_REVIEWER = 1;
   987      ADD_REVIEWER_STATE_CC = 2;
   988    }
   989  
   990    // The state to add reviewer in, defaults to REVIEWER.
   991    State state = 4;
   992  
   993    // Whether adding the reviewer is confirmed.
   994    bool confirmed = 5;
   995  
   996    // Defines who should be notified after reviewer is added, defaults to ALL.
   997    Notify notify = 6;
   998  }
   999  
  1000  // Information about a reviewer. A superset of information from AccountInfo.
  1001  //
  1002  // Source of truth:
  1003  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#reviewer-info
  1004  message ReviewerInfo {
  1005  
  1006    // The detailed account information about a reviewer.
  1007    AccountInfo account = 1;
  1008  
  1009    // The approvals as a map of label names to approval values.
  1010    map<string, int32> approvals = 2;
  1011  
  1012  }
  1013  
  1014  // The result of adding a reviewer to a change
  1015  //
  1016  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-reviewer
  1017  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-reviewer-result
  1018  message AddReviewerResult {
  1019    // The Account ID from the AddReviewerRequest.reviewer field
  1020    //
  1021    // https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
  1022    string input = 1;
  1023  
  1024    // The newly added reviewers
  1025    // If a group is added as a reviewer (or cc)
  1026    // all group members are added.
  1027    repeated ReviewerInfo reviewers = 2;
  1028  
  1029    // The newly cc'd accounts
  1030    repeated ReviewerInfo ccs = 3;
  1031  
  1032    // The error message
  1033    string error = 4;
  1034  
  1035    // Whether adding the reviewer requires confirmation
  1036    bool confirm = 5;
  1037  }
  1038  
  1039  message DeleteReviewerRequest {
  1040    // The change number.
  1041    int64 number = 1;
  1042  
  1043    // The project of this change. For example, "chromium/src".
  1044    //
  1045    // Optional, but recommended for better routing and faster RPC execution.
  1046    string project = 2;
  1047  
  1048    // The ID of a single account or group to review the change.
  1049    //
  1050    // https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
  1051    string account_id = 3;
  1052  }
  1053  
  1054  // Information to set various review bits on a change
  1055  //
  1056  // Fields are a subset of arguments from:
  1057  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
  1058  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-input
  1059  message SetReviewRequest {
  1060    // The change number.
  1061    int64 number = 1;
  1062  
  1063    // The project of this change. For example, "chromium/src".
  1064    //
  1065    // Optional, but recommended for better routing and faster RPC execution.
  1066    string project = 2;
  1067  
  1068    // Unique ID for the revision to query.
  1069    //
  1070    // Source of truth:
  1071    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
  1072    string revision_id = 3;
  1073  
  1074    // Message to be added to the change along with this review.
  1075    string message = 4;
  1076  
  1077    // labels to add, e.g.:
  1078    //   {
  1079    //     "Code-Review": -1,
  1080    //     "Verified": 1,
  1081    //   }
  1082    map<string, int32> labels = 5;
  1083  
  1084    // Tag to be applied to the review comment message, votes, and inline
  1085    // comments.
  1086    //
  1087    // Tags may be used by CI or other automated systems to distinguish them
  1088    // from human reviews. Votes/comments that contain tag with 'autogenerated:'
  1089    // prefix can be filtered out in the web UI.
  1090    string tag = 6;
  1091  
  1092    // Notify defines to whom email notifications should be sent.
  1093    Notify notify = 7;
  1094  
  1095    // NotifyDetails contains additional information about whom to notify.
  1096    //
  1097    // These notifications are sent out even if `notify` options disables normal
  1098    // notifications.
  1099    NotifyDetails notify_details = 8;
  1100  
  1101    // The account_id that the review should be posted on behalf of.
  1102    //
  1103    // To use this option the caller must have been granted labelAs-NAME
  1104    // permission for all keys of labels.
  1105    int64 on_behalf_of = 9;
  1106  
  1107    // If true, then start review.
  1108    // It is an error for both ready and work_in_progress to be true at the same
  1109    // time.
  1110    bool ready = 10;
  1111    // If true, mark the change as work in progress.
  1112    // It is an error for both ready and work_in_progress to be true at the same
  1113    // time.
  1114    bool work_in_progress = 11;
  1115  
  1116    // list of AttentionSetInput entities to add to the attention set. Users that
  1117    // are not reviewers, ccs, owner, or uploader are silently ignored.
  1118    repeated AttentionSetInput add_to_attention_set = 12;
  1119    // list of AttentionSetInput entities to remove from the attention set.
  1120    repeated AttentionSetInput remove_from_attention_set = 13;
  1121    // If true, ignore all automatic attention set rules described in the
  1122    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set
  1123    //
  1124    // Updates in add_to_attention_set and remove_from_attention_set are not
  1125    // ignored.
  1126    bool ignore_automatic_attention_set_rules = 14;
  1127  
  1128    // list of ReviewerInput entities representing reviewers that should be
  1129    // added to the change.
  1130    repeated ReviewerInput reviewers = 15;
  1131  }
  1132  
  1133  // Information to add reviewers to a change.
  1134  //
  1135  // Fields are a subset of arguments from:
  1136  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#reviewer-input
  1137  message ReviewerInput {
  1138    // The ID of a single account or group to review the change.
  1139    //
  1140    // https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
  1141    string reviewer = 1;
  1142  
  1143    // Subset of reviewer states. See the "state" entry at
  1144    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#reviewer-input
  1145    enum State {
  1146      REVIEWER_INPUT_STATE_UNSPECIFIED = 0;
  1147      REVIEWER_INPUT_STATE_REVIEWER = 1;
  1148      REVIEWER_INPUT_STATE_CC = 2;
  1149    }
  1150  
  1151    // Optional - Add reviewer in this state.
  1152    //
  1153    // Possible reviewer states are REVIEWER and CC. If not given,
  1154    // Gerrit defaults to REVIEWER.
  1155    State state = 2;
  1156  }
  1157  
  1158  // Information returned by a SetReview RPC.
  1159  //
  1160  // Fields are a subset of:
  1161  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-result
  1162  message ReviewResult {
  1163    // Map of labels to values after the review was posted. Null if any reviewer
  1164    // additions were rejected.
  1165    map<string, int32> labels = 1;
  1166  
  1167    // Map of account or group identifier to ReviewerResult representing
  1168    // the outcome of adding a reviewer.
  1169    //
  1170    // Absent if no reviewer additions were requested.
  1171    map<string, AddReviewerResult> reviewers = 2;
  1172  }
  1173  
  1174  // Information to add/remove a user from the attention set of a change.
  1175  //
  1176  // Source of truth:
  1177  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-input
  1178  message AttentionSetRequest {
  1179    // The change number.
  1180    int64 number = 1;
  1181  
  1182    // The project of this change. For example, "chromium/src".
  1183    //
  1184    // Optional, but recommended for better routing and faster RPC execution.
  1185    string project = 2;
  1186  
  1187    AttentionSetInput input = 6;
  1188  }
  1189  
  1190  // Information to add/remove a user from the attention set.
  1191  //
  1192  // Source of truth:
  1193  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-input
  1194  message AttentionSetInput {
  1195    // A unique identifier for an account.
  1196    //
  1197    // Source of truth:
  1198    // https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
  1199    string user = 1;
  1200  
  1201    // The justification for adding/removing the user.
  1202    string reason = 2;
  1203  
  1204    // Defines who should be notified after change is created, defaults to OWNER.
  1205    Notify notify = 3;
  1206  
  1207    // NotifyDetails contains additional information about whom to notify.
  1208    //
  1209    // These notifications are sent out even if `notify` options disables normal
  1210    // notifications.
  1211    NotifyDetails notify_details = 4;
  1212  }
  1213  
  1214  enum MergeableStrategy {
  1215    MERGEABLE_STRATEGY_UNSPECIFIED = 0;
  1216    RECURSIVE = 1;
  1217    RESOLVE = 2;
  1218    SIMPLE_TWO_WAY_IN_CORE = 3;
  1219    OURS = 4;
  1220    THEIRS = 5;
  1221  }
  1222  
  1223  message GetMergeableRequest {
  1224    // The change number.
  1225    int64 number = 1;
  1226  
  1227    // The project of this change. For example, "chromium/src".
  1228    //
  1229    // Optional, but recommended for better routing and faster RPC execution.
  1230    string project = 2;
  1231  
  1232    // Unique ID for the revision to query.
  1233    //
  1234    // Source of truth:
  1235    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
  1236    string revision_id = 3;
  1237  
  1238    // The source to merge from, e.g. a complete or abbreviated commit SHA-1, a
  1239    // complete reference name, a short reference name under refs/heads,
  1240    // refs/tags, or refs/remotes namespace, etc.
  1241    string source = 4;
  1242  
  1243    // The strategy of the merge.
  1244    MergeableStrategy strategy = 5;
  1245  }
  1246  
  1247  // Contains information about the mergeability of a change.
  1248  //
  1249  // Source of truth:
  1250  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#mergeable-info
  1251  message MergeableInfo {
  1252    enum SubmitType {
  1253      SUBMIT_TYPE_UNSPECIFIED = 0;
  1254      MERGE_IF_NECESSARY = 1;
  1255      FAST_FORWARD_ONLY = 2;
  1256      REBASE_IF_NECESSARY = 3;
  1257      REBASE_ALWAYS = 4;
  1258      MERGE_ALWAYS = 5;
  1259      CHERRY_PICK = 6;
  1260    }
  1261    // Submit type used for this change.
  1262    SubmitType submit_type = 1;
  1263  
  1264    // The strategy of the merge.
  1265    MergeableStrategy strategy = 2;
  1266  
  1267    // true if this change is cleanly mergeable, false otherwise.
  1268    bool mergeable = 3;
  1269  
  1270    // true if this change is already merged, false otherwise.
  1271    bool commit_merged = 4;
  1272  
  1273    // true if the content of this change is already merged, false otherwise.
  1274    bool content_merged = 5;
  1275  
  1276    // A list of paths with conflicts.
  1277    repeated string conflicts = 6;
  1278  
  1279    // A list of other branch names where this change could merge cleanly.
  1280    repeated string mergeable_into = 7;
  1281  }
  1282  
  1283  // Information for requesting the files in a change.
  1284  //
  1285  // Source of truth:
  1286  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-files
  1287  message ListFilesRequest {
  1288    // Change number.
  1289    int64 number = 1;
  1290  
  1291    // The project of this change. For example, "chromium/src".
  1292    //
  1293    // Optional, but recommended for better routing and faster RPC execution.
  1294    string project = 2;
  1295  
  1296    // Unique ID for the revision to query.
  1297    //
  1298    // Source of truth:
  1299    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
  1300    string revision_id = 3;
  1301  
  1302    // Changes the response to return a list of all files (modified or unmodified)
  1303    // that contain this substring in the path name.
  1304    string substring_query = 4;
  1305  
  1306    // For merge commits only, this requests a diff of files against a parent
  1307    // revision. Use value 1 to compare against a CL's target ref.
  1308    int64 parent = 5;
  1309  
  1310    // Can either be a revision id or a patchset number. It changes the response
  1311    // to return a map of the files which are different in this commit compared
  1312    // to the given revision. The revision must correspond to a patch set in the
  1313    // change.
  1314    string base = 6;
  1315  }
  1316  
  1317  // Information about the files in a change.
  1318  //
  1319  // Source of truth:
  1320  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-files
  1321  message ListFilesResponse {
  1322    // A map of file paths to FileInfos.
  1323    map<string, FileInfo> files = 1;
  1324  }
  1325  
  1326  // Information for requesting the related changes of a change.
  1327  //
  1328  // Source of truth:
  1329  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-related-changes
  1330  message GetRelatedChangesRequest {
  1331    // Change number.
  1332    int64 number = 1;
  1333  
  1334    // The project of this change. For example, "chromium/src".
  1335    //
  1336    // Optional, but recommended for better routing and faster RPC execution.
  1337    string project = 2;
  1338  
  1339    // Unique ID for the revision to query.
  1340    //
  1341    // Source of truth:
  1342    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
  1343    string revision_id = 3;
  1344  }
  1345  
  1346  // Information about related changes of a specific change's revision.
  1347  //
  1348  // Source of truth:
  1349  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#related-changes-info
  1350  message GetRelatedChangesResponse {
  1351    // Contains information about a related change and commit.
  1352    //
  1353    // Source of truth:
  1354    // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#related-change-and-commit-info
  1355    message ChangeAndCommit {
  1356      // The project of the change or commit.
  1357      string project = 1;
  1358      // The commit as a CommitInfo entity.
  1359      CommitInfo commit = 2;
  1360      // Optional. The change number.
  1361      int64 number = 3;
  1362      // Optional. The patchset number.
  1363      int64 patchset = 4;
  1364      // Optional. The current patchset number.
  1365      int64 current_patchset = 5;
  1366      // Optional. The status of the change.
  1367      ChangeStatus status = 6;
  1368    }
  1369  
  1370    // A list of describing the related changes.
  1371    //
  1372    // Sorted by git commit order, newest to oldest. Empty if there are no related
  1373    // changes.
  1374    repeated ChangeAndCommit changes = 1;
  1375  }
  1376  
  1377  // Information for requesting the projects on a host.
  1378  //
  1379  // Source of truth:
  1380  // https://gerrit-review.googlesource.com/Documentation/cmd-ls-projects.html
  1381  message ListProjectsRequest {
  1382    // Limit results to projects with any of the specified refs, e.g.: refs/heads/main.
  1383    // Ref SHA1 will be included in the results.
  1384    repeated string refs = 1;
  1385  
  1386  }
  1387  
  1388  // Describes a link to an external site
  1389  //
  1390  // Source of truth:
  1391  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#web-link-info
  1392  message WebLinkInfo {
  1393    // The link name
  1394    string name = 1;
  1395  
  1396    // Link URL
  1397    string url = 2;
  1398  
  1399    // URL to link icon
  1400    string image_url = 3;
  1401  }
  1402  
  1403  // Information about individual projects.
  1404  //
  1405  // Source of truth:
  1406  // https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-info
  1407  message ProjectInfo {
  1408    // The project name
  1409    string name = 1;
  1410  
  1411    // The name of the parent project
  1412    string parent = 2;
  1413  
  1414    // The description of the project
  1415    string description = 3;
  1416  
  1417    enum State {
  1418      PROJECT_STATE_UNSPECIFIED = 0;
  1419      PROJECT_STATE_ACTIVE = 1;
  1420      PROJECT_STATE_READ_ONLY = 2;
  1421      PROJECT_STATE_HIDDEN = 3;
  1422    }
  1423  
  1424    // The state of the project
  1425    State state = 4;
  1426  
  1427    // Map of ref names to HEAD revisions
  1428    map<string, string> refs = 5;
  1429  
  1430    // List of links to the project in external sites
  1431    repeated WebLinkInfo web_links = 6;
  1432  }
  1433  
  1434  // Information about the projects on a host.
  1435  //
  1436  // Source of truth:
  1437  // https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-info
  1438  message ListProjectsResponse {
  1439    // A map of project names to ProjectInfo entries, sorted by project name.
  1440    map<string, ProjectInfo> Projects = 1;
  1441  }
  1442  
  1443  // Information to request information about a branch.
  1444  message RefInfoRequest{
  1445    // The project name
  1446    string project = 1;
  1447  
  1448    // The ref ID (eg: refs/heads/main).
  1449    string ref = 2;
  1450  }
  1451  
  1452  // Information about a branch.
  1453  //
  1454  // Source of truth:
  1455  // https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#branch-info
  1456  message RefInfo{
  1457    // The ref of the branch
  1458    string ref = 1;
  1459    // The revision the branch points to
  1460    string revision = 2;
  1461  }
  1462  
  1463  // Options when requesting information about an account
  1464  //
  1465  // Source of truth:
  1466  // https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#details
  1467  message AccountOptions{
  1468    // Include account details in the response
  1469    bool details = 1;
  1470  
  1471    // Include all registered emails
  1472    // Requires the caller to have Modify Account global capability
  1473    bool all_emails = 2;
  1474  }
  1475  
  1476  // Information to request the list of OWNERS for a file/folder in a branch
  1477  message ListFileOwnersRequest{
  1478    // The project name
  1479    string project = 1;
  1480  
  1481    // The ref ID (eg: refs/heads/main)
  1482    string ref = 2;
  1483  
  1484    // Path (relative to the repo root) to the file/folder in question
  1485    string path = 3;
  1486  
  1487    // Options about how much detail to return in the AccountInfo
  1488    AccountOptions options = 4;
  1489  }
  1490  
  1491  // Information about a single OWNER
  1492  // NOTE: Gerrit OwnerInfo provides other fields beyond account,
  1493  // which can be added later.
  1494  message OwnerInfo{
  1495    AccountInfo account = 1;
  1496  }
  1497  
  1498  // Code OWNERS for a particular request
  1499  message ListOwnersResponse{
  1500    // The account(s) who are OWNERS
  1501    repeated OwnerInfo owners = 1;
  1502  }
  1503  
  1504  message GetPureRevertRequest {
  1505    // The change number.
  1506    int64 number = 1;
  1507  
  1508    // The project of this change. For example, "chromium/src".
  1509    //
  1510    // Optional, but recommended for better routing and faster RPC execution.
  1511    string project = 2;
  1512  }
  1513  
  1514  // Information about the result of a pure revert check.
  1515  //
  1516  // Source of truth:
  1517  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#pure-revert-info
  1518  message PureRevertInfo {
  1519    // Outcome of the check as boolean.
  1520    bool is_pure_revert = 1;
  1521  }
  1522  
  1523  // The SubmitRequirementResultInfo describes the result of evaluating a submit
  1524  // requirement on a change.
  1525  //
  1526  // Source of truth:
  1527  // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-result-info
  1528  message SubmitRequirementResultInfo {
  1529    // Name of The submit requirement.
  1530    string name = 1;
  1531    // Description of the submit requirement.
  1532    string description = 2;
  1533    enum Status {
  1534      SUBMIT_REQUIREMENT_STATUS_UNSPECIFIED = 0;
  1535      SATISFIED = 1;
  1536      UNSATISFIED = 2;
  1537      OVERRIDDEN = 3;
  1538      NOT_APPLICABLE = 4;
  1539      ERROR = 5;
  1540      FORCED = 6;
  1541    }
  1542    // Status describing the result of evaluating the submit requirement.
  1543    Status status = 3;
  1544    // True if this submit requirement result was created from a legacy
  1545    // SubmitRecord.
  1546    bool is_legacy = 4;
  1547    // SubmitRequirementExpressionInfo containing the result of evaluating
  1548    // the applicability expression.
  1549    //
  1550    // Not set if the submit requirement did not define an applicability
  1551    // expression. Note that the following fields are always omitted in
  1552    // `applicability_expression_result`.
  1553    // - `expression`
  1554    // - `passing_atoms`
  1555    // - `failing_atoms`
  1556    SubmitRequirementExpressionInfo applicability_expression_result = 5;
  1557    // SubmitRequirementExpressionInfo containing the result of evaluating
  1558    // the submittability expression.
  1559    //
  1560    // Not set if the submit requirement does not apply.
  1561    SubmitRequirementExpressionInfo submittability_expression_result = 6;
  1562    // SubmitRequirementExpressionInfo containing the result of evaluating
  1563    // the override expression.
  1564    //
  1565    // Not set if the submit requirement did not define an override expression or
  1566    // if it does not apply.
  1567    SubmitRequirementExpressionInfo override_expression_result = 7;
  1568  }
  1569  
  1570  // The SubmitRequirementExpressionInfo describes the result of evaluating
  1571  // a single submit requirement expression, for example label:code-review=+2.
  1572  message SubmitRequirementExpressionInfo {
  1573    // Expression of the submit requirement.
  1574    // e.g., branch:refs/heads/foo and label:verified=+1.
  1575    string expression = 1;
  1576    // True if the submit requirement is fulfilled for the change.
  1577    bool fulfilled = 2;
  1578    // List of passing atoms.
  1579    // e.g., ["branch:refs/heads/foo"]
  1580    repeated string passing_atoms = 3;
  1581    // List of failing atoms. This is similar to passing_atoms except that
  1582    // it contains a list of the predicates that are not fulfilled for the change.
  1583    repeated string failing_atoms = 4;
  1584    // If evaluating the submit requirement failed, this field will contains
  1585    // an error message describing why it failed.
  1586    string error_message = 5;
  1587  }
  1588  
  1589  // Information to retrieve the diff between two historical states of a change.
  1590  //
  1591  // If `old is omitted, the parent of the `meta` SHA-1 is used.
  1592  // If `meta` is omitted, the current state of the change is used.
  1593  // If both are omitted, the difference between the current state of the change
  1594  // and its previous state is returned.
  1595  message GetMetaDiffRequest {
  1596    // The Gerrit project.
  1597    // Specifying this field is optional, but encouraged because it requires less
  1598    // work on the Gerrit side.
  1599    string project = 1;
  1600    // Change number.
  1601    int64 number = 2;
  1602    // The SHA-1 of the old state to retrieve the diff to the state specified by
  1603    // `meta`.
  1604    string old = 3;
  1605    // The SHA-1 of the new state to retrieve the diff to the state specified by
  1606    // `old`.
  1607    string meta = 4;
  1608  
  1609    // What to include in `old_change_info` and `new_change_info` of the response.
  1610    repeated QueryOption options = 5;
  1611  }
  1612  
  1613  // Difference between two historical states of a change.
  1614  message MetaDiff {
  1615    // Change props added between the two states.
  1616    ChangeInfo added = 1;
  1617    // Change props removed between the two states.
  1618    ChangeInfo removed = 2;
  1619    // ChangeInfo of the old state.
  1620    ChangeInfo old_change_info = 3;
  1621    // ChangeInfo of the new state.
  1622    ChangeInfo new_change_info = 4;
  1623  }