title: Call to undefined method Google_Service_Drive_FileList::getItems()
body: <p>I am implementing the google drive API.</p>
  
  <p>I have referred this google documentation <a href="https://developers.google.com/api-client-library/php/auth/web-app#example" rel="noreferrer">https://developers.google.com/api-client-library/php/auth/web-app#example</a>.</p>
  
  <p>Here is my index.php</p>
  
  <pre><code>&lt;?php
  require_once __DIR__ . '/vendor/autoload.php';
  
  session_start();
  
  $client = new Google_Client();
  $client-&gt;setAuthConfigFile('client_secret.json');
  $client-&gt;addScope(Google_Service_Drive::DRIVE_METADATA_READONLY);
  
  if (isset($_SESSION['access_token']) &amp;&amp; $_SESSION['access_token']) {
      $client-&gt;setAccessToken($_SESSION['access_token']);
      $drive_service = new Google_Service_Drive($client);
      $files_list = $drive_service-&gt;files-&gt;listFiles(array())-&gt;getItems();
      echo json_encode($files_list);
  } else {
      $redirect_uri = 'http://127.0.0.1/googleApiQuickstart/oauth2callback.php';
      header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
  }
  </code></pre>
  
  <p>And my oauth2callback.php</p>
  
  <pre><code>&lt;?php
  require_once __DIR__ . '/vendor/autoload.php';
  
  session_start();
  
  $client = new Google_Client();
  $client-&gt;setAuthConfigFile('client_secret.json');
  $client-&gt;setRedirectUri('http://127.0.0.1/googleApiQuickstart/oauth2callback.php');
  $client-&gt;addScope(Google_Service_Drive::DRIVE_METADATA_READONLY);
  
  if (!isset($_GET['code'])) {
      $auth_url = $client-&gt;createAuthUrl();
      header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
  } else {
      $client-&gt;authenticate($_GET['code']);
      $_SESSION['access_token'] = $client-&gt;getAccessToken();
      $redirect_uri = 'http://127.0.0.1/googleApiQuickstart';
      header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
  }
  </code></pre>
  
  <p>But getting the error.</p>
  
  <blockquote>
    <p>Call to undefined method Google_Service_Drive_FileList::getItems()</p>
  </blockquote>
  
  <p>Where am I wrong?</p>