-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathTaskCommentApi.php
More file actions
100 lines (93 loc) · 3.68 KB
/
TaskCommentApi.php
File metadata and controls
100 lines (93 loc) · 3.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
namespace CrowdinApiClient\Api;
use CrowdinApiClient\Model\TaskComment;
use CrowdinApiClient\ModelCollection;
/**
* Manage comments on tasks within projects
*
* @package Crowdin\Api
*/
class TaskCommentApi extends AbstractApi
{
/**
* List Project Task Comments
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.getMany API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.getMany API Documentation Enterprise
*
* @param int $projectId
* @param int $taskId
* @param array $params
* integer $params[limit] Default: 25<br>
* integer $params[offset] Default: 0<br>
*
* @return ModelCollection
*/
public function list(int $projectId, int $taskId, array $params = []): ModelCollection
{
$path = sprintf('projects/%d/tasks/%d/comments', $projectId, $taskId);
return $this->_list($path, TaskComment::class, $params);
}
/**
* Get Project Task Comment
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.get API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.get API Documentation Enterprise
*
* @param int $projectId
* @param int $taskId
* @param int $commentId
* @return TaskComment|null
*/
public function get(int $projectId, int $taskId, int $commentId): ?TaskComment
{
$path = sprintf('projects/%d/tasks/%d/comments/%d', $projectId, $taskId, $commentId);
return $this->_get($path, TaskComment::class);
}
/**
* Add Project Task Comment
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.post API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.post API Documentation Enterprise
*
* @param int $projectId
* @param int $taskId
* @param array $data
* string $data[text] Text comment<br>
* integer $data[timeSpent] Time spent on the task in seconds<br>
*
* @return TaskComment|null
*/
public function create(int $projectId, int $taskId, array $data): ?TaskComment
{
$path = sprintf('projects/%d/tasks/%d/comments', $projectId, $taskId);
return $this->_create($path, TaskComment::class, $data);
}
/**
* Edit Project Task Comment
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.patch API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.patch API Documentation Enterprise
*
* @param int $projectId
* @param int $taskId
* @param TaskComment $taskComment
* @return TaskComment|null
*/
public function update(int $projectId, int $taskId, TaskComment $taskComment): ?TaskComment
{
$path = sprintf('projects/%d/tasks/%d/comments/%d', $projectId, $taskId, $taskComment->getId());
return $this->_update($path, $taskComment);
}
/**
* Delete Project Task Comment
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.delete API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.delete API Documentation Enterprise
*
* @param int $projectId
* @param int $taskId
* @param int $commentId
* @return mixed
*/
public function delete(int $projectId, int $taskId, int $commentId)
{
$path = sprintf('projects/%d/tasks/%d/comments/%d', $projectId, $taskId, $commentId);
return $this->_delete($path);
}
}