/
issues.go
45 lines (37 loc) · 1.62 KB
/
issues.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package iface
import (
"context"
"github.com/google/go-github/github"
)
// Issues defines the interface used by the issues event logic.
type Issues interface {
Edit(ctx context.Context, owner string, repo string, number int, issue *github.IssueRequest) (*github.Issue, *github.Response, error)
AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*github.Label, *github.Response, error)
RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*github.Response, error)
}
// IssuesImpl implements the Issues interface.
type IssuesImpl struct {
*github.IssuesService
}
// NewIssues creates a new Issues instance.
func NewIssues(service *github.IssuesService) *IssuesImpl {
return &IssuesImpl{service}
}
// Edit an issue.
func (i *IssuesImpl) Edit(
ctx context.Context, owner string, repo string, number int,
issue *github.IssueRequest) (*github.Issue, *github.Response, error) {
return i.IssuesService.Edit(ctx, owner, repo, number, issue)
}
// AddLabelsToIssue adds the given lables to the issue number in the owner repo.
func (i *IssuesImpl) AddLabelsToIssue(
ctx context.Context, owner string, repo string, number int,
labels []string) ([]*github.Label, *github.Response, error) {
return i.IssuesService.AddLabelsToIssue(ctx, owner, repo, number, labels)
}
// RemoveLabelForIssue removes the given label from the repo issue.
func (i *IssuesImpl) RemoveLabelForIssue(
ctx context.Context, owner string, repo string, number int,
label string) (*github.Response, error) {
return i.IssuesService.RemoveLabelForIssue(ctx, owner, repo, number, label)
}