summaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/v43/github/issues_assignees.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-24 17:58:01 -0600
committermo khan <mo@mokhan.ca>2025-07-24 17:58:01 -0600
commit72296119fc9755774719f8f625ad03e0e0ec457a (patch)
treeed236ddee12a20fb55b7cfecf13f62d3a000dcb5 /vendor/github.com/google/go-github/v43/github/issues_assignees.go
parenta920a8cfe415858bb2777371a77018599ffed23f (diff)
parenteaa1bd3b8e12934aed06413d75e7482ac58d805a (diff)
Merge branch 'the-spice-must-flow' into 'main'
Add SpiceDB Authorization See merge request gitlab-org/software-supply-chain-security/authorization/sparkled!19
Diffstat (limited to 'vendor/github.com/google/go-github/v43/github/issues_assignees.go')
-rw-r--r--vendor/github.com/google/go-github/v43/github/issues_assignees.go85
1 files changed, 85 insertions, 0 deletions
diff --git a/vendor/github.com/google/go-github/v43/github/issues_assignees.go b/vendor/github.com/google/go-github/v43/github/issues_assignees.go
new file mode 100644
index 0000000..9f15aea
--- /dev/null
+++ b/vendor/github.com/google/go-github/v43/github/issues_assignees.go
@@ -0,0 +1,85 @@
+// Copyright 2013 The go-github AUTHORS. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package github
+
+import (
+ "context"
+ "fmt"
+)
+
+// ListAssignees fetches all available assignees (owners and collaborators) to
+// which issues may be assigned.
+//
+// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-assignees
+func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo)
+ u, err := addOptions(u, opts)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+ var assignees []*User
+ resp, err := s.client.Do(ctx, req, &assignees)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return assignees, resp, nil
+}
+
+// IsAssignee checks if a user is an assignee for the specified repository.
+//
+// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#check-if-a-user-can-be-assigned
+func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user)
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return false, nil, err
+ }
+ resp, err := s.client.Do(ctx, req, nil)
+ assignee, err := parseBoolResponse(err)
+ return assignee, resp, err
+}
+
+// AddAssignees adds the provided GitHub users as assignees to the issue.
+//
+// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#add-assignees-to-an-issue
+func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
+ users := &struct {
+ Assignees []string `json:"assignees,omitempty"`
+ }{Assignees: assignees}
+ u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number)
+ req, err := s.client.NewRequest("POST", u, users)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ issue := &Issue{}
+ resp, err := s.client.Do(ctx, req, issue)
+ return issue, resp, err
+}
+
+// RemoveAssignees removes the provided GitHub users as assignees from the issue.
+//
+// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#remove-assignees-from-an-issue
+func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
+ users := &struct {
+ Assignees []string `json:"assignees,omitempty"`
+ }{Assignees: assignees}
+ u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number)
+ req, err := s.client.NewRequest("DELETE", u, users)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ issue := &Issue{}
+ resp, err := s.client.Do(ctx, req, issue)
+ return issue, resp, err
+}