/** * @param $code string The code to trade for oAuth token. * @return bool|string */ public function getAuthToken($code) { // Request arguments $args = ['type' => 'web_server', 'client_id' => $this->config->clientId, 'redirect_uri' => $this->config->redirectUri, 'client_secret' => $this->config->clientSecret, 'code' => $code]; // Make the request object. $request = new Request(Endpoints::$authorization['oauth.token'], $args, 'POST'); $request->performRequest(); if ($request->response->httpCode == 200) { return $request->response->body; } return false; }
/** * @param $projectId * @param $todolistId * @param $name * @param string $description * @return Response */ public function updateTodoList($projectId, $todolistId, $name, $description = '') { return Request::put("projects/{$projectId}/todolists/{$todolistId}.json", ['name' => $name, 'description' => $description]); }
/** * Get a list of all trashed to-dos for this to-do list. * @param $projectId * @param $todoListId * @return string */ public function getTrashedByTodoList($projectId, $todoListId) { return Request::get("projects/{$projectId}/todolists/{$todoListId}/todos/trashed.json")->body; }
/** * Get project * https://github.com/basecamp/bcx-api/blob/master/sections/projects.md#get-project * @param $projectId * @return Response * @throws \Exception */ public function getById($projectId) { return Request::get("projects/{$projectId}.json")->body; }