diff --git a/github/activity_watching.go b/github/activity_watching.go index 3af168a..0144285 100644 --- a/github/activity_watching.go +++ b/github/activity_watching.go @@ -15,8 +15,12 @@ type RepositorySubscription struct { // ListWatchers lists watchers of a particular repo. // // GitHub API Docs: http://developer.github.com/v3/activity/watching/#list-watchers -func (s *ActivityService) ListWatchers(owner, repo string) ([]User, *Response, error) { +func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]User, *Response, error) { u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo) + u, err := addOptions(u, opt) + if err != nil { + return nil, nil, err + } req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/github/activity_watching_test.go b/github/activity_watching_test.go index 46a2d96..bd55480 100644 --- a/github/activity_watching_test.go +++ b/github/activity_watching_test.go @@ -14,10 +14,14 @@ func TestActivityService_ListWatchers(t *testing.T) { mux.HandleFunc("/repos/o/r/subscribers", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") + testFormValues(t, r, values{ + "page": "2", + }) + fmt.Fprint(w, `[{"id":1}]`) }) - watchers, _, err := client.Activity.ListWatchers("o", "r") + watchers, _, err := client.Activity.ListWatchers("o", "r", &ListOptions{Page: 2}) if err != nil { t.Errorf("Activity.ListWatchers returned error: %v", err) }