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

Method ListStargazers

github/activity_star.go:31–52  ·  view source on GitHub ↗

ListStargazers lists people who have starred the specified repo. GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#list-stargazers meta:operation GET /repos/{owner}/{repo}/stargazers

(ctx context.Context, owner, repo string, opts *ListOptions)

Source from the content-addressed store, hash-verified

29//
30//meta:operation GET /repos/{owner}/{repo}/stargazers
31func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Stargazer, *Response, error) {
32 u := fmt.Sprintf("repos/%v/%v/stargazers", owner, repo)
33 u, err := addOptions(u, opts)
34 if err != nil {
35 return nil, nil, err
36 }
37
38 req, err := s.client.NewRequest(ctx, "GET", u, nil)
39 if err != nil {
40 return nil, nil, err
41 }
42
43 req.Header.Set("Accept", mediaTypeStarring)
44
45 var stargazers []*Stargazer
46 resp, err := s.client.Do(req, &stargazers)
47 if err != nil {
48 return nil, resp, err
49 }
50
51 return stargazers, resp, nil
52}
53
54// ActivityListStarredOptions specifies the optional parameters to the
55// ActivityService.ListStarred method.

Callers 3

ListStargazersIterMethod · 0.95
TestActivity_StarringFunction · 0.80

Calls 3

addOptionsFunction · 0.85
NewRequestMethod · 0.80
DoMethod · 0.45

Tested by 2

TestActivity_StarringFunction · 0.64