public static function getService() { static $service; if ($service) { return $service; } $client = \GmailApiHelper::getClient(); $service = new \Google_Service_Gmail($client); return $service; }
/** * */ protected function getLabels() { $client = \GmailApiHelper::getClient(); $service = new \Google_Service_Gmail($client); $user = '******'; $results = $service->users_labels->listUsersLabels($user); if (count($results->getLabels()) == 0) { pr("No labels found."); } else { pr("Labels:"); foreach ($results->getLabels() as $label) { pr("- " . $label->getName()); } } }