-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add New Method for Returning Board List With Offset/Paginated Results (…
…#535) * Create BoardResult.php - 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 * Update BoardService.php - 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 * Update BoardTest.php - Created a new test method which performs the same test as the get_all_boards() test but using the updated result object instead * Update README.md Add information about how to use the new getBoards() method to retrieve the entire list of board results * Add periods to end of comments Added these in order to pass StyleCI PR checks * Rename BoardResult to more generic PaginatedResult 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 BoardService.php - Update our new getBoards() method to return PaginatedResult instead of BoardResult - Add new method getSprintsForBoard() which has support for pagination and uses PaginatedResult
- Loading branch information
1 parent
e01f543
commit 087718a
Showing
4 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?php | ||
|
||
namespace JiraRestApi\Board; | ||
|
||
/** | ||
* Paginated Result object for BoardService | ||
*/ | ||
class PaginatedResult | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $expand; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
public $startAt; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
public $maxResults; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
public $total; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
public $values; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
public $isLast; | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getStartAt() | ||
{ | ||
return $this->startAt; | ||
} | ||
|
||
/** | ||
* @param int $startAt | ||
*/ | ||
public function setStartAt($startAt) | ||
{ | ||
$this->startAt = $startAt; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getMaxResults() | ||
{ | ||
return $this->maxResults; | ||
} | ||
|
||
/** | ||
* @param int $maxResults | ||
*/ | ||
public function setMaxResults($maxResults) | ||
{ | ||
$this->maxResults = $maxResults; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getTotal() | ||
{ | ||
return $this->total; | ||
} | ||
|
||
/** | ||
* @param int $total | ||
*/ | ||
public function setTotal($total) | ||
{ | ||
$this->total = $total; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getValues() | ||
{ | ||
return $this->values; | ||
} | ||
|
||
/** | ||
* @param array $values | ||
*/ | ||
public function setValues($values) | ||
{ | ||
$this->values = $values; | ||
} | ||
|
||
/** | ||
* @param int $index | ||
* | ||
* @return mixed | ||
*/ | ||
public function getValue($index) | ||
{ | ||
return $this->values[$index]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getExpand() | ||
{ | ||
return $this->expand; | ||
} | ||
|
||
/** | ||
* @param string $expand | ||
*/ | ||
public function setExpand($expand) | ||
{ | ||
$this->expand = $expand; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters