2016-11-07 07:53:13 -06:00
|
|
|
// Copyright 2016 The Gogs Authors. All rights reserved.
|
2022-11-27 12:20:29 -06:00
|
|
|
// SPDX-License-Identifier: MIT
|
2016-11-07 07:53:13 -06:00
|
|
|
|
2019-05-11 05:21:34 -05:00
|
|
|
package structs
|
2016-11-07 07:53:13 -06:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2017-11-13 01:02:25 -06:00
|
|
|
// PullRequest represents a pull request
|
2016-11-07 07:53:13 -06:00
|
|
|
type PullRequest struct {
|
2023-05-24 21:06:27 -05:00
|
|
|
ID int64 `json:"id"`
|
|
|
|
URL string `json:"url"`
|
|
|
|
Index int64 `json:"number"`
|
|
|
|
Poster *User `json:"user"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Body string `json:"body"`
|
|
|
|
Labels []*Label `json:"labels"`
|
|
|
|
Milestone *Milestone `json:"milestone"`
|
|
|
|
Assignee *User `json:"assignee"`
|
|
|
|
Assignees []*User `json:"assignees"`
|
|
|
|
RequestedReviewers []*User `json:"requested_reviewers"`
|
|
|
|
State StateType `json:"state"`
|
|
|
|
IsLocked bool `json:"is_locked"`
|
|
|
|
Comments int `json:"comments"`
|
2016-11-07 07:53:13 -06:00
|
|
|
|
2016-11-29 02:09:17 -06:00
|
|
|
HTMLURL string `json:"html_url"`
|
|
|
|
DiffURL string `json:"diff_url"`
|
|
|
|
PatchURL string `json:"patch_url"`
|
2016-11-07 07:53:13 -06:00
|
|
|
|
2018-03-05 19:22:16 -06:00
|
|
|
Mergeable bool `json:"mergeable"`
|
|
|
|
HasMerged bool `json:"merged"`
|
2017-11-13 01:02:25 -06:00
|
|
|
// swagger:strfmt date-time
|
2022-04-28 10:45:33 -05:00
|
|
|
Merged *time.Time `json:"merged_at"`
|
|
|
|
MergedCommitID *string `json:"merge_commit_sha"`
|
|
|
|
MergedBy *User `json:"merged_by"`
|
|
|
|
AllowMaintainerEdit bool `json:"allow_maintainer_edit"`
|
2016-11-29 02:09:17 -06:00
|
|
|
|
|
|
|
Base *PRBranchInfo `json:"base"`
|
|
|
|
Head *PRBranchInfo `json:"head"`
|
|
|
|
MergeBase string `json:"merge_base"`
|
2017-04-27 04:29:46 -05:00
|
|
|
|
2018-05-01 14:05:28 -05:00
|
|
|
// swagger:strfmt date-time
|
|
|
|
Deadline *time.Time `json:"due_date"`
|
|
|
|
|
2017-11-13 01:02:25 -06:00
|
|
|
// swagger:strfmt date-time
|
2017-04-27 04:29:46 -05:00
|
|
|
Created *time.Time `json:"created_at"`
|
2017-11-13 01:02:25 -06:00
|
|
|
// swagger:strfmt date-time
|
2017-04-27 04:29:46 -05:00
|
|
|
Updated *time.Time `json:"updated_at"`
|
2018-05-01 14:05:28 -05:00
|
|
|
// swagger:strfmt date-time
|
|
|
|
Closed *time.Time `json:"closed_at"`
|
2023-05-25 08:17:19 -05:00
|
|
|
|
|
|
|
PinOrder int `json:"pin_order"`
|
2016-11-29 02:09:17 -06:00
|
|
|
}
|
|
|
|
|
2017-11-13 01:02:25 -06:00
|
|
|
// PRBranchInfo information about a branch
|
2016-11-29 02:09:17 -06:00
|
|
|
type PRBranchInfo struct {
|
|
|
|
Name string `json:"label"`
|
|
|
|
Ref string `json:"ref"`
|
|
|
|
Sha string `json:"sha"`
|
|
|
|
RepoID int64 `json:"repo_id"`
|
|
|
|
Repository *Repository `json:"repo"`
|
|
|
|
}
|
|
|
|
|
2017-11-13 01:02:25 -06:00
|
|
|
// ListPullRequestsOptions options for listing pull requests
|
2016-11-29 02:09:17 -06:00
|
|
|
type ListPullRequestsOptions struct {
|
|
|
|
Page int `json:"page"`
|
|
|
|
State string `json:"state"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreatePullRequestOption options when creating a pull request
|
|
|
|
type CreatePullRequestOption struct {
|
2018-05-16 09:01:55 -05:00
|
|
|
Head string `json:"head" binding:"Required"`
|
|
|
|
Base string `json:"base" binding:"Required"`
|
|
|
|
Title string `json:"title" binding:"Required"`
|
|
|
|
Body string `json:"body"`
|
|
|
|
Assignee string `json:"assignee"`
|
|
|
|
Assignees []string `json:"assignees"`
|
|
|
|
Milestone int64 `json:"milestone"`
|
|
|
|
Labels []int64 `json:"labels"`
|
2018-05-01 14:05:28 -05:00
|
|
|
// swagger:strfmt date-time
|
2018-05-16 09:01:55 -05:00
|
|
|
Deadline *time.Time `json:"due_date"`
|
2016-11-29 02:09:17 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// EditPullRequestOption options when modify pull request
|
|
|
|
type EditPullRequestOption struct {
|
2018-05-16 09:01:55 -05:00
|
|
|
Title string `json:"title"`
|
|
|
|
Body string `json:"body"`
|
2020-06-07 14:13:40 -05:00
|
|
|
Base string `json:"base"`
|
2018-05-16 09:01:55 -05:00
|
|
|
Assignee string `json:"assignee"`
|
|
|
|
Assignees []string `json:"assignees"`
|
|
|
|
Milestone int64 `json:"milestone"`
|
|
|
|
Labels []int64 `json:"labels"`
|
|
|
|
State *string `json:"state"`
|
2018-05-01 14:05:28 -05:00
|
|
|
// swagger:strfmt date-time
|
2022-04-28 10:45:33 -05:00
|
|
|
Deadline *time.Time `json:"due_date"`
|
|
|
|
RemoveDeadline *bool `json:"unset_due_date"`
|
|
|
|
AllowMaintainerEdit *bool `json:"allow_maintainer_edit"`
|
2016-11-29 02:09:17 -06:00
|
|
|
}
|
2022-09-28 21:27:20 -05:00
|
|
|
|
|
|
|
// ChangedFile store information about files affected by the pull request
|
|
|
|
type ChangedFile struct {
|
|
|
|
Filename string `json:"filename"`
|
|
|
|
PreviousFilename string `json:"previous_filename,omitempty"`
|
|
|
|
Status string `json:"status"`
|
|
|
|
Additions int `json:"additions"`
|
|
|
|
Deletions int `json:"deletions"`
|
|
|
|
Changes int `json:"changes"`
|
|
|
|
HTMLURL string `json:"html_url,omitempty"`
|
|
|
|
ContentsURL string `json:"contents_url,omitempty"`
|
|
|
|
RawURL string `json:"raw_url,omitempty"`
|
|
|
|
}
|