code.gitea.io/gitea@v1.19.3/modules/structs/pull_review.go (about) 1 // Copyright 2020 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package structs 5 6 import ( 7 "time" 8 ) 9 10 // ReviewStateType review state type 11 type ReviewStateType string 12 13 const ( 14 // ReviewStateApproved pr is approved 15 ReviewStateApproved ReviewStateType = "APPROVED" 16 // ReviewStatePending pr state is pending 17 ReviewStatePending ReviewStateType = "PENDING" 18 // ReviewStateComment is a comment review 19 ReviewStateComment ReviewStateType = "COMMENT" 20 // ReviewStateRequestChanges changes for pr are requested 21 ReviewStateRequestChanges ReviewStateType = "REQUEST_CHANGES" 22 // ReviewStateRequestReview review is requested from user 23 ReviewStateRequestReview ReviewStateType = "REQUEST_REVIEW" 24 // ReviewStateUnknown state of pr is unknown 25 ReviewStateUnknown ReviewStateType = "" 26 ) 27 28 // PullReview represents a pull request review 29 type PullReview struct { 30 ID int64 `json:"id"` 31 Reviewer *User `json:"user"` 32 ReviewerTeam *Team `json:"team"` 33 State ReviewStateType `json:"state"` 34 Body string `json:"body"` 35 CommitID string `json:"commit_id"` 36 Stale bool `json:"stale"` 37 Official bool `json:"official"` 38 Dismissed bool `json:"dismissed"` 39 CodeCommentsCount int `json:"comments_count"` 40 // swagger:strfmt date-time 41 Submitted time.Time `json:"submitted_at"` 42 // swagger:strfmt date-time 43 Updated time.Time `json:"updated_at"` 44 45 HTMLURL string `json:"html_url"` 46 HTMLPullURL string `json:"pull_request_url"` 47 } 48 49 // PullReviewComment represents a comment on a pull request review 50 type PullReviewComment struct { 51 ID int64 `json:"id"` 52 Body string `json:"body"` 53 Poster *User `json:"user"` 54 Resolver *User `json:"resolver"` 55 ReviewID int64 `json:"pull_request_review_id"` 56 57 // swagger:strfmt date-time 58 Created time.Time `json:"created_at"` 59 // swagger:strfmt date-time 60 Updated time.Time `json:"updated_at"` 61 62 Path string `json:"path"` 63 CommitID string `json:"commit_id"` 64 OrigCommitID string `json:"original_commit_id"` 65 DiffHunk string `json:"diff_hunk"` 66 LineNum uint64 `json:"position"` 67 OldLineNum uint64 `json:"original_position"` 68 69 HTMLURL string `json:"html_url"` 70 HTMLPullURL string `json:"pull_request_url"` 71 } 72 73 // CreatePullReviewOptions are options to create a pull review 74 type CreatePullReviewOptions struct { 75 Event ReviewStateType `json:"event"` 76 Body string `json:"body"` 77 CommitID string `json:"commit_id"` 78 Comments []CreatePullReviewComment `json:"comments"` 79 } 80 81 // CreatePullReviewComment represent a review comment for creation api 82 type CreatePullReviewComment struct { 83 // the tree path 84 Path string `json:"path"` 85 Body string `json:"body"` 86 // if comment to old file line or 0 87 OldLineNum int64 `json:"old_position"` 88 // if comment to new file line or 0 89 NewLineNum int64 `json:"new_position"` 90 } 91 92 // SubmitPullReviewOptions are options to submit a pending pull review 93 type SubmitPullReviewOptions struct { 94 Event ReviewStateType `json:"event"` 95 Body string `json:"body"` 96 } 97 98 // DismissPullReviewOptions are options to dismiss a pull review 99 type DismissPullReviewOptions struct { 100 Message string `json:"message"` 101 Priors bool `json:"priors"` 102 } 103 104 // PullReviewRequestOptions are options to add or remove pull review requests 105 type PullReviewRequestOptions struct { 106 Reviewers []string `json:"reviewers"` 107 TeamReviewers []string `json:"team_reviewers"` 108 }