Git Product home page Git Product logo

Comments (3)

clementdenis avatar clementdenis commented on September 28, 2024 1

Hi @arvindkrishnakumar-okta,

I've implemented a quick and easy solution to bring back pagination in v11:
clementdenis@6879127?w=1

The idea is to wrap List<> responses with pagination info (self / next link headers) in a PagedList instance (I just brought back the class from v10, but made it extend ArrayList).

Paginating is done this way:

UserApi userApi = new UserApi(client);
int limit = 2;
List<User> pagedUserList = null;
do {
    pagedUserList = userApi.listUsers(null, PagedList.getAfter(pagedUserList), limit, null, null, null, null);
    //pagedUserList can also be casted to a PagedList instance
    // loop through all of them
    for (User tmpUser : pagedUserList.getItems()) {
        log.info("User: {}", tmpUser.getProfile().getEmail());
    }
} while (PagedList.hasMoreResults(pagedUserList));

Feel free to use this code, or I can create a PR if you prefer.

PS: I took the liberty of reformating ApiClient.mustache properly, it's much easier to add changes that way.

from okta-sdk-java.

arvindkrishnakumar-okta avatar arvindkrishnakumar-okta commented on September 28, 2024

@clementdenis Thanks, I'll create a PR for Pagination shortly.

from okta-sdk-java.

arvindkrishnakumar-okta avatar arvindkrishnakumar-okta commented on September 28, 2024

PR merged to master, will cut a new major release in a week.

from okta-sdk-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.