1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Trello\Api\Card; |
4
|
|
|
|
5
|
|
|
use Trello\Api\AbstractApi; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Trello Card Actions API |
9
|
|
|
* @link https://trello.com/docs/api/card |
10
|
|
|
* |
11
|
|
|
* Fully implemented. |
12
|
|
|
*/ |
13
|
|
|
class Actions extends AbstractApi |
14
|
|
|
{ |
15
|
|
|
protected $path = 'cards/#id#/actions'; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Get actions related to a given card |
19
|
|
|
* @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-actions |
20
|
|
|
* |
21
|
|
|
* @param string $id the card's id or short link |
22
|
|
|
* @param array $params optional parameters |
23
|
|
|
* |
24
|
|
|
* @return array |
25
|
|
|
*/ |
26
|
1 |
|
public function all($id, array $params = array()) |
27
|
|
|
{ |
28
|
1 |
|
return $this->get($this->getPath($id), $params); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Add comment to a given card |
33
|
|
|
* @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-actions-comments |
34
|
|
|
* |
35
|
|
|
* @param string $id the card's id or short link |
36
|
|
|
* @param string $text comment message |
37
|
|
|
* |
38
|
|
|
* @return array |
39
|
|
|
*/ |
40
|
1 |
|
public function addComment($id, $text) |
41
|
|
|
{ |
42
|
1 |
|
return $this->post($this->getPath($id).'/comments', array('text' => $text)); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Remove comment to a given card |
47
|
|
|
* @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-actions-idaction-comments |
48
|
|
|
* |
49
|
|
|
* @param string $id the card's id or short link |
50
|
|
|
* @param string $commentId the comment's id |
51
|
|
|
* |
52
|
|
|
* @return array |
53
|
|
|
*/ |
54
|
1 |
|
public function removeComment($id, $commentId) |
55
|
|
|
{ |
56
|
1 |
|
return $this->delete($this->getPath($id).'/'.rawurlencode($commentId).'/comments'); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Update comment to a given card |
61
|
|
|
* @link https://trello.com/docs/api/card/index.html#put-1-cards-card-id-or-shortlink-actions-idaction-comments |
62
|
|
|
* |
63
|
|
|
* @param string $id the card's id or short link |
64
|
|
|
* @param string $commentId the comment's id |
65
|
|
|
* @param string $text the new comment text |
66
|
|
|
* @return array |
67
|
|
|
*/ |
68
|
|
|
public function updateComment($id, $commentId, $text) |
69
|
|
|
{ |
70
|
|
|
return $this->put($this->getPath($id).'/'.rawurlencode($commentId).'/comments', array('text' => $text)); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|