mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Switch from govendor to go modules. (#587)
Thanks to @BenoitKnecht for leading the way on this.
This commit is contained in:
60
vendor/github.com/google/go-github/github/issues.go
generated
vendored
60
vendor/github.com/google/go-github/github/issues.go
generated
vendored
@ -8,6 +8,7 @@ package github
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -23,8 +24,9 @@ type IssuesService service
|
||||
// but not every issue is a pull request. Some endpoints, events, and webhooks
|
||||
// may also return pull requests via this struct. If PullRequestLinks is nil,
|
||||
// this is an issue, and if PullRequestLinks is not nil, this is a pull request.
|
||||
// The IsPullRequest helper method can be used to check that.
|
||||
type Issue struct {
|
||||
ID *int `json:"id,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Number *int `json:"number,omitempty"`
|
||||
State *string `json:"state,omitempty"`
|
||||
Locked *bool `json:"locked,omitempty"`
|
||||
@ -40,21 +42,37 @@ type Issue struct {
|
||||
ClosedBy *User `json:"closed_by,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
CommentsURL *string `json:"comments_url,omitempty"`
|
||||
EventsURL *string `json:"events_url,omitempty"`
|
||||
LabelsURL *string `json:"labels_url,omitempty"`
|
||||
RepositoryURL *string `json:"repository_url,omitempty"`
|
||||
Milestone *Milestone `json:"milestone,omitempty"`
|
||||
PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
|
||||
Repository *Repository `json:"repository,omitempty"`
|
||||
Reactions *Reactions `json:"reactions,omitempty"`
|
||||
Assignees []*User `json:"assignees,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
|
||||
// TextMatches is only populated from search results that request text matches
|
||||
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
|
||||
TextMatches []TextMatch `json:"text_matches,omitempty"`
|
||||
|
||||
// ActiveLockReason is populated only when LockReason is provided while locking the issue.
|
||||
// Possible values are: "off-topic", "too heated", "resolved", and "spam".
|
||||
ActiveLockReason *string `json:"active_lock_reason,omitempty"`
|
||||
}
|
||||
|
||||
func (i Issue) String() string {
|
||||
return Stringify(i)
|
||||
}
|
||||
|
||||
// IsPullRequest reports whether the issue is also a pull request. It uses the
|
||||
// method recommended by GitHub's API documentation, which is to check whether
|
||||
// PullRequestLinks is non-nil.
|
||||
func (i Issue) IsPullRequest() bool {
|
||||
return i.PullRequestLinks != nil
|
||||
}
|
||||
|
||||
// IssueRequest represents a request to create/edit an issue.
|
||||
// It is separate from Issue above because otherwise Labels
|
||||
// and Assignee fail to serialize to the correct JSON.
|
||||
@ -97,7 +115,7 @@ type IssueListOptions struct {
|
||||
}
|
||||
|
||||
// PullRequestLinks object is added to the Issue object when it's an issue included
|
||||
// in the IssueCommentEvent webhook payload, if the webhooks is fired by a comment on a PR
|
||||
// in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR.
|
||||
type PullRequestLinks struct {
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
@ -141,8 +159,9 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opt *IssueList
|
||||
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, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var issues []*Issue
|
||||
resp, err := s.client.Do(ctx, req, &issues)
|
||||
@ -208,8 +227,9 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin
|
||||
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, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var issues []*Issue
|
||||
resp, err := s.client.Do(ctx, req, &issues)
|
||||
@ -230,8 +250,9 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb
|
||||
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, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
issue := new(Issue)
|
||||
resp, err := s.client.Do(ctx, req, issue)
|
||||
@ -252,6 +273,9 @@ func (s *IssuesService) Create(ctx context.Context, owner string, repo string, i
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
i := new(Issue)
|
||||
resp, err := s.client.Do(ctx, req, i)
|
||||
if err != nil {
|
||||
@ -271,6 +295,9 @@ func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, num
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
i := new(Issue)
|
||||
resp, err := s.client.Do(ctx, req, i)
|
||||
if err != nil {
|
||||
@ -280,16 +307,29 @@ func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, num
|
||||
return i, resp, nil
|
||||
}
|
||||
|
||||
// LockIssueOptions specifies the optional parameters to the
|
||||
// IssuesService.Lock method.
|
||||
type LockIssueOptions struct {
|
||||
// LockReason specifies the reason to lock this issue.
|
||||
// Providing a lock reason can help make it clearer to contributors why an issue
|
||||
// was locked. Possible values are: "off-topic", "too heated", "resolved", and "spam".
|
||||
LockReason string `json:"lock_reason,omitempty"`
|
||||
}
|
||||
|
||||
// Lock an issue's conversation.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/issues/#lock-an-issue
|
||||
func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
||||
func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opt *LockIssueOptions) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
|
||||
req, err := s.client.NewRequest("PUT", u, nil)
|
||||
req, err := s.client.NewRequest("PUT", u, opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if opt != nil {
|
||||
req.Header.Set("Accept", mediaTypeLockReasonPreview)
|
||||
}
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user