|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Trello\Api\Board; |
|
4
|
|
|
|
|
5
|
|
|
use Trello\Api\AbstractApi; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Trello Board Cards API |
|
9
|
|
|
* @link https://trello.com/docs/api/board |
|
10
|
|
|
* |
|
11
|
|
|
* Fully implemented. |
|
12
|
|
|
*/ |
|
13
|
|
|
class Cards extends AbstractApi |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* Base path of board cards api |
|
17
|
|
|
* @var string |
|
18
|
|
|
*/ |
|
19
|
|
|
protected $path = 'boards/#id#/cards'; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Get cards related to a given board |
|
23
|
|
|
* @link https://trello.com/docs/api/board/#get-1-boards-board-id-cards |
|
24
|
|
|
* |
|
25
|
|
|
* @param string $id the board's |
|
26
|
|
|
* @param array $params optional parameters |
|
27
|
|
|
* |
|
28
|
|
|
* @return array |
|
29
|
|
|
*/ |
|
30
|
1 |
|
public function all($id, array $params = array()) |
|
31
|
|
|
{ |
|
32
|
1 |
|
return $this->get($this->getPath($id), $params); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Filter cards related to a given board |
|
37
|
|
|
* @link https://trello.com/docs/api/board/#get-1-boards-board-id-cards-filter |
|
38
|
|
|
* |
|
39
|
|
|
* @param string $id the board's id |
|
40
|
|
|
* @param string|array $filter array of / one of 'all', 'visible', 'none', 'open', 'closed' |
|
41
|
|
|
* |
|
42
|
|
|
* @return array |
|
43
|
|
|
*/ |
|
44
|
3 |
|
public function filter($id, $filter = 'all') |
|
45
|
|
|
{ |
|
46
|
3 |
|
$allowed = array('all', 'visible', 'none', 'open', 'closed'); |
|
47
|
3 |
|
$filter = $this->validateAllowedParameters($allowed, $filter, 'filter'); |
|
48
|
|
|
|
|
49
|
3 |
|
return $this->get($this->getPath($id).'/'.implode(',', $filter)); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Get a card related to a given board |
|
54
|
|
|
* @link https://trello.com/docs/api/board/#get-1-boards-board-id-cards-idcard |
|
55
|
|
|
* |
|
56
|
|
|
* @param string $id the board's id |
|
57
|
|
|
* @param string $cardId the card's id |
|
58
|
|
|
* |
|
59
|
|
|
* @return array |
|
60
|
|
|
*/ |
|
61
|
1 |
|
public function show($id, $cardId) |
|
62
|
|
|
{ |
|
63
|
1 |
|
return $this->get($this->getPath($id).'/'.rawurlencode($cardId)); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|