@@ -11,7 +11,7 @@ import "fmt"
1111// which issues may be assigned.
1212//
1313// GitHub API docs: http://developer.github.com/v3/issues/assignees/#list-assignees
14- func (s * IssuesService ) ListAssignees (owner string , repo string , opt * ListOptions ) ([]User , * Response , error ) {
14+ func (s * IssuesService ) ListAssignees (owner , repo string , opt * ListOptions ) ([]User , * Response , error ) {
1515 u := fmt .Sprintf ("repos/%v/%v/assignees" , owner , repo )
1616 u , err := addOptions (u , opt )
1717 if err != nil {
@@ -34,7 +34,7 @@ func (s *IssuesService) ListAssignees(owner string, repo string, opt *ListOption
3434// IsAssignee checks if a user is an assignee for the specified repository.
3535//
3636// GitHub API docs: http://developer.github.com/v3/issues/assignees/#check-assignee
37- func (s * IssuesService ) IsAssignee (owner string , repo string , user string ) (bool , * Response , error ) {
37+ func (s * IssuesService ) IsAssignee (owner , repo , user string ) (bool , * Response , error ) {
3838 u := fmt .Sprintf ("repos/%v/%v/assignees/%v" , owner , repo , user )
3939 req , err := s .client .NewRequest ("GET" , u , nil )
4040 if err != nil {
@@ -44,3 +44,45 @@ func (s *IssuesService) IsAssignee(owner string, repo string, user string) (bool
4444 assignee , err := parseBoolResponse (err )
4545 return assignee , resp , err
4646}
47+
48+ // AddAssignees adds the provided GitHub users as assignees to the issue.
49+ //
50+ // GitHub API docs: https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
51+ func (s * IssuesService ) AddAssignees (owner , repo string , number int , assignees []string ) (* Issue , * Response , error ) {
52+ users := & struct {
53+ Assignees []string `json:"assignees,omitempty"`
54+ }{Assignees : assignees }
55+ u := fmt .Sprintf ("repos/%v/%v/issues/%v/assignees" , owner , repo , number )
56+ req , err := s .client .NewRequest ("POST" , u , users )
57+ if err != nil {
58+ return nil , nil , err
59+ }
60+
61+ // TODO: remove custom Accept header when this API fully launches.
62+ req .Header .Set ("Accept" , mediaTypeMultipleAssigneesPreview )
63+
64+ issue := & Issue {}
65+ resp , err := s .client .Do (req , issue )
66+ return issue , resp , err
67+ }
68+
69+ // RemoveAssignees removes the provided GitHub users as assignees from the issue.
70+ //
71+ // GitHub API docs: https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue
72+ func (s * IssuesService ) RemoveAssignees (owner , repo string , number int , assignees []string ) (* Issue , * Response , error ) {
73+ users := & struct {
74+ Assignees []string `json:"assignees,omitempty"`
75+ }{Assignees : assignees }
76+ u := fmt .Sprintf ("repos/%v/%v/issues/%v/assignees" , owner , repo , number )
77+ req , err := s .client .NewRequest ("DELETE" , u , users )
78+ if err != nil {
79+ return nil , nil , err
80+ }
81+
82+ // TODO: remove custom Accept header when this API fully launches.
83+ req .Header .Set ("Accept" , mediaTypeMultipleAssigneesPreview )
84+
85+ issue := & Issue {}
86+ resp , err := s .client .Do (req , issue )
87+ return issue , resp , err
88+ }
0 commit comments