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