From 4b9d1c40048c9367eadc998cbd66c89054ae63da Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 09:47:53 +0200 Subject: [PATCH 01/55] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index a0b2dfc..f4c2ff0 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "name": "cdaguerre/php-trello-api", "type": "library", - "description": "Trello API v1 client", - "homepage": "https://github.com/cdaguerre/php-trello-api", + "description": "Trello API v1 client-adjusted", + "homepage": "https://github.com/rtvisser/php-trello-api", "keywords": ["trello"], "license": "MIT", "authors": [ From b385cc2061cd2278e9765f137d57862707214628 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 09:48:37 +0200 Subject: [PATCH 02/55] Update Card.php --- lib/Trello/Api/Card.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 5c45e16..ce92c99 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -9,6 +9,7 @@ * @link https://trello.com/docs/api/card * * Unimplemented: + * updated by Reinder * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-name * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-pos * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-state @@ -283,6 +284,21 @@ public function setSubscribed($id, $subscribed) return $this->put($this->getPath().'/'.rawurlencode($id).'/subscribed', array('value' => $subscribed)); } + + /** + * Set a given card's memberId state + * @link tbd + * + * @param string $id the list's id + * @param bool $memberId comma seperated list of responsible members + * + * @return array list info + */ + public function setIdMembers($id, $idMembers) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/idMembers', array('value' => $idMembers)); + } + /** * Actions API * From 2ee634954c7ed2aff20f7038322a3939fa3b7033 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 09:56:01 +0200 Subject: [PATCH 03/55] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f4c2ff0..c9b8180 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "cdaguerre/php-trello-api", "type": "library", "description": "Trello API v1 client-adjusted", - "homepage": "https://github.com/rtvisser/php-trello-api", + "homepage": "https://github.com/cdaguerre/php-trello-api", "keywords": ["trello"], "license": "MIT", "authors": [ From 000e6b4b3e9fee6e2b9e9c4504fadc93f772bafa Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 10:00:13 +0200 Subject: [PATCH 04/55] Update Card.php removed comment --- lib/Trello/Api/Card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index ce92c99..4fd304c 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -9,7 +9,6 @@ * @link https://trello.com/docs/api/card * * Unimplemented: - * updated by Reinder * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-name * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-pos * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-state From 62a94372628cf5b880ae56a2b86d4c30b58bb776 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 10:49:03 +0200 Subject: [PATCH 05/55] Update Card.php Added functions to update checklist item name, position and state --- lib/Trello/Api/Card.php | 52 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 4fd304c..ab0aa85 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -285,11 +285,11 @@ public function setSubscribed($id, $subscribed) /** - * Set a given card's memberId state + * Set a given card's memberId * @link tbd * * @param string $id the list's id - * @param bool $memberId comma seperated list of responsible members + * @param string $memberId comma seperated list of responsible members * * @return array list info */ @@ -297,6 +297,54 @@ public function setIdMembers($id, $idMembers) { return $this->put($this->getPath().'/'.rawurlencode($id).'/idMembers', array('value' => $idMembers)); } + +/** + * Set a given checklist item name + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-name + * + * @param string $cardId the cards's id + * @param string $checkListId the checklist's id + * @param string $itemId the item's id + * @param string $name new name value + * + * @return array list info + */ + public function setCheckListItemName($cardId,$checkListId,$itemId, $name) + { + return $this->put($this->getPath().'/'.rawurlencode($cardId).'/checklist/'.rawurlencode($checkListId).'/checkItem/'.rawurlencode($itemId).'/name', array('value' => $name)); + } + + /** + * Set a given checklist item position + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-pos + * + * @param string $cardId the cards's id + * @param string $checkListId the checklist's id + * @param string $itemId the item's id + * @param string $name new position value + * + * @return array list info + */ + public function setCheckListItemPosition($cardId,$checkListId,$itemId, $position) + { + return $this->put($this->getPath().'/'.rawurlencode($cardId).'/checklist/'.rawurlencode($checkListId).'/checkItem/'.rawurlencode($itemId).'/pos', array('value' => $position)); + } + + /** + * Set a given checklist item complete state + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-state + * + * @param string $cardId the cards's id + * @param string $checkListId the checklist's id + * @param string $itemId the item's id + * @param bool $complete new complete value, defaults to true + * + * @return array list info + */ + public function setCheckListItemState($cardId,$checkListId,$itemId, $complete = true) + { + return $this->put($this->getPath().'/'.rawurlencode($cardId).'/checklist/'.rawurlencode($checkListId).'/checkItem/'.rawurlencode($itemId).'/state', array('value' => $complete)); + } /** * Actions API From 88a9c790d5edbc2343b19bfb4c34b2f8c1767762 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 11:21:13 +0200 Subject: [PATCH 06/55] Update Card.php Updated naming of state to closed to be in line with naming convention of the api --- lib/Trello/Api/Card.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index ab0aa85..1df1c68 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -9,9 +9,6 @@ * @link https://trello.com/docs/api/card * * Unimplemented: - * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-name - * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-pos - * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-state * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklistcurrent-checkitem-idcheckitem * - https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem * - https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-converttocard @@ -331,7 +328,7 @@ public function setCheckListItemPosition($cardId,$checkListId,$itemId, $position } /** - * Set a given checklist item complete state + * Set a given checklist item closed state * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-state * * @param string $cardId the cards's id @@ -341,7 +338,7 @@ public function setCheckListItemPosition($cardId,$checkListId,$itemId, $position * * @return array list info */ - public function setCheckListItemState($cardId,$checkListId,$itemId, $complete = true) + public function setCheckListItemClosed($cardId,$checkListId,$itemId, $complete = true) { return $this->put($this->getPath().'/'.rawurlencode($cardId).'/checklist/'.rawurlencode($checkListId).'/checkItem/'.rawurlencode($itemId).'/state', array('value' => $complete)); } From 9679ab17243e506759eae8c1bbb45bd248175707 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 16:37:44 +0200 Subject: [PATCH 07/55] Update Card.php Added function to create a checklist item based on trello API --- lib/Trello/Api/Card.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 1df1c68..8696f0b 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -88,6 +88,24 @@ public function create(array $params = array()) return $this->post($this->getPath(), $params); } + + /** + * Create a checklist Item + * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem + * + * @param string $cardId id of the card the item is added to + * @param string $checkListId id of the checklist the item is added to + * @param array $params optional attributes + * + * @return array card info + */ + + public function createCheckListItem($cardId, $checkListId, $params = Array()){ + + $this->validateRequiredParameters(array('idCheckList', 'name'), $params); + + return $this->post($this->getPath().'/'.rawurlencode($cardId).'/checklist/'.rawurlencode($checkListId).'/checkItem', $params); + } /** * Update a card From 4b8eb5e60a0b52d3ff5c6f027c01b49922afb621 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 16:47:31 +0200 Subject: [PATCH 08/55] Update Card.php updated comments, removed checkitem url from unimplemented functions --- lib/Trello/Api/Card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 8696f0b..c89bc22 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -10,7 +10,6 @@ * * Unimplemented: * - https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklistcurrent-checkitem-idcheckitem - * - https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem * - https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-converttocard * - https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-markassociatednotificationsread */ From c1ef49dd1fbedcaa39e0966539e8037ee40ff60f Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 16:54:35 +0200 Subject: [PATCH 09/55] Update Card.php typo in checkList --- lib/Trello/Api/Card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index c89bc22..cb64ae3 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -101,7 +101,7 @@ public function create(array $params = array()) public function createCheckListItem($cardId, $checkListId, $params = Array()){ - $this->validateRequiredParameters(array('idCheckList', 'name'), $params); + $this->validateRequiredParameters(array('idChecklist', 'name'), $params); return $this->post($this->getPath().'/'.rawurlencode($cardId).'/checklist/'.rawurlencode($checkListId).'/checkItem', $params); } From d2f88e149b11eda6bfb4b6a3b4295bfc028b1f3a Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 Aug 2015 17:34:45 +0200 Subject: [PATCH 10/55] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c9b8180..a0b2dfc 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "cdaguerre/php-trello-api", "type": "library", - "description": "Trello API v1 client-adjusted", + "description": "Trello API v1 client", "homepage": "https://github.com/cdaguerre/php-trello-api", "keywords": ["trello"], "license": "MIT", From 0febe7d8b5281e64cc6954c2d8d4c29da9c2803c Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 26 Aug 2015 10:20:49 +0200 Subject: [PATCH 11/55] Update Card.php Fixed 2 documentation bugs found by scrutinizer, added update checklist Item by parameter function --- lib/Trello/Api/Card.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index cb64ae3..fa6cc70 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -303,7 +303,7 @@ public function setSubscribed($id, $subscribed) * @link tbd * * @param string $id the list's id - * @param string $memberId comma seperated list of responsible members + * @param string $idMembers comma seperated list of responsible members * * @return array list info */ @@ -335,7 +335,7 @@ public function setCheckListItemName($cardId,$checkListId,$itemId, $name) * @param string $cardId the cards's id * @param string $checkListId the checklist's id * @param string $itemId the item's id - * @param string $name new position value + * @param string $position new position value * * @return array list info */ @@ -360,6 +360,23 @@ public function setCheckListItemClosed($cardId,$checkListId,$itemId, $complete = return $this->put($this->getPath().'/'.rawurlencode($cardId).'/checklist/'.rawurlencode($checkListId).'/checkItem/'.rawurlencode($itemId).'/state', array('value' => $complete)); } + /** + * Update checklist item by parameter array + * @link https://trello.com/docs/api/card/index.html#put-1-cards-card-id-or-shortlink-checklist-idchecklistcurrent-checkitem-idcheckitem + * + * @param string $cardId the cards's id + * @param string $checkListId the checklist's id + * @param string $itemId the item's id + * @param array $params item attributes to update + * + * @return array list info + */ + public function updateCheckListItem($cardId,$checkListId,$itemId, $params = array()) + { + return $this->put($this->getPath().'/'.rawurlencode($cardId).'/checklist/'.rawurlencode($checkListId).'/checkItem/'.rawurlencode($itemId), $params); + } + + /** * Actions API * From e93fdfa5582590ebc7a921b19d1793b3801c2c82 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Thu, 27 Aug 2015 10:28:33 +0200 Subject: [PATCH 12/55] Update Card.php added function to get checkitem states --- lib/Trello/Api/Card.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index fa6cc70..148646c 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -166,6 +166,19 @@ public function getBoardField($id, $field) return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); } + /** + * Get the checkitemstates, for now will return the full list of checkitem states; + * @link https://trello.com/docs/api/card/index.html#get-1-cards-card-id-or-shortlink-checkitemstates + * + * @param string $id the card's id or short link + * + * @return array list info + */ + public function getCheckItemStates($id){ + + return $this->put($this->getPath().'/'.rawurlencode($id).'/checkItemStates', array('value' => 'all')); + } + /** * Set a given card's list * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idlist From b8a595f6c2ee090c65d38a05e33e825d3c5d1de4 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Thu, 27 Aug 2015 11:09:23 +0200 Subject: [PATCH 13/55] Update Card.php incorrect http method put, updated to get --- lib/Trello/Api/Card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 148646c..ff8e944 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -176,7 +176,7 @@ public function getBoardField($id, $field) */ public function getCheckItemStates($id){ - return $this->put($this->getPath().'/'.rawurlencode($id).'/checkItemStates', array('value' => 'all')); + return $this->get($this->getPath().'/'.rawurlencode($id).'/checkItemStates', array('value' => 'all')); } /** From 90bb736ad9312d19339c033b63b974694fbc5ec5 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Thu, 27 Aug 2015 17:15:07 +0200 Subject: [PATCH 14/55] Update Checklist.php Added function to remove list item --- lib/Trello/Api/Checklist.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/Trello/Api/Checklist.php b/lib/Trello/Api/Checklist.php index be3e783..6a2280f 100644 --- a/lib/Trello/Api/Checklist.php +++ b/lib/Trello/Api/Checklist.php @@ -86,6 +86,20 @@ public function remove($id) return $this->delete($this->getPath().'/'.rawurlencode($id)); } + /** + * Remove a listitem from a checklist + * @link https://trello.com/docs/api/checklist/index.html#delete-1-checklists-idchecklist-checkitems-idcheckitem + * + * @param string $checkListId the checklist's id + * @param string $listItemId the listItem id + * + * @return array + */ + public function removeListItem($checkListId, $listItemId) + { + return $this->delete($this->getPath().'/'.rawurlencode($checkListId).'/checkItems/'.rawuurlencode($listItemId)); + } + /** * Get the board of a given checklist * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-board From 9046ba0dec2d19e70bb00fae156a0e91fa2968ec Mon Sep 17 00:00:00 2001 From: rtvisser Date: Thu, 27 Aug 2015 17:20:37 +0200 Subject: [PATCH 15/55] Update Checklist.php typo rawurlencode --- lib/Trello/Api/Checklist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Checklist.php b/lib/Trello/Api/Checklist.php index 6a2280f..4870cc1 100644 --- a/lib/Trello/Api/Checklist.php +++ b/lib/Trello/Api/Checklist.php @@ -97,7 +97,7 @@ public function remove($id) */ public function removeListItem($checkListId, $listItemId) { - return $this->delete($this->getPath().'/'.rawurlencode($checkListId).'/checkItems/'.rawuurlencode($listItemId)); + return $this->delete($this->getPath().'/'.rawurlencode($checkListId).'/checkItems/'.rawurlencode($listItemId)); } /** From 1d80e9767867e31eb45c6322e1ecac448ffe9ddf Mon Sep 17 00:00:00 2001 From: rtvisser Date: Sat, 29 Aug 2015 20:53:13 +0200 Subject: [PATCH 16/55] Update Card.php Added function to retrieve the card members --- lib/Trello/Api/Card.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index ff8e944..46cd52b 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -179,6 +179,17 @@ public function getCheckItemStates($id){ return $this->get($this->getPath().'/'.rawurlencode($id).'/checkItemStates', array('value' => 'all')); } + /** + * Get the members; + * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-members + * + * @param string $id the card's id or short link + * + * @return array list info + */ + public function getMembers($id){ + return $this->get($this->getPath().'/'.rawurlencode($id).'/members', array('value' => 'all')); + } /** * Set a given card's list * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idlist From 71b9e9c36e784d900e84417d969833de59b9b12d Mon Sep 17 00:00:00 2001 From: rtvisser Date: Fri, 11 Sep 2015 19:38:04 +0200 Subject: [PATCH 17/55] Update Actions.php issue with removeComment, targetUrl not correct --- lib/Trello/Api/Card/Actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index a87032b..fe34e98 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -53,6 +53,6 @@ public function addComment($id, $text) */ public function removeComment($id, $commentId) { - return $this->delete($this->getPath($id).'/comments/'.rawurlencode($commentId)); + return $this->delete($this->getPath($id).rawurlencode($commentId).'/comments'); } } From 562808100aac9ff10ab10192a7a698e6156da509 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Fri, 11 Sep 2015 19:44:34 +0200 Subject: [PATCH 18/55] Update Actions.php test for updating the comment --- lib/Trello/Api/Card/Actions.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index fe34e98..d74e72b 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -55,4 +55,19 @@ public function removeComment($id, $commentId) { return $this->delete($this->getPath($id).rawurlencode($commentId).'/comments'); } + + /** + * Update comment to a given card + * @link undocumented + * + * @param string $id the card's id or short link + * @param string $commentId the comment's id + * @param string $text the new comment text + * @return array + */ + public function updateComment($id, $commentId, $text) + { + return $this->put($this->getPath($id).rawurlencode($commentId).'/comments', array('text' => $text)); + } + } From 95c58fc211325b0efa355457a03101307f7a066c Mon Sep 17 00:00:00 2001 From: rtvisser Date: Fri, 11 Sep 2015 19:47:49 +0200 Subject: [PATCH 19/55] Update Actions.php type on url --- lib/Trello/Api/Card/Actions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index d74e72b..20c17c4 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -53,7 +53,7 @@ public function addComment($id, $text) */ public function removeComment($id, $commentId) { - return $this->delete($this->getPath($id).rawurlencode($commentId).'/comments'); + return $this->delete($this->getPath($id).'/'.rawurlencode($commentId).'/comments'); } /** @@ -67,7 +67,7 @@ public function removeComment($id, $commentId) */ public function updateComment($id, $commentId, $text) { - return $this->put($this->getPath($id).rawurlencode($commentId).'/comments', array('text' => $text)); + return $this->put($this->getPath($id).'/'.rawurlencode($commentId).'/comments', array('text' => $text)); } } From f6c53251f5bbec0239ca1dedf624ddf44a96f202 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Fri, 11 Sep 2015 20:07:13 +0200 Subject: [PATCH 20/55] Update Actions.php Added url to documentation for updateComment function --- lib/Trello/Api/Card/Actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index 20c17c4..63ebfae 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -58,7 +58,7 @@ public function removeComment($id, $commentId) /** * Update comment to a given card - * @link undocumented + * @link https://trello.com/docs/api/card/index.html#put-1-cards-card-id-or-shortlink-actions-idaction-comments * * @param string $id the card's id or short link * @param string $commentId the comment's id From b8e0ebd189d3ef0d4e007e9027932ae77c420aa9 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Mon, 14 Sep 2015 10:34:05 +0200 Subject: [PATCH 21/55] Update Actions.php Test to get the card's comments --- lib/Trello/Api/Card/Actions.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index 63ebfae..fc86aec 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -28,6 +28,20 @@ public function all($id, array $params = array()) return $this->get($this->getPath($id), $params); } + /** + * Get comments related to a given card + * NOTE: ONDOCUMENTED TEST + * + * @param string $id the card's id or short link + * @param array $params optional parameters + * + * @return array + */ + public function getComments($id $params) + { + return $this->get($this->getPath($id).'/comments', $params); + } + /** * Add comment to a given card * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-actions-comments From 30ecdda9d0717abfef79c9c207d172ab075ed1ed Mon Sep 17 00:00:00 2001 From: rtvisser Date: Mon, 14 Sep 2015 10:37:10 +0200 Subject: [PATCH 22/55] Update Actions.php --- lib/Trello/Api/Card/Actions.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index fc86aec..100fea9 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -27,20 +27,6 @@ public function all($id, array $params = array()) { return $this->get($this->getPath($id), $params); } - - /** - * Get comments related to a given card - * NOTE: ONDOCUMENTED TEST - * - * @param string $id the card's id or short link - * @param array $params optional parameters - * - * @return array - */ - public function getComments($id $params) - { - return $this->get($this->getPath($id).'/comments', $params); - } /** * Add comment to a given card From 513bd40c211f218f5ee8a5f11fff7ef1e2844be7 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 3 Nov 2015 21:16:04 +0100 Subject: [PATCH 23/55] Update Labels.php update to add and remove label by label id --- lib/Trello/Api/Card/Labels.php | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/Trello/Api/Card/Labels.php b/lib/Trello/Api/Card/Labels.php index a8cfbfd..201a425 100644 --- a/lib/Trello/Api/Card/Labels.php +++ b/lib/Trello/Api/Card/Labels.php @@ -38,6 +38,25 @@ public function set($id, array $labels) return $this->put($this->getPath($id), array('value' => $labels)); } + + /** + * Set a given card's label by labelId + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-labels + * + * @param string $id the card's id or short link + * @param string $labelId the label id + * + * @return array card info + * + * @throws InvalidArgumentException If a label does not exist + */ + public function setById($id, $labelId) + { + //first set the right path based on the documentation; + $this->path = 'cards/#id#/idLabels'; + + return $this->post($this->getPath($id), array('value' => $labelId)); + } /** * Remove a given label from a given card @@ -58,4 +77,21 @@ public function remove($id, $label) return $this->delete($this->getPath($id).'/'.rawurlencode($label)); } + + /** + * Remove a given label from a given card based on the label id + * @link https://developers.trello.com/advanced-reference/card#delete-1-cards-card-id-or-shortlink-idlabels-idlabel + * + * @param string $id the card's id or short link + * @param string $labelId the label id to remove + * + * @return array card info + * + * @throws InvalidArgumentException If a label does not exist + */ + public function removeById($id, $labelId) + { + $this->path = 'cards/#id#/idLabels'; + return $this->delete($this->getPath($id).'/'.rawurlencode($labelId)); + } } From faeaa9f4d0ba0432fc26e967212f3de57b4d5c95 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Fri, 28 Apr 2017 17:07:27 +0200 Subject: [PATCH 24/55] add a member to the board by memberId - add() --- lib/Trello/Api/Board/Members.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/Trello/Api/Board/Members.php b/lib/Trello/Api/Board/Members.php index f1cc6c2..8091936 100644 --- a/lib/Trello/Api/Board/Members.php +++ b/lib/Trello/Api/Board/Members.php @@ -47,6 +47,25 @@ public function remove($id, $memberId) { return $this->delete($this->getPath($id).'/'.$memberId); } + + /** + * Add a given member from a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members + * + * @param string $id the board's id + * @param string $memberId the member's id + * + * @return array + */ + public function add($id, $memberId, $role = 'normal') + { + $params = array( + 'idMember' => $memberId, + 'type' => $role, + ); + + return $this->put($this->getPath($id).'/'.$memberId, $params); + } /** * Filter members related to a given board From 7567d171f0c995a6def4ba9d17920d99914897dd Mon Sep 17 00:00:00 2001 From: rtvisser Date: Fri, 28 Apr 2017 17:43:31 +0200 Subject: [PATCH 25/55] add label by color and name to board --- lib/Trello/Api/Board/Labels.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/Trello/Api/Board/Labels.php b/lib/Trello/Api/Board/Labels.php index f924f76..6ca1f5a 100644 --- a/lib/Trello/Api/Board/Labels.php +++ b/lib/Trello/Api/Board/Labels.php @@ -56,6 +56,27 @@ public function show($id, $color) return $this->get($this->getPath($id).'/'.rawurlencode($color)); } + /** + * Add a label related to a given board + * @link https://developers.trello.com/advanced-reference/board#post-1-boards-board-id-labels + * + * @param string $id the board's id + * @param string $color the label's color + * @param string $name the label's name + * + * @return array + */ + public function add($id, $color, $name) + { + + $params = array( + 'color' => $color, + 'name' => $name + ); + + return $this->post($this->getPath($id).'/'.rawurlencode($color), $params); + } + /** * Set a label's name on a given board and for a given color * @link https://trello.com/docs/api/board/#put-1-boards-board-id-labelnames-blue From d32e4fa3be13e93ae7327962dcec761d11cee884 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Fri, 28 Apr 2017 17:51:43 +0200 Subject: [PATCH 26/55] fixed endpoint in add label to board function --- lib/Trello/Api/Board/Labels.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Board/Labels.php b/lib/Trello/Api/Board/Labels.php index 6ca1f5a..095b9d7 100644 --- a/lib/Trello/Api/Board/Labels.php +++ b/lib/Trello/Api/Board/Labels.php @@ -74,7 +74,7 @@ public function add($id, $color, $name) 'name' => $name ); - return $this->post($this->getPath($id).'/'.rawurlencode($color), $params); + return $this->post($this->getPath($id), $params); } /** From 31cbf96324ee4a192a3221c76f4625a56d3b54a0 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Sat, 29 Apr 2017 14:44:12 +0200 Subject: [PATCH 27/55] increased timeout counter for httpclient --- lib/Trello/HttpClient/HttpClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index fda62e8..bdb4d98 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -17,7 +17,7 @@ class HttpClient implements HttpClientInterface protected $options = array( 'base_url' => 'https://api.trello.com/', 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', - 'timeout' => 10, + 'timeout' => 50, 'api_version' => 1, ); From b67607d4ac89d84e0225c2f0cab5bbc409f08cf4 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 09:56:11 +0200 Subject: [PATCH 28/55] Added actions to add/remove/update checklist items --- lib/Trello/Api/Card/Actions.php | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index 100fea9..647f6bc 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -70,4 +70,46 @@ public function updateComment($id, $commentId, $text) return $this->put($this->getPath($id).'/'.rawurlencode($commentId).'/comments', array('text' => $text)); } + /** + * Get checkitem from a given card + * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-2 + * + * @param string $id the card's id or short link + * @param string $checkItemId the check item id + * @param array $params the parameter array to retrieve, default is to retrieve all fields + * + * @return array + */ + public function getCheckItem($id, $checkItemId, array $params = array('fields'=> 'all')) + { + return $this->get($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId), $params); + } + + /** + * Update checkItem for a given card + * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-1 + * + * @param string $id the card's id or short link + * @param string $checkItemId the check item id + * @param array $updateFields the fields that should be updated + * @return array + */ + public function updateComment($id, $commentId, array $updateFields = array()) + { + return $this->put($this->getPath($id).'/'.rawurlencode($commentId).'/comments', $updateFields); + } + + /** + * Remove checkitem from a given card + * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-2 + * + * @param string $id the card's id or short link + * @param string $checkItemId the checklist item id + * + * @return array + */ + public function removeCheckItem($id, $checkItemId) + { + return $this->delete($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId)); + } } From b3acbb83c7063da8bf133a51f02041332f011b68 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 10:09:34 +0200 Subject: [PATCH 29/55] Fixed type in function name --- lib/Trello/Api/Card/Actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index 647f6bc..880c0ca 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -94,7 +94,7 @@ public function getCheckItem($id, $checkItemId, array $params = array('fields'=> * @param array $updateFields the fields that should be updated * @return array */ - public function updateComment($id, $commentId, array $updateFields = array()) + public function updateCheckItem($id, $commentId, array $updateFields = array()) { return $this->put($this->getPath($id).'/'.rawurlencode($commentId).'/comments', $updateFields); } From d9ec2fb54cae9350036c7d77f31341f375f7e21c Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 10:37:21 +0200 Subject: [PATCH 30/55] reverted changes --- lib/Trello/Api/Card/Actions.php | 43 --------------------------------- 1 file changed, 43 deletions(-) diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index 880c0ca..a57e926 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -69,47 +69,4 @@ public function updateComment($id, $commentId, $text) { return $this->put($this->getPath($id).'/'.rawurlencode($commentId).'/comments', array('text' => $text)); } - - /** - * Get checkitem from a given card - * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-2 - * - * @param string $id the card's id or short link - * @param string $checkItemId the check item id - * @param array $params the parameter array to retrieve, default is to retrieve all fields - * - * @return array - */ - public function getCheckItem($id, $checkItemId, array $params = array('fields'=> 'all')) - { - return $this->get($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId), $params); - } - - /** - * Update checkItem for a given card - * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-1 - * - * @param string $id the card's id or short link - * @param string $checkItemId the check item id - * @param array $updateFields the fields that should be updated - * @return array - */ - public function updateCheckItem($id, $commentId, array $updateFields = array()) - { - return $this->put($this->getPath($id).'/'.rawurlencode($commentId).'/comments', $updateFields); - } - - /** - * Remove checkitem from a given card - * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-2 - * - * @param string $id the card's id or short link - * @param string $checkItemId the checklist item id - * - * @return array - */ - public function removeCheckItem($id, $checkItemId) - { - return $this->delete($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId)); - } } From bd8747fc6d06976652dc847f64e11c84b1bdd87d Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 10:39:52 +0200 Subject: [PATCH 31/55] Get/Update/Delete checklist items from card --- lib/Trello/Api/Card.php | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 46cd52b..70ab780 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -400,6 +400,48 @@ public function updateCheckListItem($cardId,$checkListId,$itemId, $params = arra return $this->put($this->getPath().'/'.rawurlencode($cardId).'/checklist/'.rawurlencode($checkListId).'/checkItem/'.rawurlencode($itemId), $params); } + /** + * Get checkitem from a given card + * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-2 + * + * @param string $id the card's id or short link + * @param string $checkItemId the check item id + * @param array $params the parameter array to retrieve, default is to retrieve all fields + * + * @return array + */ + public function getCheckItem($id, $checkItemId, array $params = array('fields'=> 'all')) + { + return $this->get($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId), $params); + } + + /** + * Update checkItem for a given card + * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-1 + * + * @param string $id the card's id or short link + * @param string $checkItemId the check item id + * @param array $updateFields the fields that should be updated + * @return array + */ + public function updateCheckItem($id, $checkItemId, array $updateFields = array()) + { + return $this->put($this->getPath($id).'/'.rawurlencode($checkItemId).'/checkItem', $updateFields); + } + + /** + * Remove checkitem from a given card + * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-2 + * + * @param string $id the card's id or short link + * @param string $checkItemId the checklist item id + * + * @return array + */ + public function removeCheckItem($id, $checkItemId) + { + return $this->delete($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId)); + } /** * Actions API From c651f942b53bc08fe7fc7b4945a5ab26998b85f3 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 10:51:25 +0200 Subject: [PATCH 32/55] Fixed issue with adding cardid for checklist items --- lib/Trello/Api/Card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 70ab780..47ecdab 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -412,7 +412,7 @@ public function updateCheckListItem($cardId,$checkListId,$itemId, $params = arra */ public function getCheckItem($id, $checkItemId, array $params = array('fields'=> 'all')) { - return $this->get($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId), $params); + return $this->get($this->getPath().'/'.rawurlencode($id).'/checkItem/'.rawurlencode($checkItemId), $params); } /** @@ -426,7 +426,7 @@ public function getCheckItem($id, $checkItemId, array $params = array('fields'=> */ public function updateCheckItem($id, $checkItemId, array $updateFields = array()) { - return $this->put($this->getPath($id).'/'.rawurlencode($checkItemId).'/checkItem', $updateFields); + return $this->put($this->getPath().'/'.rawurlencode($id).'/'.rawurlencode($checkItemId).'/checkItem', $updateFields); } /** @@ -440,7 +440,7 @@ public function updateCheckItem($id, $checkItemId, array $updateFields = array() */ public function removeCheckItem($id, $checkItemId) { - return $this->delete($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId)); + return $this->delete($this->getPath().'/'.rawurlencode($id).'/checkItem/'.rawurlencode($checkItemId)); } /** From 405dfaf9b9781cbf2a2c2467f92a36dd449170f8 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 11:12:24 +0200 Subject: [PATCH 33/55] fixed updateCheckItem endpoint --- lib/Trello/Api/Card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 47ecdab..43fab6b 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -426,7 +426,7 @@ public function getCheckItem($id, $checkItemId, array $params = array('fields'=> */ public function updateCheckItem($id, $checkItemId, array $updateFields = array()) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/'.rawurlencode($checkItemId).'/checkItem', $updateFields); + return $this->put($this->getPath().'/'.rawurlencode($id).'/checkItem/'.rawurlencode($checkItemId), $updateFields); } /** From 1ced1916e0a7fb8a37fca0a1a70d1c513508482b Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 15:02:24 +0200 Subject: [PATCH 34/55] Added getChecklists call from card https://trello.readme.io/v1.0/reference#cardsidchecklists --- lib/Trello/Api/Card.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 43fab6b..1e34991 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -179,6 +179,21 @@ public function getCheckItemStates($id){ return $this->get($this->getPath().'/'.rawurlencode($id).'/checkItemStates', array('value' => 'all')); } + /** + * Get the checklists, for now will return the full list of checkitem states; + * @link https://trello.readme.io/v1.0/reference#cardsidchecklists + * + * @param string $id the card's id or short link + * @param array $fields (optional) an array with the requested fields, all by default + * + * @return array checklist info + */ + public function getCheckLists($id, array $fields = array('fields'=>'all'){ + + return $this->get($this->getPath().'/'.rawurlencode($id).'/checklists', $fields); + + } + /** * Get the members; * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-members From 9ca700d5b514db9c80b5a2070a7c2efa6ac79841 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 15:08:00 +0200 Subject: [PATCH 35/55] Get checklist items directly from checklist https://trello.readme.io/v1.0/reference#checklistsidcardscheckitems --- lib/Trello/Api/Checklist.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/Trello/Api/Checklist.php b/lib/Trello/Api/Checklist.php index 4870cc1..70c4ba9 100644 --- a/lib/Trello/Api/Checklist.php +++ b/lib/Trello/Api/Checklist.php @@ -85,7 +85,7 @@ public function remove($id) { return $this->delete($this->getPath().'/'.rawurlencode($id)); } - + /** * Remove a listitem from a checklist * @link https://trello.com/docs/api/checklist/index.html#delete-1-checklists-idchecklist-checkitems-idcheckitem @@ -100,6 +100,30 @@ public function removeListItem($checkListId, $listItemId) return $this->delete($this->getPath().'/'.rawurlencode($checkListId).'/checkItems/'.rawurlencode($listItemId)); } + + /** + * get checklist items from a checklist + * @link https://trello.readme.io/v1.0/reference#checklistsidcardscheckitems + * + * @param string $checkListId the checklist's id + * @param string $listItemId (optional) the listItem id + * @param array $fields (options) the fi + * + * @return array + */ + public function getListItems($checkListId, $listItemId = null, array $fields = array('fields' => 'all') + { + if($listItemId == null){ + + return $this->get($this->getPath().'/'.rawurlencode($checkListId).'/checkItems', $fields); + + }else{ + + return $this->get($this->getPath().'/'.rawurlencode($checkListId).'/checkItems/'.rawurlencode($listItemId), $fields); + + } + } + /** * Get the board of a given checklist * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-board From 06a954d1980a872c65d9acb9eb836ca2a2c4d737 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 15:26:16 +0200 Subject: [PATCH 36/55] typo in function declaration --- lib/Trello/Api/Card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 1e34991..288f958 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -188,7 +188,7 @@ public function getCheckItemStates($id){ * * @return array checklist info */ - public function getCheckLists($id, array $fields = array('fields'=>'all'){ + public function getCheckLists($id, array $fields = array('fields'=>'all')){ return $this->get($this->getPath().'/'.rawurlencode($id).'/checklists', $fields); From 897c9cf3984634bb4963c7bf25676b5b862d8eb9 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Wed, 2 Aug 2017 15:34:34 +0200 Subject: [PATCH 37/55] Split getChecklistItems and getChecklistItem --- lib/Trello/Api/Checklist.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/Trello/Api/Checklist.php b/lib/Trello/Api/Checklist.php index 70c4ba9..29711c1 100644 --- a/lib/Trello/Api/Checklist.php +++ b/lib/Trello/Api/Checklist.php @@ -107,21 +107,28 @@ public function removeListItem($checkListId, $listItemId) * * @param string $checkListId the checklist's id * @param string $listItemId (optional) the listItem id - * @param array $fields (options) the fi + * @param array $fields (options) the fields to retrieve * * @return array */ - public function getListItems($checkListId, $listItemId = null, array $fields = array('fields' => 'all') + public function getListItems($checkListId, array $fields = array('fields' => 'all')) { - if($listItemId == null){ - - return $this->get($this->getPath().'/'.rawurlencode($checkListId).'/checkItems', $fields); - - }else{ - - return $this->get($this->getPath().'/'.rawurlencode($checkListId).'/checkItems/'.rawurlencode($listItemId), $fields); - - } + return $this->get($this->getPath().'/'.rawurlencode($checkListId).'/checkItems', $fields); + } + + /** + * get a specific checklist item from a checklist + * @link https://trello.readme.io/v1.0/reference#checklistsidcardscheckitems + * + * @param string $checkListId the checklist's id + * @param string $listItemId the listItem id + * @param array $fields (options) the fields to retrieve + * + * @return array + */ + public function getListItem($checkListId, $listItemId, array $fields = array('fields' => 'all')) + { + return $this->get($this->getPath().'/'.rawurlencode($checkListId).'/checkItem/'.rawurlencode($listItemId), $fields); } /** From f53f479a1ea9b5f0784b390b9739c5c84b221ea0 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Fri, 8 Sep 2017 10:21:09 +0200 Subject: [PATCH 38/55] Update timeout to 50 sec --- lib/Trello/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Client.php b/lib/Trello/Client.php index d276941..6626520 100644 --- a/lib/Trello/Client.php +++ b/lib/Trello/Client.php @@ -62,7 +62,7 @@ class Client implements ClientInterface private $options = array( 'base_url' => 'https://api.trello.com/', 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', - 'timeout' => 10, + 'timeout' => 50, 'api_limit' => 5000, 'api_version' => 1, 'cache_dir' => null, From d2b829f032fcaea2fb493ae475561cfb608fa292 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 11:39:12 +0100 Subject: [PATCH 39/55] Updated dependency to guzzle --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a0b2dfc..5d9e1e5 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": ">=5.3.2", - "guzzle/guzzle": "~3.7" + "guzzlehttp/guzzle": ">=6.0" }, "require-dev": { "phpunit/phpunit": ">=4.1" From 9120328a9ecaedcfcfd63ea61a0fd013ed978285 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 13:56:50 +0100 Subject: [PATCH 40/55] Upgrade to GuzzleHttp --- lib/Trello/HttpClient/HttpClient.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index bdb4d98..bf07603 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -2,10 +2,10 @@ namespace Trello\HttpClient; -use Guzzle\Http\Client as GuzzleClient; -use Guzzle\Http\ClientInterface; -use Guzzle\Http\Message\Request; -use Guzzle\Http\Message\Response; +use GuzzleHttp\Client as GuzzleClient; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Message\Request; +use GuzzleHttp\Message\Response; use Trello\Exception\ErrorException; use Trello\Exception\RuntimeException; use Trello\HttpClient\Listener\AuthListener; From 0b100962947130395eea8265e53158feed445d26 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 13:57:16 +0100 Subject: [PATCH 41/55] Update to guzzleHttp --- lib/Trello/HttpClient/HttpClientInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/HttpClient/HttpClientInterface.php b/lib/Trello/HttpClient/HttpClientInterface.php index 08a4338..5a6e1ab 100644 --- a/lib/Trello/HttpClient/HttpClientInterface.php +++ b/lib/Trello/HttpClient/HttpClientInterface.php @@ -3,7 +3,7 @@ namespace Trello\HttpClient; use Trello\Exception\InvalidArgumentException; -use Guzzle\Http\Message\Response; +use GuzzleHttp\Message\Response; interface HttpClientInterface { From 9fb8756bf4decf8243a40c3894833362c7589edd Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 13:59:25 +0100 Subject: [PATCH 42/55] Update to guzzleHttp --- lib/Trello/HttpClient/Listener/ErrorListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/HttpClient/Listener/ErrorListener.php b/lib/Trello/HttpClient/Listener/ErrorListener.php index 9fd2a82..005a7cb 100644 --- a/lib/Trello/HttpClient/Listener/ErrorListener.php +++ b/lib/Trello/HttpClient/Listener/ErrorListener.php @@ -3,7 +3,7 @@ namespace Trello\HttpClient\Listener; use Trello\HttpClient\Message\ResponseMediator; -use Guzzle\Common\Event; +use GuzzleHttp\Event; use Trello\Exception\ErrorException; use Trello\Exception\RuntimeException; use Trello\Exception\PermissionDeniedException; From 8c7c595262caa597d660f2881971a89fbb45de3d Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 14:03:08 +0100 Subject: [PATCH 43/55] Update to GuzzleHttp --- lib/Trello/HttpClient/Message/ResponseMediator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/HttpClient/Message/ResponseMediator.php b/lib/Trello/HttpClient/Message/ResponseMediator.php index b14b129..cafef47 100644 --- a/lib/Trello/HttpClient/Message/ResponseMediator.php +++ b/lib/Trello/HttpClient/Message/ResponseMediator.php @@ -2,7 +2,7 @@ namespace Trello\HttpClient\Message; -use Guzzle\Http\Message\Response; +use GuzzleHttp\Message\Response; class ResponseMediator { From eb0af16aa60a9d8acead149d0b1c4b4677aabc7c Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 14:04:00 +0100 Subject: [PATCH 44/55] Update to GuzzleHttp --- lib/Trello/HttpClient/Listener/AuthListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/HttpClient/Listener/AuthListener.php b/lib/Trello/HttpClient/Listener/AuthListener.php index 53b9c58..182ba81 100644 --- a/lib/Trello/HttpClient/Listener/AuthListener.php +++ b/lib/Trello/HttpClient/Listener/AuthListener.php @@ -2,7 +2,7 @@ namespace Trello\HttpClient\Listener; -use Guzzle\Common\Event; +use GuzzleHttp\Event; use Trello\Client; use Trello\Exception\RuntimeException; From 064ef0e7c8c5c00e0408c3393a63a022d1c9ea4b Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 14:10:31 +0100 Subject: [PATCH 45/55] Revert changes --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5d9e1e5..a0b2dfc 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": ">=5.3.2", - "guzzlehttp/guzzle": ">=6.0" + "guzzle/guzzle": "~3.7" }, "require-dev": { "phpunit/phpunit": ">=4.1" From 2a9fc1ccef55d6921073bf7511be2f9f893f209d Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 14:11:54 +0100 Subject: [PATCH 46/55] Revert changes --- lib/Trello/HttpClient/HttpClientInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/HttpClient/HttpClientInterface.php b/lib/Trello/HttpClient/HttpClientInterface.php index 5a6e1ab..08a4338 100644 --- a/lib/Trello/HttpClient/HttpClientInterface.php +++ b/lib/Trello/HttpClient/HttpClientInterface.php @@ -3,7 +3,7 @@ namespace Trello\HttpClient; use Trello\Exception\InvalidArgumentException; -use GuzzleHttp\Message\Response; +use Guzzle\Http\Message\Response; interface HttpClientInterface { From a7bb6a5477c49c59dbc1cefdd557ca3bc1ca650b Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 14:12:28 +0100 Subject: [PATCH 47/55] Revert changes guzzleHttp --- lib/Trello/HttpClient/HttpClient.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index bf07603..bdb4d98 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -2,10 +2,10 @@ namespace Trello\HttpClient; -use GuzzleHttp\Client as GuzzleClient; -use GuzzleHttp\ClientInterface; -use GuzzleHttp\Message\Request; -use GuzzleHttp\Message\Response; +use Guzzle\Http\Client as GuzzleClient; +use Guzzle\Http\ClientInterface; +use Guzzle\Http\Message\Request; +use Guzzle\Http\Message\Response; use Trello\Exception\ErrorException; use Trello\Exception\RuntimeException; use Trello\HttpClient\Listener\AuthListener; From 18ed846d7c7e6882de835acaece89ff99f4294bd Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 14:13:01 +0100 Subject: [PATCH 48/55] Revert changes guzzleHttp --- lib/Trello/HttpClient/Message/ResponseMediator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/HttpClient/Message/ResponseMediator.php b/lib/Trello/HttpClient/Message/ResponseMediator.php index cafef47..b14b129 100644 --- a/lib/Trello/HttpClient/Message/ResponseMediator.php +++ b/lib/Trello/HttpClient/Message/ResponseMediator.php @@ -2,7 +2,7 @@ namespace Trello\HttpClient\Message; -use GuzzleHttp\Message\Response; +use Guzzle\Http\Message\Response; class ResponseMediator { From 2ef7598597fa9a9d5c9f7248b99ae0b883f130c3 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 14:13:51 +0100 Subject: [PATCH 49/55] Revert changes guzzelHttp --- lib/Trello/HttpClient/Listener/AuthListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/HttpClient/Listener/AuthListener.php b/lib/Trello/HttpClient/Listener/AuthListener.php index 182ba81..53b9c58 100644 --- a/lib/Trello/HttpClient/Listener/AuthListener.php +++ b/lib/Trello/HttpClient/Listener/AuthListener.php @@ -2,7 +2,7 @@ namespace Trello\HttpClient\Listener; -use GuzzleHttp\Event; +use Guzzle\Common\Event; use Trello\Client; use Trello\Exception\RuntimeException; From e29933ff3c56630b53af3a9162df519d9ff2bc28 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 20 Mar 2018 14:14:27 +0100 Subject: [PATCH 50/55] Revert changes guzzleHttp --- lib/Trello/HttpClient/Listener/ErrorListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/HttpClient/Listener/ErrorListener.php b/lib/Trello/HttpClient/Listener/ErrorListener.php index 005a7cb..9fd2a82 100644 --- a/lib/Trello/HttpClient/Listener/ErrorListener.php +++ b/lib/Trello/HttpClient/Listener/ErrorListener.php @@ -3,7 +3,7 @@ namespace Trello\HttpClient\Listener; use Trello\HttpClient\Message\ResponseMediator; -use GuzzleHttp\Event; +use Guzzle\Common\Event; use Trello\Exception\ErrorException; use Trello\Exception\RuntimeException; use Trello\Exception\PermissionDeniedException; From 6adf3e8d04327dbc05ad9e95a48a6ef59d21f85d Mon Sep 17 00:00:00 2001 From: Dariusz Drobisz Date: Thu, 3 Oct 2019 12:05:33 +0200 Subject: [PATCH 51/55] Custom fields basic API support --- lib/Trello/Api/Board.php | 10 +++++++ lib/Trello/Api/Board/CustomFields.php | 33 ++++++++++++++++++++++ lib/Trello/Api/Card.php | 10 +++++++ lib/Trello/Api/Card/CustomFieldItems.php | 36 ++++++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 lib/Trello/Api/Board/CustomFields.php create mode 100644 lib/Trello/Api/Card/CustomFieldItems.php diff --git a/lib/Trello/Api/Board.php b/lib/Trello/Api/Board.php index a033270..2851872 100644 --- a/lib/Trello/Api/Board.php +++ b/lib/Trello/Api/Board.php @@ -336,4 +336,14 @@ public function powerUps() { return new Board\PowerUps($this->client); } + + /** + * Board CustomFields API + * + * @return Board\CustomFields + */ + public function customFields() + { + return new Board\CustomFields($this->client); + } } diff --git a/lib/Trello/Api/Board/CustomFields.php b/lib/Trello/Api/Board/CustomFields.php new file mode 100644 index 0000000..d81515c --- /dev/null +++ b/lib/Trello/Api/Board/CustomFields.php @@ -0,0 +1,33 @@ +get($this->getPath($id), $params); + } +} diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 288f958..3b0bb47 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -517,4 +517,14 @@ public function stickers() { return new Card\Stickers($this->client); } + + /** + * CustomFieldItems API + * + * @return Card\CustomFieldItems + */ + public function customFieldItems() + { + return new Card\CustomFieldItems($this->client); + } } diff --git a/lib/Trello/Api/Card/CustomFieldItems.php b/lib/Trello/Api/Card/CustomFieldItems.php new file mode 100644 index 0000000..0fa13e7 --- /dev/null +++ b/lib/Trello/Api/Card/CustomFieldItems.php @@ -0,0 +1,36 @@ + 'true')); + $data = $this->get($this->getPath($id), $params); + + return array_key_exists('customFieldItems', $data) ? $data['customFieldItems'] : array(); + } +} From 38827df2e6fd36a08ce82452185bca454359db23 Mon Sep 17 00:00:00 2001 From: Dariusz Drobisz Date: Mon, 9 Dec 2019 19:03:25 +0100 Subject: [PATCH 52/55] Update custom field item on card --- lib/Trello/Api/Card/CustomFieldItems.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/Trello/Api/Card/CustomFieldItems.php b/lib/Trello/Api/Card/CustomFieldItems.php index 0fa13e7..912197e 100644 --- a/lib/Trello/Api/Card/CustomFieldItems.php +++ b/lib/Trello/Api/Card/CustomFieldItems.php @@ -33,4 +33,24 @@ public function all($id, array $params = array()) return array_key_exists('customFieldItems', $data) ? $data['customFieldItems'] : array(); } + + /** + * Update a given custom field value on a given card + * @link https://developers.trello.com/docs/getting-started-custom-fields#section-setting-updating-customfielditems + * + * @param string $id the card's id or short link + * @param string $customFieldId the card's id or short link + * @param array $value the member's id + * + * @return array + */ + public function update($id, $customFieldId, $value = array()) + { + $path = $this->getPath($id) . 'customField/' . rawurldecode($customFieldId) . '/item'; + + return $this->put( + $path, + $value + ); + } } From fea57ecdee580b31bd6f83bc82762e9605bca257 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 May 2021 12:29:13 +0200 Subject: [PATCH 53/55] Update PowerUps.php Add function to retrieve all power-ups from a Trello board and to enable a power-up on the board. --- lib/Trello/Api/Board/PowerUps.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/Trello/Api/Board/PowerUps.php b/lib/Trello/Api/Board/PowerUps.php index 9dc22dd..239aae2 100644 --- a/lib/Trello/Api/Board/PowerUps.php +++ b/lib/Trello/Api/Board/PowerUps.php @@ -18,5 +18,33 @@ class PowerUps extends AbstractApi * Base path of board power ups api * @var string */ - protected $path = 'boards/#id#/powerUps'; + privated $path = 'boards/#id#/boardPlugins'; + + + /** + * Get all power ups that are enabled on the board + * @link https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-plugins-get + * + * @param string $id the board's id + * + * @return array + */ + public function all($boardId, array $params = array()) + { + return $this->get($this->getPath($boardId), $params); + } + + /** + * Enable a powerup on the board + * @link https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-boardplugins-post + * + * @param string $boardId the board's id + * @param string $powerUpId the id of the powerUp that should be enabled + * + * @return array + */ + public function enable($boardId, $powerUpId) + { + return $this->put($this->getPath($boardId), array('idPlugin' => $powerUpId)); + } } From 13f7b10f1bf33ea06aabd5520da0c23a1a0c3e9b Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 May 2021 12:41:17 +0200 Subject: [PATCH 54/55] Update PowerUps.php --- lib/Trello/Api/Board/PowerUps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Board/PowerUps.php b/lib/Trello/Api/Board/PowerUps.php index 239aae2..5507254 100644 --- a/lib/Trello/Api/Board/PowerUps.php +++ b/lib/Trello/Api/Board/PowerUps.php @@ -18,7 +18,7 @@ class PowerUps extends AbstractApi * Base path of board power ups api * @var string */ - privated $path = 'boards/#id#/boardPlugins'; + protected $path = 'boards/#id#/boardPlugins'; /** From d90db840d7636709c01378635299b868ae12f745 Mon Sep 17 00:00:00 2001 From: rtvisser Date: Tue, 25 May 2021 14:57:09 +0200 Subject: [PATCH 55/55] Update PowerUps.php --- lib/Trello/Api/Board/PowerUps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Trello/Api/Board/PowerUps.php b/lib/Trello/Api/Board/PowerUps.php index 5507254..ea5909b 100644 --- a/lib/Trello/Api/Board/PowerUps.php +++ b/lib/Trello/Api/Board/PowerUps.php @@ -45,6 +45,6 @@ public function all($boardId, array $params = array()) */ public function enable($boardId, $powerUpId) { - return $this->put($this->getPath($boardId), array('idPlugin' => $powerUpId)); + return $this->post($this->getPath($boardId), array('idPlugin' => $powerUpId)); } }