diff --git a/lib/Trello/Api/Board/Labels.php b/lib/Trello/Api/Board/Labels.php index f924f76..356dbcf 100644 --- a/lib/Trello/Api/Board/Labels.php +++ b/lib/Trello/Api/Board/Labels.php @@ -84,4 +84,28 @@ public function setName($id, $color, $name) return $this->put('boards/'.rawurlencode($id).'/labelNames/'.rawurlencode($color), array('value' => $name)); } + + /** + * Create a list on a given board + * @link https://trello.com/docs/api/board/#post-1-boards-board-id-lists + * + * @param string $id the board's id + * @param string $color the label color to set the name of + * @param string $name + * + * @return array + */ + public function create($id, $color, $name) + { + $colors = array('blue', 'green', 'orange', 'purple', 'red', 'yellow'); + + if (!in_array($color, $colors)) { + throw new InvalidArgumentException(sprintf( + 'The "color" parameter must be one of "%s".', + implode(", ", $colors) + )); + } + + return $this->post('boards/'.rawurlencode($id).'/labels/', array('name' => $name, 'color' => $color)); + } }