|
|
@ -42,13 +42,23 @@ type PullRequest struct { |
|
|
IssueURL *string `json:"issue_url,omitempty"` |
|
|
IssueURL *string `json:"issue_url,omitempty"` |
|
|
StatusesURL *string `json:"statuses_url,omitempty"` |
|
|
StatusesURL *string `json:"statuses_url,omitempty"` |
|
|
|
|
|
|
|
|
// TODO(willnorris): add head and base once we have a Commit struct defined somewhere
|
|
|
|
|
|
|
|
|
Head *PullRequestBranch `json:"head,omitempty"` |
|
|
|
|
|
Base *PullRequestBranch `json:"base,omitempty"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (p PullRequest) String() string { |
|
|
func (p PullRequest) String() string { |
|
|
return Stringify(p) |
|
|
return Stringify(p) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// PullRequestBranch represents a base or head branch in a GitHub pull request.
|
|
|
|
|
|
type PullRequestBranch struct { |
|
|
|
|
|
Label *string `json:"label,omitempty"` |
|
|
|
|
|
Ref *string `json:"ref,omitempty"` |
|
|
|
|
|
SHA *string `json:"sha,omitempty"` |
|
|
|
|
|
Repo *Repository `json:"repo,omitempty"` |
|
|
|
|
|
User *User `json:"user,omitempty"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// PullRequestListOptions specifies the optional parameters to the
|
|
|
// PullRequestListOptions specifies the optional parameters to the
|
|
|
// PullRequestsService.List method.
|
|
|
// PullRequestsService.List method.
|
|
|
type PullRequestListOptions struct { |
|
|
type PullRequestListOptions struct { |
|
|
@ -109,10 +119,19 @@ func (s *PullRequestsService) Get(owner string, repo string, number int) (*PullR |
|
|
return pull, resp, err |
|
|
return pull, resp, err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// NewPullRequest represents a new pull request to be created.
|
|
|
|
|
|
type NewPullRequest struct { |
|
|
|
|
|
Title *string `json:"title,omitempty"` |
|
|
|
|
|
Head *string `json:"head,omitempty"` |
|
|
|
|
|
Base *string `json:"base,omitempty"` |
|
|
|
|
|
Body *string `json:"body,omitempty"` |
|
|
|
|
|
Issue *int `json:"issue,omitempty"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Create a new pull request on the specified repository.
|
|
|
// Create a new pull request on the specified repository.
|
|
|
//
|
|
|
//
|
|
|
// GitHub API docs: https://developer.github.com/v3/pulls/#create-a-pull-request
|
|
|
// GitHub API docs: https://developer.github.com/v3/pulls/#create-a-pull-request
|
|
|
func (s *PullRequestsService) Create(owner string, repo string, pull *PullRequest) (*PullRequest, *Response, error) { |
|
|
|
|
|
|
|
|
func (s *PullRequestsService) Create(owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) { |
|
|
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) |
|
|
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) |
|
|
req, err := s.client.NewRequest("POST", u, pull) |
|
|
req, err := s.client.NewRequest("POST", u, pull) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
|