Merge v1.2.1-master
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
a590155b0b
commit
aeb17182b4
396 changed files with 27271 additions and 9969 deletions
37
vendor/github.com/google/go-github/github/pulls_comments.go
generated
vendored
37
vendor/github.com/google/go-github/github/pulls_comments.go
generated
vendored
|
@ -6,6 +6,7 @@
|
|||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
@ -37,10 +38,10 @@ func (p PullRequestComment) String() string {
|
|||
// PullRequestListCommentsOptions specifies the optional parameters to the
|
||||
// PullRequestsService.ListComments method.
|
||||
type PullRequestListCommentsOptions struct {
|
||||
// Sort specifies how to sort comments. Possible values are: created, updated.
|
||||
// Sort specifies how to sort comments. Possible values are: created, updated.
|
||||
Sort string `url:"sort,omitempty"`
|
||||
|
||||
// Direction in which to sort comments. Possible values are: asc, desc.
|
||||
// Direction in which to sort comments. Possible values are: asc, desc.
|
||||
Direction string `url:"direction,omitempty"`
|
||||
|
||||
// Since filters comments by time.
|
||||
|
@ -49,12 +50,12 @@ type PullRequestListCommentsOptions struct {
|
|||
ListOptions
|
||||
}
|
||||
|
||||
// ListComments lists all comments on the specified pull request. Specifying a
|
||||
// ListComments lists all comments on the specified pull request. Specifying a
|
||||
// pull request number of 0 will return all comments on all pull requests for
|
||||
// the repository.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
|
||||
func (s *PullRequestsService) ListComments(owner string, repo string, number int, opt *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) {
|
||||
func (s *PullRequestsService) ListComments(ctx context.Context, owner string, repo string, number int, opt *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) {
|
||||
var u string
|
||||
if number == 0 {
|
||||
u = fmt.Sprintf("repos/%v/%v/pulls/comments", owner, repo)
|
||||
|
@ -74,19 +75,19 @@ func (s *PullRequestsService) ListComments(owner string, repo string, number int
|
|||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
comments := new([]*PullRequestComment)
|
||||
resp, err := s.client.Do(req, comments)
|
||||
var comments []*PullRequestComment
|
||||
resp, err := s.client.Do(ctx, req, &comments)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return *comments, resp, err
|
||||
return comments, resp, nil
|
||||
}
|
||||
|
||||
// GetComment fetches the specified pull request comment.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#get-a-single-comment
|
||||
func (s *PullRequestsService) GetComment(owner string, repo string, number int) (*PullRequestComment, *Response, error) {
|
||||
func (s *PullRequestsService) GetComment(ctx context.Context, owner string, repo string, number int) (*PullRequestComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, number)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
|
@ -97,18 +98,18 @@ func (s *PullRequestsService) GetComment(owner string, repo string, number int)
|
|||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
comment := new(PullRequestComment)
|
||||
resp, err := s.client.Do(req, comment)
|
||||
resp, err := s.client.Do(ctx, req, comment)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return comment, resp, err
|
||||
return comment, resp, nil
|
||||
}
|
||||
|
||||
// CreateComment creates a new comment on the specified pull request.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#create-a-comment
|
||||
func (s *PullRequestsService) CreateComment(owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
||||
func (s *PullRequestsService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number)
|
||||
req, err := s.client.NewRequest("POST", u, comment)
|
||||
if err != nil {
|
||||
|
@ -116,18 +117,18 @@ func (s *PullRequestsService) CreateComment(owner string, repo string, number in
|
|||
}
|
||||
|
||||
c := new(PullRequestComment)
|
||||
resp, err := s.client.Do(req, c)
|
||||
resp, err := s.client.Do(ctx, req, c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, err
|
||||
return c, resp, nil
|
||||
}
|
||||
|
||||
// EditComment updates a pull request comment.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#edit-a-comment
|
||||
func (s *PullRequestsService) EditComment(owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
||||
func (s *PullRequestsService) EditComment(ctx context.Context, owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, number)
|
||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||
if err != nil {
|
||||
|
@ -135,22 +136,22 @@ func (s *PullRequestsService) EditComment(owner string, repo string, number int,
|
|||
}
|
||||
|
||||
c := new(PullRequestComment)
|
||||
resp, err := s.client.Do(req, c)
|
||||
resp, err := s.client.Do(ctx, req, c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, err
|
||||
return c, resp, nil
|
||||
}
|
||||
|
||||
// DeleteComment deletes a pull request comment.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#delete-a-comment
|
||||
func (s *PullRequestsService) DeleteComment(owner string, repo string, number int) (*Response, error) {
|
||||
func (s *PullRequestsService) DeleteComment(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, number)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.client.Do(req, nil)
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue