From 77a85b653a388f18f76e64871e7f3801c5b978f4 Mon Sep 17 00:00:00 2001 From: Steven Maguire Date: Mon, 26 Mar 2018 11:52:03 -0500 Subject: [PATCH] Add support for getting a custom fields for a given card --- API-GUIDE.md | 6 ++++++ CHANGELOG.md | 19 ++++++++++++++++++- src/Traits/ApiMethodsTrait.php | 1 + tests/ApiTestTrait.php | 12 ++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/API-GUIDE.md b/API-GUIDE.md index 9c42a88..1cf2013 100644 --- a/API-GUIDE.md +++ b/API-GUIDE.md @@ -608,6 +608,12 @@ $result = $client->addCardChecklist($cardId, $attributes); $result = $client->deleteCardChecklist($cardId, $checklistId); ``` +#### Get card custom field + +```php +$result = $client->getCardCustomField($cardId, $customFieldId); +``` + #### Update card custom field ```php diff --git a/CHANGELOG.md b/CHANGELOG.md index ed2bef6..3338bd0 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,24 @@ -#Changelog +# Changelog All Notable changes to `trello-php` will be documented in this file +## 0.5.1 - 2018-03-26 + +### Added +- Added support for getting a custom fields for a given card + +### Deprecated +- Nothing + +### Fixed +- Nothing + +### Removed +- Nothing + +### Security +- Nothing + ## 0.5.0 - 2018-03-23 ### Added diff --git a/src/Traits/ApiMethodsTrait.php b/src/Traits/ApiMethodsTrait.php index 8449c2d..53b37b2 100644 --- a/src/Traits/ApiMethodsTrait.php +++ b/src/Traits/ApiMethodsTrait.php @@ -140,6 +140,7 @@ trait ApiMethodsTrait 'addCardLabel' => ['post', 'cards/%s/labels'], 'updateCardLabel' => ['put', 'cards/%s/labels'], 'deleteCardLabel' => ['delete', 'cards/%s/labels/%s'], + 'getCardCustomField' => ['get', 'cards/%s/customField/%s'], 'updateCardCustomField' => ['put', 'cards/%s/customField/%s'], 'getCardList' => ['get', 'cards/%s/list'], 'getCardListField' => ['get', 'cards/%s/list/%s'], diff --git a/tests/ApiTestTrait.php b/tests/ApiTestTrait.php index dc033a6..c08c7b1 100644 --- a/tests/ApiTestTrait.php +++ b/tests/ApiTestTrait.php @@ -1319,6 +1319,18 @@ public function testDeleteCardChecklistCheckItem() $this->assertExpectedEqualsResult($payload, $result); } + public function testGetCardCustomField() + { + $cardId = $this->getTestString(); + $customFieldId = $this->getTestString(); + $payload = $this->getSuccessPayload(); + $this->prepareFor("GET", sprintf("/cards/%s/customField/%s", $cardId, $customFieldId), "", $payload); + + $result = $this->client->getCardCustomField($cardId, $customFieldId); + + $this->assertExpectedEqualsResult($payload, $result); + } + public function testUpdateCardCustomField() { $cardId = $this->getTestString();