Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | // 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. |
| 4 | |
| 5 | syntax = "proto3"; |
| 6 | |
| 7 | package monorail.v3; |
| 8 | |
| 9 | option go_package = "api/v3/api_proto"; |
| 10 | |
| 11 | import "google/api/field_behavior.proto"; |
| 12 | import "google/api/resource.proto"; |
| 13 | import "api/v3/api_proto/user_objects.proto"; |
| 14 | import "google/protobuf/empty.proto"; |
| 15 | import "google/protobuf/field_mask.proto"; |
| 16 | |
| 17 | // ***ONLY CALL rpcs WITH `status: {ALPHA|STABLE}`*** |
| 18 | // rpcs without `status` are not ready. |
| 19 | |
| 20 | // Users service includes all methods needed for managing Users. |
| 21 | service Users { |
| 22 | // status: ALPHA |
| 23 | // Returns the requested User. |
| 24 | // |
| 25 | // Raises: |
| 26 | // NOT_FOUND is the user is not found. |
| 27 | // INVALID_ARGUMENT if the `name` is invalid. |
| 28 | rpc GetUser (GetUserRequest) returns (User) {} |
| 29 | |
| 30 | // status: ALPHA |
| 31 | // Returns all of the requested Users. |
| 32 | // |
| 33 | // Raises: |
| 34 | // NOT_FOUND if any users are not found. |
| 35 | // INVALID_ARGUMENT if any `names` are invalid. |
| 36 | rpc BatchGetUsers (BatchGetUsersRequest) returns (BatchGetUsersResponse) {} |
| 37 | |
| 38 | // status: NOT READY |
| 39 | // Updates a User. |
| 40 | // |
| 41 | // Raises: |
| 42 | // NOT_FOUND if the user is not found. |
| 43 | // PERMISSION_DENIED if the requester is not allowed to update the user. |
| 44 | // INVALID_ARGUMENT if required fields are missing or fields are invalid. |
| 45 | rpc UpdateUser (UpdateUserRequest) returns (User) {} |
| 46 | |
| 47 | // status: NOT READY |
| 48 | // Stars a given project for the requestor. |
| 49 | // |
| 50 | // Raises: |
| 51 | // NOT_FOUND if the requested project is not found. |
| 52 | // INVALID_ARGUMENT if the given `project` is not valid. |
| 53 | rpc StarProject (StarProjectRequest) returns (ProjectStar) {} |
| 54 | |
| 55 | // status: NOT READY |
| 56 | // Unstars a given project for the requestor. |
| 57 | // |
| 58 | // Raises: |
| 59 | // NOT_FOUND if the requested project is not found. |
| 60 | // INVALID_ARGUMENT if the given `project` is not valid. |
| 61 | rpc UnStarProject (UnStarProjectRequest) returns (google.protobuf.Empty) {} |
| 62 | |
| 63 | // status: NOT READY |
| 64 | // Lists all of a user's starred projects. |
| 65 | // |
| 66 | // Raises: |
| 67 | // NOT_FOUND if the requested user is not found. |
| 68 | // INVALID_ARGUMENT if the given `parent` is not valid. |
| 69 | rpc ListProjectStars (ListProjectStarsRequest) returns (ListProjectStarsResponse) {} |
| 70 | } |
| 71 | |
| 72 | |
| 73 | // The request message for Users.GetUser. |
| 74 | // Next available tag: 2 |
| 75 | message GetUserRequest { |
| 76 | // The name of the user to request. |
| 77 | string name = 1 [ |
| 78 | (google.api.resource_reference) = {type: "api.crbug.com/User"}, |
| 79 | (google.api.field_behavior) = REQUIRED ]; |
| 80 | } |
| 81 | |
| 82 | |
| 83 | // The request message for Users.BatchGetUsers. |
| 84 | // Next available tag: 2 |
| 85 | message BatchGetUsersRequest { |
| 86 | // The name of the users to request. At most 100 may be requested. |
| 87 | repeated string names = 1 [ |
| 88 | (google.api.resource_reference) = {type: "api.crbug.com/User"}, |
| 89 | (google.api.field_behavior) = REQUIRED ]; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | // The response message for Users.BatchGetUsers. |
| 94 | // Next available tag: 2 |
| 95 | message BatchGetUsersResponse { |
| 96 | // The users that were requested. |
| 97 | repeated User users = 1; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | // The request message for Users.UpdateUser. |
| 102 | // Next available tag: 3 |
| 103 | message UpdateUserRequest { |
| 104 | // The user's `name` field is used to identify the user to be updated. |
| 105 | User user = 1 [ |
| 106 | (google.api.field_behavior) = REQUIRED, |
| 107 | (google.api.resource_reference) = {type: "api.crbug.com/User"} ]; |
| 108 | // The list of fields to be updated. |
| 109 | google.protobuf.FieldMask update_mask = 2 [ (google.api.field_behavior) = REQUIRED ]; |
| 110 | } |
| 111 | |
| 112 | |
| 113 | // The request message for Users.StarProject. |
| 114 | // Next available tag: 2 |
| 115 | message StarProjectRequest { |
| 116 | // The resource name for the Project to star. |
| 117 | string project = 1 [ |
| 118 | (google.api.resource_reference) = {type: "api.crbug.com/Project"}, |
| 119 | (google.api.field_behavior) = REQUIRED ]; |
| 120 | } |
| 121 | |
| 122 | |
| 123 | // The request message for Users.UnStarProject. |
| 124 | // Next available tag: 2 |
| 125 | message UnStarProjectRequest { |
| 126 | // The resource name for the Project to unstar. |
| 127 | string project = 1 [ |
| 128 | (google.api.resource_reference) = {type: "api.crbug.com/Project"}, |
| 129 | (google.api.field_behavior) = REQUIRED ]; |
| 130 | } |
| 131 | |
| 132 | |
| 133 | // The request message for Users.ListProjectStars. |
| 134 | // Next available tag: 4 |
| 135 | message ListProjectStarsRequest { |
| 136 | // The resource name for the user having stars listed. |
| 137 | string parent = 1 [ |
| 138 | (google.api.resource_reference) = {type: "api.crbug.com/User"}, |
| 139 | (google.api.field_behavior) = REQUIRED ]; |
| 140 | // The maximum number of items to return. The service may return fewer than |
| 141 | // this value. |
| 142 | // If unspecified, at most 1000 items will be returned. |
| 143 | int32 page_size = 2; |
| 144 | // A page token, received from a previous `ListProjectStars` call. |
| 145 | // Provide this to retrieve the subsequent page. |
| 146 | // |
| 147 | // When paginating, all other parameters provided to `ListProjectStars` must |
| 148 | // match the call that provided the page token. |
| 149 | string page_token = 3; |
| 150 | } |
| 151 | |
| 152 | |
| 153 | // The response message for Users.ListProjectStars. |
| 154 | // Next available tag: 3 |
| 155 | message ListProjectStarsResponse { |
| 156 | // Data for each starred project. |
| 157 | repeated ProjectStar project_stars = 1; |
| 158 | // A token, which can be sent as `page_token` to retrieve the next page. |
| 159 | // If this field is omitted, there are no subsequent pages. |
| 160 | string next_page_token = 2; |
| 161 | } |