aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/repos_comments.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/repos_comments.go')
-rw-r--r--vendor/github.com/google/go-github/github/repos_comments.go25
1 files changed, 13 insertions, 12 deletions
diff --git a/vendor/github.com/google/go-github/github/repos_comments.go b/vendor/github.com/google/go-github/github/repos_comments.go
index d5917e1..4830ee2 100644
--- a/vendor/github.com/google/go-github/github/repos_comments.go
+++ b/vendor/github.com/google/go-github/github/repos_comments.go
@@ -6,6 +6,7 @@
package github
import (
+ "context"
"fmt"
"time"
)
@@ -35,7 +36,7 @@ func (r RepositoryComment) String() string {
// ListComments lists all the comments for the repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
-func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
+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 {
@@ -51,7 +52,7 @@ func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions)
req.Header.Set("Accept", mediaTypeReactionsPreview)
var comments []*RepositoryComment
- resp, err := s.client.Do(req, &comments)
+ resp, err := s.client.Do(ctx, req, &comments)
if err != nil {
return nil, resp, err
}
@@ -62,7 +63,7 @@ func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions)
// ListCommitComments lists all the comments for a given commit SHA.
//
// GitHub API docs: https://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) {
+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 {
@@ -78,7 +79,7 @@ func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *L
req.Header.Set("Accept", mediaTypeReactionsPreview)
var comments []*RepositoryComment
- resp, err := s.client.Do(req, &comments)
+ resp, err := s.client.Do(ctx, req, &comments)
if err != nil {
return nil, resp, err
}
@@ -90,7 +91,7 @@ func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *L
// Note: GitHub allows for comments to be created for non-existing files and positions.
//
// GitHub API docs: https://developer.github.com/v3/repos/comments/#create-a-commit-comment
-func (s *RepositoriesService) CreateComment(owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
+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,7 +99,7 @@ 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
}
@@ -109,7 +110,7 @@ func (s *RepositoriesService) CreateComment(owner, repo, sha string, comment *Re
// GetComment gets a single comment from a repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment
-func (s *RepositoriesService) GetComment(owner, repo string, id int) (*RepositoryComment, *Response, error) {
+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,7 +121,7 @@ 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
}
@@ -131,7 +132,7 @@ func (s *RepositoriesService) GetComment(owner, repo string, id int) (*Repositor
// UpdateComment updates the body of a single comment.
//
// GitHub API docs: https://developer.github.com/v3/repos/comments/#update-a-commit-comment
-func (s *RepositoriesService) UpdateComment(owner, repo string, id int, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
+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,7 +140,7 @@ 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
}
@@ -150,11 +151,11 @@ func (s *RepositoriesService) UpdateComment(owner, repo string, id int, comment
// DeleteComment deletes a single comment from a repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/comments/#delete-a-commit-comment
-func (s *RepositoriesService) DeleteComment(owner, repo string, id int) (*Response, error) {
+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)
}