ListWatchers lists watchers of a particular repo. GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#list-watchers meta:operation GET /repos/{owner}/{repo}/subscribers
(ctx context.Context, owner, repo string, opts *ListOptions)
| 31 | // |
| 32 | //meta:operation GET /repos/{owner}/{repo}/subscribers |
| 33 | func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { |
| 34 | u := fmt.Sprintf("repos/%v/%v/subscribers", owner, repo) |
| 35 | u, err := addOptions(u, opts) |
| 36 | if err != nil { |
| 37 | return nil, nil, err |
| 38 | } |
| 39 | |
| 40 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 41 | if err != nil { |
| 42 | return nil, nil, err |
| 43 | } |
| 44 | |
| 45 | var watchers []*User |
| 46 | resp, err := s.client.Do(req, &watchers) |
| 47 | if err != nil { |
| 48 | return nil, resp, err |
| 49 | } |
| 50 | |
| 51 | return watchers, resp, nil |
| 52 | } |
| 53 | |
| 54 | // ListWatched lists the repositories the specified user is watching. Passing |
| 55 | // the empty string will fetch watched repos for the authenticated user. |