Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 1 | // Copyright 2020 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | |
| 5 | syntax = "proto3"; |
| 6 | |
| 7 | package monorail.v3; |
| 8 | |
Adrià Vilanova Martínez | ac4a644 | 2022-05-15 19:05:13 +0200 | [diff] [blame] | 9 | option go_package = "infra/monorailv2/api/v3/api_proto"; |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 10 | |
| 11 | import "api/v3/api_proto/feature_objects.proto"; |
| 12 | import "google/protobuf/field_mask.proto"; |
| 13 | import "google/protobuf/empty.proto"; |
| 14 | import "google/api/field_behavior.proto"; |
| 15 | import "google/api/resource.proto"; |
| 16 | |
| 17 | // ***ONLY CALL rpcs WITH `status: {ALPHA|STABLE}`*** |
| 18 | // rpcs without `status` are not ready. |
| 19 | |
| 20 | // Hotlists service includes all methods needed for managing Hotlists. |
| 21 | service Hotlists { |
| 22 | // status: NOT READY |
| 23 | // Creates a new hotlist. |
| 24 | // |
| 25 | // Raises: |
| 26 | // NOT_FOUND if some given hotlist editors do not exist. |
| 27 | // ALREADY_EXISTS if a hotlist with the same name owned by the user |
| 28 | // already exists. |
| 29 | // INVALID_ARGUMENT if a `hotlist.owner` is given. |
| 30 | rpc CreateHotlist (CreateHotlistRequest) returns (Hotlist) {} |
| 31 | |
| 32 | // status: NOT READY |
| 33 | // Returns the requested Hotlist. |
| 34 | // |
| 35 | // Raises: |
| 36 | // NOT_FOUND if the requested hotlist is not found. |
| 37 | // PERMISSION_DENIED if the requester is not allowed to view the hotlist. |
| 38 | // INVALID_ARGUMENT if the given resource name is not valid. |
| 39 | rpc GetHotlist (GetHotlistRequest) returns (Hotlist) {} |
| 40 | |
| 41 | // status: NOT READY |
| 42 | // Updates a hotlist. |
| 43 | // |
| 44 | // Raises: |
| 45 | // NOT_FOUND if the hotlist is not found. |
| 46 | // PERMISSION_DENIED if the requester is not allowed to update the hotlist. |
| 47 | // INVALID_ARGUMENT if required fields are missing. |
| 48 | rpc UpdateHotlist (UpdateHotlistRequest) returns (Hotlist) {} |
| 49 | |
| 50 | // status: NOT READY |
| 51 | // Deletes a hotlist. |
| 52 | // |
| 53 | // Raises: |
| 54 | // NOT_FOUND if the hotlist is not found. |
| 55 | // PERMISSION_DENIED if the requester is not allowed to delete the hotlist. |
| 56 | rpc DeleteHotlist (GetHotlistRequest) returns (google.protobuf.Empty) {} |
| 57 | |
| 58 | // status: NOT READY |
| 59 | // Returns a list of all HotlistItems in the hotlist. |
| 60 | // |
| 61 | // Raises: |
| 62 | // NOT_FOUND if the parent hotlist is not found. |
| 63 | // PERMISSION_DENIED if the requester is not allowed to view the hotlist. |
| 64 | // INVALID_ARGUMENT if the page_token or given hotlist resource name is not |
| 65 | // valid. |
| 66 | rpc ListHotlistItems (ListHotlistItemsRequest) returns (ListHotlistItemsResponse) {} |
| 67 | |
| 68 | // status: NOT READY |
| 69 | // Reranks a hotlist's items. |
| 70 | // |
| 71 | // Raises: |
| 72 | // NOT_FOUND if the hotlist or issues to rerank are not found. |
| 73 | // PERMISSION_DENIED if the requester is not allowed to rerank the hotlist |
| 74 | // or view issues they're trying to rerank. |
| 75 | // INVALID_ARGUMENT if the `target_position` is invalid or `hotlist_items` |
| 76 | // is empty or contains items not in the Hotlist. |
| 77 | rpc RerankHotlistItems (RerankHotlistItemsRequest) returns (google.protobuf.Empty) {} |
| 78 | |
| 79 | // status: NOT READY |
| 80 | // Adds new items associated with given issues to a hotlist. |
| 81 | // |
| 82 | // Raises: |
| 83 | // NOT_FOUND if the parent hotlist or issues are not found. |
| 84 | // PERMISSION_DENIED if the requester is not allowed to edit the hotlist or |
| 85 | // view issues they are trying to add. |
| 86 | // INVALID_ARGUMENT if the `target_position` is invalid or `hotlist_items` |
| 87 | // is empty or contains items not in the Hotlist. |
| 88 | rpc AddHotlistItems (AddHotlistItemsRequest) returns (google.protobuf.Empty) {} |
| 89 | |
| 90 | // status: NOT READY |
| 91 | // Removes items associated with given issues from a hotlist. |
| 92 | // |
| 93 | // Raises: |
| 94 | // NOT_FOUND if the parent hotlist or issues are not found. |
| 95 | // PERMISSION_DENIED if the requester is not allowed to edit the hotlist or |
| 96 | // view issues they are trying to remove. |
| 97 | // INVALID_ARGUMENT if the `target_position` is invalid or `hotlist_items` |
| 98 | // is empty or contains items not in the Hotlist. |
| 99 | rpc RemoveHotlistItems (RemoveHotlistItemsRequest) returns (google.protobuf.Empty) {} |
| 100 | |
| 101 | // status: NOT READY |
| 102 | // Removes editors assigned to a hotlist. |
| 103 | // |
| 104 | // Raises: |
| 105 | // NOT_FOUND if the hotlist is not found. |
| 106 | // PERMISSION_DENIED if the requester is not allowed to remove all specified |
| 107 | // editors from the hotlist. |
| 108 | // INVALID_ARGUMENT if any specified editors are not in the hotlist. |
| 109 | rpc RemoveHotlistEditors (RemoveHotlistEditorsRequest) returns (google.protobuf.Empty) {} |
| 110 | |
| 111 | // status: NOT READY |
| 112 | // Gathers all viewable hotlists that a user is a member of. |
| 113 | // |
| 114 | // Raises: |
| 115 | // NOT_FOUND if the user is not found. |
| 116 | // INVALID_ARGUMENT if the `user` is invalid. |
| 117 | rpc GatherHotlistsForUser (GatherHotlistsForUserRequest) returns (GatherHotlistsForUserResponse) {} |
| 118 | } |
| 119 | |
| 120 | |
| 121 | // Request message for CreateHotlist method. |
| 122 | // Next available tag: 2 |
| 123 | message CreateHotlistRequest { |
| 124 | // The hotlist to create. |
| 125 | // `hotlist.owner` must be empty. The owner of the new hotlist will be |
| 126 | // set to the requester. |
| 127 | Hotlist hotlist = 1 [ (google.api.field_behavior) = REQUIRED ]; |
| 128 | } |
| 129 | |
| 130 | |
| 131 | // Request message for GetHotlist method. |
| 132 | // Next available tag: 2 |
| 133 | message GetHotlistRequest { |
| 134 | // The name of the hotlist to retrieve. |
| 135 | string name = 1 [ |
| 136 | (google.api.field_behavior) = REQUIRED, |
| 137 | (google.api.resource_reference) = {type: "api.crbug.com/Hotlist"}]; |
| 138 | } |
| 139 | |
| 140 | |
| 141 | // Request message for UpdateHotlist method. |
| 142 | // Next available tag: 2 |
| 143 | message UpdateHotlistRequest { |
| 144 | // The hotlist's `name` field is used to identify the hotlist to be updated. |
| 145 | Hotlist hotlist = 1 [ |
| 146 | (google.api.field_behavior) = REQUIRED, |
| 147 | (google.api.resource_reference) = {type: "api.crbug.com/Hotlist"} ]; |
| 148 | // The list of fields to be updated. |
| 149 | google.protobuf.FieldMask update_mask = 2 [ (google.api.field_behavior) = REQUIRED ]; |
| 150 | } |
| 151 | |
| 152 | |
| 153 | // Request message for ListHotlistItems method. |
| 154 | // Next available tag: 5 |
| 155 | message ListHotlistItemsRequest { |
| 156 | // The parent hotlist, which owns this collection of items. |
| 157 | string parent = 1 [ |
| 158 | (google.api.field_behavior) = REQUIRED, |
| 159 | (google.api.resource_reference) = {type: "api.crbug.com/Hotlist"} ]; |
| 160 | // The maximum number of items to return. The service may return fewer than |
| 161 | // this value. |
| 162 | // If unspecified, at most 1000 items will be returned. |
| 163 | // The maximum value is 1000; values above 1000 will be coerced to 1000. |
| 164 | int32 page_size = 2; |
| 165 | // The string of comma separated field names used to order the items. |
| 166 | // Adding '-' before a field, reverses the sort order. |
| 167 | // E.g. 'stars,-status' sorts the items by number of stars low to high, then |
| 168 | // status high to low. |
| 169 | // If unspecified, items will be ordered by their rank in the parent. |
| 170 | string order_by = 3; |
| 171 | // A page token, received from a previous `ListHotlistItems` call. |
| 172 | // Provide this to retrieve the subsequent page. |
| 173 | // |
| 174 | // When paginating, all other parameters provided to `ListHotlistItems` must |
| 175 | // match the call that provided the page token. |
| 176 | string page_token = 4; |
| 177 | } |
| 178 | |
| 179 | |
| 180 | // Response to ListHotlistItems call. |
| 181 | // Next available tag: 3 |
| 182 | message ListHotlistItemsResponse { |
| 183 | // The items from the specified hotlist. |
| 184 | repeated HotlistItem items = 1; |
| 185 | // A token, which can be sent as `page_token` to retrieve the next page. |
| 186 | // If this field is omitted, there are no subsequent pages. |
| 187 | string next_page_token = 2; |
| 188 | } |
| 189 | |
| 190 | |
| 191 | // The request used to rerank a Hotlist. |
| 192 | // Next available tag: 4 |
| 193 | message RerankHotlistItemsRequest { |
| 194 | // Resource name of the Hotlist to rerank. |
| 195 | string name = 1 [ |
| 196 | (google.api.resource_reference) = {type: "api.crbug.com/Hotlist"}, |
| 197 | (google.api.field_behavior) = REQUIRED ]; |
| 198 | // HotlistItems to be moved. The order of `hotlist_items` will |
| 199 | // determine the order of these items after they have been moved. |
| 200 | // E.g. With items [a, b, c, d, e], moving [d, c] to `target_position` 3, will |
| 201 | // result in items [a, b, e, d, c]. |
| 202 | repeated string hotlist_items = 2 [ |
| 203 | (google.api.resource_reference) = {type: "api.crbug.com/HotlistItem"}, |
| 204 | (google.api.field_behavior) = REQUIRED ]; |
| 205 | // Target starting position of the moved items. |
| 206 | // `target_position` must be between 0 and (# hotlist items - # items being moved). |
| 207 | uint32 target_position = 3 [ (google.api.field_behavior) = REQUIRED ]; |
| 208 | } |
| 209 | |
| 210 | |
| 211 | // Request message for an AddHotlistItems call. |
| 212 | // Next available tag: 4 |
| 213 | message AddHotlistItemsRequest { |
| 214 | // Resource name of the Hotlist to add new items to. |
| 215 | string parent = 1 [ |
| 216 | (google.api.field_behavior) = REQUIRED, |
| 217 | (google.api.resource_reference) = {type: "api.crbug.com/Hotlist"} ]; |
| 218 | // Resource names of Issues to associate with new HotlistItems added to `parent`. |
| 219 | repeated string issues = 2 [ |
| 220 | (google.api.field_behavior) = REQUIRED, |
| 221 | (google.api.resource_reference) = {type: "api.crbug.com/Issue"} ]; |
| 222 | // Target starting position of the new items. |
| 223 | // `target_position` must be between [0 and # of items that currently exist in |
| 224 | // `parent`]. The request will fail if a specified `target_position` is outside |
| 225 | // of this range. |
| 226 | // New HotlistItems added to a non-last position of the hotlist will |
| 227 | // cause ranks of existing HotlistItems below `target_position` to be adjusted. |
| 228 | // If no `target_position` is given, new items will be added to the end of |
| 229 | // `parent`. |
| 230 | uint32 target_position = 3; |
| 231 | } |
| 232 | |
| 233 | |
| 234 | // Request message for a RemoveHotlistItems call. |
| 235 | // Next available tag: 3 |
| 236 | message RemoveHotlistItemsRequest { |
| 237 | // Resource name of the Hotlist to remove items from. |
| 238 | string parent = 1 [ |
| 239 | (google.api.field_behavior) = REQUIRED, |
| 240 | (google.api.resource_reference) = {type: "api.crbug.com/Hotlist"} ]; |
| 241 | // Resource names of Issues associated with HotlistItems that should be removed. |
| 242 | repeated string issues = 2 [ |
| 243 | (google.api.field_behavior) = REQUIRED, |
| 244 | (google.api.resource_reference) = {type: "api.crbug.com/Issue"} ]; |
| 245 | } |
| 246 | |
| 247 | |
| 248 | // Request message for a RemoveHotlistEditors call. |
| 249 | // Next available tag: 3 |
| 250 | message RemoveHotlistEditorsRequest { |
| 251 | // Resource name of the Hotlist to remove editors from. |
| 252 | string name = 1 [ |
| 253 | (google.api.field_behavior) = REQUIRED, |
| 254 | (google.api.resource_reference) = {type: "api.crbug.com/Hotlist"} ]; |
| 255 | // Resource names of Users associated with the hotlist that should be removed. |
| 256 | repeated string editors = 2 [ |
| 257 | (google.api.field_behavior) = REQUIRED, |
| 258 | (google.api.resource_reference) = {type: "api.crbug.com/User"} ]; |
| 259 | } |
| 260 | |
| 261 | |
| 262 | // Request message for a GatherHotlistsForUser call. |
| 263 | // Next available tag: 2 |
| 264 | message GatherHotlistsForUserRequest { |
| 265 | // Resource name of the user whose hotlists we want to fetch. |
| 266 | string user = 1 [ (google.api.field_behavior) = REQUIRED, |
| 267 | (google.api.resource_reference) = {type: "api.crbug.com/User"} ]; |
| 268 | } |
| 269 | |
| 270 | |
| 271 | // Response message for a GatherHotlistsForUser call. |
| 272 | // Next available tag: 2 |
| 273 | message GatherHotlistsForUserResponse { |
| 274 | repeated Hotlist hotlists = 1; |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 275 | } |