close
Skip to content

Add marker based pagination for get users methods - #759

Merged
sujaygarlanka merged 14 commits into
masterfrom
users-marker-pagination
Dec 16, 2019
Merged

Add marker based pagination for get users methods#759
sujaygarlanka merged 14 commits into
masterfrom
users-marker-pagination

Conversation

@sujaygarlanka

Copy link
Copy Markdown
Contributor

Issue Link 🔗

Goals ⚽

  • Add marker based pagination for get users methods

Implementation Details 🚧

  • Added usemarker and marker parameters to multiple get users methods
  • Updated BoxResourceIterable to be able to pass in marker to start pagination
  • Updated BoxResourceIterable to expose the next marker string

Testing Details 🔍

  • Unit testing
  • Manual testing

@boxcla

boxcla commented Dec 12, 2019

Copy link
Copy Markdown

Verified that @sujaygarlanka has signed the CLA. Thanks for the pull request!

Comment thread doc/users.md Outdated
Comment thread doc/users.md Outdated
[`getAllEnterpriseUsers(BoxAPIConnection api, boolean usemarker, String marker)`][get-all-enterprise-users],
[`getAllEnterpriseUsers(BoxAPIConnection api, String filterTerm, boolean usemarker, String marker, String... fields)`][get-all-enterprise-users-2], or
[`getAllEnterpriseOrExternalUsers(BoxAPIConnection api, String filterTerm, boolean usemarker, String marker, String... fields)`][get-all-enterprise-users-3] method.
To do marker pagination without passing in a marker, set the marker as `null`. In order to get the next marker, you must cast the iterable to `BoxResourseIterable<BoxUser.info>`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To do marker pagination without passing in a marker, set the marker as `null`. In order to get the next marker, you must cast the iterable to `BoxResourseIterable<BoxUser.info>`
To get the first page of results, set the `String marker` parameter to `null`. In order to get the next page of results, you must first cast the returned object to `BoxResourseIterable<BoxUser.info>`

Comment thread doc/users.md Outdated
[`getAllEnterpriseUsers(BoxAPIConnection api, String filterTerm, boolean usemarker, String marker, String... fields)`][get-all-enterprise-users-2], or
[`getAllEnterpriseOrExternalUsers(BoxAPIConnection api, String filterTerm, boolean usemarker, String marker, String... fields)`][get-all-enterprise-users-3] method.
To do marker pagination without passing in a marker, set the marker as `null`. In order to get the next marker, you must cast the iterable to `BoxResourseIterable<BoxUser.info>`
and call `getNextMarker()` on that iterable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and call `getNextMarker()` on that iterable.
and call `getNextMarker()` on that object to get the next page's marker. Then, this marker can be set to the `String marker` parameter to get the next page of results, if there are any. If the marker returned from `getNextMarker()` is null, then there are no more pages of results.

Comment thread doc/users.md Outdated
Iterable<BoxUser.Info> users = BoxUser.getAllEnterpriseUsers(api, true, null);

// Get marker
((BoxResourceIterable<BoxUser.Info>) users).getNextMarker();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
((BoxResourceIterable<BoxUser.Info>) users).getNextMarker();
String marker = ((BoxResourceIterable<BoxUser.Info>) users).getNextMarker();
// Get next page
users = BoxUser.getAllEnterpriseUsers(api, true, marker);

Comment thread doc/users.md Outdated
To get app user using external app user ID, call the
[`getAppUsersByExternalAppUserID(BoxAPIConnection api, String externalID, boolean usemarker, String marker, String... fields)`][get-app-users-by-external-app-user-id].
This method allows you to easily associate Box app users with your application's
identifiers for those users. To do marker pagination without passing in a marker, set the marker as `null`. In order to get the next marker, you must cast the iterable to `BoxResourseIterable<BoxUser.info>`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
identifiers for those users. To do marker pagination without passing in a marker, set the marker as `null`. In order to get the next marker, you must cast the iterable to `BoxResourseIterable<BoxUser.info>`
identifiers for those users. To get the first page of results, set the `String marker` parameter to `null`. In order to get the next page of results, you must first cast the returned object to `BoxResourseIterable<BoxUser.info>`

Comment thread doc/users.md Outdated
[`getAppUsersByExternalAppUserID(BoxAPIConnection api, String externalID, boolean usemarker, String marker, String... fields)`][get-app-users-by-external-app-user-id].
This method allows you to easily associate Box app users with your application's
identifiers for those users. To do marker pagination without passing in a marker, set the marker as `null`. In order to get the next marker, you must cast the iterable to `BoxResourseIterable<BoxUser.info>`
and call `getNextMarker()` on that iterable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and call `getNextMarker()` on that iterable.
and call `getNextMarker()` on that object to get the next page's marker. Then, this marker can be set to the `String marker` parameter to get the next page of results, if there are any. If the marker returned from `getNextMarker()` is null, then there are no more pages of results.

Comment thread src/main/java/com/box/sdk/BoxResourceIterable.java Outdated
sujaygarlanka and others added 2 commits December 13, 2019 15:49
Co-Authored-By: Patrick Simon <patrick@box.com>
Comment thread src/main/java/com/box/sdk/BoxResourceIterable.java Outdated
Comment thread src/main/java/com/box/sdk/BoxResourceIterable.java Outdated

@PJSimon PJSimon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small edits, other wise, APPROVED!

@coveralls

coveralls commented Dec 14, 2019

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 2019

  • 26 of 39 (66.67%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 65.26%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/main/java/com/box/sdk/BoxResourceIterable.java 10 11 90.91%
src/main/java/com/box/sdk/BoxUser.java 16 28 57.14%
Totals Coverage Status
Change from base Build 2002: 0.01%
Covered Lines: 5352
Relevant Lines: 8201

💛 - Coveralls

@sujaygarlanka
sujaygarlanka merged commit f16869e into master Dec 16, 2019
@sujaygarlanka
sujaygarlanka deleted the users-marker-pagination branch December 16, 2019 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants