/** * Client constructor * * @param Repository $config */ public function __construct(Repository $config) { // Get the config data $this->config = $config; // Make the client instance $this->client = new Client(); $this->client->authenticate($this->config->get('trello.api_key'), $this->config->get('trello.api_token'), Client::AUTH_URL_CLIENT_ID); }
public static function TrelloAPI($token) { $client = new Trello\Client(); $client->authenticate('658f0e49767a334eb04b65d1c43167b4', $token, Client::AUTH_URL_CLIENT_ID); // Get list boards $boards = $client->api('member')->boards()->all("me", array()); $boardNUM = 0; $boardID = ""; $listID = ""; foreach ($boards as $board) { $boardID = $board['id']; echo $boardNUM++ . "/ " . "<a style='background-color: red;'>--------Board name</a>: " . $board['name'] . "<br/>" . " - Board ID: " . $boardID; echo "<br/>"; echo "------------------------"; echo "<br/>"; // Get list of boards echo "List of boards"; echo "<br/>"; $lists = $client->api('boards')->lists()->all("{$boardID}", array()); foreach ($lists as $list) { $listID = $list['id']; echo "+" . "<a style='background-color: green;'> List name: </a>" . $list['name'] . "<br/>" . "List ID: " . $list['id']; echo "<br/>"; $cards = $client->api('lists')->cards()->all("{$listID}", array()); foreach ($cards as $card) { echo "+" . "<a style='background-color: blue;'> Card name: </a>" . $card['name'] . "<br/>"; echo "Deadline: " . $card['due'] . "<br/>"; echo "Description: " . $card['desc'] . "<br/>"; } } } }
<?php //namespace Trello; // require "HttpClient/HttpClientInterface.php"; // require "HttpClient/HttpClient.php"; // require "Client.php"; // require '../../vendor/autoload.php'; // use \Trello\HttpClient\HttpClientInterface; // use \Trello\HttpClient\HttpClient; use Trello\Client; $client = new Client(); //$client->authenticate('658f0e49767a334eb04b65d1c43167b4', '77e308573b49ba9e498e4371df88402fc8e33a08ded0eaed9b9e41b893155a1e', Client::AUTH_URL_CLIENT_ID); $client->authenticate('658f0e49767a334eb04b65d1c43167b4', 'da5d95a64591f6e44948221dce3c611e1fd993ea4902f3ef997f6a6e8ddcd762', Client::AUTH_URL_CLIENT_ID); // $boards = $client->api('member')->boards()->all("me", array()); // //print_r($boards); $board_id = ""; foreach ($boards as $board) { //print_r($board); //Voi moi board: $board_id = $board["id"]; echo "name->" . $board["name"] . ", id->{$board_id}"; echo "<br/ >"; } $board_id = "55dac641076bcf0fc17be2f9"; //list card cua cua board: echo "<br /> lists board {$board_id} la: <br />"; $lists = $client->api('board')->lists()->all($board_id, array()); //print_r($lists);
/** * Set Client and authenticate. */ public function setClient() { $this->client = new Client(); $this->client->authenticate($this->apiKey, $this->apiToken, Client::AUTH_URL_CLIENT_ID); }
return; } // 404.html, or 40x.html, or 4xx.html, or error.html $templates = array('errors/' . $code . '.html', 'errors/' . substr($code, 0, 2) . 'x.html', 'errors/' . substr($code, 0, 1) . 'xx.html', 'errors/default.html'); return new Response($app['twig']->resolveTemplate($templates)->render(array('code' => $code)), $code); }); $app->get('/untranslated', function () use($app) { $client = new Goutte\Client(); $crawler = $client->request('GET', 'http://doc.php.net/revcheck.php?p=missfiles&lang=pt_BR'); $crawler = $crawler->filter("table > tr"); $nodeValues = $crawler->each(function (Crawler $node, $i) { $first = $node->children()->first()->text(); $last = $node->children()->last()->text(); return array($first, $last); }); $extractor = new Extractor($nodeValues); return new Response(var_dump($extractor->getFullNames())); })->bind('untranslated'); $app->get('/trello', function () use($app) { $client = new Client(); //veja aqui para gerar a key e o token de uso //https://trello.com/c/jObnWvl1/25-generating-your-developer-key $client->authenticate('afdadfasdfasfd', 'adsfasdfsdfafas', Client::AUTH_URL_CLIENT_ID); $board = $client->api('board')->show('j6Nuulpn'); $cards = $client->api('board')->cards()->all('j6Nuulpn'); $cardsNames = new \ArrayIterator(); foreach ($cards as $key => $value) { $cardsNames->append($value['name']); } return new Response(var_dump($cardsNames)); })->bind('trello');
public function actionUpdatecard() { $session = Yii::app()->session; if (isset($_POST['cardname']) && $_POST['description'] && $_POST['idCard'] && $_POST['due'] && $_POST['idList']) { $card_name = $_POST['cardname']; $des = $_POST['description']; $due = $_POST['due']; $idList = $_POST['idList']; $idCard = $_POST['idCard']; $arr = array("name" => $card_name, "desc" => $des, "due" => $due); if (isset($session['token'])) { $token = $session['token']; $client = new Trello\Client(); $client->authenticate('658f0e49767a334eb04b65d1c43167b4', $token, Client::AUTH_URL_CLIENT_ID); $cards = $client->api('cards')->update($idCard, $arr); return $this->redirect('getcardlist?listID=' . $idList); } else { echo "ko tim thay token"; exit; } } return $this->render('updatecard'); }
<?php use Trello\Client; // var_dump(file_exists(dirname(__FIle__)."/../lib/Trello/Client.php")); // // require("/../lib/Trello/Client.php"); // include dirname(__FIle__)."/../lib/Trello/Client.php"; //require_once dirname(__FIle__)."/../lib/Trello/Client.php"; $client = new Client(); $client->authenticate('658f0e49767a334eb04b65d1c43167b4', '77e308573b49ba9e498e4371df88402fc8e33a08ded0eaed9b9e41b893155a1e', Client::AUTH_URL_CLIENT_ID); $boards = $client->api('member')->boards()->all(); print_r('debug'); // exit();