Skip to content

Add New Method for Returning Board List With Offset/Paginated Results #535

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

Merged

Conversation

nickpoulos
Copy link
Contributor

@nickpoulos nickpoulos commented Jun 8, 2024

The current implementation of the BoardService->getBoardList() method will only return the first 50 results from the Jira Board endpoint (/rest/agile/1.0/board).

Rather than modify the existing getBoardList() method and introduce a breaking change, I created a new method -- getBoards() -- which maps the response data from /rest/agile/1.0/board into a newly created BoardResult object. This new object has properties for data like total results, and a isLast boolean, which are returned by the endpoint but currently ignored by getBoardList().

Using this new object data, developers can easily make multiple calls to the /rest/agile/1.0/board endpoint to retrieve the entire list of boards rather than just the first 50.

I added this information to the ReadMe and added an additional test.

Let me know what you think.

Thanks.

- Create a new class to hold the entire result data of the response returned from the "/rest/agile/1.0/board" endpoint

- The approach is very similar to how the existing IssueService->search() function works already
- Instead of updating the existing getAllBoards() method and create a breaking change, I introduced a new method getBoards()

- This method calls to the same "/rest/agile/1.0/board" endpoint as getAllBoards() but it maps the value into the newly created BoardResult class rather than ArrayObject.

- This allows the developer to determine if there are more results past the initial 50 on the first page, and get additional pages if necessary
- Created a new test method which performs the same test as the get_all_boards() test but using the updated result object instead
Add information about how to use the new getBoards() method to retrieve the entire list of board results
*
* Test we can obtain the paginated board list.
*/
public function get_boards() : string

Choose a reason for hiding this comment

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

Method name BoardTest::get_boards is not in camel caps format

Copy link
Contributor Author

@nickpoulos nickpoulos Jun 10, 2024

Choose a reason for hiding this comment

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

...but neither is any other method in the this test class?

Is it more important to keep consistency within the file or attempt to bring one new method in line with our new standards? Let me know and I can adjust accordingly. 👍

Added these in order to pass StyleCI PR checks
I realized other methods in BoardService also did not have proper pagination built in.  We will reuse this class in a more generic way for other methods such as getSprintsForBoard()
- Update our new getBoards() method to return PaginatedResult instead of BoardResult
- Add new method getSprintsForBoard() which has support for pagination and uses PaginatedResult
@lesstif lesstif merged commit 087718a into lesstif:main Sep 16, 2024
1 of 3 checks passed
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.

3 participants