Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 1 | # Copyright 2016 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 | """Protocol buffers for Monorail API.""" |
| 6 | |
| 7 | from __future__ import print_function |
| 8 | from __future__ import division |
| 9 | from __future__ import absolute_import |
| 10 | |
| 11 | from endpoints import ResourceContainer |
| 12 | from protorpc import messages |
| 13 | from protorpc import message_types |
| 14 | |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 15 | from mrproto import usergroup_pb2 |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 16 | |
| 17 | |
| 18 | ########################## Helper Message ########################## |
| 19 | |
| 20 | |
| 21 | class ErrorMessage(messages.Message): |
| 22 | """Request error.""" |
| 23 | code = messages.IntegerField( |
| 24 | 1, required=True, variant=messages.Variant.INT32) |
| 25 | reason = messages.StringField(2, required=True) |
| 26 | message = messages.StringField(3, required=True) |
| 27 | |
| 28 | |
| 29 | class Status(messages.Message): |
| 30 | """Issue status.""" |
| 31 | status = messages.StringField(1, required=True) |
| 32 | meansOpen = messages.BooleanField(2, required=True) |
| 33 | description = messages.StringField(3) |
| 34 | |
| 35 | |
| 36 | class Label(messages.Message): |
| 37 | """Issue label.""" |
| 38 | label = messages.StringField(1, required=True) |
| 39 | description = messages.StringField(2) |
| 40 | |
| 41 | |
| 42 | class Prompt(messages.Message): |
| 43 | """Default issue template values.""" |
| 44 | name = messages.StringField(1, required=True) |
| 45 | title = messages.StringField(2) |
| 46 | description = messages.StringField(3) |
| 47 | titleMustBeEdited = messages.BooleanField(4) |
| 48 | status = messages.StringField(5) |
| 49 | labels = messages.StringField(6, repeated=True) |
| 50 | membersOnly = messages.BooleanField(7) |
| 51 | defaultToMember = messages.BooleanField(8) |
| 52 | componentRequired = messages.BooleanField(9) |
| 53 | |
| 54 | |
| 55 | class Role(messages.Enum): |
| 56 | """User role.""" |
| 57 | owner = 1 |
| 58 | member = 2 |
| 59 | contributor = 3 |
| 60 | |
| 61 | |
| 62 | class IssueState(messages.Enum): |
| 63 | """Issue state.""" |
| 64 | closed = 0 |
| 65 | open = 1 |
| 66 | |
| 67 | |
| 68 | class CannedQuery(messages.Enum): |
| 69 | """Canned query to search issues.""" |
| 70 | all = 0 |
| 71 | new = 1 |
| 72 | open = 2 |
| 73 | owned = 3 |
| 74 | reported = 4 |
| 75 | starred = 5 |
| 76 | to_verify = 6 |
| 77 | |
| 78 | |
| 79 | class AtomPerson(messages.Message): |
| 80 | """Atomic person.""" |
| 81 | name = messages.StringField(1, required=True) |
| 82 | htmlLink = messages.StringField(2) |
| 83 | kind = messages.StringField(3) |
| 84 | last_visit_days_ago = messages.IntegerField(4) |
| 85 | email_bouncing = messages.BooleanField(5) |
| 86 | vacation_message = messages.StringField(6) |
| 87 | |
| 88 | |
| 89 | class Attachment(messages.Message): |
| 90 | """Issue attachment.""" |
| 91 | attachmentId = messages.IntegerField( |
| 92 | 1, variant=messages.Variant.INT64, required=True) |
| 93 | fileName = messages.StringField(2, required=True) |
| 94 | fileSize = messages.IntegerField( |
| 95 | 3, required=True, variant=messages.Variant.INT32) |
| 96 | mimetype = messages.StringField(4, required=True) |
| 97 | isDeleted = messages.BooleanField(5) |
| 98 | |
| 99 | |
| 100 | class IssueRef(messages.Message): |
| 101 | "Issue reference." |
| 102 | issueId = messages.IntegerField( |
| 103 | 1, required=True, variant=messages.Variant.INT32) |
| 104 | projectId = messages.StringField(2) |
| 105 | kind = messages.StringField(3) |
| 106 | |
| 107 | |
| 108 | class FieldValueOperator(messages.Enum): |
| 109 | """Operator of field values.""" |
| 110 | add = 1 |
| 111 | remove = 2 |
| 112 | clear = 3 |
| 113 | |
| 114 | |
| 115 | class FieldValue(messages.Message): |
| 116 | """Custom field values.""" |
| 117 | fieldName = messages.StringField(1, required=True) |
| 118 | fieldValue = messages.StringField(2) |
| 119 | derived = messages.BooleanField(3, default=False) |
| 120 | operator = messages.EnumField(FieldValueOperator, 4, default='add') |
| 121 | phaseName = messages.StringField(5) |
| 122 | approvalName = messages.StringField(6) |
| 123 | |
| 124 | |
| 125 | class Update(messages.Message): |
| 126 | """Issue update.""" |
| 127 | summary = messages.StringField(1) |
| 128 | status = messages.StringField(2) |
| 129 | owner = messages.StringField(3) |
| 130 | labels = messages.StringField(4, repeated=True) |
| 131 | cc = messages.StringField(5, repeated=True) |
| 132 | blockedOn = messages.StringField(6, repeated=True) |
| 133 | blocking = messages.StringField(7, repeated=True) |
| 134 | mergedInto = messages.StringField(8) |
| 135 | kind = messages.StringField(9) |
| 136 | components = messages.StringField(10, repeated=True) |
| 137 | moveToProject = messages.StringField(11) |
| 138 | fieldValues = messages.MessageField(FieldValue, 12, repeated=True) |
| 139 | is_description = messages.BooleanField(13) |
| 140 | |
| 141 | |
| 142 | class ApprovalUpdate(messages.Message): |
| 143 | """Approval update.""" |
| 144 | approvers = messages.StringField(1, repeated=True) |
| 145 | status = messages.StringField(2) |
| 146 | kind = messages.StringField(3) |
| 147 | fieldValues = messages.MessageField(FieldValue, 4, repeated=True) |
| 148 | |
| 149 | |
| 150 | class ProjectIssueConfig(messages.Message): |
| 151 | """Issue configuration of project.""" |
| 152 | kind = messages.StringField(1) |
| 153 | restrictToKnown = messages.BooleanField(2) |
| 154 | defaultColumns = messages.StringField(3, repeated=True) |
| 155 | defaultSorting = messages.StringField(4, repeated=True) |
| 156 | statuses = messages.MessageField(Status, 5, repeated=True) |
| 157 | labels = messages.MessageField(Label, 6, repeated=True) |
| 158 | prompts = messages.MessageField(Prompt, 7, repeated=True) |
| 159 | defaultPromptForMembers = messages.IntegerField( |
| 160 | 8, variant=messages.Variant.INT32) |
| 161 | defaultPromptForNonMembers = messages.IntegerField( |
| 162 | 9, variant=messages.Variant.INT32) |
| 163 | usersCanSetLabels = messages.BooleanField(10) |
| 164 | |
| 165 | |
| 166 | class Phase(messages.Message): |
| 167 | """Issue phase details.""" |
| 168 | phaseName = messages.StringField(1) |
| 169 | rank = messages.IntegerField(2) |
| 170 | |
| 171 | |
| 172 | class IssueCommentWrapper(messages.Message): |
| 173 | """Issue comment details.""" |
| 174 | attachments = messages.MessageField(Attachment, 1, repeated=True) |
| 175 | author = messages.MessageField(AtomPerson, 2) |
| 176 | canDelete = messages.BooleanField(3) |
| 177 | content = messages.StringField(4) |
| 178 | deletedBy = messages.MessageField(AtomPerson, 5) |
| 179 | id = messages.IntegerField(6, variant=messages.Variant.INT32) |
| 180 | published = message_types.DateTimeField(7) |
| 181 | updates = messages.MessageField(Update, 8) |
| 182 | kind = messages.StringField(9) |
| 183 | is_description = messages.BooleanField(10) |
| 184 | |
| 185 | |
| 186 | class ApprovalCommentWrapper(messages.Message): |
| 187 | """Approval comment details.""" |
| 188 | attachments = messages.MessageField(Attachment, 1, repeated=True) |
| 189 | author = messages.MessageField(AtomPerson, 2) |
| 190 | canDelete = messages.BooleanField(3) |
| 191 | content = messages.StringField(4) |
| 192 | deletedBy = messages.MessageField(AtomPerson, 5) |
| 193 | id = messages.IntegerField(6, variant=messages.Variant.INT32) |
| 194 | published = message_types.DateTimeField(7) |
| 195 | approvalUpdates = messages.MessageField(ApprovalUpdate, 8) |
| 196 | kind = messages.StringField(9) |
| 197 | is_description = messages.BooleanField(10) |
| 198 | |
| 199 | |
| 200 | class ApprovalStatus(messages.Enum): |
| 201 | """Allowed Approval Statuses.""" |
| 202 | needsReview = 1 |
| 203 | nA = 2 |
| 204 | reviewRequested = 3 |
| 205 | reviewStarted = 4 |
| 206 | needInfo = 5 |
| 207 | approved = 6 |
| 208 | notApproved = 7 |
| 209 | notSet = 8 |
| 210 | |
| 211 | |
| 212 | class Approval(messages.Message): |
| 213 | """Approval Value details""" |
| 214 | approvalName = messages.StringField(1) |
| 215 | approvers = messages.MessageField(AtomPerson, 2, repeated=True) |
| 216 | status = messages.EnumField(ApprovalStatus, 3) |
| 217 | setter = messages.MessageField(AtomPerson, 4) |
| 218 | setOn = message_types.DateTimeField(5) |
| 219 | phaseName = messages.StringField(6) |
| 220 | |
| 221 | |
| 222 | class IssueWrapper(messages.Message): |
| 223 | """Issue details.""" |
| 224 | author = messages.MessageField(AtomPerson, 1) |
| 225 | blockedOn = messages.MessageField(IssueRef, 2, repeated=True) |
| 226 | blocking = messages.MessageField(IssueRef, 3, repeated=True) |
| 227 | canComment = messages.BooleanField(4) |
| 228 | canEdit = messages.BooleanField(5) |
| 229 | cc = messages.MessageField(AtomPerson, 6, repeated=True) |
| 230 | closed = message_types.DateTimeField(7) |
| 231 | description = messages.StringField(8) |
| 232 | id = messages.IntegerField(9, variant=messages.Variant.INT32) |
| 233 | kind = messages.StringField(10) |
| 234 | labels = messages.StringField(11, repeated=True) |
| 235 | owner = messages.MessageField(AtomPerson, 12) |
| 236 | published = message_types.DateTimeField(13) |
| 237 | starred = messages.BooleanField(14) |
| 238 | stars = messages.IntegerField(15, variant=messages.Variant.INT32) |
| 239 | state = messages.EnumField(IssueState, 16) |
| 240 | status = messages.StringField(17, required=True) |
| 241 | summary = messages.StringField(18, required=True) |
| 242 | title = messages.StringField(19) |
| 243 | updated = message_types.DateTimeField(20) |
| 244 | components = messages.StringField(21, repeated=True) |
| 245 | projectId = messages.StringField(22, required=True) |
| 246 | mergedInto = messages.MessageField(IssueRef, 23) |
| 247 | fieldValues = messages.MessageField(FieldValue, 24, repeated=True) |
| 248 | owner_modified = message_types.DateTimeField(25) |
| 249 | status_modified = message_types.DateTimeField(26) |
| 250 | component_modified = message_types.DateTimeField(27) |
| 251 | approvalValues = messages.MessageField(Approval, 28, repeated=True) |
| 252 | phases = messages.MessageField(Phase, 29, repeated=True) |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 253 | migrated_id = messages.StringField(30) |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 254 | |
| 255 | class ProjectWrapper(messages.Message): |
| 256 | """Project details.""" |
| 257 | kind = messages.StringField(1) |
| 258 | name = messages.StringField(2) |
| 259 | externalId = messages.StringField(3, required=True) |
| 260 | htmlLink = messages.StringField(4, required=True) |
| 261 | summary = messages.StringField(5) |
| 262 | description = messages.StringField(6) |
| 263 | versionControlSystem = messages.StringField(7) |
| 264 | repositoryUrls = messages.StringField(8, repeated=True) |
| 265 | issuesConfig = messages.MessageField(ProjectIssueConfig, 9) |
| 266 | role = messages.EnumField(Role, 10) |
| 267 | members = messages.MessageField(AtomPerson, 11, repeated=True) |
| 268 | |
| 269 | |
| 270 | class UserGroupSettingsWrapper(messages.Message): |
| 271 | """User group settings.""" |
| 272 | groupName = messages.StringField(1, required=True) |
| 273 | who_can_view_members = messages.EnumField( |
| 274 | usergroup_pb2.MemberVisibility, 2, |
| 275 | default=usergroup_pb2.MemberVisibility.MEMBERS) |
| 276 | ext_group_type = messages.EnumField(usergroup_pb2.GroupType, 3) |
| 277 | last_sync_time = messages.IntegerField( |
| 278 | 4, default=0, variant=messages.Variant.INT32) |
| 279 | |
| 280 | |
| 281 | class GroupCitizens(messages.Message): |
| 282 | """Group members and owners.""" |
| 283 | groupOwners = messages.StringField(1, repeated=True) |
| 284 | groupMembers = messages.StringField(2, repeated=True) |
| 285 | |
| 286 | |
| 287 | ########################## Comments Message ########################## |
| 288 | |
| 289 | # pylint: disable=pointless-string-statement |
| 290 | |
| 291 | """Request to delete/undelete an issue's comments.""" |
| 292 | ISSUES_COMMENTS_DELETE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 293 | message_types.VoidMessage, |
| 294 | projectId=messages.StringField(1, required=True), |
| 295 | issueId=messages.IntegerField( |
| 296 | 2, required=True, variant=messages.Variant.INT32), |
| 297 | commentId=messages.IntegerField( |
| 298 | 3, required=True, variant=messages.Variant.INT32) |
| 299 | ) |
| 300 | |
| 301 | |
| 302 | class IssuesCommentsDeleteResponse(messages.Message): |
| 303 | """Response message of request to delete/undelete an issue's comments.""" |
| 304 | error = messages.MessageField(ErrorMessage, 1) |
| 305 | |
| 306 | |
| 307 | """Request to insert an issue's comments.""" |
| 308 | ISSUES_COMMENTS_INSERT_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 309 | IssueCommentWrapper, |
| 310 | projectId=messages.StringField(1, required=True), |
| 311 | issueId=messages.IntegerField( |
| 312 | 2, required=True, variant=messages.Variant.INT32), |
| 313 | sendEmail=messages.BooleanField(3) |
| 314 | ) |
| 315 | |
| 316 | |
| 317 | class IssuesCommentsInsertResponse(messages.Message): |
| 318 | """Response message of request to insert an issue's comments.""" |
| 319 | error = messages.MessageField(ErrorMessage, 1) |
| 320 | id = messages.IntegerField(2, variant=messages.Variant.INT32) |
| 321 | kind = messages.StringField(3) |
| 322 | author = messages.MessageField(AtomPerson, 4) |
| 323 | content = messages.StringField(5) |
| 324 | published = message_types.DateTimeField(6) |
| 325 | updates = messages.MessageField(Update, 7) |
| 326 | canDelete = messages.BooleanField(8) |
| 327 | |
| 328 | |
| 329 | """Request to list an issue's comments.""" |
| 330 | ISSUES_COMMENTS_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 331 | message_types.VoidMessage, |
| 332 | projectId=messages.StringField(1, required=True), |
| 333 | issueId=messages.IntegerField( |
| 334 | 2, required=True, variant=messages.Variant.INT32), |
| 335 | maxResults=messages.IntegerField( |
| 336 | 3, default=100, variant=messages.Variant.INT32), |
| 337 | startIndex=messages.IntegerField( |
| 338 | 4, default=0, variant=messages.Variant.INT32) |
| 339 | ) |
| 340 | |
| 341 | |
| 342 | class IssuesCommentsListResponse(messages.Message): |
| 343 | """Response message of request to list an issue's comments.""" |
| 344 | error = messages.MessageField(ErrorMessage, 1) |
| 345 | items = messages.MessageField(IssueCommentWrapper, 2, repeated=True) |
| 346 | totalResults = messages.IntegerField(3, variant=messages.Variant.INT32) |
| 347 | kind = messages.StringField(4) |
| 348 | |
| 349 | ########################## ApprovalComments Message ################ |
| 350 | |
| 351 | """Request to insert an issue approval's comments.""" |
| 352 | APPROVALS_COMMENTS_INSERT_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 353 | ApprovalCommentWrapper, |
| 354 | projectId=messages.StringField(1, required=True), |
| 355 | issueId=messages.IntegerField( |
| 356 | 2, required=True, variant=messages.Variant.INT32), |
| 357 | approvalName=messages.StringField(3, required=True), |
| 358 | sendEmail=messages.BooleanField(4) |
| 359 | ) |
| 360 | |
| 361 | |
| 362 | class ApprovalsCommentsInsertResponse(messages.Message): |
| 363 | """Response message of request to insert an isuse's comments.""" |
| 364 | error = messages.MessageField(ErrorMessage, 1) |
| 365 | id = messages.IntegerField(2, variant=messages.Variant.INT32) |
| 366 | kind = messages.StringField(3) |
| 367 | author = messages.MessageField(AtomPerson, 4) |
| 368 | content = messages.StringField(5) |
| 369 | published = message_types.DateTimeField(6) |
| 370 | approvalUpdates = messages.MessageField(ApprovalUpdate, 7) |
| 371 | canDelete = messages.BooleanField(8) |
| 372 | approvalName = messages.StringField(9) |
| 373 | |
| 374 | |
| 375 | """Requests to list an approval's comments.""" |
| 376 | APPROVALS_COMMENTS_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 377 | message_types.VoidMessage, |
| 378 | projectId=messages.StringField(1, required=True), |
| 379 | issueId=messages.IntegerField( |
| 380 | 2, required=True, variant=messages.Variant.INT32), |
| 381 | approvalName=messages.StringField(3, required=True), |
| 382 | maxResults=messages.IntegerField( |
| 383 | 4, default=100, variant=messages.Variant.INT32), |
| 384 | startIndex=messages.IntegerField( |
| 385 | 5, default=0, variant=messages.Variant.INT32) |
| 386 | ) |
| 387 | |
| 388 | |
| 389 | class ApprovalsCommentsListResponse(messages.Message): |
| 390 | """Response message of request to list an approval's comments.""" |
| 391 | error = messages.MessageField(ErrorMessage, 1) |
| 392 | items = messages.MessageField(ApprovalCommentWrapper, 2, repeated=True) |
| 393 | totalResults = messages.IntegerField(3, variant=messages.Variant.INT32) |
| 394 | kind = messages.StringField(4) |
| 395 | |
| 396 | ########################## Users Message ########################## |
| 397 | |
| 398 | """Request to get a user.""" |
| 399 | USERS_GET_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 400 | message_types.VoidMessage, |
| 401 | userId=messages.StringField(1, required=True), |
| 402 | ownerProjectsOnly=messages.BooleanField(2, default=False) |
| 403 | ) |
| 404 | |
| 405 | |
| 406 | class UsersGetResponse(messages.Message): |
| 407 | """Response message of request to get a user.""" |
| 408 | error = messages.MessageField(ErrorMessage, 1) |
| 409 | id = messages.StringField(2) |
| 410 | kind = messages.StringField(3) |
| 411 | projects = messages.MessageField(ProjectWrapper, 4, repeated=True) |
| 412 | |
| 413 | |
| 414 | ########################## Issues Message ########################## |
| 415 | |
| 416 | """Request to get an issue.""" |
| 417 | ISSUES_GET_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 418 | message_types.VoidMessage, |
| 419 | projectId=messages.StringField(1, required=True), |
| 420 | issueId=messages.IntegerField( |
| 421 | 2, required=True, variant=messages.Variant.INT32) |
| 422 | ) |
| 423 | |
| 424 | |
| 425 | """Request to insert an issue.""" |
| 426 | ISSUES_INSERT_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 427 | IssueWrapper, |
| 428 | projectId=messages.StringField(1, required=True), |
| 429 | sendEmail=messages.BooleanField(2, default=True) |
| 430 | ) |
| 431 | |
| 432 | |
| 433 | class IssuesGetInsertResponse(messages.Message): |
| 434 | """Response message of request to get/insert an issue.""" |
| 435 | error = messages.MessageField(ErrorMessage, 1) |
| 436 | kind = messages.StringField(2) |
| 437 | id = messages.IntegerField(3, variant=messages.Variant.INT32) |
| 438 | title = messages.StringField(4) |
| 439 | summary = messages.StringField(5) |
| 440 | stars = messages.IntegerField(6, variant=messages.Variant.INT32) |
| 441 | starred = messages.BooleanField(7) |
| 442 | status = messages.StringField(8) |
| 443 | state = messages.EnumField(IssueState, 9) |
| 444 | labels = messages.StringField(10, repeated=True) |
| 445 | author = messages.MessageField(AtomPerson, 11) |
| 446 | owner = messages.MessageField(AtomPerson, 12) |
| 447 | cc = messages.MessageField(AtomPerson, 13, repeated=True) |
| 448 | updated = message_types.DateTimeField(14) |
| 449 | published = message_types.DateTimeField(15) |
| 450 | closed = message_types.DateTimeField(16) |
| 451 | blockedOn = messages.MessageField(IssueRef, 17, repeated=True) |
| 452 | blocking = messages.MessageField(IssueRef, 18, repeated=True) |
| 453 | projectId = messages.StringField(19) |
| 454 | canComment = messages.BooleanField(20) |
| 455 | canEdit = messages.BooleanField(21) |
| 456 | components = messages.StringField(22, repeated=True) |
| 457 | mergedInto = messages.MessageField(IssueRef, 23) |
| 458 | fieldValues = messages.MessageField(FieldValue, 24, repeated=True) |
| 459 | owner_modified = message_types.DateTimeField(25) |
| 460 | status_modified = message_types.DateTimeField(26) |
| 461 | component_modified = message_types.DateTimeField(27) |
| 462 | approvalValues = messages.MessageField(Approval, 28, repeated=True) |
| 463 | phases = messages.MessageField(Phase, 29, repeated=True) |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 464 | migrated_id = messages.StringField(30) |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 465 | |
| 466 | |
| 467 | """Request to list issues.""" |
| 468 | ISSUES_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 469 | message_types.VoidMessage, |
| 470 | projectId=messages.StringField(1, required=True), |
| 471 | additionalProject=messages.StringField(2, repeated=True), |
| 472 | can=messages.EnumField(CannedQuery, 3, default='all'), |
| 473 | label=messages.StringField(4), |
| 474 | maxResults=messages.IntegerField( |
| 475 | 5, default=100, variant=messages.Variant.INT32), |
| 476 | owner=messages.StringField(6), |
| 477 | publishedMax=messages.IntegerField(7, variant=messages.Variant.INT64), |
| 478 | publishedMin=messages.IntegerField(8, variant=messages.Variant.INT64), |
| 479 | q=messages.StringField(9), |
| 480 | sort=messages.StringField(10), |
| 481 | startIndex=messages.IntegerField( |
| 482 | 11, default=0, variant=messages.Variant.INT32), |
| 483 | status=messages.StringField(12), |
| 484 | updatedMax=messages.IntegerField(13, variant=messages.Variant.INT64), |
| 485 | updatedMin=messages.IntegerField(14, variant=messages.Variant.INT64) |
| 486 | ) |
| 487 | |
| 488 | |
| 489 | class IssuesListResponse(messages.Message): |
| 490 | """Response message of request to list issues.""" |
| 491 | error = messages.MessageField(ErrorMessage, 1) |
| 492 | items = messages.MessageField(IssueWrapper, 2, repeated=True) |
| 493 | totalResults = messages.IntegerField(3, variant=messages.Variant.INT32) |
| 494 | kind = messages.StringField(4) |
| 495 | |
| 496 | |
| 497 | """Request to list group settings.""" |
| 498 | GROUPS_SETTINGS_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 499 | message_types.VoidMessage, |
| 500 | importedGroupsOnly=messages.BooleanField(1, default=False) |
| 501 | ) |
| 502 | |
| 503 | |
| 504 | class GroupsSettingsListResponse(messages.Message): |
| 505 | """Response message of request to list group settings.""" |
| 506 | error = messages.MessageField(ErrorMessage, 1) |
| 507 | groupSettings = messages.MessageField( |
| 508 | UserGroupSettingsWrapper, 2, repeated=True) |
| 509 | |
| 510 | |
| 511 | """Request to create a group.""" |
| 512 | GROUPS_CREATE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 513 | message_types.VoidMessage, |
| 514 | groupName = messages.StringField(1, required=True), |
| 515 | who_can_view_members = messages.EnumField( |
| 516 | usergroup_pb2.MemberVisibility, 2, |
| 517 | default=usergroup_pb2.MemberVisibility.MEMBERS, required=True), |
| 518 | ext_group_type = messages.EnumField(usergroup_pb2.GroupType, 3) |
| 519 | ) |
| 520 | |
| 521 | |
| 522 | class GroupsCreateResponse(messages.Message): |
| 523 | """Response message of request to create a group.""" |
| 524 | error = messages.MessageField(ErrorMessage, 1) |
| 525 | groupID = messages.IntegerField( |
| 526 | 2, variant=messages.Variant.INT32) |
| 527 | |
| 528 | |
| 529 | """Request to get a group.""" |
| 530 | GROUPS_GET_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 531 | message_types.VoidMessage, |
| 532 | groupName = messages.StringField(1, required=True) |
| 533 | ) |
| 534 | |
| 535 | |
| 536 | class GroupsGetResponse(messages.Message): |
| 537 | """Response message of request to create a group.""" |
| 538 | error = messages.MessageField(ErrorMessage, 1) |
| 539 | groupID = messages.IntegerField( |
| 540 | 2, variant=messages.Variant.INT32) |
| 541 | groupSettings = messages.MessageField( |
| 542 | UserGroupSettingsWrapper, 3) |
| 543 | groupOwners = messages.StringField(4, repeated=True) |
| 544 | groupMembers = messages.StringField(5, repeated=True) |
| 545 | |
| 546 | |
| 547 | """Request to update a group.""" |
| 548 | GROUPS_UPDATE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 549 | GroupCitizens, |
| 550 | groupName = messages.StringField(1, required=True), |
| 551 | who_can_view_members = messages.EnumField( |
| 552 | usergroup_pb2.MemberVisibility, 2), |
| 553 | ext_group_type = messages.EnumField(usergroup_pb2.GroupType, 3), |
| 554 | last_sync_time = messages.IntegerField( |
| 555 | 4, default=0, variant=messages.Variant.INT32), |
| 556 | friend_projects = messages.StringField(5, repeated=True), |
| 557 | ) |
| 558 | |
| 559 | |
| 560 | class GroupsUpdateResponse(messages.Message): |
| 561 | """Response message of request to update a group.""" |
| 562 | error = messages.MessageField(ErrorMessage, 1) |
| 563 | |
| 564 | |
| 565 | ########################## Component Message ########################## |
| 566 | |
| 567 | class Component(messages.Message): |
| 568 | """Component PB.""" |
| 569 | componentId = messages.IntegerField( |
| 570 | 1, required=True, variant=messages.Variant.INT32) |
| 571 | projectName = messages.StringField(2, required=True) |
| 572 | componentPath = messages.StringField(3, required=True) |
| 573 | description = messages.StringField(4) |
| 574 | admin = messages.StringField(5, repeated=True) |
| 575 | cc = messages.StringField(6, repeated=True) |
| 576 | deprecated = messages.BooleanField(7, default=False) |
| 577 | created = message_types.DateTimeField(8) |
| 578 | creator = messages.StringField(9) |
| 579 | modified = message_types.DateTimeField(10) |
| 580 | modifier = messages.StringField(11) |
| 581 | |
| 582 | |
| 583 | """Request to get components of a project.""" |
| 584 | COMPONENTS_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 585 | message_types.VoidMessage, |
| 586 | projectId=messages.StringField(1, required=True), |
| 587 | ) |
| 588 | |
| 589 | |
| 590 | class ComponentsListResponse(messages.Message): |
| 591 | """Response to list components.""" |
| 592 | components = messages.MessageField( |
| 593 | Component, 1, repeated=True) |
| 594 | |
| 595 | |
| 596 | class ComponentCreateRequestBody(messages.Message): |
| 597 | """Request body to create a component.""" |
| 598 | parentPath = messages.StringField(1) |
| 599 | description = messages.StringField(2) |
| 600 | admin = messages.StringField(3, repeated=True) |
| 601 | cc = messages.StringField(4, repeated=True) |
| 602 | deprecated = messages.BooleanField(5, default=False) |
| 603 | |
| 604 | |
| 605 | """Request to create component of a project.""" |
| 606 | COMPONENTS_CREATE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 607 | ComponentCreateRequestBody, |
| 608 | projectId=messages.StringField(1, required=True), |
| 609 | componentName=messages.StringField(2, required=True), |
| 610 | ) |
| 611 | |
| 612 | |
| 613 | """Request to delete a component.""" |
| 614 | COMPONENTS_DELETE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 615 | message_types.VoidMessage, |
| 616 | projectId=messages.StringField(1, required=True), |
| 617 | componentPath=messages.StringField(2, required=True), |
| 618 | ) |
| 619 | |
| 620 | |
| 621 | class ComponentUpdateFieldID(messages.Enum): |
| 622 | """Possible fields that can be updated in a component.""" |
| 623 | LEAF_NAME = 1 |
| 624 | DESCRIPTION = 2 |
| 625 | ADMIN = 3 |
| 626 | CC = 4 |
| 627 | DEPRECATED = 5 |
| 628 | |
| 629 | |
| 630 | class ComponentUpdate(messages.Message): |
| 631 | """Component update.""" |
| 632 | # 'field' allows a field to be cleared |
| 633 | field = messages.EnumField(ComponentUpdateFieldID, 1, required=True) |
| 634 | leafName = messages.StringField(2) |
| 635 | description = messages.StringField(3) |
| 636 | admin = messages.StringField(4, repeated=True) |
| 637 | cc = messages.StringField(5, repeated=True) |
| 638 | deprecated = messages.BooleanField(6) |
| 639 | |
| 640 | |
| 641 | class ComponentUpdateRequestBody(messages.Message): |
| 642 | """Request body to update a component.""" |
| 643 | updates = messages.MessageField(ComponentUpdate, 1, repeated=True) |
| 644 | |
| 645 | |
| 646 | """Request to update a component.""" |
| 647 | COMPONENTS_UPDATE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 648 | ComponentUpdateRequestBody, |
| 649 | projectId=messages.StringField(1, required=True), |
| 650 | componentPath=messages.StringField(2, required=True), |
| 651 | ) |