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
51
vendor/github.com/google/go-github/github/repos_comments.go
generated
vendored
51
vendor/github.com/google/go-github/github/repos_comments.go
generated
vendored
|
@ -6,6 +6,7 @@
|
|||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
@ -34,8 +35,8 @@ func (r RepositoryComment) String() string {
|
|||
|
||||
// ListComments lists all the comments for the repository.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
|
||||
func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
|
||||
func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/comments", owner, repo)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
|
@ -50,19 +51,19 @@ func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions)
|
|||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
comments := new([]*RepositoryComment)
|
||||
resp, err := s.client.Do(req, comments)
|
||||
var comments []*RepositoryComment
|
||||
resp, err := s.client.Do(ctx, req, &comments)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return *comments, resp, err
|
||||
return comments, resp, nil
|
||||
}
|
||||
|
||||
// ListCommitComments lists all the comments for a given commit SHA.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit
|
||||
func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit
|
||||
func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
|
@ -77,20 +78,20 @@ func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *L
|
|||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
comments := new([]*RepositoryComment)
|
||||
resp, err := s.client.Do(req, comments)
|
||||
var comments []*RepositoryComment
|
||||
resp, err := s.client.Do(ctx, req, &comments)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return *comments, resp, err
|
||||
return comments, resp, nil
|
||||
}
|
||||
|
||||
// CreateComment creates a comment for the given commit.
|
||||
// Note: GitHub allows for comments to be created for non-existing files and positions.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/comments/#create-a-commit-comment
|
||||
func (s *RepositoriesService) CreateComment(owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#create-a-commit-comment
|
||||
func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
|
||||
req, err := s.client.NewRequest("POST", u, comment)
|
||||
if err != nil {
|
||||
|
@ -98,18 +99,18 @@ func (s *RepositoriesService) CreateComment(owner, repo, sha string, comment *Re
|
|||
}
|
||||
|
||||
c := new(RepositoryComment)
|
||||
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
|
||||
}
|
||||
|
||||
// GetComment gets a single comment from a repository.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/comments/#get-a-single-commit-comment
|
||||
func (s *RepositoriesService) GetComment(owner, repo string, id int) (*RepositoryComment, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment
|
||||
func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int) (*RepositoryComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
|
@ -120,18 +121,18 @@ func (s *RepositoriesService) GetComment(owner, repo string, id int) (*Repositor
|
|||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
c := new(RepositoryComment)
|
||||
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
|
||||
}
|
||||
|
||||
// UpdateComment updates the body of a single comment.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/comments/#update-a-commit-comment
|
||||
func (s *RepositoriesService) UpdateComment(owner, repo string, id int, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#update-a-commit-comment
|
||||
func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
|
||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||
if err != nil {
|
||||
|
@ -139,22 +140,22 @@ func (s *RepositoriesService) UpdateComment(owner, repo string, id int, comment
|
|||
}
|
||||
|
||||
c := new(RepositoryComment)
|
||||
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 single comment from a repository.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/comments/#delete-a-commit-comment
|
||||
func (s *RepositoriesService) DeleteComment(owner, repo string, id int) (*Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#delete-a-commit-comment
|
||||
func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
|
||||
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