MCPcopy Create free account
hub / github.com/google/go-github / ListWatchers

Method ListWatchers

github/activity_watching.go:33–52  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

31//
32//meta:operation GET /repos/{owner}/{repo}/subscribers
33func (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.

Callers 3

ListWatchersIterMethod · 0.95
TestActivity_WatchingFunction · 0.80

Calls 3

addOptionsFunction · 0.85
NewRequestMethod · 0.80
DoMethod · 0.45

Tested by 2

TestActivity_WatchingFunction · 0.64