Skip to content

search feature #2

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
merged 1 commit into from
Jul 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions src/Issue/IssueSearchResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php
/**
* Created by PhpStorm.
* User: keanor
* Date: 29.07.15
* Time: 13:12
*/

namespace JiraRestApi\Issue;

/**
* Issue search result
*
* @package JiraRestApi\Issue
*/
class IssueSearchResult
{
/**
* @var string
*/
protected $expand;

/**
* @var int
*/
protected $startAt;

/**
* @var int
*/
protected $maxResults;

/**
* @var int
*/
protected $total;

/**
* @var Issue[]
*/
protected $issues;

/**
* @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 Issue[]
*/
public function getIssues()
{
return $this->issues;
}

/**
* @param Issue[] $issues
*/
public function setIssues($issues)
{
$this->issues = $issues;
}

/**
* @return string
*/
public function getExpand()
{
return $this->expand;
}

/**
* @param string $expand
*/
public function setExpand($expand)
{
$this->expand = $expand;
}
}
28 changes: 28 additions & 0 deletions src/Issue/IssueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,34 @@ public function transition($issueIdOrKey, $transition)

$this->log->addDebug('getTransitions result='.var_export($ret, true));
}

/**
* Search issues
*
* @param $jql
* @param int $startAt
* @param int $maxResults
* @param array $fields
*
* @return object
*/
public function search($jql, $startAt=0, $maxResults=15, $fields=[])
{
$data = json_encode(array(
'jql' => $jql,
'startAt' => $startAt,
'maxResults' => $maxResults,
'fields' => $fields
));

$ret = $this->exec("search", $data, 'POST');

$result = $this->json_mapper->map(
json_decode($ret), new IssueSearchResult()
);

return $result;
}
}

?>
Expand Down