@@ -10,10 +10,20 @@ import (
10
10
"fmt"
11
11
)
12
12
13
+ type Collaborator struct {
14
+ * User
15
+ Permissions Permission `json:"permissions"`
16
+ }
17
+
13
18
type AddCollaboratorOption struct {
14
19
Permission * string `json:"permission"`
15
20
}
16
21
22
+ func (c * Client ) ListCollaborator (user , repo string ) ([]* Collaborator , error ) {
23
+ collabs := make ([]* Collaborator , 0 , 10 )
24
+ return collabs , c .getParsedResponse ("GET" , fmt .Sprintf ("/repos/%s/%s/collaborators" , user , repo ), nil , nil , & collabs )
25
+ }
26
+
17
27
func (c * Client ) AddCollaborator (user , repo , collaborator string , opt AddCollaboratorOption ) error {
18
28
body , err := json .Marshal (& opt )
19
29
if err != nil {
@@ -22,3 +32,13 @@ func (c *Client) AddCollaborator(user, repo, collaborator string, opt AddCollabo
22
32
_ , err = c .getResponse ("PUT" , fmt .Sprintf ("/repos/%s/%s/collaborators/%s" , user , repo , collaborator ), nil , bytes .NewReader (body ))
23
33
return err
24
34
}
35
+
36
+ func (c * Client ) DeleteCollaborator (user , repo , collaborator string ) error {
37
+ _ , err := c .getResponse ("DELETE" , fmt .Sprintf ("/repos/%s/%s/collaborators/%s" , user , repo , collaborator ), nil , nil )
38
+ return err
39
+ }
40
+
41
+ func (c * Client ) IsCollaborator (user , repo , collaborator string ) error {
42
+ _ , err := c .getResponse ("GET" , fmt .Sprintf ("/repos/%s/%s/collaborators/%s" , user , repo , collaborator ), nil , nil )
43
+ return err
44
+ }
0 commit comments