Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination Not Working Correctly with /sizes Endpoint #80

Closed
Mac-Genius opened this issue Apr 24, 2018 · 6 comments
Closed

Pagination Not Working Correctly with /sizes Endpoint #80

Mac-Genius opened this issue Apr 24, 2018 · 6 comments
Assignees

Comments

@Mac-Genius
Copy link

Description

The function getAvailableSizes in the DigitalOceanClient class ignores the pageNo parameter.

This happens because pageNo is passed to the wrong ApiRequest constructor on line 785 of the DigitalOceanClient class.

This may be an issue with other endpoints that use pagination.

Possible Fix

Instead of using this constructor:

public ApiRequest(ApiAction apiAction, Object data) {
  ...
}

Use the constructor that uses pageNo and perPage:

public ApiRequest(ApiAction apiAction, Integer pageNo, Integer perPage) {
  ...
}

Then pass in the default perPage value on line 785 of DigitalOceanClient:

return (Sizes) perform(new ApiRequest(ApiAction.AVAILABLE_SIZES, pageNo, DEFAULT_PAGE_SIZE)).getData();
@jeevatkm jeevatkm self-assigned this Apr 24, 2018
@jeevatkm jeevatkm added this to the v2.15 Milestone milestone Apr 24, 2018
@jeevatkm
Copy link
Owner

@Mac-Genius Thank you for reporting it with detailed information. Yeah, I see an issue. I will fix it tonight or tomorrow and make a release.

@Mac-Genius
Copy link
Author

Thank you!

jeevatkm added a commit that referenced this issue Apr 26, 2018
- getAvailableRegions
- getAvailableSizes
- getAvailableDomains
- getAvailableKeys
@jeevatkm
Copy link
Owner

I have fixed the issue, affected methods are -

  • getAvailableRegions
  • getAvailableSizes
  • getAvailableDomains
  • getAvailableKeys

And published 2.15-SNAPSHOT. Please give it try and let me know.

@jeevatkm
Copy link
Owner

jeevatkm commented May 1, 2018

@Mac-Genius I hope everything seems alright, I'm closing this one. Thank you.

@jeevatkm jeevatkm closed this as completed May 1, 2018
@Mac-Genius
Copy link
Author

@jeevatkm Sorry it took me so long, everything seems to be working properly now. Thank you!

@jeevatkm
Copy link
Owner

jeevatkm commented May 2, 2018

@Mac-Genius no worries, good to hear its working properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants