aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/reactions.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/reactions.go')
-rw-r--r--vendor/github.com/google/go-github/github/reactions.go60
1 files changed, 35 insertions, 25 deletions
diff --git a/vendor/github.com/google/go-github/github/reactions.go b/vendor/github.com/google/go-github/github/reactions.go
index 739413d..19b533f 100644
--- a/vendor/github.com/google/go-github/github/reactions.go
+++ b/vendor/github.com/google/go-github/github/reactions.go
@@ -8,6 +8,7 @@ package github
import (
"context"
"fmt"
+ "strings"
)
// ReactionsService provides access to the reactions-related functions in the
@@ -19,8 +20,9 @@ type ReactionsService service
// Reaction represents a GitHub reaction.
type Reaction struct {
// ID is the Reaction ID.
- ID *int `json:"id,omitempty"`
- User *User `json:"user,omitempty"`
+ ID *int64 `json:"id,omitempty"`
+ User *User `json:"user,omitempty"`
+ NodeID *string `json:"node_id,omitempty"`
// Content is the type of reaction.
// Possible values are:
// "+1", "-1", "laugh", "confused", "heart", "hooray".
@@ -46,7 +48,7 @@ func (r Reaction) String() string {
// ListCommentReactions lists the reactions for a commit comment.
//
// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment
-func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int, opt *ListOptions) ([]*Reaction, *Response, error) {
+func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id)
u, err := addOptions(u, opt)
if err != nil {
@@ -58,8 +60,9 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
+ // TODO: remove custom Accept headers when APIs fully launch.
+ acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
+ req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
@@ -75,7 +78,7 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo
// previously created reaction will be returned with Status: 200 OK.
//
// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment
-func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int, content string) (*Reaction, *Response, error) {
+func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id)
body := &Reaction{Content: String(content)}
@@ -84,8 +87,9 @@ func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
+ // TODO: remove custom Accept headers when APIs fully launch.
+ acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
+ req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
@@ -111,8 +115,9 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
+ // TODO: remove custom Accept headers when APIs fully launch.
+ acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
+ req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
@@ -137,8 +142,9 @@ func (s ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo s
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
+ // TODO: remove custom Accept headers when APIs fully launch.
+ acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
+ req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
@@ -152,7 +158,7 @@ func (s ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo s
// ListIssueCommentReactions lists the reactions for an issue comment.
//
// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment
-func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int, opt *ListOptions) ([]*Reaction, *Response, error) {
+func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id)
u, err := addOptions(u, opt)
if err != nil {
@@ -164,8 +170,9 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
+ // TODO: remove custom Accept headers when APIs fully launch.
+ acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
+ req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
@@ -181,7 +188,7 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner,
// previously created reaction will be returned with Status: 200 OK.
//
// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment
-func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int, content string) (*Reaction, *Response, error) {
+func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id)
body := &Reaction{Content: String(content)}
@@ -190,8 +197,9 @@ func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
+ // TODO: remove custom Accept headers when APIs fully launch.
+ acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
+ req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
@@ -205,7 +213,7 @@ func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner,
// ListPullRequestCommentReactions lists the reactions for a pull request review comment.
//
// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment
-func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int, opt *ListOptions) ([]*Reaction, *Response, error) {
+func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id)
u, err := addOptions(u, opt)
if err != nil {
@@ -217,8 +225,9 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
+ // TODO: remove custom Accept headers when APIs fully launch.
+ acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
+ req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
@@ -234,7 +243,7 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context,
// previously created reaction will be returned with Status: 200 OK.
//
// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment
-func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int, content string) (*Reaction, *Response, error) {
+func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id)
body := &Reaction{Content: String(content)}
@@ -243,8 +252,9 @@ func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
+ // TODO: remove custom Accept headers when APIs fully launch.
+ acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
+ req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
@@ -258,7 +268,7 @@ func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context,
// DeleteReaction deletes a reaction.
//
// GitHub API docs: https://developer.github.com/v3/reaction/reactions/#delete-a-reaction-archive
-func (s *ReactionsService) DeleteReaction(ctx context.Context, id int) (*Response, error) {
+func (s *ReactionsService) DeleteReaction(ctx context.Context, id int64) (*Response, error) {
u := fmt.Sprintf("reactions/%v", id)
req, err := s.client.NewRequest("DELETE", u, nil)