code.gitea.io/gitea@v1.19.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 State StateType `json:"state"` 23 IsLocked bool `json:"is_locked"` 24 Comments int `json:"comments"` 25 26 HTMLURL string `json:"html_url"` 27 DiffURL string `json:"diff_url"` 28 PatchURL string `json:"patch_url"` 29 30 Mergeable bool `json:"mergeable"` 31 HasMerged bool `json:"merged"` 32 // swagger:strfmt date-time 33 Merged *time.Time `json:"merged_at"` 34 MergedCommitID *string `json:"merge_commit_sha"` 35 MergedBy *User `json:"merged_by"` 36 AllowMaintainerEdit bool `json:"allow_maintainer_edit"` 37 38 Base *PRBranchInfo `json:"base"` 39 Head *PRBranchInfo `json:"head"` 40 MergeBase string `json:"merge_base"` 41 42 // swagger:strfmt date-time 43 Deadline *time.Time `json:"due_date"` 44 45 // swagger:strfmt date-time 46 Created *time.Time `json:"created_at"` 47 // swagger:strfmt date-time 48 Updated *time.Time `json:"updated_at"` 49 // swagger:strfmt date-time 50 Closed *time.Time `json:"closed_at"` 51 } 52 53 // PRBranchInfo information about a branch 54 type PRBranchInfo struct { 55 Name string `json:"label"` 56 Ref string `json:"ref"` 57 Sha string `json:"sha"` 58 RepoID int64 `json:"repo_id"` 59 Repository *Repository `json:"repo"` 60 } 61 62 // ListPullRequestsOptions options for listing pull requests 63 type ListPullRequestsOptions struct { 64 Page int `json:"page"` 65 State string `json:"state"` 66 } 67 68 // CreatePullRequestOption options when creating a pull request 69 type CreatePullRequestOption struct { 70 Head string `json:"head" binding:"Required"` 71 Base string `json:"base" binding:"Required"` 72 Title string `json:"title" binding:"Required"` 73 Body string `json:"body"` 74 Assignee string `json:"assignee"` 75 Assignees []string `json:"assignees"` 76 Milestone int64 `json:"milestone"` 77 Labels []int64 `json:"labels"` 78 // swagger:strfmt date-time 79 Deadline *time.Time `json:"due_date"` 80 } 81 82 // EditPullRequestOption options when modify pull request 83 type EditPullRequestOption struct { 84 Title string `json:"title"` 85 Body string `json:"body"` 86 Base string `json:"base"` 87 Assignee string `json:"assignee"` 88 Assignees []string `json:"assignees"` 89 Milestone int64 `json:"milestone"` 90 Labels []int64 `json:"labels"` 91 State *string `json:"state"` 92 // swagger:strfmt date-time 93 Deadline *time.Time `json:"due_date"` 94 RemoveDeadline *bool `json:"unset_due_date"` 95 AllowMaintainerEdit *bool `json:"allow_maintainer_edit"` 96 } 97 98 // ChangedFile store information about files affected by the pull request 99 type ChangedFile struct { 100 Filename string `json:"filename"` 101 PreviousFilename string `json:"previous_filename,omitempty"` 102 Status string `json:"status"` 103 Additions int `json:"additions"` 104 Deletions int `json:"deletions"` 105 Changes int `json:"changes"` 106 HTMLURL string `json:"html_url,omitempty"` 107 ContentsURL string `json:"contents_url,omitempty"` 108 RawURL string `json:"raw_url,omitempty"` 109 }