This is effectively a Java port of the same functionality in the .NET library. For more details about how this works, please see the linked PR.
This PR requires the introduction of a new PaginatedCollection class that will sit in the inheritance chain between any XCollection (i.e. AddressCollection) and the base EasyPostResource class. This is needed to ensure each object that we can get the next page of will have a hasMore property, and helps limit the scope of type parameters needed for the abstracted core functionality.
This PR:
Adds PaginatedCollection class, implements as need for all collection types
Adds base functionality for building parameters and calling functions to get the next page of a paginated collection
Implements base functionality into all PaginatedCollection-based classes
Adds user-facing getNextPage function to all service classes as needed
Store report type in ReportCollection, needed to make pagination call
Testing
Unit tests added to confirm the base functionality (crafting parameters, calling the all function passed in as a variable, accounting for page size optional parameter) is working properly. Cassettes added as needed.
Unit tests added to test getting the next page for each type of collection (e.g. AddressCollection, ShipmentCollection, etc.)
Pull Request Type
Please select the option(s) that are relevant to this PR.
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[x] Improvement (fixing a typo, updating readme, renaming a variable name, etc)
Description
This is effectively a Java port of the same functionality in the .NET library. For more details about how this works, please see the linked PR.
This PR requires the introduction of a new
PaginatedCollection
class that will sit in the inheritance chain between anyXCollection
(i.e.AddressCollection
) and the baseEasyPostResource
class. This is needed to ensure each object that we can get the next page of will have ahasMore
property, and helps limit the scope of type parameters needed for the abstracted core functionality.This PR:
PaginatedCollection
class, implements as need for all collection typesPaginatedCollection
-based classesgetNextPage
function to all service classes as neededReportCollection
, needed to make pagination callTesting
all
function passed in as a variable, accounting for page size optional parameter) is working properly. Cassettes added as needed.AddressCollection
,ShipmentCollection
, etc.)Pull Request Type
Please select the option(s) that are relevant to this PR.