blob: 225fde832c98526b8912044dff742ea20688f851 [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001// 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.
Copybara854996b2021-09-07 19:36:02 +00004
5syntax = "proto3";
6
7package monorail.v3;
8
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +02009option go_package = "infra/monorailv2/api/v3/api_proto";
Copybara854996b2021-09-07 19:36:02 +000010
11import "google/protobuf/field_mask.proto";
12import "google/api/field_behavior.proto";
13import "google/api/resource.proto";
14import "api/v3/api_proto/issue_objects.proto";
15
16// ***ONLY CALL rpcs WITH `status: {ALPHA|STABLE}`***
17// rpcs without `status` are not ready.
18
19// Issues service includes all methods needed for managing Issues.
20service Issues {
21 // status: ALPHA
22 // Returns the requested Issue.
23 //
24 // Raises:
25 // INVALID_ARGUMENT if `name` is formatted incorrectly.
26 // NOT_FOUND if the issue does not exist.
27 // PERMISSION_DENIED if the requester is not allowed to view the issue.
28 rpc GetIssue (GetIssueRequest) returns (Issue) {}
29
30 // status: ALPHA
31 // Returns the requested Issues.
32 //
33 // Raises:
34 // INVALID_ARGUMENT if `names` is formatted incorrectly. Or if a parent
35 // collection in `names` does not match the value in `parent`.
36 // NOT_FOUND if any of the given issues do not exist.
37 // PERMISSION_DENIED if the requester does not have permission to view one
38 // (or more) of the given issues.
39 rpc BatchGetIssues(BatchGetIssuesRequest) returns (BatchGetIssuesResponse) {}
40
41 // status: ALPHA
42 // Searches over issues within the specified projects.
43 //
44 // Raises:
45 // INVALID_ARGUMENT if project names or search query are invalid.
46 rpc SearchIssues (SearchIssuesRequest) returns (SearchIssuesResponse) {}
47
48 // status: ALPHA
49 // Lists comments for an issue.
50 //
51 // Raises:
52 // INVALID_ARGUMENT if `parent` is formatted incorrectly or `page_size` < 0.
53 // NOT_FOUND if `parent` does not exist.
54 // PERMISSION_DENIED if the requester is not allowed to view `parent`.
55 rpc ListComments (ListCommentsRequest) returns (ListCommentsResponse) {}
56
57 // status: ALPHA
58 // Modifies Issues and creates a new Comment for each.
59 // Issues with NOOP changes and no comment_content will not be updated
60 // and will not be included in the response.
61 // We do not offer a standard UpdateIssue because every issue change
62 // must result in the side-effect of creating a new Comment, and may result in
63 // the side effect of sending a notification. We also want to allow for any
64 // combination of issue changes to be made at once in a monolithic method.
65 //
66 // Raises:
67 // INVALID_ARGUMENT required fields are missing or fields are formatted
68 // incorrectly.
69 // NOT_FOUND if any specified issues are not found.
70 // PERMISSION_DENIED if the requester is not allowed to make the
71 // requested change.
72 rpc ModifyIssues (ModifyIssuesRequest) returns (ModifyIssuesResponse) {}
73
74 // status: ALPHA
75 // Modifies ApprovalValues and creates a new Comment for each delta.
76 // We do not offer a standard UpdateApprovalValue because changes result
77 // in creating Comments on the parent Issue, and may have the side effect of
78 // sending notifications. We also want to allow for any combination of
79 // approval changes to be made at once in a monolithic method.
80 // To modify owner add 'owner' to update_mask, though 'owner.user' works too.
81 //
82 // Raises:
83 // INVALID_ARGUMENT required fields are missing or fields are formatted
84 // incorrectly.
85 // NOT_FOUND if any specified ApprovalValues are not found.
86 // PERMISSION_DENIED if the requester is not allowed to make any of the
87 // requested changes.
88 rpc ModifyIssueApprovalValues (ModifyIssueApprovalValuesRequest) returns
89 (ModifyIssueApprovalValuesResponse) {}
90
91 // status: ALPHA
92 // Lists approval values for an issue.
93 //
94 // Raises:
95 // INVALID_ARGUMENT if request `parent` is formatted incorrectly.
96 // NOT_FOUND if the parent issue does not exist.
97 // PERMISSION_DENIED if the requester is not allowed to view parent issue.
98 rpc ListApprovalValues (ListApprovalValuesRequest) returns
99 (ListApprovalValuesResponse) {}
100
101 // status: NOT READY
102 // Changes state for a comment. Supported state transitions:
103 // - ACTIVE -> DELETED
104 // - ACTIVE -> SPAM
105 // - DELETED -> ACTIVE
106 // - SPAM -> ACTIVE
107 //
108 // Raises:
109 // TODO(crbug/monorail/7867): Document errors when implemented
110 rpc ModifyCommentState (ModifyCommentStateRequest) returns
111 (ModifyCommentStateResponse) {}
112
113 // status: NOT READY
114 // Makes an issue from an IssueTemplate and deltas.
115 //
116 // Raises:
117 // TODO(crbug/monorail/7197): Document errors when implemented
118 rpc MakeIssueFromTemplate (MakeIssueFromTemplateRequest) returns (Issue) {}
119
120 // status: ALPHA
121 // Makes a basic issue, does not support phases, approvals, or approval
122 // fields.
123 // We do not offer a standard CreateIssue because Issue descriptions are
124 // required, but not included in the Issue proto.
125 //
126 // Raises:
127 // INVALID_ARGUMENT if any given names does not have a valid format, if any
128 // fields in the requested issue were invalid, or if proposed values
129 // violates filter rules that should error.
130 // NOT_FOUND if no project exists with the given name.
131 // PERMISSION_DENIED if user lacks sufficient permissions.
132 rpc MakeIssue (MakeIssueRequest) returns (Issue) {}
133}
134
135
136// The request message for Issues.GetIssue.
137// Next available tag: 2
138message GetIssueRequest {
139 // The name of the issue to request.
140 string name = 1 [
141 (google.api.resource_reference) = {type: "api.crbug.com/Issue"},
142 (google.api.field_behavior) = REQUIRED ];
143}
144
145// The request message for Issues.BatchGetIssues.
146// Next available tag: 3
147message BatchGetIssuesRequest {
148 // The project name from which to batch get issues. If included, the parent
149 // of all the issues specified in `names` must match this field.
150 string parent = 1 [
151 (google.api.resource_reference) = {type: "api.crbug.com/Project"} ];
152 // The issues to request. Maximum of 100 can be retrieved.
153 repeated string names = 2 [
154 (google.api.resource_reference) = {type: "api.crbug.com/Issue"} ];
155}
156
157// The response message for Issues.BatchGetIssues.
158// Next available tag: 2
159message BatchGetIssuesResponse {
160 // Issues matching the given request.
161 repeated Issue issues = 1;
162}
163
164// The request message for Issues.SearchIssues.
165// Next available tag: 6
166message SearchIssuesRequest {
167 // The names of Projects in which to search issues.
168 repeated string projects = 1 [
169 (google.api.resource_reference) = {type: "api.crbug.com/Project"},
170 (google.api.field_behavior) = REQUIRED ];
171 // The query string can contain any number of free text and
172 // field search expressions.
173 // Please see https://bugs.chromium.org/p/chromium/issues/searchtips for more
174 // details of how the query string works.
175 //
176 // Canned queries have been deprecated in v3 in favor of search scoping using
177 // parentheses support.
178 // For clients who previously used canned queries, we're providing the
179 // mapping of legacy canned query IDs to Monorail search syntax:
180 // - Format: (can_id, description, query_string)
181 // - (1, 'All issues', '')
182 // - (2, 'Open issues', 'is:open')
183 // - (3, 'Open and owned by me', 'is:open owner:me')
184 // - (4, 'Open and reported by me', 'is:open reporter:me')
185 // - (5, 'Open and starred by me', 'is:open is:starred')
186 // - (6, 'New issues', 'status:new')
187 // - (7, 'Issues to verify', 'status=fixed,done')
188 // - (8, 'Open with comment by me', 'is:open commentby:me')
189 string query = 2;
190 // The maximum number of items to return. The service may return fewer than
191 // this value.
192 // If unspecified, at most 100 items will be returned.
193 // The maximum value is 100; values above 100 will be coerced to 100.
194 int32 page_size = 3;
195 // A page token, received from a previous `SearchIssues` call.
196 // Provide this to retrieve the subsequent page.
197 //
198 // When paginating, all other parameters provided to `SearchIssues` must match
199 // the call that provided the page token.
200 string page_token = 4;
201 // The string of comma separated field names used to order the items.
202 // Adding '-' before a field, reverses the sort order.
203 // E.g. 'stars,-status' sorts the items by number of stars, high to low,
204 // then by status, low to high.
205 string order_by = 5;
206}
207
208// The response message for Issues.SearchIssues.
209// Next available tag: 3
210message SearchIssuesResponse {
211 // Issues matching the given request.
212 repeated Issue issues = 1;
213 // A token, which can be sent as `page_token` to retrieve the next page.
214 // If this field is omitted, there are no subsequent pages.
215 string next_page_token = 2;
216}
217
218// The request message for Issues.ListComments.
219// Next available tag: 5
220message ListCommentsRequest {
221 // The name of the issue for which to list comments.
222 string parent = 1 [
223 (google.api.resource_reference) = {type: "api.crbug.com/Issue"},
224 (google.api.field_behavior) = REQUIRED ];
225 // The maximum number of items to return. The service may return fewer than
226 // this value.
227 // If unspecified, at most 100 items will be returned.
228 // The maximum value is 100; values above 100 will be coerced to 100.
229 int32 page_size = 2;
230 // A page token, received from a previous `ListComments` call.
231 // Provide this to retrieve the subsequent page.
232 //
233 // When paginating, all other parameters provided to `ListComments` must
234 // match the call that provided the page token.
235 string page_token = 3;
236 // For our initial release this filter only supports filtering to comments
237 // related to a specific approval.
238 // For example `approval = "projects/monorail/approvalDefs/1"`,
239 // Note that no further logical or comparison operators are supported
240 string filter = 4;
241}
242
243// The response message for Issues.ListComments
244// Next available tag: 3
245message ListCommentsResponse {
246 // The comments from the specified issue.
247 repeated Comment comments = 1;
248 // A token, which can be sent as `page_token` to retrieve the next page.
249 // If this field is omitted, there are no subsequent pages.
250 string next_page_token = 2;
251}
252
253// An attachment to upload to a comment or description.
254// Next available tag: 3
255message AttachmentUpload {
256 string filename = 1 [ (google.api.field_behavior) = REQUIRED ];
257 bytes content = 2 [ (google.api.field_behavior) = REQUIRED ];
258}
259
260// Holds changes to one issue, used in ModifyIssuesRequest.
261// Next available tag: 9
262message IssueDelta {
263 // The issue's `name` field is used to identify the issue to be
264 // updated. `issue.name` must always be filled.
265 //
266 // Values with rule-based Derivation within `issue` and in `field_vals_remove`
267 // will be ignored.
268 Issue issue = 1 [
269 (google.api.field_behavior) = REQUIRED ];
270 // The list of fields in `issue` to be updated.
271 //
272 // Repeated fields set on `issue` will be appended to.
273 //
274 // Non-repeated fields (e.g. `owner`) can be set with `issue.owner` set and
275 // either 'owner' or 'owner.user' added to `update_mask`.
276 // To unset non-repeated fields back to their default value, `issue.owner`
277 // must contain the default value and `update_mask` must include 'owner.user'
278 // NOT 'owner'.
279 //
280 // Its `field_values`, however, are a special case. Fields can be specified as
281 // single-value or multi-value in their FieldDef.
282 //
283 // Single-value Field: if there is preexisting FieldValue with the same
284 // `field` and `phase`, it will be REPLACED.
285 //
286 // Multi-value Field: a new value will be appended, unless the same `field`,
287 // `phase`, `value` combination already exists. In that case, the FieldValue
288 // will be ignored. In other words, duplicate values are ignored.
289 // (With the exception of crbug.com/monorail/8137 until it is fixed).
290 google.protobuf.FieldMask update_mask = 2 [
291 (google.api.field_behavior) = REQUIRED ];
292
293 // Values to remove from the repeated fields of the issue.
294
295 // Cc's to remove.
296 repeated string ccs_remove = 3 [
297 (google.api.resource_reference) = {type: "api.crbug.com/User"}];
298 // Blocked_on issues to remove.
299 repeated IssueRef blocked_on_issues_remove = 4;
300 // Blocking issues to remove.
301 repeated IssueRef blocking_issues_remove = 5;
302 // Components to remove.
303 repeated string components_remove = 6 [
304 (google.api.resource_reference) = {type: "api.crbug.com/ComponentDef"}];
305 // Labels to remove.
306 repeated string labels_remove = 7;
307 // FieldValues to remove. Any values that did not already exist will be
308 // ignored e.g. if you append a FieldValue in issue and remove it here, it
309 // will still be added.
310 repeated FieldValue field_vals_remove = 8;
311
312 // TODO(crbug.com/monorail/8019): add Attachment uploading and removing.
313}
314
315// Changes to make to an ApprovalValue. Used to ModifyIssueApprovalValues or
316// to MakeIssueFromTemplate.
317//
318// NOTE: The same handling of FieldValues discussed in IssueDelta applies here.
319// Next available tag: 6
320message ApprovalDelta {
321 // The ApprovalValue we want to update. `approval_value.name` must always be
322 // set.
323 ApprovalValue approval_value = 1;
324 // Repeated fields found in `update_mask` will be appended to.
325 google.protobuf.FieldMask update_mask = 2 [
326 (google.api.field_behavior) = REQUIRED ];
327 // Resource names of the approvers we want to remove.
328 repeated string approvers_remove = 3 [
329 (google.api.resource_reference) = { type: "api.crbug.com/User" }
330 ];
331 // FieldValues that do not belong to `approval_value` will trigger error.
332 repeated FieldValue field_vals_remove = 5;
333 // TODO(crbug.com/monorail/8019): add Attachment uploading and removing.
334}
335
336
337// The type of notification a change should trigger.
338// See monorail/doc/userguide/email.md
339// Next available tag: 2
340enum NotifyType {
341 // The default value. This value is unused.
342 NOTIFY_TYPE_UNSPECIFIED = 0;
343 // An email notification should be sent.
344 EMAIL = 1;
345 // No notifcation should be triggered at all.
346 NO_NOTIFICATION = 2;
347}
348
349
350// The request message for Issues.ModifyIssues.
351// Next available tag: 5
352message ModifyIssuesRequest {
353 // The issue changes to make. A maximum of 100 issue changes can be requested.
354 // There is also a constraint of 50 additional 'impacted issues' per
355 // ModifyIssuesRequest. 'Impacted issues' are issues that are adding/removing
356 // `blocked_on`, `blocking`, or `merge`
357 // If you encounter this error, consider significantly smaller batches.
358 repeated IssueDelta deltas = 1;
359 // The type of notification the modifications should trigger.
360 NotifyType notify_type = 2;
361 // The comment text that should be added to each issue in delta.
362 // Max length is 51200 characters.
363 string comment_content = 3;
364 // The attachment that will be to each comment for each issue in delta.
365 repeated AttachmentUpload uploads = 4;
366}
367
368
369// The response message for Issues.ModifyIssues.
370// Next available tag: 2
371message ModifyIssuesResponse {
372 // The updated issues.
373 repeated Issue issues = 1;
374}
375
376// The request message for Issues.ModifyIssueApprovalValues.
377// Next available tag: 4
378message ModifyIssueApprovalValuesRequest {
379 // The ApprovalValue changes to make. Maximum of 100 deltas can be requested.
380 repeated ApprovalDelta deltas = 1;
381 // The type of notification the modifications should trigger.
382 NotifyType notify_type = 2;
383 // The `content` of the Comment created for each change in `deltas`.
384 // Max length is 51200 characters.
385 string comment_content = 3;
386}
387
388// The response message for Issues.ModifyIssueApprovalValuesRequest.
389// Next available tag: 2
390message ModifyIssueApprovalValuesResponse {
391 // The updated ApprovalValues.
392 repeated ApprovalValue approval_values = 1;
393}
394
395// The request message for Issue.ListApprovalValues.
396// Next available tag: 2
397message ListApprovalValuesRequest {
398 // The name of the issue for which to list approval values.
399 string parent = 1 [
400 (google.api.resource_reference) = {type: "api.crbug.com/Issue"},
401 (google.api.field_behavior) = REQUIRED ];
402}
403
404// The response message for Issues.ListApprovalValues.
405// Next available tag: 2
406message ListApprovalValuesResponse {
407 // The approval values from the specified issue.
408 repeated ApprovalValue approval_values = 1;
409}
410
411// The request message for Issues.ModifyCommentState.
412// Next available tag: 3
413message ModifyCommentStateRequest {
414 // Resource name of the comment to modify state.
415 string name = 1 [
416 (google.api.resource_reference) = {type: "api.crbug.com/Comment"},
417 (google.api.field_behavior) = REQUIRED ];
418 // Requested state.
419 IssueContentState state = 2;
420}
421
422// The response message for Issues.ModifyCommentState.
423// Next available tag: 2
424message ModifyCommentStateResponse {
425 // The updated comment after modifying state.
426 Comment comment = 1;
427}
428
429// The request message for MakeIssueFromTemplate.
430// Next available tag: 5
431message MakeIssueFromTemplateRequest {
432 // Resource name of the template to use for filling in default values
433 // and adding approvals and phases.
434 string template = 1 [
435 (google.api.resource_reference) = { type: "api.crbug.com/Template" }
436 ];
437 // The issue differences relative to the `template.issue` default.
438 IssueDelta template_issue_delta = 2;
439 // Changes to fields belonging to approvals relative to template default.
440 // While ApprovalDelta can hold additional information, this method only
441 // allows adding and removing field values, all other deltas will be ignored.
442 repeated ApprovalDelta template_approval_deltas = 3;
443 // The issue description, will be saved as the first comment.
444 string description = 4;
445}
446
447// The request message for MakeIssue.
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +0200448// Next available tag: 6
Copybara854996b2021-09-07 19:36:02 +0000449message MakeIssueRequest {
450 // The name of the project the issue should belong to.
451 string parent = 1 [
452 (google.api.resource_reference) = {type: "api.crbug.com/Project"},
453 (google.api.field_behavior) = REQUIRED ];
454 // The issue to be created.
455 Issue issue = 2;
456 // The issue description.
457 string description = 3;
458 // The type of notification the creation should trigger.
459 NotifyType notify_type = 4;
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +0200460 // The attachment that will be attached to each new issue.
461 repeated AttachmentUpload uploads = 5;
Copybara854996b2021-09-07 19:36:02 +0000462}