Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Issue/IssueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,26 @@ public function getWorklogById(string $issueIdOrKey, int $workLogId): Worklog
);
}

/**
* @param array<int> $ids
*
* @return array<Worklog>
*/
public function getWorklogsByIds(array $ids): array
{
$ret = $this->exec('/worklog/list', json_encode(['ids' => $ids]), 'POST');

$this->log->debug("getWorklogsByIds res=$ret\n");

$worklogsResponse = json_decode($ret, false, 512, JSON_THROW_ON_ERROR);

$worklogs = array_map(function ($worklog) {
return $this->json_mapper->map($worklog, new Worklog());
}, $worklogsResponse);

return $worklogs;
}

/**
* add work log to issue.
*
Expand Down
16 changes: 16 additions & 0 deletions tests/WorkLogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ public function testGetWorkLogById($workLogid)
}
}

/**
* @depends testUpdateWorkLogInIssue
*/
public function testGetWorkLogsByIds($workLogid)
{
try {
$issueService = new IssueService();

$worklogs = $issueService->getWorklogsByIds([$workLogid]);

Dumper::dump($worklogs);
} catch (JiraException $e) {
$this->assertTrue(false, 'testGetWorkLogsByIds Failed : '.$e->getMessage());
}
}

/**
* @depends testUpdateWorkLogInIssue
*/
Expand Down