Skip to content

Commit

Permalink
add comment methods for task service
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterXuan committed Dec 10, 2017
1 parent cf00d25 commit f6027d9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Entity/Request/TaskRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class TaskRequest extends BasicRequest
'userId',
'groupId',
'type',
'variables'
'variables',
'message'
];
}
31 changes: 31 additions & 0 deletions src/Service/TaskService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,37 @@

class TaskService extends BasicService
{
public function getCommentList($taskId)
{
$this->setRequestUrl('/task/' . $taskId . '/comment')
->setRequestMethod('GET')
->setRequestContentType('QUERY')
->run();

return $this->getResponseContents();
}

public function getComment($taskId, $commentId)
{
$this->setRequestUrl('/task/' . $taskId . '/comment/' . $commentId)
->setRequestMethod('GET')
->setRequestContentType('QUERY')
->run();

return $this->getResponseContents();
}

public function createComment($taskId, $taskRequest = null)
{
$this->setRequestUrl('/task/' . $taskId . '/comment/create')
->setRequestMethod('POST')
->setRequestContentType('JSON')
->setRequestObject($taskRequest)
->run();

return $this->getResponseContents();
}

public function getIdentityLinks($taskId, $taskRequest = null)
{
$this->setRequestUrl('/task/' . $taskId . '/identity-links')
Expand Down
9 changes: 9 additions & 0 deletions tests/Service/TaskServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,13 @@ public function testCompleteTask()

echo $taskService->complete($taskId, $taskRequest);
}

public function testGetCommentList()
{
$taskService = new TaskService(self::CAMUNDA_REST_HOST);

$taskId = 'e1a2d7a6-dce0-11e7-901d-005056c00008';

var_dump($taskService->getCommentList($taskId));
}
}

0 comments on commit f6027d9

Please sign in to comment.