Browse Source

including ListOptions in RepositoryListForksOptions for pagination

Colin Misare 12 years ago
committed by Will Norris
parent
commit
cca6b65b10
2 changed files with 10 additions and 2 deletions
  1. +2
    -0
      github/repos_forks.go
  2. +8
    -2
      github/repos_forks_test.go

+ 2
- 0
github/repos_forks.go View File

@ -13,6 +13,8 @@ type RepositoryListForksOptions struct {
// How to sort the forks list. Possible values are: newest, oldest,
// watchers. Default is "newest".
Sort string `url:"sort,omitempty"`
ListOptions
}
// ListForks lists the forks of the specified repository.


+ 8
- 2
github/repos_forks_test.go View File

@ -18,11 +18,17 @@ func TestRepositoriesService_ListForks(t *testing.T) {
mux.HandleFunc("/repos/o/r/forks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testFormValues(t, r, values{"sort": "newest"})
testFormValues(t, r, values{
"sort": "newest",
"page": "3",
})
fmt.Fprint(w, `[{"id":1},{"id":2}]`)
})
opt := &RepositoryListForksOptions{Sort: "newest"}
opt := &RepositoryListForksOptions{
Sort: "newest",
ListOptions: ListOptions{Page: 3},
}
repos, _, err := client.Repositories.ListForks("o", "r", opt)
if err != nil {
t.Errorf("Repositories.ListForks returned error: %v", err)


Loading…
Cancel
Save