Skip to content
This repository has been archived by the owner on Oct 3, 2018. It is now read-only.

Commit

Permalink
Fix users request paginate params
Browse files Browse the repository at this point in the history
  • Loading branch information
khigia committed Feb 18, 2015
1 parent dcbdf15 commit fcfb443
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions users.go
Expand Up @@ -2,6 +2,7 @@ package gogitlab

import (
"encoding/json"
"strconv"
)

const (
Expand All @@ -28,9 +29,12 @@ type User struct {
ColorSchemeId int `json:"color_scheme_id,color_scheme_id"`
}

func (g *Gitlab) Users() ([]*User, error) {
func (g *Gitlab) Users(page int, per_page int) ([]*User, error) {

url := g.ResourceUrl(users_url, nil)
qry := map[string]string{
"page": strconv.Itoa(page),
"per_page": strconv.Itoa(per_page)}
url := g.ResourceUrlQuery(users_url, nil, qry)

var users []*User

Expand Down
2 changes: 1 addition & 1 deletion users_test.go
Expand Up @@ -7,7 +7,7 @@ import (

func TestUsers(t *testing.T) {
ts, gitlab := Stub("stubs/users/index.json")
users, err := gitlab.Users()
users, err := gitlab.Users(0, 100)

assert.Equal(t, err, nil)
assert.Equal(t, len(users), 2)
Expand Down

0 comments on commit fcfb443

Please sign in to comment.