Example #1
0
 public function getAll()
 {
     $base = API::getBaseUrl();
     $async = new AsyncRequest([new Request($base . "todolists.json"), new Request($base . "todolists/completed.json"), new Request($base . "todolists/trashed.json")]);
     $async->performRequests();
     return ['active' => $async->requests[0]->response->body, 'completed' => $async->requests[1]->response->body, 'trashed' => $async->requests[2]->response->body];
 }
Example #2
0
 /**
  * Get Projects
  * https://github.com/basecamp/bcx-api/blob/master/sections/projects.md#get-projects
  * Returns an array of 'active', 'drafts', 'archived' projects.
  * @return array
  */
 public function getAll()
 {
     // Endpoints
     $endPoints = ['projects.json', 'projects/drafts.json', 'projects/archived.json'];
     // Declare an array to hold requests.
     $requests = [];
     // Get the base url.
     $baseUrl = API::getBaseUrl();
     // Loop through the urls
     foreach ($endPoints as $endPoint) {
         $requests[] = new Request($baseUrl . $endPoint);
     }
     // Perform requests.
     $async = new AsyncRequest($requests);
     $async->performRequests();
     return ['active' => $async->requests[0]->response->body, 'drafts' => $async->requests[1]->response->body, 'archived' => $async->requests[2]->response->body];
 }