diff options
Diffstat (limited to 'vendor/github.com/google/go-github/github/issues_labels.go')
-rw-r--r-- | vendor/github.com/google/go-github/github/issues_labels.go | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/vendor/github.com/google/go-github/github/issues_labels.go b/vendor/github.com/google/go-github/github/issues_labels.go index c9f8c46..a39001d 100644 --- a/vendor/github.com/google/go-github/github/issues_labels.go +++ b/vendor/github.com/google/go-github/github/issues_labels.go @@ -5,10 +5,14 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Label represents a GitHub label on an Issue type Label struct { + ID *int `json:"id,omitempty"` URL *string `json:"url,omitempty"` Name *string `json:"name,omitempty"` Color *string `json:"color,omitempty"` @@ -21,7 +25,7 @@ func (l Label) String() string { // ListLabels lists all labels for a repository. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository -func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) ([]*Label, *Response, error) { +func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) u, err := addOptions(u, opt) if err != nil { @@ -34,7 +38,7 @@ func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) } var labels []*Label - resp, err := s.client.Do(req, &labels) + resp, err := s.client.Do(ctx, req, &labels) if err != nil { return nil, resp, err } @@ -45,7 +49,7 @@ func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) // GetLabel gets a single label. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#get-a-single-label -func (s *IssuesService) GetLabel(owner string, repo string, name string) (*Label, *Response, error) { +func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -53,7 +57,7 @@ func (s *IssuesService) GetLabel(owner string, repo string, name string) (*Label } label := new(Label) - resp, err := s.client.Do(req, label) + resp, err := s.client.Do(ctx, req, label) if err != nil { return nil, resp, err } @@ -64,7 +68,7 @@ func (s *IssuesService) GetLabel(owner string, repo string, name string) (*Label // CreateLabel creates a new label on the specified repository. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#create-a-label -func (s *IssuesService) CreateLabel(owner string, repo string, label *Label) (*Label, *Response, error) { +func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) req, err := s.client.NewRequest("POST", u, label) if err != nil { @@ -72,7 +76,7 @@ func (s *IssuesService) CreateLabel(owner string, repo string, label *Label) (*L } l := new(Label) - resp, err := s.client.Do(req, l) + resp, err := s.client.Do(ctx, req, l) if err != nil { return nil, resp, err } @@ -83,7 +87,7 @@ func (s *IssuesService) CreateLabel(owner string, repo string, label *Label) (*L // EditLabel edits a label. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#update-a-label -func (s *IssuesService) EditLabel(owner string, repo string, name string, label *Label) (*Label, *Response, error) { +func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) req, err := s.client.NewRequest("PATCH", u, label) if err != nil { @@ -91,7 +95,7 @@ func (s *IssuesService) EditLabel(owner string, repo string, name string, label } l := new(Label) - resp, err := s.client.Do(req, l) + resp, err := s.client.Do(ctx, req, l) if err != nil { return nil, resp, err } @@ -102,19 +106,19 @@ func (s *IssuesService) EditLabel(owner string, repo string, name string, label // DeleteLabel deletes a label. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#delete-a-label -func (s *IssuesService) DeleteLabel(owner string, repo string, name string) (*Response, error) { +func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) 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) } // ListLabelsByIssue lists all labels for an issue. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue -func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) { +func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) u, err := addOptions(u, opt) if err != nil { @@ -127,7 +131,7 @@ func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int, } var labels []*Label - resp, err := s.client.Do(req, &labels) + resp, err := s.client.Do(ctx, req, &labels) if err != nil { return nil, resp, err } @@ -138,7 +142,7 @@ func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int, // AddLabelsToIssue adds labels to an issue. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue -func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { +func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) req, err := s.client.NewRequest("POST", u, labels) if err != nil { @@ -146,7 +150,7 @@ func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int, } var l []*Label - resp, err := s.client.Do(req, &l) + resp, err := s.client.Do(ctx, req, &l) if err != nil { return nil, resp, err } @@ -157,19 +161,19 @@ func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int, // RemoveLabelForIssue removes a label for an issue. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue -func (s *IssuesService) RemoveLabelForIssue(owner string, repo string, number int, label string) (*Response, error) { +func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label) 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) } // ReplaceLabelsForIssue replaces all labels for an issue. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue -func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { +func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) req, err := s.client.NewRequest("PUT", u, labels) if err != nil { @@ -177,7 +181,7 @@ func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number } var l []*Label - resp, err := s.client.Do(req, &l) + resp, err := s.client.Do(ctx, req, &l) if err != nil { return nil, resp, err } @@ -188,19 +192,19 @@ func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number // RemoveLabelsForIssue removes all labels for an issue. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue -func (s *IssuesService) RemoveLabelsForIssue(owner string, repo string, number int) (*Response, error) { +func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, repo string, number int) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", 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) } // ListLabelsForMilestone lists labels for every issue in a milestone. // // GitHub API docs: https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone -func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) { +func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number) u, err := addOptions(u, opt) if err != nil { @@ -213,7 +217,7 @@ func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number } var labels []*Label - resp, err := s.client.Do(req, &labels) + resp, err := s.client.Do(ctx, req, &labels) if err != nil { return nil, resp, err } |