code.gitea.io/gitea@v1.22.3/modules/structs/pull.go (about) 1 // Copyright 2016 The Gogs Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package structs 5 6 import ( 7 "time" 8 ) 9 10 // PullRequest represents a pull request 11 type PullRequest struct { 12 ID int64 `json:"id"` 13 URL string `json:"url"` 14 Index int64 `json:"number"` 15 Poster *User `json:"user"` 16 Title string `json:"title"` 17 Body string `json:"body"` 18 Labels []*Label `json:"labels"` 19 Milestone *Milestone `json:"milestone"` 20 Assignee *User `json:"assignee"` 21 Assignees []*User `json:"assignees"` 22 RequestedReviewers []*User `json:"requested_reviewers"` 23 State StateType `json:"state"` 24 Draft bool `json:"draft"` 25 IsLocked bool `json:"is_locked"` 26 Comments int `json:"comments"` 27 // number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR) 28 ReviewComments int `json:"review_comments"` 29 Additions int `json:"additions"` 30 Deletions int `json:"deletions"` 31 ChangedFiles int `json:"changed_files"` 32 33 HTMLURL string `json:"html_url"` 34 DiffURL string `json:"diff_url"` 35 PatchURL string `json:"patch_url"` 36 37 Mergeable bool `json:"mergeable"` 38 HasMerged bool `json:"merged"` 39 // swagger:strfmt date-time 40 Merged *time.Time `json:"merged_at"` 41 MergedCommitID *string `json:"merge_commit_sha"` 42 MergedBy *User `json:"merged_by"` 43 AllowMaintainerEdit bool `json:"allow_maintainer_edit"` 44 45 Base *PRBranchInfo `json:"base"` 46 Head *PRBranchInfo `json:"head"` 47 MergeBase string `json:"merge_base"` 48 49 // swagger:strfmt date-time 50 Deadline *time.Time `json:"due_date"` 51 52 // swagger:strfmt date-time 53 Created *time.Time `json:"created_at"` 54 // swagger:strfmt date-time 55 Updated *time.Time `json:"updated_at"` 56 // swagger:strfmt date-time 57 Closed *time.Time `json:"closed_at"` 58 59 PinOrder int `json:"pin_order"` 60 } 61 62 // PRBranchInfo information about a branch 63 type PRBranchInfo struct { 64 Name string `json:"label"` 65 Ref string `json:"ref"` 66 Sha string `json:"sha"` 67 RepoID int64 `json:"repo_id"` 68 Repository *Repository `json:"repo"` 69 } 70 71 // ListPullRequestsOptions options for listing pull requests 72 type ListPullRequestsOptions struct { 73 Page int `json:"page"` 74 State string `json:"state"` 75 } 76 77 // CreatePullRequestOption options when creating a pull request 78 type CreatePullRequestOption struct { 79 Head string `json:"head" binding:"Required"` 80 Base string `json:"base" binding:"Required"` 81 Title string `json:"title" binding:"Required"` 82 Body string `json:"body"` 83 Assignee string `json:"assignee"` 84 Assignees []string `json:"assignees"` 85 Milestone int64 `json:"milestone"` 86 Labels []int64 `json:"labels"` 87 // swagger:strfmt date-time 88 Deadline *time.Time `json:"due_date"` 89 } 90 91 // EditPullRequestOption options when modify pull request 92 type EditPullRequestOption struct { 93 Title string `json:"title"` 94 Body *string `json:"body"` 95 Base string `json:"base"` 96 Assignee string `json:"assignee"` 97 Assignees []string `json:"assignees"` 98 Milestone int64 `json:"milestone"` 99 Labels []int64 `json:"labels"` 100 State *string `json:"state"` 101 // swagger:strfmt date-time 102 Deadline *time.Time `json:"due_date"` 103 RemoveDeadline *bool `json:"unset_due_date"` 104 AllowMaintainerEdit *bool `json:"allow_maintainer_edit"` 105 } 106 107 // ChangedFile store information about files affected by the pull request 108 type ChangedFile struct { 109 Filename string `json:"filename"` 110 PreviousFilename string `json:"previous_filename,omitempty"` 111 Status string `json:"status"` 112 Additions int `json:"additions"` 113 Deletions int `json:"deletions"` 114 Changes int `json:"changes"` 115 HTMLURL string `json:"html_url,omitempty"` 116 ContentsURL string `json:"contents_url,omitempty"` 117 RawURL string `json:"raw_url,omitempty"` 118 }