1 | <?php |
||
20 | class Card extends AbstractApi |
||
21 | { |
||
22 | /** |
||
23 | * Base path of cards api |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $path = 'cards'; |
||
27 | |||
28 | /** |
||
29 | * Card fields |
||
30 | * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-field |
||
31 | * @var array |
||
32 | */ |
||
33 | public static $fields = array( |
||
34 | 'badges', |
||
35 | 'checkItemStates', |
||
36 | 'closed', |
||
37 | 'dateLastActivity', |
||
38 | 'desc', |
||
39 | 'descData', |
||
40 | 'due', |
||
41 | 'email', |
||
42 | 'idBoard', |
||
43 | 'idChecklists', |
||
44 | 'idList', |
||
45 | 'idMembers', |
||
46 | 'idMembersVoted', |
||
47 | 'idShort', |
||
48 | 'idAttachmentCover', |
||
49 | 'manualCoverAttachment', |
||
50 | 'labels', |
||
51 | 'name', |
||
52 | 'pos', |
||
53 | 'shortLink', |
||
54 | 'shortUrl', |
||
55 | 'subscribed', |
||
56 | 'url', |
||
57 | ); |
||
58 | |||
59 | /** |
||
60 | * Find a card by id |
||
61 | * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink |
||
62 | * |
||
63 | * @param string $id the card's id or short link |
||
64 | * @param array $params optional attributes |
||
65 | * |
||
66 | * @return array card info |
||
67 | */ |
||
68 | 1 | public function show($id, array $params = array()) |
|
72 | |||
73 | /** |
||
74 | * Create a card |
||
75 | * @link https://trello.com/docs/api/card/#post-1-cards |
||
76 | * |
||
77 | * @param array $params optional attributes |
||
78 | * |
||
79 | * @return array card info |
||
80 | */ |
||
81 | 3 | public function create(array $params = array()) |
|
97 | |||
98 | /** |
||
99 | * Update a card |
||
100 | * @link https://trello.com/docs/api/card/#put-1-cards |
||
101 | * |
||
102 | * @param string $id the card's id or short link |
||
103 | * @param array $params card attributes to update |
||
104 | * |
||
105 | * @return array card info |
||
106 | */ |
||
107 | 1 | public function update($id, array $params = array()) |
|
111 | |||
112 | /** |
||
113 | * Set a given card's board |
||
114 | * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idboard |
||
115 | * |
||
116 | * @param string $id the card's id or short link |
||
117 | * @param string $boardId the board's id |
||
118 | * |
||
119 | * @return array board info |
||
120 | */ |
||
121 | 1 | public function setBoard($id, $boardId) |
|
125 | |||
126 | /** |
||
127 | * Get a given card's board |
||
128 | * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idboard |
||
129 | * |
||
130 | * @param string $id the card's id or short link |
||
131 | * @param array $params optional parameters |
||
132 | * |
||
133 | * @return array board info |
||
134 | */ |
||
135 | 1 | public function getBoard($id, array $params = array()) |
|
139 | |||
140 | /** |
||
141 | * Get the field of a board of a given card |
||
142 | * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-board-field |
||
143 | * |
||
144 | * @param string $id the card's id |
||
145 | * @param array $field the name of the field |
||
146 | * |
||
147 | * @return array board info |
||
148 | * |
||
149 | * @throws InvalidArgumentException if the field does not exist |
||
150 | */ |
||
151 | 2 | public function getBoardField($id, $field) |
|
157 | |||
158 | /** |
||
159 | * Set a given card's list |
||
160 | * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idlist |
||
161 | * |
||
162 | * @param string $id the card's id or short link |
||
163 | * @param string $listId the list's id |
||
164 | * |
||
165 | * @return array list info |
||
166 | */ |
||
167 | 1 | public function setList($id, $listId) |
|
171 | |||
172 | /** |
||
173 | * Get a given card's list |
||
174 | * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-list |
||
175 | * |
||
176 | * @param string $id the card's id or short link |
||
177 | * @param array $params optional parameters |
||
178 | * |
||
179 | * @return array list info |
||
180 | */ |
||
181 | 1 | public function getList($id, array $params = array()) |
|
185 | |||
186 | /** |
||
187 | * Get the field of a list of a given card |
||
188 | * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-list-field |
||
189 | * |
||
190 | * @param string $id the card's id |
||
191 | * @param array $field the name of the field |
||
192 | * |
||
193 | * @return array board info |
||
194 | * |
||
195 | * @throws InvalidArgumentException if the field does not exist |
||
196 | */ |
||
197 | 2 | public function getListField($id, $field) |
|
203 | |||
204 | /** |
||
205 | * Set a given card's name |
||
206 | * @link https://trello.com/docs/api/card/#put-1-cards-card-id-name |
||
207 | * |
||
208 | * @param string $id the card's id or short link |
||
209 | * @param string $name the name |
||
210 | * |
||
211 | * @return array card info |
||
212 | */ |
||
213 | 1 | public function setName($id, $name) |
|
217 | |||
218 | /** |
||
219 | * Set a given card's description |
||
220 | * @link https://trello.com/docs/api/card/#put-1-cards-card-id-desc |
||
221 | * |
||
222 | * @param string $id the card's id or short link |
||
223 | * @param string $description the description |
||
224 | * |
||
225 | * @return array card info |
||
226 | */ |
||
227 | 1 | public function setDescription($id, $description) |
|
231 | |||
232 | /** |
||
233 | * Set a given card's state |
||
234 | * @link https://trello.com/docs/api/card/#put-1-cards-card-id-closed |
||
235 | * |
||
236 | * @param string $id the card's id or short link |
||
237 | * @param bool $closed whether the card should be closed or not |
||
238 | * |
||
239 | * @return array card info |
||
240 | */ |
||
241 | 1 | public function setClosed($id, $closed = true) |
|
245 | |||
246 | /** |
||
247 | * Set a given card's due date |
||
248 | * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-due |
||
249 | * |
||
250 | * @param string $id the card's id or short link |
||
251 | * @param \DateTime $date the due date |
||
252 | * |
||
253 | * @return array card info |
||
254 | */ |
||
255 | 1 | public function setDueDate($id, \DateTime $date = null) |
|
259 | |||
260 | /** |
||
261 | * Set a given card's position |
||
262 | * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-pos |
||
263 | * |
||
264 | * @param string $id the card's id or short link |
||
265 | * @param string|integer $position the position, eg. 'top', 'bottom' |
||
266 | * or a positive number |
||
267 | * |
||
268 | * @return array card info |
||
269 | */ |
||
270 | 1 | public function setPosition($id, $position) |
|
274 | |||
275 | /** |
||
276 | * Set a given card's subscription state |
||
277 | * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-subscribed |
||
278 | * |
||
279 | * @param string $id the list's id |
||
280 | * @param bool $subscribed subscription state |
||
281 | * |
||
282 | * @return array list info |
||
283 | */ |
||
284 | 1 | public function setSubscribed($id, $subscribed) |
|
288 | |||
289 | /** |
||
290 | * Actions API |
||
291 | * |
||
292 | * @return Card\Actions |
||
293 | */ |
||
294 | 1 | public function actions() |
|
298 | |||
299 | /** |
||
300 | * Attachments API |
||
301 | * |
||
302 | * @return Card\Attachments |
||
303 | */ |
||
304 | 1 | public function attachments() |
|
308 | |||
309 | /** |
||
310 | * Checklists API |
||
311 | * |
||
312 | * @return Card\Checklists |
||
313 | */ |
||
314 | 1 | public function checklists() |
|
318 | |||
319 | /** |
||
320 | * Labels API |
||
321 | * |
||
322 | * @return Card\Labels |
||
323 | */ |
||
324 | 1 | public function labels() |
|
328 | |||
329 | /** |
||
330 | * Members API |
||
331 | * |
||
332 | * @return Card\Members |
||
333 | */ |
||
334 | 1 | public function members() |
|
338 | |||
339 | /** |
||
340 | * Stickers API |
||
341 | * |
||
342 | * @return Card\Stickers |
||
343 | */ |
||
344 | 1 | public function stickers() |
|
348 | } |
||
349 |