diff --git a/controllers/me_following_users_controller.go b/controllers/me_following_users_controller.go index 0bb70b2..26d1847 100644 --- a/controllers/me_following_users_controller.go +++ b/controllers/me_following_users_controller.go @@ -1,6 +1,8 @@ package controllers import ( + "strconv" + "github.com/BrandonRomano/wrecker" "github.com/carrot/go-pinterest/models" ) @@ -22,6 +24,7 @@ func newMeFollowingUsersController(wc *wrecker.Wrecker) *MeFollowingUsersControl // parameters for the Fetch method type FollowingUsersControllerFetchOptionals struct { Cursor string + Limit int } // Fetch loads the users that the authorized user follows @@ -36,6 +39,9 @@ func (c *MeFollowingUsersController) Fetch(optionals *FollowingUsersControllerFe if optionals.Cursor != "" { request.URLParam("cursor", optionals.Cursor) } + if optionals.Limit != 0 { + request.URLParam("limit", strconv.Itoa(optionals.Limit)) + } httpResp, err := request.Execute() // Check Error diff --git a/pinterest_test.go b/pinterest_test.go index 62a5c39..1b5aa33 100644 --- a/pinterest_test.go +++ b/pinterest_test.go @@ -1083,13 +1083,14 @@ func (suite *ClientTestSuite) TestSuccessfulMeFollowingUsersFetch() { assert.Equal(suite.T(), len(*users), 25) // Load second page - suite.client.Me.Following.Users.Fetch( + users, _, err = suite.client.Me.Following.Users.Fetch( &controllers.FollowingUsersControllerFetchOptionals{ Cursor: page.Cursor, + Limit: 3, }, ) assert.Equal(suite.T(), nil, err) - assert.True(suite.T(), len(*users) > 0) + assert.True(suite.T(), len(*users) == 3) } // TestTimeoutMeFollowingUsersFetch tests that an error is appropriately thrown