MDL-37217 repository: Adding Google API PHP SDK
authorFrederic Massart <fred@moodle.com>
Tue, 8 Jan 2013 09:11:09 +0000 (17:11 +0800)
committerFred <fmcell@gmail.com>
Tue, 19 Feb 2013 05:36:23 +0000 (13:36 +0800)
67 files changed:
lib/google/Google_Client.php [new file with mode: 0644]
lib/google/LICENSE [new file with mode: 0755]
lib/google/NOTICE [new file with mode: 0755]
lib/google/README [new file with mode: 0755]
lib/google/auth/Google_AssertionCredentials.php [new file with mode: 0644]
lib/google/auth/Google_Auth.php [new file with mode: 0644]
lib/google/auth/Google_AuthNone.php [new file with mode: 0644]
lib/google/auth/Google_LoginTicket.php [new file with mode: 0644]
lib/google/auth/Google_OAuth2.php [new file with mode: 0644]
lib/google/auth/Google_P12Signer.php [new file with mode: 0644]
lib/google/auth/Google_PemVerifier.php [new file with mode: 0644]
lib/google/auth/Google_Signer.php [new file with mode: 0644]
lib/google/auth/Google_Verifier.php [new file with mode: 0644]
lib/google/cache/Google_ApcCache.php [new file with mode: 0644]
lib/google/cache/Google_Cache.php [new file with mode: 0644]
lib/google/cache/Google_FileCache.php [new file with mode: 0644]
lib/google/cache/Google_MemcacheCache.php [new file with mode: 0644]
lib/google/config.php [new file with mode: 0755]
lib/google/contrib/Google_AdexchangebuyerService.php [new file with mode: 0644]
lib/google/contrib/Google_AdsenseService.php [new file with mode: 0644]
lib/google/contrib/Google_AdsensehostService.php [new file with mode: 0644]
lib/google/contrib/Google_AnalyticsService.php [new file with mode: 0644]
lib/google/contrib/Google_BigqueryService.php [new file with mode: 0644]
lib/google/contrib/Google_BloggerService.php [new file with mode: 0644]
lib/google/contrib/Google_BooksService.php [new file with mode: 0644]
lib/google/contrib/Google_CalendarService.php [new file with mode: 0644]
lib/google/contrib/Google_ComputeService.php [new file with mode: 0644]
lib/google/contrib/Google_CustomsearchService.php [new file with mode: 0644]
lib/google/contrib/Google_DriveService.php [new file with mode: 0644]
lib/google/contrib/Google_FreebaseService.php [new file with mode: 0644]
lib/google/contrib/Google_FusiontablesService.php [new file with mode: 0644]
lib/google/contrib/Google_GanService.php [new file with mode: 0644]
lib/google/contrib/Google_LatitudeService.php [new file with mode: 0644]
lib/google/contrib/Google_LicensingService.php [new file with mode: 0644]
lib/google/contrib/Google_ModeratorService.php [new file with mode: 0644]
lib/google/contrib/Google_Oauth2Service.php [new file with mode: 0644]
lib/google/contrib/Google_OrkutService.php [new file with mode: 0644]
lib/google/contrib/Google_PagespeedonlineService.php [new file with mode: 0644]
lib/google/contrib/Google_PlusMomentsService.php [new file with mode: 0644]
lib/google/contrib/Google_PlusService.php [new file with mode: 0644]
lib/google/contrib/Google_PredictionService.php [new file with mode: 0644]
lib/google/contrib/Google_ShoppingService.php [new file with mode: 0644]
lib/google/contrib/Google_SiteVerificationService.php [new file with mode: 0644]
lib/google/contrib/Google_StorageService.php [new file with mode: 0644]
lib/google/contrib/Google_TaskqueueService.php [new file with mode: 0644]
lib/google/contrib/Google_TasksService.php [new file with mode: 0644]
lib/google/contrib/Google_TranslateService.php [new file with mode: 0644]
lib/google/contrib/Google_UrlshortenerService.php [new file with mode: 0644]
lib/google/contrib/Google_WebfontsService.php [new file with mode: 0644]
lib/google/contrib/Google_YoutubeService.php [new file with mode: 0644]
lib/google/curlio.php [new file with mode: 0644]
lib/google/external/URITemplateParser.php [new file with mode: 0644]
lib/google/io/Google_CacheParser.php [new file with mode: 0644]
lib/google/io/Google_CurlIO.php [new file with mode: 0644]
lib/google/io/Google_HttpRequest.php [new file with mode: 0644]
lib/google/io/Google_IO.php [new file with mode: 0644]
lib/google/io/Google_REST.php [new file with mode: 0644]
lib/google/io/cacerts.pem [new file with mode: 0644]
lib/google/local_config.php [new file with mode: 0644]
lib/google/readme_moodle.txt [new file with mode: 0644]
lib/google/service/Google_BatchRequest.php [new file with mode: 0644]
lib/google/service/Google_MediaFileUpload.php [new file with mode: 0644]
lib/google/service/Google_Model.php [new file with mode: 0644]
lib/google/service/Google_Service.php [new file with mode: 0644]
lib/google/service/Google_ServiceResource.php [new file with mode: 0644]
lib/google/service/Google_Utils.php [new file with mode: 0644]
lib/thirdpartylibs.xml

diff --git a/lib/google/Google_Client.php b/lib/google/Google_Client.php
new file mode 100644 (file)
index 0000000..e6026a1
--- /dev/null
@@ -0,0 +1,453 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Check for the required json and curl extensions, the Google APIs PHP Client
+// won't function without them.
+if (! function_exists('curl_init')) {
+  throw new Exception('Google PHP API Client requires the CURL PHP extension');
+}
+
+if (! function_exists('json_decode')) {
+  throw new Exception('Google PHP API Client requires the JSON PHP extension');
+}
+
+if (! function_exists('http_build_query')) {
+  throw new Exception('Google PHP API Client requires http_build_query()');
+}
+
+if (! ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
+  date_default_timezone_set('UTC');
+}
+
+// hack around with the include paths a bit so the library 'just works'
+set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
+
+require_once "config.php";
+// If a local configuration file is found, merge it's values with the default configuration
+if (file_exists(dirname(__FILE__)  . '/local_config.php')) {
+  $defaultConfig = $apiConfig;
+  require_once (dirname(__FILE__)  . '/local_config.php');
+  $apiConfig = array_merge($defaultConfig, $apiConfig);
+}
+
+// Include the top level classes, they each include their own dependencies
+require_once 'service/Google_Model.php';
+require_once 'service/Google_Service.php';
+require_once 'service/Google_ServiceResource.php';
+require_once 'auth/Google_AssertionCredentials.php';
+require_once 'auth/Google_Signer.php';
+require_once 'auth/Google_P12Signer.php';
+require_once 'service/Google_BatchRequest.php';
+require_once 'external/URITemplateParser.php';
+require_once 'auth/Google_Auth.php';
+require_once 'cache/Google_Cache.php';
+require_once 'io/Google_IO.php';
+require_once('service/Google_MediaFileUpload.php');
+
+/**
+ * The Google API Client
+ * http://code.google.com/p/google-api-php-client/
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ * @author Chirag Shah <chirags@google.com>
+ */
+class Google_Client {
+  /**
+   * @static
+   * @var Google_Auth $auth
+   */
+  static $auth;
+
+  /**
+   * @static
+   * @var Google_IO $io
+   */
+  static $io;
+
+  /**
+   * @static
+   * @var Google_Cache $cache
+   */
+  static $cache;
+
+  /**
+   * @static
+   * @var boolean $useBatch
+   */
+  static $useBatch = false;
+
+  /** @var array $scopes */
+  protected $scopes = array();
+
+  /** @var bool $useObjects */
+  protected $useObjects = false;
+
+  // definitions of services that are discovered.
+  protected $services = array();
+
+  // Used to track authenticated state, can't discover services after doing authenticate()
+  private $authenticated = false;
+
+  public function __construct($config = array()) {
+    global $apiConfig;
+    $apiConfig = array_merge($apiConfig, $config);
+    self::$cache = new $apiConfig['cacheClass']();
+    self::$auth = new $apiConfig['authClass']();
+    self::$io = new $apiConfig['ioClass']();
+  }
+
+  /**
+   * Add a service
+   */
+  public function addService($service, $version = false) {
+    global $apiConfig;
+    if ($this->authenticated) {
+      throw new Google_Exception('Cant add services after having authenticated');
+    }
+    $this->services[$service] = array();
+    if (isset($apiConfig['services'][$service])) {
+      // Merge the service descriptor with the default values
+      $this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]);
+    }
+  }
+
+  public function authenticate($code = null) {
+    $service = $this->prepareService();
+    $this->authenticated = true;
+    return self::$auth->authenticate($service, $code);
+  }
+
+  /**
+   * @return array
+   * @visible For Testing
+   */
+  public function prepareService() {
+    $service = array();
+    $scopes = array();
+    if ($this->scopes) {
+      $scopes = $this->scopes;
+    } else {
+      foreach ($this->services as $key => $val) {
+        if (isset($val['scope'])) {
+          if (is_array($val['scope'])) {
+            $scopes = array_merge($val['scope'], $scopes);
+          } else {
+            $scopes[] = $val['scope'];
+          }
+        } else {
+          $scopes[] = 'https://www.googleapis.com/auth/' . $key;
+        }
+        unset($val['discoveryURI']);
+        unset($val['scope']);
+        $service = array_merge($service, $val);
+      }
+    }
+    $service['scope'] = implode(' ', $scopes);
+    return $service;
+  }
+
+  /**
+   * Set the OAuth 2.0 access token using the string that resulted from calling authenticate()
+   * or Google_Client#getAccessToken().
+   * @param string $accessToken JSON encoded string containing in the following format:
+   * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
+   *  "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
+   */
+  public function setAccessToken($accessToken) {
+    if ($accessToken == null || 'null' == $accessToken) {
+      $accessToken = null;
+    }
+    self::$auth->setAccessToken($accessToken);
+  }
+
+  /**
+   * Set the type of Auth class the client should use.
+   * @param string $authClassName
+   */
+  public function setAuthClass($authClassName) {
+    self::$auth = new $authClassName();
+  }
+
+  /**
+   * Construct the OAuth 2.0 authorization request URI.
+   * @return string
+   */
+  public function createAuthUrl() {
+    $service = $this->prepareService();
+    return self::$auth->createAuthUrl($service['scope']);
+  }
+
+  /**
+   * Get the OAuth 2.0 access token.
+   * @return string $accessToken JSON encoded string in the following format:
+   * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
+   *  "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
+   */
+  public function getAccessToken() {
+    $token = self::$auth->getAccessToken();
+    return (null == $token || 'null' == $token) ? null : $token;
+  }
+
+  /**
+   * Returns if the access_token is expired.
+   * @return bool Returns True if the access_token is expired.
+   */
+  public function isAccessTokenExpired() {
+    return self::$auth->isAccessTokenExpired();
+  }
+
+  /**
+   * Set the developer key to use, these are obtained through the API Console.
+   * @see http://code.google.com/apis/console-help/#generatingdevkeys
+   * @param string $developerKey
+   */
+  public function setDeveloperKey($developerKey) {
+    self::$auth->setDeveloperKey($developerKey);
+  }
+
+  /**
+   * Set OAuth 2.0 "state" parameter to achieve per-request customization.
+   * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
+   * @param string $state
+   */
+  public function setState($state) {
+    self::$auth->setState($state);
+  }
+
+  /**
+   * @param string $accessType Possible values for access_type include:
+   *  {@code "offline"} to request offline access from the user. (This is the default value)
+   *  {@code "online"} to request online access from the user.
+   */
+  public function setAccessType($accessType) {
+    self::$auth->setAccessType($accessType);
+  }
+
+  /**
+   * @param string $approvalPrompt Possible values for approval_prompt include:
+   *  {@code "force"} to force the approval UI to appear. (This is the default value)
+   *  {@code "auto"} to request auto-approval when possible.
+   */
+  public function setApprovalPrompt($approvalPrompt) {
+    self::$auth->setApprovalPrompt($approvalPrompt);
+  }
+
+  /**
+   * Set the application name, this is included in the User-Agent HTTP header.
+   * @param string $applicationName
+   */
+  public function setApplicationName($applicationName) {
+    global $apiConfig;
+    $apiConfig['application_name'] = $applicationName;
+  }
+
+  /**
+   * Set the OAuth 2.0 Client ID.
+   * @param string $clientId
+   */
+  public function setClientId($clientId) {
+    global $apiConfig;
+    $apiConfig['oauth2_client_id'] = $clientId;
+    self::$auth->clientId = $clientId;
+  }
+
+  /**
+   * Get the OAuth 2.0 Client ID.
+   */
+  public function getClientId() {
+    return self::$auth->clientId;
+  }
+  
+  /**
+   * Set the OAuth 2.0 Client Secret.
+   * @param string $clientSecret
+   */
+  public function setClientSecret($clientSecret) {
+    global $apiConfig;
+    $apiConfig['oauth2_client_secret'] = $clientSecret;
+    self::$auth->clientSecret = $clientSecret;
+  }
+
+  /**
+   * Get the OAuth 2.0 Client Secret.
+   */
+  public function getClientSecret() {
+    return self::$auth->clientSecret;
+  }
+
+  /**
+   * Set the OAuth 2.0 Redirect URI.
+   * @param string $redirectUri
+   */
+  public function setRedirectUri($redirectUri) {
+    global $apiConfig;
+    $apiConfig['oauth2_redirect_uri'] = $redirectUri;
+    self::$auth->redirectUri = $redirectUri;
+  }
+
+  /**
+   * Get the OAuth 2.0 Redirect URI.
+   */
+  public function getRedirectUri() {
+    return self::$auth->redirectUri;
+  }
+
+  /**
+   * Fetches a fresh OAuth 2.0 access token with the given refresh token.
+   * @param string $refreshToken
+   * @return void
+   */
+  public function refreshToken($refreshToken) {
+    self::$auth->refreshToken($refreshToken);
+  }
+
+  /**
+   * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
+   * token, if a token isn't provided.
+   * @throws Google_AuthException
+   * @param string|null $token The token (access token or a refresh token) that should be revoked.
+   * @return boolean Returns True if the revocation was successful, otherwise False.
+   */
+  public function revokeToken($token = null) {
+    self::$auth->revokeToken($token);
+  }
+
+  /**
+   * Verify an id_token. This method will verify the current id_token, if one
+   * isn't provided.
+   * @throws Google_AuthException
+   * @param string|null $token The token (id_token) that should be verified.
+   * @return Google_LoginTicket Returns an apiLoginTicket if the verification was
+   * successful.
+   */
+  public function verifyIdToken($token = null) {
+    return self::$auth->verifyIdToken($token);
+  }
+
+  /**
+   * @param Google_AssertionCredentials $creds
+   * @return void
+   */
+  public function setAssertionCredentials(Google_AssertionCredentials $creds) {
+    self::$auth->setAssertionCredentials($creds);
+  }
+
+  /**
+   * This function allows you to overrule the automatically generated scopes,
+   * so that you can ask for more or less permission in the auth flow
+   * Set this before you call authenticate() though!
+   * @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/moderator')
+   */
+  public function setScopes($scopes) {
+    $this->scopes = is_string($scopes) ? explode(" ", $scopes) : $scopes;
+  }
+
+  /**
+   * Declare if objects should be returned by the api service classes.
+   *
+   * @param boolean $useObjects True if objects should be returned by the service classes.
+   * False if associative arrays should be returned (default behavior).
+   * @experimental
+   */
+  public function setUseObjects($useObjects) {
+    global $apiConfig;
+    $apiConfig['use_objects'] = $useObjects;
+  }
+
+  /**
+   * Declare if objects should be returned by the api service classes.
+   *
+   * @param boolean $useBatch True if the experimental batch support should
+   * be enabled. Defaults to False.
+   * @experimental
+   */
+  public function setUseBatch($useBatch) {
+    self::$useBatch = $useBatch;
+  }
+
+  /**
+   * @static
+   * @return Google_Auth the implementation of apiAuth.
+   */
+  public static function getAuth() {
+    return Google_Client::$auth;
+  }
+
+  /**
+   * @static
+   * @return Google_IO the implementation of apiIo.
+   */
+  public static function getIo() {
+    return Google_Client::$io;
+  }
+
+  /**
+   * @return Google_Cache the implementation of apiCache.
+   */
+  public function getCache() {
+    return Google_Client::$cache;
+  }
+}
+
+// Exceptions that the Google PHP API Library can throw
+class Google_Exception extends Exception {}
+class Google_AuthException extends Google_Exception {}
+class Google_CacheException extends Google_Exception {}
+class Google_IOException extends Google_Exception {}
+class Google_ServiceException extends Google_Exception {
+  /**
+   * Optional list of errors returned in a JSON body of an HTTP error response.
+   */
+  protected $errors = array();
+
+  /**
+   * Override default constructor to add ability to set $errors.
+   *
+   * @param string $message
+   * @param int $code
+   * @param Exception|null $previous
+   * @param [{string, string}] errors List of errors returned in an HTTP
+   * response.  Defaults to [].
+   */
+  public function __construct($message, $code = 0, Exception $previous = null,
+                              $errors = array()) {
+    if(version_compare(PHP_VERSION, '5.3.0') >= 0) {
+      parent::__construct($message, $code, $previous);
+    } else {
+      parent::__construct($message, $code);
+    }
+    
+    $this->errors = $errors;
+  }
+
+  /**
+   * An example of the possible errors returned.
+   *
+   * {
+   *   "domain": "global",
+   *   "reason": "authError",
+   *   "message": "Invalid Credentials",
+   *   "locationType": "header",
+   *   "location": "Authorization",
+   * }
+   *
+   * @return [{string, string}] List of errors return in an HTTP response or [].
+   */
+  public function getErrors() {
+    return $this->errors;
+  }
+}
diff --git a/lib/google/LICENSE b/lib/google/LICENSE
new file mode 100755 (executable)
index 0000000..a148ba5
--- /dev/null
@@ -0,0 +1,203 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all
+other entities that control, are controlled by, or are under common
+control with that entity. For the purposes of this definition,
+"control" means (i) the power, direct or indirect, to cause the
+direction or management of such entity, whether by contract or
+otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation
+source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or
+Object form, made available under the License, as indicated by a
+copyright notice that is included in or attached to the work
+(an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object
+form, that is based on (or derived from) the Work and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship. For the purposes
+of this License, Derivative Works shall not include works that remain
+separable from, or merely link (or bind by name) to the interfaces of,
+the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including
+the original version of the Work and any modifications or additions
+to that Work or Derivative Works thereof, that is intentionally
+submitted to Licensor for inclusion in the Work by the copyright owner
+or by an individual or Legal Entity authorized to submit on behalf of
+the copyright owner. For the purposes of this definition, "submitted"
+means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems,
+and issue tracking systems that are managed by, or on behalf of, the
+Licensor for the purpose of discussing and improving the Work, but
+excluding communication that is conspicuously marked or otherwise
+designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work,
+where such license applies only to those patent claims licensable
+by such Contributor that are necessarily infringed by their
+Contribution(s) alone or by combination of their Contribution(s)
+with the Work to which such Contribution(s) was submitted. If You
+institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work
+or a Contribution incorporated within the Work constitutes direct
+or contributory patent infringement, then any patent licenses
+granted to You under this License for that Work shall terminate
+as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+Work or Derivative Works thereof in any medium, with or without
+modifications, and in Source or Object form, provided that You
+meet the following conditions:
+
+(a) You must give any other recipients of the Work or
+Derivative Works a copy of this License; and
+
+(b) You must cause any modified files to carry prominent notices
+stating that You changed the files; and
+
+(c) You must retain, in the Source form of any Derivative Works
+that You distribute, all copyright, patent, trademark, and
+attribution notices from the Source form of the Work,
+excluding those notices that do not pertain to any part of
+the Derivative Works; and
+
+(d) If the Work includes a "NOTICE" text file as part of its
+distribution, then any Derivative Works that You distribute must
+include a readable copy of the attribution notices contained
+within such NOTICE file, excluding those notices that do not
+pertain to any part of the Derivative Works, in at least one
+of the following places: within a NOTICE text file distributed
+as part of the Derivative Works; within the Source form or
+documentation, if provided along with the Derivative Works; or,
+within a display generated by the Derivative Works, if and
+wherever such third-party notices normally appear. The contents
+of the NOTICE file are for informational purposes only and
+do not modify the License. You may add Your own attribution
+notices within Derivative Works that You distribute, alongside
+or as an addendum to the NOTICE text from the Work, provided
+that such additional attribution notices cannot be construed
+as modifying the License.
+
+You may add Your own copyright statement to Your modifications and
+may provide additional or different license terms and conditions
+for use, reproduction, or distribution of Your modifications, or
+for any such Derivative Works as a whole, provided Your use,
+reproduction, and distribution of the Work otherwise complies with
+the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+To apply the Apache License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
diff --git a/lib/google/NOTICE b/lib/google/NOTICE
new file mode 100755 (executable)
index 0000000..22d7cb5
--- /dev/null
@@ -0,0 +1,4 @@
+This product contains the following libraries:
+
+XRDS-Simple library from http://code.google.com/p/diso/
+Apache License 2.0
diff --git a/lib/google/README b/lib/google/README
new file mode 100755 (executable)
index 0000000..42c42c0
--- /dev/null
@@ -0,0 +1,40 @@
+Google APIs Client Library for PHP
+=====================================
+
+== Description
+The Google API Client Library enables you to work with Google APIs such as Google+, Drive, Tasks, or Latitude on your server.
+
+Requirements:
+  PHP 5.2.x or higher [http://www.php.net/]
+  PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
+  PHP JSON extension [http://php.net/manual/en/book.json.php]
+
+Project page:
+  http://code.google.com/p/google-api-php-client
+
+OAuth 2 instructions:
+  http://code.google.com/p/google-api-php-client/wiki/OAuth2
+
+Report a defect or feature request here:
+  http://code.google.com/p/google-api-php-client/issues/entry
+
+Subscribe to project updates in your feed reader:
+  http://code.google.com/feeds/p/google-api-php-client/updates/basic
+
+Supported sample applications:
+  http://code.google.com/p/google-api-php-client/wiki/Samples
+
+== Basic Example
+  <?php
+  require_once 'path/to/src/Google_Client.php';
+  require_once 'path/to/src/contrib/apiBooksService.php';
+
+  $client = new Google_Client();
+  $service = new Google_BooksService($client);
+
+  $optParams = array('filter' => 'free-ebooks');
+  $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
+
+  foreach ($results['items'] as $item) {
+    print($item['volumeInfo']['title'] . '<br>');
+  }
diff --git a/lib/google/auth/Google_AssertionCredentials.php b/lib/google/auth/Google_AssertionCredentials.php
new file mode 100644 (file)
index 0000000..0d7aeb3
--- /dev/null
@@ -0,0 +1,95 @@
+<?php
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Credentials object used for OAuth 2.0 Signed JWT assertion grants.
+ *
+ * @author Chirag Shah <chirags@google.com>
+ */
+class Google_AssertionCredentials {
+  const MAX_TOKEN_LIFETIME_SECS = 3600;
+
+  public $serviceAccountName;
+  public $scopes;
+  public $privateKey;
+  public $privateKeyPassword;
+  public $assertionType;
+  public $prn;
+
+  /**
+   * @param $serviceAccountName
+   * @param $scopes array List of scopes
+   * @param $privateKey
+   * @param string $privateKeyPassword
+   * @param string $assertionType
+   * @param bool|string $prn The email address of the user for which the
+   *               application is requesting delegated access.
+   */
+  public function __construct(
+      $serviceAccountName,
+      $scopes,
+      $privateKey,
+      $privateKeyPassword = 'notasecret',
+      $assertionType = 'http://oauth.net/grant_type/jwt/1.0/bearer',
+      $prn = false) {
+    $this->serviceAccountName = $serviceAccountName;
+    $this->scopes = is_string($scopes) ? $scopes : implode(' ', $scopes);
+    $this->privateKey = $privateKey;
+    $this->privateKeyPassword = $privateKeyPassword;
+    $this->assertionType = $assertionType;
+    $this->prn = $prn;
+  }
+
+  public function generateAssertion() {
+    $now = time();
+
+    $jwtParams = array(
+          'aud' => Google_OAuth2::OAUTH2_TOKEN_URI,
+          'scope' => $this->scopes,
+          'iat' => $now,
+          'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS,
+          'iss' => $this->serviceAccountName,
+    );
+
+    if ($this->prn !== false) {
+      $jwtParams['prn'] = $this->prn;
+    }
+
+    return $this->makeSignedJwt($jwtParams);
+  }
+
+  /**
+   * Creates a signed JWT.
+   * @param array $payload
+   * @return string The signed JWT.
+   */
+  private function makeSignedJwt($payload) {
+    $header = array('typ' => 'JWT', 'alg' => 'RS256');
+
+    $segments = array(
+      Google_Utils::urlSafeB64Encode(json_encode($header)),
+      Google_Utils::urlSafeB64Encode(json_encode($payload))
+    );
+
+    $signingInput = implode('.', $segments);
+    $signer = new Google_P12Signer($this->privateKey, $this->privateKeyPassword);
+    $signature = $signer->sign($signingInput);
+    $segments[] = Google_Utils::urlSafeB64Encode($signature);
+
+    return implode(".", $segments);
+  }
+}
diff --git a/lib/google/auth/Google_Auth.php b/lib/google/auth/Google_Auth.php
new file mode 100644 (file)
index 0000000..010782d
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google_AuthNone.php";
+require_once "Google_OAuth2.php";
+
+/**
+ * Abstract class for the Authentication in the API client
+ * @author Chris Chabot <chabotc@google.com>
+ *
+ */
+abstract class Google_Auth {
+  abstract public function authenticate($service);
+  abstract public function sign(Google_HttpRequest $request);
+  abstract public function createAuthUrl($scope);
+
+  abstract public function getAccessToken();
+  abstract public function setAccessToken($accessToken);
+  abstract public function setDeveloperKey($developerKey);
+  abstract public function refreshToken($refreshToken);
+  abstract public function revokeToken();
+}
diff --git a/lib/google/auth/Google_AuthNone.php b/lib/google/auth/Google_AuthNone.php
new file mode 100644 (file)
index 0000000..6ca6bc2
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Do-nothing authentication implementation, use this if you want to make un-authenticated calls
+ * @author Chris Chabot <chabotc@google.com>
+ * @author Chirag Shah <chirags@google.com>
+ */
+class Google_AuthNone extends Google_Auth {
+  public $key = null;
+
+  public function __construct() {
+    global $apiConfig;
+    if (!empty($apiConfig['developer_key'])) {
+      $this->setDeveloperKey($apiConfig['developer_key']);
+    }
+  }
+
+  public function setDeveloperKey($key) {$this->key = $key;}
+  public function authenticate($service) {/*noop*/}
+  public function setAccessToken($accessToken) {/* noop*/}
+  public function getAccessToken() {return null;}
+  public function createAuthUrl($scope) {return null;}
+  public function refreshToken($refreshToken) {/* noop*/}
+  public function revokeToken() {/* noop*/}
+
+  public function sign(Google_HttpRequest $request) {
+    if ($this->key) {
+      $request->setUrl($request->getUrl() . ((strpos($request->getUrl(), '?') === false) ? '?' : '&')
+          . 'key='.urlencode($this->key));
+    }
+    return $request;
+  }
+}
diff --git a/lib/google/auth/Google_LoginTicket.php b/lib/google/auth/Google_LoginTicket.php
new file mode 100644 (file)
index 0000000..c0ce614
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Class to hold information about an authenticated login.
+ *
+ * @author Brian Eaton <beaton@google.com>
+ */
+class Google_LoginTicket {
+  const USER_ATTR = "id";
+
+  // Information from id token envelope.
+  private $envelope;
+
+  // Information from id token payload.
+  private $payload;
+
+  /**
+   * Creates a user based on the supplied token.
+   *
+   * @param string $envelope Header from a verified authentication token.
+   * @param string $payload Information from a verified authentication token.
+   */
+  public function __construct($envelope, $payload) {
+    $this->envelope = $envelope;
+    $this->payload = $payload;
+  }
+
+  /**
+   * Returns the numeric identifier for the user.
+   * @throws Google_AuthException
+   * @return
+   */
+  public function getUserId() {
+    if (array_key_exists(self::USER_ATTR, $this->payload)) {
+      return $this->payload[self::USER_ATTR];
+    }
+    throw new Google_AuthException("No user_id in token");
+  }
+
+  /**
+   * Returns attributes from the login ticket.  This can contain
+   * various information about the user session.
+   * @return array
+   */
+  public function getAttributes() {
+    return array("envelope" => $this->envelope, "payload" => $this->payload);
+  }
+}
diff --git a/lib/google/auth/Google_OAuth2.php b/lib/google/auth/Google_OAuth2.php
new file mode 100644 (file)
index 0000000..7394316
--- /dev/null
@@ -0,0 +1,444 @@
+<?php
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google_Verifier.php";
+require_once "Google_LoginTicket.php";
+require_once "service/Google_Utils.php";
+
+/**
+ * Authentication class that deals with the OAuth 2 web-server authentication flow
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ * @author Chirag Shah <chirags@google.com>
+ *
+ */
+class Google_OAuth2 extends Google_Auth {
+  public $clientId;
+  public $clientSecret;
+  public $developerKey;
+  public $token;
+  public $redirectUri;
+  public $state;
+  public $accessType = 'offline';
+  public $approvalPrompt = 'force';
+
+  /** @var Google_AssertionCredentials $assertionCredentials */
+  public $assertionCredentials;
+
+  const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
+  const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
+  const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
+  const OAUTH2_FEDERATED_SIGNON_CERTS_URL = 'https://www.googleapis.com/oauth2/v1/certs';
+  const CLOCK_SKEW_SECS = 300; // five minutes in seconds
+  const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds
+  const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
+
+  /**
+   * Instantiates the class, but does not initiate the login flow, leaving it
+   * to the discretion of the caller (which is done by calling authenticate()).
+   */
+  public function __construct() {
+    global $apiConfig;
+    
+    if (! empty($apiConfig['developer_key'])) {
+      $this->developerKey = $apiConfig['developer_key'];
+    }
+
+    if (! empty($apiConfig['oauth2_client_id'])) {
+      $this->clientId = $apiConfig['oauth2_client_id'];
+    }
+
+    if (! empty($apiConfig['oauth2_client_secret'])) {
+      $this->clientSecret = $apiConfig['oauth2_client_secret'];
+    }
+
+    if (! empty($apiConfig['oauth2_redirect_uri'])) {
+      $this->redirectUri = $apiConfig['oauth2_redirect_uri'];
+    }
+    
+    if (! empty($apiConfig['oauth2_access_type'])) {
+      $this->accessType = $apiConfig['oauth2_access_type'];
+    }
+
+    if (! empty($apiConfig['oauth2_approval_prompt'])) {
+      $this->approvalPrompt = $apiConfig['oauth2_approval_prompt'];
+    }
+  }
+
+  /**
+   * @param $service
+   * @param string|null $code
+   * @throws Google_AuthException
+   * @return string
+   */
+  public function authenticate($service, $code = null) {
+    if (!$code && isset($_GET['code'])) {
+      $code = $_GET['code'];
+    }
+
+    if ($code) {
+      // We got here from the redirect from a successful authorization grant, fetch the access token
+      $request = Google_Client::$io->makeRequest(new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), array(
+          'code' => $code,
+          'grant_type' => 'authorization_code',
+          'redirect_uri' => $this->redirectUri,
+          'client_id' => $this->clientId,
+          'client_secret' => $this->clientSecret
+      )));
+
+      if ($request->getResponseHttpCode() == 200) {
+        $this->setAccessToken($request->getResponseBody());
+        $this->token['created'] = time();
+        return $this->getAccessToken();
+      } else {
+        $response = $request->getResponseBody();
+        $decodedResponse = json_decode($response, true);
+        if ($decodedResponse != null && $decodedResponse['error']) {
+          $response = $decodedResponse['error'];
+        }
+        throw new Google_AuthException("Error fetching OAuth2 access token, message: '$response'", $request->getResponseHttpCode());
+      }
+    }
+
+    $authUrl = $this->createAuthUrl($service['scope']);
+    header('Location: ' . $authUrl);
+    return true;
+  } 
+
+  /**
+   * Create a URL to obtain user authorization.
+   * The authorization endpoint allows the user to first
+   * authenticate, and then grant/deny the access request.
+   * @param string $scope The scope is expressed as a list of space-delimited strings.
+   * @return string
+   */
+  public function createAuthUrl($scope) {
+    $params = array(
+        'response_type=code',
+        'redirect_uri=' . urlencode($this->redirectUri),
+        'client_id=' . urlencode($this->clientId),
+        'scope=' . urlencode($scope),
+        'access_type=' . urlencode($this->accessType),
+        'approval_prompt=' . urlencode($this->approvalPrompt)
+    );
+
+    if (isset($this->state)) {
+      $params[] = 'state=' . urlencode($this->state);
+    }
+    $params = implode('&', $params);
+    return self::OAUTH2_AUTH_URL . "?$params";
+  }
+
+  /**
+   * @param string $token
+   * @throws Google_AuthException
+   */
+  public function setAccessToken($token) {
+    $token = json_decode($token, true);
+    if ($token == null) {
+      throw new Google_AuthException('Could not json decode the token');
+    }
+    if (! isset($token['access_token'])) {
+      throw new Google_AuthException("Invalid token format");
+    }
+    $this->token = $token;
+  }
+
+  public function getAccessToken() {
+    return json_encode($this->token);
+  }
+
+  public function setDeveloperKey($developerKey) {
+    $this->developerKey = $developerKey;
+  }
+
+  public function setState($state) {
+    $this->state = $state;
+  }
+
+  public function setAccessType($accessType) {
+    $this->accessType = $accessType;
+  }
+
+  public function setApprovalPrompt($approvalPrompt) {
+    $this->approvalPrompt = $approvalPrompt;
+  }
+
+  public function setAssertionCredentials(Google_AssertionCredentials $creds) {
+    $this->assertionCredentials = $creds;
+  }
+
+  /**
+   * Include an accessToken in a given apiHttpRequest.
+   * @param Google_HttpRequest $request
+   * @return Google_HttpRequest
+   * @throws Google_AuthException
+   */
+  public function sign(Google_HttpRequest $request) {
+    // add the developer key to the request before signing it
+    if ($this->developerKey) {
+      $requestUrl = $request->getUrl();
+      $requestUrl .= (strpos($request->getUrl(), '?') === false) ? '?' : '&';
+      $requestUrl .=  'key=' . urlencode($this->developerKey);
+      $request->setUrl($requestUrl);
+    }
+
+    // Cannot sign the request without an OAuth access token.
+    if (null == $this->token && null == $this->assertionCredentials) {
+      return $request;
+    }
+
+    // Check if the token is set to expire in the next 30 seconds
+    // (or has already expired).
+    if ($this->isAccessTokenExpired()) {
+      if ($this->assertionCredentials) {
+        $this->refreshTokenWithAssertion();
+      } else {
+        if (! array_key_exists('refresh_token', $this->token)) {
+            throw new Google_AuthException("The OAuth 2.0 access token has expired, "
+                . "and a refresh token is not available. Refresh tokens are not "
+                . "returned for responses that were auto-approved.");
+        }
+        $this->refreshToken($this->token['refresh_token']);
+      }
+    }
+
+    // Add the OAuth2 header to the request
+    $request->setRequestHeaders(
+        array('Authorization' => 'Bearer ' . $this->token['access_token'])
+    );
+
+    return $request;
+  }
+
+  /**
+   * Fetches a fresh access token with the given refresh token.
+   * @param string $refreshToken
+   * @return void
+   */
+  public function refreshToken($refreshToken) {
+    $this->refreshTokenRequest(array(
+        'client_id' => $this->clientId,
+        'client_secret' => $this->clientSecret,
+        'refresh_token' => $refreshToken,
+        'grant_type' => 'refresh_token'
+    ));
+  }
+
+  /**
+   * Fetches a fresh access token with a given assertion token.
+   * @param Google_AssertionCredentials $assertionCredentials optional.
+   * @return void
+   */
+  public function refreshTokenWithAssertion($assertionCredentials = null) {
+    if (!$assertionCredentials) {
+      $assertionCredentials = $this->assertionCredentials;
+    }
+
+    $this->refreshTokenRequest(array(
+        'grant_type' => 'assertion',
+        'assertion_type' => $assertionCredentials->assertionType,
+        'assertion' => $assertionCredentials->generateAssertion(),
+    ));
+  }
+
+  private function refreshTokenRequest($params) {
+    $http = new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), $params);
+    $request = Google_Client::$io->makeRequest($http);
+
+    $code = $request->getResponseHttpCode();
+    $body = $request->getResponseBody();
+    if (200 == $code) {
+      $token = json_decode($body, true);
+      if ($token == null) {
+        throw new Google_AuthException("Could not json decode the access token");
+      }
+
+      if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
+        throw new Google_AuthException("Invalid token format");
+      }
+
+      $this->token['access_token'] = $token['access_token'];
+      $this->token['expires_in'] = $token['expires_in'];
+      $this->token['created'] = time();
+    } else {
+      throw new Google_AuthException("Error refreshing the OAuth2 token, message: '$body'", $code);
+    }
+  }
+
+    /**
+     * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
+     * token, if a token isn't provided.
+     * @throws Google_AuthException
+     * @param string|null $token The token (access token or a refresh token) that should be revoked.
+     * @return boolean Returns True if the revocation was successful, otherwise False.
+     */
+  public function revokeToken($token = null) {
+    if (!$token) {
+      $token = $this->token['access_token'];
+    }
+    $request = new Google_HttpRequest(self::OAUTH2_REVOKE_URI, 'POST', array(), "token=$token");
+    $response = Google_Client::$io->makeRequest($request);
+    $code = $response->getResponseHttpCode();
+    if ($code == 200) {
+      $this->token = null;
+      return true;
+    }
+
+    return false;
+  }
+
+  /**
+   * Returns if the access_token is expired.
+   * @return bool Returns True if the access_token is expired.
+   */
+  public function isAccessTokenExpired() {
+    if (null == $this->token) {
+      return true;
+    }
+
+    // If the token is set to expire in the next 30 seconds.
+    $expired = ($this->token['created']
+        + ($this->token['expires_in'] - 30)) < time();
+
+    return $expired;
+  }
+
+  // Gets federated sign-on certificates to use for verifying identity tokens.
+  // Returns certs as array structure, where keys are key ids, and values
+  // are PEM encoded certificates.
+  private function getFederatedSignOnCerts() {
+    // This relies on makeRequest caching certificate responses.
+    $request = Google_Client::$io->makeRequest(new Google_HttpRequest(
+        self::OAUTH2_FEDERATED_SIGNON_CERTS_URL));
+    if ($request->getResponseHttpCode() == 200) {
+      $certs = json_decode($request->getResponseBody(), true);
+      if ($certs) {
+        return $certs;
+      }
+    }
+    throw new Google_AuthException(
+        "Failed to retrieve verification certificates: '" .
+            $request->getResponseBody() . "'.",
+        $request->getResponseHttpCode());
+  }
+
+  /**
+   * Verifies an id token and returns the authenticated apiLoginTicket.
+   * Throws an exception if the id token is not valid.
+   * The audience parameter can be used to control which id tokens are
+   * accepted.  By default, the id token must have been issued to this OAuth2 client.
+   *
+   * @param $id_token
+   * @param $audience
+   * @return Google_LoginTicket
+   */
+  public function verifyIdToken($id_token = null, $audience = null) {
+    if (!$id_token) {
+      $id_token = $this->token['id_token'];
+    }
+
+    $certs = $this->getFederatedSignonCerts();
+    if (!$audience) {
+      $audience = $this->clientId;
+    }
+    return $this->verifySignedJwtWithCerts($id_token, $certs, $audience);
+  }
+
+  // Verifies the id token, returns the verified token contents.
+  // Visible for testing.
+  function verifySignedJwtWithCerts($jwt, $certs, $required_audience) {
+    $segments = explode(".", $jwt);
+    if (count($segments) != 3) {
+      throw new Google_AuthException("Wrong number of segments in token: $jwt");
+    }
+    $signed = $segments[0] . "." . $segments[1];
+    $signature = Google_Utils::urlSafeB64Decode($segments[2]);
+
+    // Parse envelope.
+    $envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
+    if (!$envelope) {
+      throw new Google_AuthException("Can't parse token envelope: " . $segments[0]);
+    }
+
+    // Parse token
+    $json_body = Google_Utils::urlSafeB64Decode($segments[1]);
+    $payload = json_decode($json_body, true);
+    if (!$payload) {
+      throw new Google_AuthException("Can't parse token payload: " . $segments[1]);
+    }
+
+    // Check signature
+    $verified = false;
+    foreach ($certs as $keyName => $pem) {
+      $public_key = new Google_PemVerifier($pem);
+      if ($public_key->verify($signed, $signature)) {
+        $verified = true;
+        break;
+      }
+    }
+
+    if (!$verified) {
+      throw new Google_AuthException("Invalid token signature: $jwt");
+    }
+
+    // Check issued-at timestamp
+    $iat = 0;
+    if (array_key_exists("iat", $payload)) {
+      $iat = $payload["iat"];
+    }
+    if (!$iat) {
+      throw new Google_AuthException("No issue time in token: $json_body");
+    }
+    $earliest = $iat - self::CLOCK_SKEW_SECS;
+
+    // Check expiration timestamp
+    $now = time();
+    $exp = 0;
+    if (array_key_exists("exp", $payload)) {
+      $exp = $payload["exp"];
+    }
+    if (!$exp) {
+      throw new Google_AuthException("No expiration time in token: $json_body");
+    }
+    if ($exp >= $now + self::MAX_TOKEN_LIFETIME_SECS) {
+      throw new Google_AuthException(
+          "Expiration time too far in future: $json_body");
+    }
+
+    $latest = $exp + self::CLOCK_SKEW_SECS;
+    if ($now < $earliest) {
+      throw new Google_AuthException(
+          "Token used too early, $now < $earliest: $json_body");
+    }
+    if ($now > $latest) {
+      throw new Google_AuthException(
+          "Token used too late, $now > $latest: $json_body");
+    }
+
+    // TODO(beaton): check issuer field?
+
+    // Check audience
+    $aud = $payload["aud"];
+    if ($aud != $required_audience) {
+      throw new Google_AuthException("Wrong recipient, $aud != $required_audience: $json_body");
+    }
+
+    // All good.
+    return new Google_LoginTicket($envelope, $payload);
+  }
+}
diff --git a/lib/google/auth/Google_P12Signer.php b/lib/google/auth/Google_P12Signer.php
new file mode 100644 (file)
index 0000000..1bed590
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Signs data.
+ *
+ * Only used for testing.
+ *
+ * @author Brian Eaton <beaton@google.com>
+ */
+class Google_P12Signer extends Google_Signer {
+  // OpenSSL private key resource
+  private $privateKey;
+
+  // Creates a new signer from a .p12 file.
+  function __construct($p12, $password) {
+    if (!function_exists('openssl_x509_read')) {
+      throw new Exception(
+          'The Google PHP API library needs the openssl PHP extension');
+    }
+
+    // This throws on error
+    $certs = array();
+    if (!openssl_pkcs12_read($p12, $certs, $password)) {
+      throw new Google_AuthException("Unable to parse the p12 file.  " .
+          "Is this a .p12 file?  Is the password correct?  OpenSSL error: " .
+          openssl_error_string());
+    }
+    // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
+    // method?  What happens if there are multiple private keys?  Do we care?
+    if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
+      throw new Google_AuthException("No private key found in p12 file.");
+    }
+    $this->privateKey = openssl_pkey_get_private($certs["pkey"]);
+    if (!$this->privateKey) {
+      throw new Google_AuthException("Unable to load private key in ");
+    }
+  }
+
+  function __destruct() {
+    if ($this->privateKey) {
+      openssl_pkey_free($this->privateKey);
+    }
+  }
+
+  function sign($data) {
+    if(version_compare(PHP_VERSION, '5.3.0') < 0) {
+      throw new Google_AuthException(
+        "PHP 5.3.0 or higher is required to use service accounts.");
+    }
+    if (!openssl_sign($data, $signature, $this->privateKey, "sha256")) {
+      throw new Google_AuthException("Unable to sign data");
+    }
+    return $signature;
+  }
+}
diff --git a/lib/google/auth/Google_PemVerifier.php b/lib/google/auth/Google_PemVerifier.php
new file mode 100644 (file)
index 0000000..6c1c85f
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Verifies signatures using PEM encoded certificates.
+ *
+ * @author Brian Eaton <beaton@google.com>
+ */
+class Google_PemVerifier extends Google_Verifier {
+  private $publicKey;
+
+  /**
+   * Constructs a verifier from the supplied PEM-encoded certificate.
+   *
+   * $pem: a PEM encoded certificate (not a file).
+   * @param $pem
+   * @throws Google_AuthException
+   * @throws Google_Exception
+   */
+  function __construct($pem) {
+    if (!function_exists('openssl_x509_read')) {
+      throw new Google_Exception('Google API PHP client needs the openssl PHP extension');
+    }
+    $this->publicKey = openssl_x509_read($pem);
+    if (!$this->publicKey) {
+      throw new Google_AuthException("Unable to parse PEM: $pem");
+    }
+  }
+
+  function __destruct() {
+    if ($this->publicKey) {
+      openssl_x509_free($this->publicKey);
+    }
+  }
+
+  /**
+   * Verifies the signature on data.
+   *
+   * Returns true if the signature is valid, false otherwise.
+   * @param $data
+   * @param $signature
+   * @throws Google_AuthException
+   * @return bool
+   */
+  function verify($data, $signature) {
+    $status = openssl_verify($data, $signature, $this->publicKey, "sha256");
+    if ($status === -1) {
+      throw new Google_AuthException('Signature verification error: ' . openssl_error_string());
+    }
+    return $status === 1;
+  }
+}
diff --git a/lib/google/auth/Google_Signer.php b/lib/google/auth/Google_Signer.php
new file mode 100644 (file)
index 0000000..7892baa
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google_P12Signer.php";
+
+/**
+ * Signs data.
+ *
+ * @author Brian Eaton <beaton@google.com>
+ */
+abstract class Google_Signer {
+  /**
+   * Signs data, returns the signature as binary data.
+   */
+  abstract public function sign($data);
+}
diff --git a/lib/google/auth/Google_Verifier.php b/lib/google/auth/Google_Verifier.php
new file mode 100644 (file)
index 0000000..2839a37
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google_PemVerifier.php";
+
+/**
+ * Verifies signatures.
+ *
+ * @author Brian Eaton <beaton@google.com>
+ */
+abstract class Google_Verifier {
+  /**
+   * Checks a signature, returns true if the signature is correct,
+   * false otherwise.
+   */
+  abstract public function verify($data, $signature);
+}
diff --git a/lib/google/cache/Google_ApcCache.php b/lib/google/cache/Google_ApcCache.php
new file mode 100644 (file)
index 0000000..3523c98
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A persistent storage class based on the APC cache, which is not
+ * really very persistent, as soon as you restart your web server
+ * the storage will be wiped, however for debugging and/or speed
+ * it can be useful, kinda, and cache is a lot cheaper then storage.
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ */
+class googleApcCache extends Google_Cache {
+
+  public function __construct() {
+    if (! function_exists('apc_add')) {
+      throw new Google_CacheException("Apc functions not available");
+    }
+  }
+
+  private function isLocked($key) {
+    if ((@apc_fetch($key . '.lock')) === false) {
+      return false;
+    }
+    return true;
+  }
+
+  private function createLock($key) {
+    // the interesting thing is that this could fail if the lock was created in the meantime..
+    // but we'll ignore that out of convenience
+    @apc_add($key . '.lock', '', 5);
+  }
+
+  private function removeLock($key) {
+    // suppress all warnings, if some other process removed it that's ok too
+    @apc_delete($key . '.lock');
+  }
+
+  private function waitForLock($key) {
+    // 20 x 250 = 5 seconds
+    $tries = 20;
+    $cnt = 0;
+    do {
+      // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
+      usleep(250);
+      $cnt ++;
+    } while ($cnt <= $tries && $this->isLocked($key));
+    if ($this->isLocked($key)) {
+      // 5 seconds passed, assume the owning process died off and remove it
+      $this->removeLock($key);
+    }
+  }
+
+   /**
+   * @inheritDoc
+   */
+  public function get($key, $expiration = false) {
+
+    if (($ret = @apc_fetch($key)) === false) {
+      return false;
+    }
+    if (!$expiration || (time() - $ret['time'] > $expiration)) {
+      $this->delete($key);
+      return false;
+    }
+    return unserialize($ret['data']);
+  }
+
+  /**
+   * @inheritDoc
+   */
+  public function set($key, $value) {
+    if (@apc_store($key, array('time' => time(), 'data' => serialize($value))) == false) {
+      throw new Google_CacheException("Couldn't store data");
+    }
+  }
+
+  /**
+   * @inheritDoc
+   * @param String $key
+   */
+  public function delete($key) {
+    @apc_delete($key);
+  }
+}
diff --git a/lib/google/cache/Google_Cache.php b/lib/google/cache/Google_Cache.php
new file mode 100644 (file)
index 0000000..809c55e
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google_FileCache.php";
+require_once "Google_MemcacheCache.php";
+
+/**
+ * Abstract storage class
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ */
+abstract class Google_Cache {
+
+  /**
+   * Retrieves the data for the given key, or false if they
+   * key is unknown or expired
+   *
+   * @param String $key The key who's data to retrieve
+   * @param boolean|int $expiration Expiration time in seconds
+   *
+   */
+  abstract function get($key, $expiration = false);
+
+  /**
+   * Store the key => $value set. The $value is serialized
+   * by this function so can be of any type
+   *
+   * @param string $key Key of the data
+   * @param string $value data
+   */
+  abstract function set($key, $value);
+
+  /**
+   * Removes the key/data pair for the given $key
+   *
+   * @param String $key
+   */
+  abstract function delete($key);
+}
+
+
diff --git a/lib/google/cache/Google_FileCache.php b/lib/google/cache/Google_FileCache.php
new file mode 100644 (file)
index 0000000..fbb1337
--- /dev/null
@@ -0,0 +1,137 @@
+<?php
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This class implements a basic on disk storage. While that does
+ * work quite well it's not the most elegant and scalable solution.
+ * It will also get you into a heap of trouble when you try to run
+ * this in a clustered environment. In those cases please use the
+ * MySql back-end
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ */
+class Google_FileCache extends Google_Cache {
+  private $path;
+
+  public function __construct() {
+    global $apiConfig;
+    $this->path = $apiConfig['ioFileCache_directory'];
+  }
+
+  private function isLocked($storageFile) {
+    // our lock file convention is simple: /the/file/path.lock
+    return file_exists($storageFile . '.lock');
+  }
+
+  private function createLock($storageFile) {
+    $storageDir = dirname($storageFile);
+    if (! is_dir($storageDir)) {
+      // @codeCoverageIgnoreStart
+      if (! @mkdir($storageDir, 0755, true)) {
+        // make sure the failure isn't because of a concurrency issue
+        if (! is_dir($storageDir)) {
+          throw new Google_CacheException("Could not create storage directory: $storageDir");
+        }
+      }
+      // @codeCoverageIgnoreEnd
+    }
+    @touch($storageFile . '.lock');
+  }
+
+  private function removeLock($storageFile) {
+    // suppress all warnings, if some other process removed it that's ok too
+    @unlink($storageFile . '.lock');
+  }
+
+  private function waitForLock($storageFile) {
+    // 20 x 250 = 5 seconds
+    $tries = 20;
+    $cnt = 0;
+    do {
+      // make sure PHP picks up on file changes. This is an expensive action but really can't be avoided
+      clearstatcache();
+      // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
+      usleep(250);
+      $cnt ++;
+    } while ($cnt <= $tries && $this->isLocked($storageFile));
+    if ($this->isLocked($storageFile)) {
+      // 5 seconds passed, assume the owning process died off and remove it
+      $this->removeLock($storageFile);
+    }
+  }
+
+  private function getCacheDir($hash) {
+    // use the first 2 characters of the hash as a directory prefix
+    // this should prevent slowdowns due to huge directory listings
+    // and thus give some basic amount of scalability
+    return $this->path . '/' . substr($hash, 0, 2);
+  }
+
+  private function getCacheFile($hash) {
+    return $this->getCacheDir($hash) . '/' . $hash;
+  }
+
+  public function get($key, $expiration = false) {
+    $storageFile = $this->getCacheFile(md5($key));
+    // See if this storage file is locked, if so we wait upto 5 seconds for the lock owning process to
+    // complete it's work. If the lock is not released within that time frame, it's cleaned up.
+    // This should give us a fair amount of 'Cache Stampeding' protection
+    if ($this->isLocked($storageFile)) {
+      $this->waitForLock($storageFile);
+    }
+    if (file_exists($storageFile) && is_readable($storageFile)) {
+      $now = time();
+      if (! $expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
+        if (($data = @file_get_contents($storageFile)) !== false) {
+          $data = unserialize($data);
+          return $data;
+        }
+      }
+    }
+    return false;
+  }
+
+  public function set($key, $value) {
+    $storageDir = $this->getCacheDir(md5($key));
+    $storageFile = $this->getCacheFile(md5($key));
+    if ($this->isLocked($storageFile)) {
+      // some other process is writing to this file too, wait until it's done to prevent hickups
+      $this->waitForLock($storageFile);
+    }
+    if (! is_dir($storageDir)) {
+      if (! @mkdir($storageDir, 0755, true)) {
+        throw new Google_CacheException("Could not create storage directory: $storageDir");
+      }
+    }
+    // we serialize the whole request object, since we don't only want the
+    // responseContent but also the postBody used, headers, size, etc
+    $data = serialize($value);
+    $this->createLock($storageFile);
+    if (! @file_put_contents($storageFile, $data)) {
+      $this->removeLock($storageFile);
+      throw new Google_CacheException("Could not store data in the file");
+    }
+    $this->removeLock($storageFile);
+  }
+
+  public function delete($key) {
+    $file = $this->getCacheFile(md5($key));
+    if (! @unlink($file)) {
+      throw new Google_CacheException("Cache file could not be deleted");
+    }
+  }
+}
diff --git a/lib/google/cache/Google_MemcacheCache.php b/lib/google/cache/Google_MemcacheCache.php
new file mode 100644 (file)
index 0000000..22493f8
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A persistent storage class based on the memcache, which is not
+ * really very persistent, as soon as you restart your memcache daemon
+ * the storage will be wiped, however for debugging and/or speed
+ * it can be useful, kinda, and cache is a lot cheaper then storage.
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ */
+class Google_MemcacheCache extends Google_Cache {
+  private $connection = false;
+
+  public function __construct() {
+    global $apiConfig;
+    if (! function_exists('memcache_connect')) {
+      throw new Google_CacheException("Memcache functions not available");
+    }
+    $this->host = $apiConfig['ioMemCacheCache_host'];
+    $this->port = $apiConfig['ioMemCacheCache_port'];
+    if (empty($this->host) || empty($this->port)) {
+      throw new Google_CacheException("You need to supply a valid memcache host and port");
+    }
+  }
+
+  private function isLocked($key) {
+    $this->check();
+    if ((@memcache_get($this->connection, $key . '.lock')) === false) {
+      return false;
+    }
+    return true;
+  }
+
+  private function createLock($key) {
+    $this->check();
+    // the interesting thing is that this could fail if the lock was created in the meantime..
+    // but we'll ignore that out of convenience
+    @memcache_add($this->connection, $key . '.lock', '', 0, 5);
+  }
+
+  private function removeLock($key) {
+    $this->check();
+    // suppress all warnings, if some other process removed it that's ok too
+    @memcache_delete($this->connection, $key . '.lock');
+  }
+
+  private function waitForLock($key) {
+    $this->check();
+    // 20 x 250 = 5 seconds
+    $tries = 20;
+    $cnt = 0;
+    do {
+      // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
+      usleep(250);
+      $cnt ++;
+    } while ($cnt <= $tries && $this->isLocked($key));
+    if ($this->isLocked($key)) {
+      // 5 seconds passed, assume the owning process died off and remove it
+      $this->removeLock($key);
+    }
+  }
+
+  // I prefer lazy initialization since the cache isn't used every request
+  // so this potentially saves a lot of overhead
+  private function connect() {
+    if (! $this->connection = @memcache_pconnect($this->host, $this->port)) {
+      throw new Google_CacheException("Couldn't connect to memcache server");
+    }
+  }
+
+  private function check() {
+    if (! $this->connection) {
+      $this->connect();
+    }
+  }
+
+  /**
+   * @inheritDoc
+   */
+  public function get($key, $expiration = false) {
+    $this->check();
+    if (($ret = @memcache_get($this->connection, $key)) === false) {
+      return false;
+    }
+    if (! $expiration || (time() - $ret['time'] > $expiration)) {
+      $this->delete($key);
+      return false;
+    }
+    return $ret['data'];
+  }
+
+  /**
+   * @inheritDoc
+   * @param string $key
+   * @param string $value
+   * @throws Google_CacheException
+   */
+  public function set($key, $value) {
+    $this->check();
+    // we store it with the cache_time default expiration so objects will at least get cleaned eventually.
+    if (@memcache_set($this->connection, $key, array('time' => time(),
+        'data' => $value), false) == false) {
+      throw new Google_CacheException("Couldn't store data in cache");
+    }
+  }
+
+  /**
+   * @inheritDoc
+   * @param String $key
+   */
+  public function delete($key) {
+    $this->check();
+    @memcache_delete($this->connection, $key);
+  }
+}
diff --git a/lib/google/config.php b/lib/google/config.php
new file mode 100755 (executable)
index 0000000..00917f4
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+global $apiConfig;
+$apiConfig = array(
+    // True if objects should be returned by the service classes.
+    // False if associative arrays should be returned (default behavior).
+    'use_objects' => false,
+  
+    // The application_name is included in the User-Agent HTTP header.
+    'application_name' => '',
+
+    // OAuth2 Settings, you can get these keys at https://code.google.com/apis/console
+    'oauth2_client_id' => '',
+    'oauth2_client_secret' => '',
+    'oauth2_redirect_uri' => '',
+
+    // The developer key, you get this at https://code.google.com/apis/console
+    'developer_key' => '',
+  
+    // Site name to show in the Google's OAuth 1 authentication screen.
+    'site_name' => 'www.example.org',
+
+    // Which Authentication, Storage and HTTP IO classes to use.
+    'authClass'    => 'Google_OAuth2',
+    'ioClass'      => 'Google_CurlIO',
+    'cacheClass'   => 'Google_FileCache',
+
+    // Don't change these unless you're working against a special development or testing environment.
+    'basePath' => 'https://www.googleapis.com',
+
+    // IO Class dependent configuration, you only have to configure the values
+    // for the class that was configured as the ioClass above
+    'ioFileCache_directory'  =>
+        (function_exists('sys_get_temp_dir') ?
+            sys_get_temp_dir() . '/Google_Client' :
+        '/tmp/Google_Client'),
+
+    // Definition of service specific values like scopes, oauth token URLs, etc
+    'services' => array(
+      'analytics' => array('scope' => 'https://www.googleapis.com/auth/analytics.readonly'),
+      'calendar' => array(
+          'scope' => array(
+              "https://www.googleapis.com/auth/calendar",
+              "https://www.googleapis.com/auth/calendar.readonly",
+          )
+      ),
+      'books' => array('scope' => 'https://www.googleapis.com/auth/books'),
+      'latitude' => array(
+          'scope' => array(
+              'https://www.googleapis.com/auth/latitude.all.best',
+              'https://www.googleapis.com/auth/latitude.all.city',
+          )
+      ),
+      'moderator' => array('scope' => 'https://www.googleapis.com/auth/moderator'),
+      'oauth2' => array(
+          'scope' => array(
+              'https://www.googleapis.com/auth/userinfo.profile',
+              'https://www.googleapis.com/auth/userinfo.email',
+          )
+      ),
+      'plus' => array('scope' => 'https://www.googleapis.com/auth/plus.me'),
+      'siteVerification' => array('scope' => 'https://www.googleapis.com/auth/siteverification'),
+      'tasks' => array('scope' => 'https://www.googleapis.com/auth/tasks'),
+      'urlshortener' => array('scope' => 'https://www.googleapis.com/auth/urlshortener')
+    )
+);
\ No newline at end of file
diff --git a/lib/google/contrib/Google_AdexchangebuyerService.php b/lib/google/contrib/Google_AdexchangebuyerService.php
new file mode 100644 (file)
index 0000000..0fae208
--- /dev/null
@@ -0,0 +1,567 @@
+<?php
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+
+  /**
+   * The "directDeals" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adexchangebuyerService = new Google_AdexchangebuyerService(...);
+   *   $directDeals = $adexchangebuyerService->directDeals;
+   *  </code>
+   */
+  class Google_DirectDealsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Retrieves the authenticated user's list of direct deals. (directDeals.list)
+     *
+     * @param array $optParams Optional parameters.
+     * @return Google_DirectDealsList
+     */
+    public function listDirectDeals($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_DirectDealsList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Gets one direct deal by ID. (directDeals.get)
+     *
+     * @param string $id The direct deal id
+     * @param array $optParams Optional parameters.
+     * @return Google_DirectDeal
+     */
+    public function get($id, $optParams = array()) {
+      $params = array('id' => $id);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_DirectDeal($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "accounts" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adexchangebuyerService = new Google_AdexchangebuyerService(...);
+   *   $accounts = $adexchangebuyerService->accounts;
+   *  </code>
+   */
+  class Google_AccountsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Updates an existing account. This method supports patch semantics. (accounts.patch)
+     *
+     * @param int $id The account id
+     * @param Google_Account $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Account
+     */
+    public function patch($id, Google_Account $postBody, $optParams = array()) {
+      $params = array('id' => $id, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('patch', array($params));
+      if ($this->useObjects()) {
+        return new Google_Account($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Retrieves the authenticated user's list of accounts. (accounts.list)
+     *
+     * @param array $optParams Optional parameters.
+     * @return Google_AccountsList
+     */
+    public function listAccounts($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AccountsList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Updates an existing account. (accounts.update)
+     *
+     * @param int $id The account id
+     * @param Google_Account $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Account
+     */
+    public function update($id, Google_Account $postBody, $optParams = array()) {
+      $params = array('id' => $id, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('update', array($params));
+      if ($this->useObjects()) {
+        return new Google_Account($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Gets one account by ID. (accounts.get)
+     *
+     * @param int $id The account id
+     * @param array $optParams Optional parameters.
+     * @return Google_Account
+     */
+    public function get($id, $optParams = array()) {
+      $params = array('id' => $id);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Account($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "creatives" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adexchangebuyerService = new Google_AdexchangebuyerService(...);
+   *   $creatives = $adexchangebuyerService->creatives;
+   *  </code>
+   */
+  class Google_CreativesServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Submit a new creative. (creatives.insert)
+     *
+     * @param Google_Creative $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Creative
+     */
+    public function insert(Google_Creative $postBody, $optParams = array()) {
+      $params = array('postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('insert', array($params));
+      if ($this->useObjects()) {
+        return new Google_Creative($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Retrieves a list of the authenticated user's active creatives. (creatives.list)
+     *
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. Optional.
+     * @opt_param string maxResults Maximum number of entries returned on one result page. If not set, the default is 100. Optional.
+     * @return Google_CreativesList
+     */
+    public function listCreatives($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_CreativesList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Gets the status for a single creative. (creatives.get)
+     *
+     * @param int $accountId The id for the account that will serve this creative.
+     * @param string $buyerCreativeId The buyer-specific id for this creative.
+     * @param string $adgroupId The adgroup this creative belongs to.
+     * @param array $optParams Optional parameters.
+     * @return Google_Creative
+     */
+    public function get($accountId, $buyerCreativeId, $adgroupId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'buyerCreativeId' => $buyerCreativeId, 'adgroupId' => $adgroupId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Creative($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+/**
+ * Service definition for Google_Adexchangebuyer (v1).
+ *
+ * <p>
+ * Lets you manage your Ad Exchange Buyer account.
+ * </p>
+ *
+ * <p>
+ * For more information about this service, see the
+ * <a href="https://developers.google.com/ad-exchange/buyer-rest" target="_blank">API Documentation</a>
+ * </p>
+ *
+ * @author Google, Inc.
+ */
+class Google_AdexchangebuyerService extends Google_Service {
+  public $directDeals;
+  public $accounts;
+  public $creatives;
+  /**
+   * Constructs the internal representation of the Adexchangebuyer service.
+   *
+   * @param Google_Client $client
+   */
+  public function __construct(Google_Client $client) {
+    $this->servicePath = 'adexchangebuyer/v1/';
+    $this->version = 'v1';
+    $this->serviceName = 'adexchangebuyer';
+
+    $client->addService($this->serviceName, $this->version);
+    $this->directDeals = new Google_DirectDealsServiceResource($this, $this->serviceName, 'directDeals', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adexchange.buyer"], "path": "directdeals", "response": {"$ref": "DirectDealsList"}, "id": "adexchangebuyer.directDeals.list", "httpMethod": "GET"}, "get": {"scopes": ["https://www.googleapis.com/auth/adexchange.buyer"], "parameters": {"id": {"required": true, "type": "string", "location": "path", "format": "int64"}}, "id": "adexchangebuyer.directDeals.get", "httpMethod": "GET", "path": "directdeals/{id}", "response": {"$ref": "DirectDeal"}}}}', true));
+    $this->accounts = new Google_AccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"patch": {"scopes": ["https://www.googleapis.com/auth/adexchange.buyer"], "parameters": {"id": {"required": true, "type": "integer", "location": "path", "format": "int32"}}, "request": {"$ref": "Account"}, "response": {"$ref": "Account"}, "httpMethod": "PATCH", "path": "accounts/{id}", "id": "adexchangebuyer.accounts.patch"}, "list": {"scopes": ["https://www.googleapis.com/auth/adexchange.buyer"], "path": "accounts", "response": {"$ref": "AccountsList"}, "id": "adexchangebuyer.accounts.list", "httpMethod": "GET"}, "update": {"scopes": ["https://www.googleapis.com/auth/adexchange.buyer"], "parameters": {"id": {"required": true, "type": "integer", "location": "path", "format": "int32"}}, "request": {"$ref": "Account"}, "response": {"$ref": "Account"}, "httpMethod": "PUT", "path": "accounts/{id}", "id": "adexchangebuyer.accounts.update"}, "get": {"scopes": ["https://www.googleapis.com/auth/adexchange.buyer"], "parameters": {"id": {"required": true, "type": "integer", "location": "path", "format": "int32"}}, "id": "adexchangebuyer.accounts.get", "httpMethod": "GET", "path": "accounts/{id}", "response": {"$ref": "Account"}}}}', true));
+    $this->creatives = new Google_CreativesServiceResource($this, $this->serviceName, 'creatives', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/adexchange.buyer"], "request": {"$ref": "Creative"}, "response": {"$ref": "Creative"}, "httpMethod": "POST", "path": "creatives", "id": "adexchangebuyer.creatives.insert"}, "list": {"scopes": ["https://www.googleapis.com/auth/adexchange.buyer"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "1", "type": "integer", "maximum": "1000", "format": "uint32"}}, "response": {"$ref": "CreativesList"}, "httpMethod": "GET", "path": "creatives", "id": "adexchangebuyer.creatives.list"}, "get": {"scopes": ["https://www.googleapis.com/auth/adexchange.buyer"], "parameters": {"adgroupId": {"required": true, "type": "string", "location": "query", "format": "int64"}, "buyerCreativeId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "integer", "location": "path", "format": "int32"}}, "id": "adexchangebuyer.creatives.get", "httpMethod": "GET", "path": "creatives/{accountId}/{buyerCreativeId}", "response": {"$ref": "Creative"}}}}', true));
+
+  }
+}
+
+class Google_Account extends Google_Model {
+  public $kind;
+  public $maximumTotalQps;
+  protected $__bidderLocationType = 'Google_AccountBidderLocation';
+  protected $__bidderLocationDataType = 'array';
+  public $bidderLocation;
+  public $cookieMatchingNid;
+  public $id;
+  public $cookieMatchingUrl;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setMaximumTotalQps($maximumTotalQps) {
+    $this->maximumTotalQps = $maximumTotalQps;
+  }
+  public function getMaximumTotalQps() {
+    return $this->maximumTotalQps;
+  }
+  public function setBidderLocation($bidderLocation) {
+    $this->assertIsArray($bidderLocation, 'Google_AccountBidderLocation', __METHOD__);
+    $this->bidderLocation = $bidderLocation;
+  }
+  public function getBidderLocation() {
+    return $this->bidderLocation;
+  }
+  public function setCookieMatchingNid($cookieMatchingNid) {
+    $this->cookieMatchingNid = $cookieMatchingNid;
+  }
+  public function getCookieMatchingNid() {
+    return $this->cookieMatchingNid;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setCookieMatchingUrl($cookieMatchingUrl) {
+    $this->cookieMatchingUrl = $cookieMatchingUrl;
+  }
+  public function getCookieMatchingUrl() {
+    return $this->cookieMatchingUrl;
+  }
+}
+
+class Google_AccountBidderLocation extends Google_Model {
+  public $url;
+  public $maximumQps;
+  public function setUrl($url) {
+    $this->url = $url;
+  }
+  public function getUrl() {
+    return $this->url;
+  }
+  public function setMaximumQps($maximumQps) {
+    $this->maximumQps = $maximumQps;
+  }
+  public function getMaximumQps() {
+    return $this->maximumQps;
+  }
+}
+
+class Google_AccountsList extends Google_Model {
+  protected $__itemsType = 'Google_Account';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_Account', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+}
+
+class Google_Creative extends Google_Model {
+  public $productCategories;
+  public $advertiserName;
+  public $adgroupId;
+  public $videoURL;
+  public $width;
+  public $attribute;
+  public $kind;
+  public $height;
+  public $advertiserId;
+  public $HTMLSnippet;
+  public $status;
+  public $buyerCreativeId;
+  public $clickThroughUrl;
+  public $vendorType;
+  public $disapprovalReasons;
+  public $sensitiveCategories;
+  public $accountId;
+  public function setProductCategories($productCategories) {
+    $this->productCategories = $productCategories;
+  }
+  public function getProductCategories() {
+    return $this->productCategories;
+  }
+  public function setAdvertiserName($advertiserName) {
+    $this->advertiserName = $advertiserName;
+  }
+  public function getAdvertiserName() {
+    return $this->advertiserName;
+  }
+  public function setAdgroupId($adgroupId) {
+    $this->adgroupId = $adgroupId;
+  }
+  public function getAdgroupId() {
+    return $this->adgroupId;
+  }
+  public function setVideoURL($videoURL) {
+    $this->videoURL = $videoURL;
+  }
+  public function getVideoURL() {
+    return $this->videoURL;
+  }
+  public function setWidth($width) {
+    $this->width = $width;
+  }
+  public function getWidth() {
+    return $this->width;
+  }
+  public function setAttribute($attribute) {
+    $this->attribute = $attribute;
+  }
+  public function getAttribute() {
+    return $this->attribute;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setHeight($height) {
+    $this->height = $height;
+  }
+  public function getHeight() {
+    return $this->height;
+  }
+  public function setAdvertiserId($advertiserId) {
+    $this->advertiserId = $advertiserId;
+  }
+  public function getAdvertiserId() {
+    return $this->advertiserId;
+  }
+  public function setHTMLSnippet($HTMLSnippet) {
+    $this->HTMLSnippet = $HTMLSnippet;
+  }
+  public function getHTMLSnippet() {
+    return $this->HTMLSnippet;
+  }
+  public function setStatus($status) {
+    $this->status = $status;
+  }
+  public function getStatus() {
+    return $this->status;
+  }
+  public function setBuyerCreativeId($buyerCreativeId) {
+    $this->buyerCreativeId = $buyerCreativeId;
+  }
+  public function getBuyerCreativeId() {
+    return $this->buyerCreativeId;
+  }
+  public function setClickThroughUrl($clickThroughUrl) {
+    $this->clickThroughUrl = $clickThroughUrl;
+  }
+  public function getClickThroughUrl() {
+    return $this->clickThroughUrl;
+  }
+  public function setVendorType($vendorType) {
+    $this->vendorType = $vendorType;
+  }
+  public function getVendorType() {
+    return $this->vendorType;
+  }
+  public function setDisapprovalReasons($disapprovalReasons) {
+    $this->disapprovalReasons = $disapprovalReasons;
+  }
+  public function getDisapprovalReasons() {
+    return $this->disapprovalReasons;
+  }
+  public function setSensitiveCategories($sensitiveCategories) {
+    $this->sensitiveCategories = $sensitiveCategories;
+  }
+  public function getSensitiveCategories() {
+    return $this->sensitiveCategories;
+  }
+  public function setAccountId($accountId) {
+    $this->accountId = $accountId;
+  }
+  public function getAccountId() {
+    return $this->accountId;
+  }
+}
+
+class Google_CreativesList extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_Creative';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_Creative', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+}
+
+class Google_DirectDeal extends Google_Model {
+  public $advertiser;
+  public $kind;
+  public $currencyCode;
+  public $fixedCpm;
+  public $startTime;
+  public $endTime;
+  public $sellerNetwork;
+  public $id;
+  public $accountId;
+  public function setAdvertiser($advertiser) {
+    $this->advertiser = $advertiser;
+  }
+  public function getAdvertiser() {
+    return $this->advertiser;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setCurrencyCode($currencyCode) {
+    $this->currencyCode = $currencyCode;
+  }
+  public function getCurrencyCode() {
+    return $this->currencyCode;
+  }
+  public function setFixedCpm($fixedCpm) {
+    $this->fixedCpm = $fixedCpm;
+  }
+  public function getFixedCpm() {
+    return $this->fixedCpm;
+  }
+  public function setStartTime($startTime) {
+    $this->startTime = $startTime;
+  }
+  public function getStartTime() {
+    return $this->startTime;
+  }
+  public function setEndTime($endTime) {
+    $this->endTime = $endTime;
+  }
+  public function getEndTime() {
+    return $this->endTime;
+  }
+  public function setSellerNetwork($sellerNetwork) {
+    $this->sellerNetwork = $sellerNetwork;
+  }
+  public function getSellerNetwork() {
+    return $this->sellerNetwork;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setAccountId($accountId) {
+    $this->accountId = $accountId;
+  }
+  public function getAccountId() {
+    return $this->accountId;
+  }
+}
+
+class Google_DirectDealsList extends Google_Model {
+  public $kind;
+  protected $__directDealsType = 'Google_DirectDeal';
+  protected $__directDealsDataType = 'array';
+  public $directDeals;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setDirectDeals($directDeals) {
+    $this->assertIsArray($directDeals, 'Google_DirectDeal', __METHOD__);
+    $this->directDeals = $directDeals;
+  }
+  public function getDirectDeals() {
+    return $this->directDeals;
+  }
+}
diff --git a/lib/google/contrib/Google_AdsenseService.php b/lib/google/contrib/Google_AdsenseService.php
new file mode 100644 (file)
index 0000000..d887090
--- /dev/null
@@ -0,0 +1,1140 @@
+<?php
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+
+  /**
+   * The "urlchannels" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $urlchannels = $adsenseService->urlchannels;
+   *  </code>
+   */
+  class Google_UrlchannelsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all URL channels in the specified ad client for this AdSense account. (urlchannels.list)
+     *
+     * @param string $adClientId Ad client for which to list URL channels.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of URL channels to include in the response, used for paging.
+     * @return Google_UrlChannels
+     */
+    public function listUrlchannels($adClientId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_UrlChannels($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "adunits" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $adunits = $adsenseService->adunits;
+   *  </code>
+   */
+  class Google_AdunitsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all ad units in the specified ad client for this AdSense account. (adunits.list)
+     *
+     * @param string $adClientId Ad client for which to list ad units.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
+     * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
+     * @return Google_AdUnits
+     */
+    public function listAdunits($adClientId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnits($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Gets the specified ad unit in the specified ad client. (adunits.get)
+     *
+     * @param string $adClientId Ad client for which to get the ad unit.
+     * @param string $adUnitId Ad unit to retrieve.
+     * @param array $optParams Optional parameters.
+     * @return Google_AdUnit
+     */
+    public function get($adClientId, $adUnitId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnit($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "customchannels" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $customchannels = $adsenseService->customchannels;
+   *  </code>
+   */
+  class Google_AdunitsCustomchannelsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all custom channels which the specified ad unit belongs to. (customchannels.list)
+     *
+     * @param string $adClientId Ad client which contains the ad unit.
+     * @param string $adUnitId Ad unit for which to list custom channels.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
+     * @return Google_CustomChannels
+     */
+    public function listAdunitsCustomchannels($adClientId, $adUnitId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannels($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "adclients" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $adclients = $adsenseService->adclients;
+   *  </code>
+   */
+  class Google_AdclientsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all ad clients in this AdSense account. (adclients.list)
+     *
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of ad clients to include in the response, used for paging.
+     * @return Google_AdClients
+     */
+    public function listAdclients($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdClients($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "reports" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $reports = $adsenseService->reports;
+   *  </code>
+   */
+  class Google_ReportsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Generate an AdSense report based on the report request sent in the query parameters. Returns the
+     * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
+     * (reports.generate)
+     *
+     * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
+     * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
+     * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
+     * @opt_param string metric Numeric columns to include in the report.
+     * @opt_param int maxResults The maximum number of rows of report data to return.
+     * @opt_param string filter Filters to be run on the report.
+     * @opt_param string currency Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.
+     * @opt_param int startIndex Index of the first row of report data to return.
+     * @opt_param string dimension Dimensions to base the report on.
+     * @opt_param string accountId Accounts upon which to report.
+     * @return Google_AdsenseReportsGenerateResponse
+     */
+    public function generate($startDate, $endDate, $optParams = array()) {
+      $params = array('startDate' => $startDate, 'endDate' => $endDate);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('generate', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdsenseReportsGenerateResponse($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "accounts" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $accounts = $adsenseService->accounts;
+   *  </code>
+   */
+  class Google_AccountsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all accounts available to this AdSense account. (accounts.list)
+     *
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of accounts to include in the response, used for paging.
+     * @return Google_Accounts
+     */
+    public function listAccounts($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_Accounts($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get information about the selected AdSense account. (accounts.get)
+     *
+     * @param string $accountId Account to get information about.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param bool tree Whether the tree of sub accounts should be returned.
+     * @return Google_Account
+     */
+    public function get($accountId, $optParams = array()) {
+      $params = array('accountId' => $accountId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Account($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "urlchannels" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $urlchannels = $adsenseService->urlchannels;
+   *  </code>
+   */
+  class Google_AccountsUrlchannelsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all URL channels in the specified ad client for the specified account. (urlchannels.list)
+     *
+     * @param string $accountId Account to which the ad client belongs.
+     * @param string $adClientId Ad client for which to list URL channels.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of URL channels to include in the response, used for paging.
+     * @return Google_UrlChannels
+     */
+    public function listAccountsUrlchannels($accountId, $adClientId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_UrlChannels($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "adunits" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $adunits = $adsenseService->adunits;
+   *  </code>
+   */
+  class Google_AccountsAdunitsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all ad units in the specified ad client for the specified account. (adunits.list)
+     *
+     * @param string $accountId Account to which the ad client belongs.
+     * @param string $adClientId Ad client for which to list ad units.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
+     * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
+     * @return Google_AdUnits
+     */
+    public function listAccountsAdunits($accountId, $adClientId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnits($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Gets the specified ad unit in the specified ad client for the specified account. (adunits.get)
+     *
+     * @param string $accountId Account to which the ad client belongs.
+     * @param string $adClientId Ad client for which to get the ad unit.
+     * @param string $adUnitId Ad unit to retrieve.
+     * @param array $optParams Optional parameters.
+     * @return Google_AdUnit
+     */
+    public function get($accountId, $adClientId, $adUnitId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnit($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "customchannels" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $customchannels = $adsenseService->customchannels;
+   *  </code>
+   */
+  class Google_AccountsAdunitsCustomchannelsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all custom channels which the specified ad unit belongs to. (customchannels.list)
+     *
+     * @param string $accountId Account to which the ad client belongs.
+     * @param string $adClientId Ad client which contains the ad unit.
+     * @param string $adUnitId Ad unit for which to list custom channels.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
+     * @return Google_CustomChannels
+     */
+    public function listAccountsAdunitsCustomchannels($accountId, $adClientId, $adUnitId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannels($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "adclients" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $adclients = $adsenseService->adclients;
+   *  </code>
+   */
+  class Google_AccountsAdclientsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all ad clients in the specified account. (adclients.list)
+     *
+     * @param string $accountId Account for which to list ad clients.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of ad clients to include in the response, used for paging.
+     * @return Google_AdClients
+     */
+    public function listAccountsAdclients($accountId, $optParams = array()) {
+      $params = array('accountId' => $accountId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdClients($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "reports" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $reports = $adsenseService->reports;
+   *  </code>
+   */
+  class Google_AccountsReportsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Generate an AdSense report based on the report request sent in the query parameters. Returns the
+     * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
+     * (reports.generate)
+     *
+     * @param string $accountId Account upon which to report.
+     * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
+     * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
+     * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
+     * @opt_param string metric Numeric columns to include in the report.
+     * @opt_param int maxResults The maximum number of rows of report data to return.
+     * @opt_param string filter Filters to be run on the report.
+     * @opt_param string currency Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.
+     * @opt_param int startIndex Index of the first row of report data to return.
+     * @opt_param string dimension Dimensions to base the report on.
+     * @return Google_AdsenseReportsGenerateResponse
+     */
+    public function generate($accountId, $startDate, $endDate, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'startDate' => $startDate, 'endDate' => $endDate);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('generate', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdsenseReportsGenerateResponse($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "customchannels" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $customchannels = $adsenseService->customchannels;
+   *  </code>
+   */
+  class Google_AccountsCustomchannelsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all custom channels in the specified ad client for the specified account.
+     * (customchannels.list)
+     *
+     * @param string $accountId Account to which the ad client belongs.
+     * @param string $adClientId Ad client for which to list custom channels.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
+     * @return Google_CustomChannels
+     */
+    public function listAccountsCustomchannels($accountId, $adClientId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannels($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get the specified custom channel from the specified ad client for the specified account.
+     * (customchannels.get)
+     *
+     * @param string $accountId Account to which the ad client belongs.
+     * @param string $adClientId Ad client which contains the custom channel.
+     * @param string $customChannelId Custom channel to retrieve.
+     * @param array $optParams Optional parameters.
+     * @return Google_CustomChannel
+     */
+    public function get($accountId, $adClientId, $customChannelId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'customChannelId' => $customChannelId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannel($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "adunits" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $adunits = $adsenseService->adunits;
+   *  </code>
+   */
+  class Google_AccountsCustomchannelsAdunitsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all ad units in the specified custom channel. (adunits.list)
+     *
+     * @param string $accountId Account to which the ad client belongs.
+     * @param string $adClientId Ad client which contains the custom channel.
+     * @param string $customChannelId Custom channel for which to list ad units.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
+     * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
+     * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @return Google_AdUnits
+     */
+    public function listAccountsCustomchannelsAdunits($accountId, $adClientId, $customChannelId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'customChannelId' => $customChannelId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnits($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "customchannels" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $customchannels = $adsenseService->customchannels;
+   *  </code>
+   */
+  class Google_CustomchannelsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all custom channels in the specified ad client for this AdSense account.
+     * (customchannels.list)
+     *
+     * @param string $adClientId Ad client for which to list custom channels.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
+     * @return Google_CustomChannels
+     */
+    public function listCustomchannels($adClientId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannels($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get the specified custom channel from the specified ad client. (customchannels.get)
+     *
+     * @param string $adClientId Ad client which contains the custom channel.
+     * @param string $customChannelId Custom channel to retrieve.
+     * @param array $optParams Optional parameters.
+     * @return Google_CustomChannel
+     */
+    public function get($adClientId, $customChannelId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannel($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "adunits" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsenseService = new Google_AdsenseService(...);
+   *   $adunits = $adsenseService->adunits;
+   *  </code>
+   */
+  class Google_CustomchannelsAdunitsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all ad units in the specified custom channel. (adunits.list)
+     *
+     * @param string $adClientId Ad client which contains the custom channel.
+     * @param string $customChannelId Custom channel for which to list ad units.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
+     * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
+     * @return Google_AdUnits
+     */
+    public function listCustomchannelsAdunits($adClientId, $customChannelId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnits($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+/**
+ * Service definition for Google_Adsense (v1.1).
+ *
+ * <p>
+ * Gives AdSense publishers access to their inventory and the ability to generate reports
+ * </p>
+ *
+ * <p>
+ * For more information about this service, see the
+ * <a href="https://developers.google.com/adsense/management/" target="_blank">API Documentation</a>
+ * </p>
+ *
+ * @author Google, Inc.
+ */
+class Google_AdsenseService extends Google_Service {
+  public $urlchannels;
+  public $adunits;
+  public $adunits_customchannels;
+  public $adclients;
+  public $reports;
+  public $accounts;
+  public $accounts_urlchannels;
+  public $accounts_adunits;
+  public $accounts_adunits_customchannels;
+  public $accounts_adclients;
+  public $accounts_reports;
+  public $accounts_customchannels;
+  public $accounts_customchannels_adunits;
+  public $customchannels;
+  public $customchannels_adunits;
+  /**
+   * Constructs the internal representation of the Adsense service.
+   *
+   * @param Google_Client $client
+   */
+  public function __construct(Google_Client $client) {
+    $this->servicePath = 'adsense/v1.1/';
+    $this->version = 'v1.1';
+    $this->serviceName = 'adsense';
+
+    $client->addService($this->serviceName, $this->version);
+    $this->urlchannels = new Google_UrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}}, "id": "adsense.urlchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/urlchannels", "response": {"$ref": "UrlChannels"}}}}', true));
+    $this->adunits = new Google_AdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}}, "id": "adsense.adunits.list", "httpMethod": "GET", "path": "adclients/{adClientId}/adunits", "response": {"$ref": "AdUnits"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.adunits.get", "httpMethod": "GET", "path": "adclients/{adClientId}/adunits/{adUnitId}", "response": {"$ref": "AdUnit"}}}}', true));
+    $this->adunits_customchannels = new Google_AdunitsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}, "adUnitId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.adunits.customchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/adunits/{adUnitId}/customchannels", "response": {"$ref": "CustomChannels"}}}}', true));
+    $this->adclients = new Google_AdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}}, "response": {"$ref": "AdClients"}, "httpMethod": "GET", "path": "adclients", "id": "adsense.adclients.list"}}}', true));
+    $this->reports = new Google_ReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"sort": {"repeated": true, "type": "string", "location": "query"}, "startDate": {"required": true, "type": "string", "location": "query"}, "endDate": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "metric": {"repeated": true, "type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "50000", "format": "int32"}, "filter": {"repeated": true, "type": "string", "location": "query"}, "currency": {"type": "string", "location": "query"}, "startIndex": {"location": "query", "minimum": "0", "type": "integer", "maximum": "5000", "format": "int32"}, "dimension": {"repeated": true, "type": "string", "location": "query"}, "accountId": {"repeated": true, "type": "string", "location": "query"}}, "id": "adsense.reports.generate", "httpMethod": "GET", "supportsMediaDownload": true, "path": "reports", "response": {"$ref": "AdsenseReportsGenerateResponse"}}}}', true));
+    $this->accounts = new Google_AccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}}, "response": {"$ref": "Accounts"}, "httpMethod": "GET", "path": "accounts", "id": "adsense.accounts.list"}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"tree": {"type": "boolean", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.get", "httpMethod": "GET", "path": "accounts/{accountId}", "response": {"$ref": "Account"}}}}', true));
+    $this->accounts_urlchannels = new Google_AccountsUrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.urlchannels.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/urlchannels", "response": {"$ref": "UrlChannels"}}}}', true));
+    $this->accounts_adunits = new Google_AccountsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adunits.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "response": {"$ref": "AdUnits"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adunits.get", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}", "response": {"$ref": "AdUnit"}}}}', true));
+    $this->accounts_adunits_customchannels = new Google_AccountsAdunitsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adunits.customchannels.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/customchannels", "response": {"$ref": "CustomChannels"}}}}', true));
+    $this->accounts_adclients = new Google_AccountsAdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adclients.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients", "response": {"$ref": "AdClients"}}}}', true));
+    $this->accounts_reports = new Google_AccountsReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"sort": {"repeated": true, "type": "string", "location": "query"}, "startDate": {"required": true, "type": "string", "location": "query"}, "endDate": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "metric": {"repeated": true, "type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "50000", "format": "int32"}, "filter": {"repeated": true, "type": "string", "location": "query"}, "currency": {"type": "string", "location": "query"}, "startIndex": {"location": "query", "minimum": "0", "type": "integer", "maximum": "5000", "format": "int32"}, "dimension": {"repeated": true, "type": "string", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.reports.generate", "httpMethod": "GET", "supportsMediaDownload": true, "path": "accounts/{accountId}/reports", "response": {"$ref": "AdsenseReportsGenerateResponse"}}}}', true));
+    $this->accounts_customchannels = new Google_AccountsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.customchannels.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels", "response": {"$ref": "CustomChannels"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.customchannels.get", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}", "response": {"$ref": "CustomChannel"}}}}', true));
+    $this->accounts_customchannels_adunits = new Google_AccountsCustomchannelsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}, "pageToken": {"type": "string", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.customchannels.adunits.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}/adunits", "response": {"$ref": "AdUnits"}}}}', true));
+    $this->customchannels = new Google_CustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}}, "id": "adsense.customchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels", "response": {"$ref": "CustomChannels"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.customchannels.get", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels/{customChannelId}", "response": {"$ref": "CustomChannel"}}}}', true));
+    $this->customchannels_adunits = new Google_CustomchannelsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "int32"}}, "id": "adsense.customchannels.adunits.list", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels/{customChannelId}/adunits", "response": {"$ref": "AdUnits"}}}}', true));
+
+  }
+}
+
+class Google_Account extends Google_Model {
+  public $kind;
+  public $id;
+  protected $__subAccountsType = 'Google_Account';
+  protected $__subAccountsDataType = 'array';
+  public $subAccounts;
+  public $name;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSubAccounts($subAccounts) {
+    $this->assertIsArray($subAccounts, 'Google_Account', __METHOD__);
+    $this->subAccounts = $subAccounts;
+  }
+  public function getSubAccounts() {
+    return $this->subAccounts;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_Accounts extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_Account';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_Account', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
+
+class Google_AdClient extends Google_Model {
+  public $productCode;
+  public $kind;
+  public $id;
+  public $supportsReporting;
+  public function setProductCode($productCode) {
+    $this->productCode = $productCode;
+  }
+  public function getProductCode() {
+    return $this->productCode;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSupportsReporting($supportsReporting) {
+    $this->supportsReporting = $supportsReporting;
+  }
+  public function getSupportsReporting() {
+    return $this->supportsReporting;
+  }
+}
+
+class Google_AdClients extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_AdClient';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_AdClient', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
+
+class Google_AdUnit extends Google_Model {
+  public $status;
+  public $kind;
+  public $code;
+  public $id;
+  public $name;
+  public function setStatus($status) {
+    $this->status = $status;
+  }
+  public function getStatus() {
+    return $this->status;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setCode($code) {
+    $this->code = $code;
+  }
+  public function getCode() {
+    return $this->code;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_AdUnits extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_AdUnit';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_AdUnit', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
+
+class Google_AdsenseReportsGenerateResponse extends Google_Model {
+  public $kind;
+  public $rows;
+  public $warnings;
+  public $totals;
+  protected $__headersType = 'Google_AdsenseReportsGenerateResponseHeaders';
+  protected $__headersDataType = 'array';
+  public $headers;
+  public $totalMatchedRows;
+  public $averages;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setRows($rows) {
+    $this->rows = $rows;
+  }
+  public function getRows() {
+    return $this->rows;
+  }
+  public function setWarnings($warnings) {
+    $this->warnings = $warnings;
+  }
+  public function getWarnings() {
+    return $this->warnings;
+  }
+  public function setTotals($totals) {
+    $this->totals = $totals;
+  }
+  public function getTotals() {
+    return $this->totals;
+  }
+  public function setHeaders($headers) {
+    $this->assertIsArray($headers, 'Google_AdsenseReportsGenerateResponseHeaders', __METHOD__);
+    $this->headers = $headers;
+  }
+  public function getHeaders() {
+    return $this->headers;
+  }
+  public function setTotalMatchedRows($totalMatchedRows) {
+    $this->totalMatchedRows = $totalMatchedRows;
+  }
+  public function getTotalMatchedRows() {
+    return $this->totalMatchedRows;
+  }
+  public function setAverages($averages) {
+    $this->averages = $averages;
+  }
+  public function getAverages() {
+    return $this->averages;
+  }
+}
+
+class Google_AdsenseReportsGenerateResponseHeaders extends Google_Model {
+  public $currency;
+  public $type;
+  public $name;
+  public function setCurrency($currency) {
+    $this->currency = $currency;
+  }
+  public function getCurrency() {
+    return $this->currency;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_CustomChannel extends Google_Model {
+  public $kind;
+  public $code;
+  protected $__targetingInfoType = 'Google_CustomChannelTargetingInfo';
+  protected $__targetingInfoDataType = '';
+  public $targetingInfo;
+  public $id;
+  public $name;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setCode($code) {
+    $this->code = $code;
+  }
+  public function getCode() {
+    return $this->code;
+  }
+  public function setTargetingInfo(Google_CustomChannelTargetingInfo $targetingInfo) {
+    $this->targetingInfo = $targetingInfo;
+  }
+  public function getTargetingInfo() {
+    return $this->targetingInfo;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_CustomChannelTargetingInfo extends Google_Model {
+  public $location;
+  public $adsAppearOn;
+  public $siteLanguage;
+  public $description;
+  public function setLocation($location) {
+    $this->location = $location;
+  }
+  public function getLocation() {
+    return $this->location;
+  }
+  public function setAdsAppearOn($adsAppearOn) {
+    $this->adsAppearOn = $adsAppearOn;
+  }
+  public function getAdsAppearOn() {
+    return $this->adsAppearOn;
+  }
+  public function setSiteLanguage($siteLanguage) {
+    $this->siteLanguage = $siteLanguage;
+  }
+  public function getSiteLanguage() {
+    return $this->siteLanguage;
+  }
+  public function setDescription($description) {
+    $this->description = $description;
+  }
+  public function getDescription() {
+    return $this->description;
+  }
+}
+
+class Google_CustomChannels extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_CustomChannel';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_CustomChannel', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
+
+class Google_UrlChannel extends Google_Model {
+  public $kind;
+  public $id;
+  public $urlPattern;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setUrlPattern($urlPattern) {
+    $this->urlPattern = $urlPattern;
+  }
+  public function getUrlPattern() {
+    return $this->urlPattern;
+  }
+}
+
+class Google_UrlChannels extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_UrlChannel';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_UrlChannel', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
diff --git a/lib/google/contrib/Google_AdsensehostService.php b/lib/google/contrib/Google_AdsensehostService.php
new file mode 100644 (file)
index 0000000..246d052
--- /dev/null
@@ -0,0 +1,1378 @@
+<?php
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+
+  /**
+   * The "urlchannels" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsensehostService = new Google_AdsensehostService(...);
+   *   $urlchannels = $adsensehostService->urlchannels;
+   *  </code>
+   */
+  class Google_UrlchannelsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Add a new URL channel to the host AdSense account. (urlchannels.insert)
+     *
+     * @param string $adClientId Ad client to which the new URL channel will be added.
+     * @param Google_UrlChannel $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_UrlChannel
+     */
+    public function insert($adClientId, Google_UrlChannel $postBody, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('insert', array($params));
+      if ($this->useObjects()) {
+        return new Google_UrlChannel($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * List all host URL channels in the host AdSense account. (urlchannels.list)
+     *
+     * @param string $adClientId Ad client for which to list URL channels.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param string maxResults The maximum number of URL channels to include in the response, used for paging.
+     * @return Google_UrlChannels
+     */
+    public function listUrlchannels($adClientId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_UrlChannels($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Delete a URL channel from the host AdSense account. (urlchannels.delete)
+     *
+     * @param string $adClientId Ad client from which to delete the URL channel.
+     * @param string $urlChannelId URL channel to delete.
+     * @param array $optParams Optional parameters.
+     * @return Google_UrlChannel
+     */
+    public function delete($adClientId, $urlChannelId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'urlChannelId' => $urlChannelId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('delete', array($params));
+      if ($this->useObjects()) {
+        return new Google_UrlChannel($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "adclients" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsensehostService = new Google_AdsensehostService(...);
+   *   $adclients = $adsensehostService->adclients;
+   *  </code>
+   */
+  class Google_AdclientsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all host ad clients in this AdSense account. (adclients.list)
+     *
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param string maxResults The maximum number of ad clients to include in the response, used for paging.
+     * @return Google_AdClients
+     */
+    public function listAdclients($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdClients($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get information about one of the ad clients in the Host AdSense account. (adclients.get)
+     *
+     * @param string $adClientId Ad client to get.
+     * @param array $optParams Optional parameters.
+     * @return Google_AdClient
+     */
+    public function get($adClientId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdClient($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "associationsessions" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsensehostService = new Google_AdsensehostService(...);
+   *   $associationsessions = $adsensehostService->associationsessions;
+   *  </code>
+   */
+  class Google_AssociationsessionsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Create an association session for initiating an association with an AdSense user.
+     * (associationsessions.start)
+     *
+     * @param string $productCode Products to associate with the user.
+     * @param string $websiteUrl The URL of the user's hosted website.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string websiteLocale The locale of the user's hosted website.
+     * @opt_param string userLocale The preferred locale of the user.
+     * @return Google_AssociationSession
+     */
+    public function start($productCode, $websiteUrl, $optParams = array()) {
+      $params = array('productCode' => $productCode, 'websiteUrl' => $websiteUrl);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('start', array($params));
+      if ($this->useObjects()) {
+        return new Google_AssociationSession($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Verify an association session after the association callback returns from AdSense signup.
+     * (associationsessions.verify)
+     *
+     * @param string $token The token returned to the association callback URL.
+     * @param array $optParams Optional parameters.
+     * @return Google_AssociationSession
+     */
+    public function verify($token, $optParams = array()) {
+      $params = array('token' => $token);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('verify', array($params));
+      if ($this->useObjects()) {
+        return new Google_AssociationSession($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "reports" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsensehostService = new Google_AdsensehostService(...);
+   *   $reports = $adsensehostService->reports;
+   *  </code>
+   */
+  class Google_ReportsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Generate an AdSense report based on the report request sent in the query parameters. Returns the
+     * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
+     * (reports.generate)
+     *
+     * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
+     * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
+     * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
+     * @opt_param string metric Numeric columns to include in the report.
+     * @opt_param string maxResults The maximum number of rows of report data to return.
+     * @opt_param string filter Filters to be run on the report.
+     * @opt_param string startIndex Index of the first row of report data to return.
+     * @opt_param string dimension Dimensions to base the report on.
+     * @return Google_Report
+     */
+    public function generate($endDate, $startDate, $optParams = array()) {
+      $params = array('endDate' => $endDate, 'startDate' => $startDate);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('generate', array($params));
+      if ($this->useObjects()) {
+        return new Google_Report($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "accounts" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsensehostService = new Google_AdsensehostService(...);
+   *   $accounts = $adsensehostService->accounts;
+   *  </code>
+   */
+  class Google_AccountsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List hosted accounts associated with this AdSense account by ad client id. (accounts.list)
+     *
+     * @param string $filterAdClientId Ad clients to list accounts for.
+     * @param array $optParams Optional parameters.
+     * @return Google_Accounts
+     */
+    public function listAccounts($filterAdClientId, $optParams = array()) {
+      $params = array('filterAdClientId' => $filterAdClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_Accounts($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get information about the selected associated AdSense account. (accounts.get)
+     *
+     * @param string $accountId Account to get information about.
+     * @param array $optParams Optional parameters.
+     * @return Google_Account
+     */
+    public function get($accountId, $optParams = array()) {
+      $params = array('accountId' => $accountId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Account($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "adunits" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsensehostService = new Google_AdsensehostService(...);
+   *   $adunits = $adsensehostService->adunits;
+   *  </code>
+   */
+  class Google_AccountsAdunitsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Insert the supplied ad unit into the specified publisher AdSense account. (adunits.insert)
+     *
+     * @param string $accountId Account which will contain the ad unit.
+     * @param string $adClientId Ad client into which to insert the ad unit.
+     * @param Google_AdUnit $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_AdUnit
+     */
+    public function insert($accountId, $adClientId, Google_AdUnit $postBody, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('insert', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnit($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get the specified host ad unit in this AdSense account. (adunits.get)
+     *
+     * @param string $accountId Account which contains the ad unit.
+     * @param string $adClientId Ad client for which to get ad unit.
+     * @param string $adUnitId Ad unit to get.
+     * @param array $optParams Optional parameters.
+     * @return Google_AdUnit
+     */
+    public function get($accountId, $adClientId, $adUnitId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnit($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get ad code for the specified ad unit, attaching the specified host custom channels.
+     * (adunits.getAdCode)
+     *
+     * @param string $accountId Account which contains the ad client.
+     * @param string $adClientId Ad client with contains the ad unit.
+     * @param string $adUnitId Ad unit to get the code for.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string hostCustomChannelId Host custom channel to attach to the ad code.
+     * @return Google_AdCode
+     */
+    public function getAdCode($accountId, $adClientId, $adUnitId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('getAdCode', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdCode($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * List all ad units in the specified publisher's AdSense account. (adunits.list)
+     *
+     * @param string $accountId Account which contains the ad client.
+     * @param string $adClientId Ad client for which to list ad units.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
+     * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param string maxResults The maximum number of ad units to include in the response, used for paging.
+     * @return Google_AdUnits
+     */
+    public function listAccountsAdunits($accountId, $adClientId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnits($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Update the supplied ad unit in the specified publisher AdSense account. (adunits.update)
+     *
+     * @param string $accountId Account which contains the ad client.
+     * @param string $adClientId Ad client which contains the ad unit.
+     * @param Google_AdUnit $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_AdUnit
+     */
+    public function update($accountId, $adClientId, Google_AdUnit $postBody, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('update', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnit($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Update the supplied ad unit in the specified publisher AdSense account. This method supports
+     * patch semantics. (adunits.patch)
+     *
+     * @param string $accountId Account which contains the ad client.
+     * @param string $adClientId Ad client which contains the ad unit.
+     * @param string $adUnitId Ad unit to get.
+     * @param Google_AdUnit $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_AdUnit
+     */
+    public function patch($accountId, $adClientId, $adUnitId, Google_AdUnit $postBody, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('patch', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnit($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Delete the specified ad unit from the specified publisher AdSense account. (adunits.delete)
+     *
+     * @param string $accountId Account which contains the ad unit.
+     * @param string $adClientId Ad client for which to get ad unit.
+     * @param string $adUnitId Ad unit to delete.
+     * @param array $optParams Optional parameters.
+     * @return Google_AdUnit
+     */
+    public function delete($accountId, $adClientId, $adUnitId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('delete', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdUnit($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "adclients" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsensehostService = new Google_AdsensehostService(...);
+   *   $adclients = $adsensehostService->adclients;
+   *  </code>
+   */
+  class Google_AccountsAdclientsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * List all hosted ad clients in the specified hosted account. (adclients.list)
+     *
+     * @param string $accountId Account for which to list ad clients.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param string maxResults The maximum number of ad clients to include in the response, used for paging.
+     * @return Google_AdClients
+     */
+    public function listAccountsAdclients($accountId, $optParams = array()) {
+      $params = array('accountId' => $accountId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdClients($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get information about one of the ad clients in the specified publisher's AdSense account.
+     * (adclients.get)
+     *
+     * @param string $accountId Account which contains the ad client.
+     * @param string $adClientId Ad client to get.
+     * @param array $optParams Optional parameters.
+     * @return Google_AdClient
+     */
+    public function get($accountId, $adClientId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_AdClient($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "reports" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsensehostService = new Google_AdsensehostService(...);
+   *   $reports = $adsensehostService->reports;
+   *  </code>
+   */
+  class Google_AccountsReportsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Generate an AdSense report based on the report request sent in the query parameters. Returns the
+     * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
+     * (reports.generate)
+     *
+     * @param string $accountId Hosted account upon which to report.
+     * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
+     * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
+     * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
+     * @opt_param string metric Numeric columns to include in the report.
+     * @opt_param string maxResults The maximum number of rows of report data to return.
+     * @opt_param string filter Filters to be run on the report.
+     * @opt_param string startIndex Index of the first row of report data to return.
+     * @opt_param string dimension Dimensions to base the report on.
+     * @return Google_Report
+     */
+    public function generate($accountId, $startDate, $endDate, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'startDate' => $startDate, 'endDate' => $endDate);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('generate', array($params));
+      if ($this->useObjects()) {
+        return new Google_Report($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "customchannels" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $adsensehostService = new Google_AdsensehostService(...);
+   *   $customchannels = $adsensehostService->customchannels;
+   *  </code>
+   */
+  class Google_CustomchannelsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Add a new custom channel to the host AdSense account. (customchannels.insert)
+     *
+     * @param string $adClientId Ad client to which the new custom channel will be added.
+     * @param Google_CustomChannel $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_CustomChannel
+     */
+    public function insert($adClientId, Google_CustomChannel $postBody, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('insert', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannel($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get a specific custom channel from the host AdSense account. (customchannels.get)
+     *
+     * @param string $adClientId Ad client from which to get the custom channel.
+     * @param string $customChannelId Custom channel to get.
+     * @param array $optParams Optional parameters.
+     * @return Google_CustomChannel
+     */
+    public function get($adClientId, $customChannelId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannel($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * List all host custom channels in this AdSense account. (customchannels.list)
+     *
+     * @param string $adClientId Ad client for which to list custom channels.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
+     * @opt_param string maxResults The maximum number of custom channels to include in the response, used for paging.
+     * @return Google_CustomChannels
+     */
+    public function listCustomchannels($adClientId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannels($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Update a custom channel in the host AdSense account. (customchannels.update)
+     *
+     * @param string $adClientId Ad client in which the custom channel will be updated.
+     * @param Google_CustomChannel $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_CustomChannel
+     */
+    public function update($adClientId, Google_CustomChannel $postBody, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('update', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannel($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Update a custom channel in the host AdSense account. This method supports patch semantics.
+     * (customchannels.patch)
+     *
+     * @param string $adClientId Ad client in which the custom channel will be updated.
+     * @param string $customChannelId Custom channel to get.
+     * @param Google_CustomChannel $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_CustomChannel
+     */
+    public function patch($adClientId, $customChannelId, Google_CustomChannel $postBody, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('patch', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannel($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Delete a specific custom channel from the host AdSense account. (customchannels.delete)
+     *
+     * @param string $adClientId Ad client from which to delete the custom channel.
+     * @param string $customChannelId Custom channel to delete.
+     * @param array $optParams Optional parameters.
+     * @return Google_CustomChannel
+     */
+    public function delete($adClientId, $customChannelId, $optParams = array()) {
+      $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('delete', array($params));
+      if ($this->useObjects()) {
+        return new Google_CustomChannel($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+/**
+ * Service definition for Google_Adsensehost (v4.1).
+ *
+ * <p>
+ * Gives AdSense Hosts access to report generation, ad code generation, and publisher management capabilities.
+ * </p>
+ *
+ * <p>
+ * For more information about this service, see the
+ * <a href="https://developers.google.com/adsense/host/" target="_blank">API Documentation</a>
+ * </p>
+ *
+ * @author Google, Inc.
+ */
+class Google_AdsensehostService extends Google_Service {
+  public $urlchannels;
+  public $adclients;
+  public $associationsessions;
+  public $reports;
+  public $accounts;
+  public $accounts_adunits;
+  public $accounts_adclients;
+  public $accounts_reports;
+  public $customchannels;
+  /**
+   * Constructs the internal representation of the Adsensehost service.
+   *
+   * @param Google_Client $client
+   */
+  public function __construct(Google_Client $client) {
+    $this->servicePath = 'adsensehost/v4.1/';
+    $this->version = 'v4.1';
+    $this->serviceName = 'adsensehost';
+
+    $client->addService($this->serviceName, $this->version);
+    $this->urlchannels = new Google_UrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "UrlChannel"}, "response": {"$ref": "UrlChannel"}, "httpMethod": "POST", "path": "adclients/{adClientId}/urlchannels", "id": "adsensehost.urlchannels.insert"}, "list": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "uint32"}}, "id": "adsensehost.urlchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/urlchannels", "response": {"$ref": "UrlChannels"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "urlChannelId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.urlchannels.delete", "httpMethod": "DELETE", "path": "adclients/{adClientId}/urlchannels/{urlChannelId}", "response": {"$ref": "UrlChannel"}}}}', true));
+    $this->adclients = new Google_AdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "uint32"}}, "response": {"$ref": "AdClients"}, "httpMethod": "GET", "path": "adclients", "id": "adsensehost.adclients.list"}, "get": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.adclients.get", "httpMethod": "GET", "path": "adclients/{adClientId}", "response": {"$ref": "AdClient"}}}}', true));
+    $this->associationsessions = new Google_AssociationsessionsServiceResource($this, $this->serviceName, 'associationsessions', json_decode('{"methods": {"start": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"websiteLocale": {"type": "string", "location": "query"}, "productCode": {"repeated": true, "required": true, "type": "string", "location": "query", "enum": ["AFC", "AFF", "AFMC", "AFS"]}, "userLocale": {"type": "string", "location": "query"}, "websiteUrl": {"required": true, "type": "string", "location": "query"}}, "id": "adsensehost.associationsessions.start", "httpMethod": "GET", "path": "associationsessions/start", "response": {"$ref": "AssociationSession"}}, "verify": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"token": {"required": true, "type": "string", "location": "query"}}, "id": "adsensehost.associationsessions.verify", "httpMethod": "GET", "path": "associationsessions/verify", "response": {"$ref": "AssociationSession"}}}}', true));
+    $this->reports = new Google_ReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"sort": {"repeated": true, "type": "string", "location": "query"}, "startDate": {"required": true, "type": "string", "location": "query"}, "endDate": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "metric": {"repeated": true, "type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "50000", "format": "uint32"}, "filter": {"repeated": true, "type": "string", "location": "query"}, "startIndex": {"location": "query", "minimum": "0", "type": "integer", "maximum": "5000", "format": "uint32"}, "dimension": {"repeated": true, "type": "string", "location": "query"}}, "id": "adsensehost.reports.generate", "httpMethod": "GET", "path": "reports", "response": {"$ref": "Report"}}}}', true));
+    $this->accounts = new Google_AccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"filterAdClientId": {"repeated": true, "required": true, "type": "string", "location": "query"}}, "id": "adsensehost.accounts.list", "httpMethod": "GET", "path": "accounts", "response": {"$ref": "Accounts"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.accounts.get", "httpMethod": "GET", "path": "accounts/{accountId}", "response": {"$ref": "Account"}}}}', true));
+    $this->accounts_adunits = new Google_AccountsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "AdUnit"}, "response": {"$ref": "AdUnit"}, "httpMethod": "POST", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "id": "adsensehost.accounts.adunits.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.accounts.adunits.get", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}", "response": {"$ref": "AdUnit"}}, "getAdCode": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "hostCustomChannelId": {"repeated": true, "type": "string", "location": "query"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.accounts.adunits.getAdCode", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode", "response": {"$ref": "AdCode"}}, "list": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "uint32"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.accounts.adunits.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "response": {"$ref": "AdUnits"}}, "update": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "AdUnit"}, "response": {"$ref": "AdUnit"}, "httpMethod": "PUT", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "id": "adsensehost.accounts.adunits.update"}, "patch": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "AdUnit"}, "response": {"$ref": "AdUnit"}, "httpMethod": "PATCH", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "id": "adsensehost.accounts.adunits.patch"}, "delete": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.accounts.adunits.delete", "httpMethod": "DELETE", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}", "response": {"$ref": "AdUnit"}}}}', true));
+    $this->accounts_adclients = new Google_AccountsAdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "uint32"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.accounts.adclients.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients", "response": {"$ref": "AdClients"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.accounts.adclients.get", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}", "response": {"$ref": "AdClient"}}}}', true));
+    $this->accounts_reports = new Google_AccountsReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"sort": {"repeated": true, "type": "string", "location": "query"}, "startDate": {"required": true, "type": "string", "location": "query"}, "endDate": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "metric": {"repeated": true, "type": "string", "location": "query"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "50000", "format": "uint32"}, "filter": {"repeated": true, "type": "string", "location": "query"}, "startIndex": {"location": "query", "minimum": "0", "type": "integer", "maximum": "5000", "format": "uint32"}, "dimension": {"repeated": true, "type": "string", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.accounts.reports.generate", "httpMethod": "GET", "path": "accounts/{accountId}/reports", "response": {"$ref": "Report"}}}}', true));
+    $this->customchannels = new Google_CustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "CustomChannel"}, "response": {"$ref": "CustomChannel"}, "httpMethod": "POST", "path": "adclients/{adClientId}/customchannels", "id": "adsensehost.customchannels.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.customchannels.get", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels/{customChannelId}", "response": {"$ref": "CustomChannel"}}, "list": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"location": "query", "minimum": "0", "type": "integer", "maximum": "10000", "format": "uint32"}}, "id": "adsensehost.customchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels", "response": {"$ref": "CustomChannels"}}, "update": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "CustomChannel"}, "response": {"$ref": "CustomChannel"}, "httpMethod": "PUT", "path": "adclients/{adClientId}/customchannels", "id": "adsensehost.customchannels.update"}, "patch": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"customChannelId": {"required": true, "type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "CustomChannel"}, "response": {"$ref": "CustomChannel"}, "httpMethod": "PATCH", "path": "adclients/{adClientId}/customchannels", "id": "adsensehost.customchannels.patch"}, "delete": {"scopes": ["https://www.googleapis.com/auth/adsensehost"], "parameters": {"customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}}, "id": "adsensehost.customchannels.delete", "httpMethod": "DELETE", "path": "adclients/{adClientId}/customchannels/{customChannelId}", "response": {"$ref": "CustomChannel"}}}}', true));
+
+  }
+}
+
+class Google_Account extends Google_Model {
+  public $status;
+  public $kind;
+  public $id;
+  public $name;
+  public function setStatus($status) {
+    $this->status = $status;
+  }
+  public function getStatus() {
+    return $this->status;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_Accounts extends Google_Model {
+  protected $__itemsType = 'Google_Account';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_Account', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
+
+class Google_AdClient extends Google_Model {
+  public $productCode;
+  public $kind;
+  public $id;
+  public $arcOptIn;
+  public $supportsReporting;
+  public function setProductCode($productCode) {
+    $this->productCode = $productCode;
+  }
+  public function getProductCode() {
+    return $this->productCode;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setArcOptIn($arcOptIn) {
+    $this->arcOptIn = $arcOptIn;
+  }
+  public function getArcOptIn() {
+    return $this->arcOptIn;
+  }
+  public function setSupportsReporting($supportsReporting) {
+    $this->supportsReporting = $supportsReporting;
+  }
+  public function getSupportsReporting() {
+    return $this->supportsReporting;
+  }
+}
+
+class Google_AdClients extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_AdClient';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_AdClient', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
+
+class Google_AdCode extends Google_Model {
+  public $adCode;
+  public $kind;
+  public function setAdCode($adCode) {
+    $this->adCode = $adCode;
+  }
+  public function getAdCode() {
+    return $this->adCode;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+}
+
+class Google_AdStyle extends Google_Model {
+  public $corners;
+  protected $__colorsType = 'Google_AdStyleColors';
+  protected $__colorsDataType = '';
+  public $colors;
+  protected $__fontType = 'Google_AdStyleFont';
+  protected $__fontDataType = '';
+  public $font;
+  public $kind;
+  public function setCorners($corners) {
+    $this->corners = $corners;
+  }
+  public function getCorners() {
+    return $this->corners;
+  }
+  public function setColors(Google_AdStyleColors $colors) {
+    $this->colors = $colors;
+  }
+  public function getColors() {
+    return $this->colors;
+  }
+  public function setFont(Google_AdStyleFont $font) {
+    $this->font = $font;
+  }
+  public function getFont() {
+    return $this->font;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+}
+
+class Google_AdStyleColors extends Google_Model {
+  public $url;
+  public $text;
+  public $border;
+  public $background;
+  public $title;
+  public function setUrl($url) {
+    $this->url = $url;
+  }
+  public function getUrl() {
+    return $this->url;
+  }
+  public function setText($text) {
+    $this->text = $text;
+  }
+  public function getText() {
+    return $this->text;
+  }
+  public function setBorder($border) {
+    $this->border = $border;
+  }
+  public function getBorder() {
+    return $this->border;
+  }
+  public function setBackground($background) {
+    $this->background = $background;
+  }
+  public function getBackground() {
+    return $this->background;
+  }
+  public function setTitle($title) {
+    $this->title = $title;
+  }
+  public function getTitle() {
+    return $this->title;
+  }
+}
+
+class Google_AdStyleFont extends Google_Model {
+  public $family;
+  public $size;
+  public function setFamily($family) {
+    $this->family = $family;
+  }
+  public function getFamily() {
+    return $this->family;
+  }
+  public function setSize($size) {
+    $this->size = $size;
+  }
+  public function getSize() {
+    return $this->size;
+  }
+}
+
+class Google_AdUnit extends Google_Model {
+  public $status;
+  public $kind;
+  public $code;
+  public $name;
+  protected $__contentAdsSettingsType = 'Google_AdUnitContentAdsSettings';
+  protected $__contentAdsSettingsDataType = '';
+  public $contentAdsSettings;
+  public $id;
+  protected $__mobileContentAdsSettingsType = 'Google_AdUnitMobileContentAdsSettings';
+  protected $__mobileContentAdsSettingsDataType = '';
+  public $mobileContentAdsSettings;
+  protected $__customStyleType = 'Google_AdStyle';
+  protected $__customStyleDataType = '';
+  public $customStyle;
+  public function setStatus($status) {
+    $this->status = $status;
+  }
+  public function getStatus() {
+    return $this->status;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setCode($code) {
+    $this->code = $code;
+  }
+  public function getCode() {
+    return $this->code;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+  public function setContentAdsSettings(Google_AdUnitContentAdsSettings $contentAdsSettings) {
+    $this->contentAdsSettings = $contentAdsSettings;
+  }
+  public function getContentAdsSettings() {
+    return $this->contentAdsSettings;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setMobileContentAdsSettings(Google_AdUnitMobileContentAdsSettings $mobileContentAdsSettings) {
+    $this->mobileContentAdsSettings = $mobileContentAdsSettings;
+  }
+  public function getMobileContentAdsSettings() {
+    return $this->mobileContentAdsSettings;
+  }
+  public function setCustomStyle(Google_AdStyle $customStyle) {
+    $this->customStyle = $customStyle;
+  }
+  public function getCustomStyle() {
+    return $this->customStyle;
+  }
+}
+
+class Google_AdUnitContentAdsSettings extends Google_Model {
+  public $type;
+  protected $__backupOptionType = 'Google_AdUnitContentAdsSettingsBackupOption';
+  protected $__backupOptionDataType = '';
+  public $backupOption;
+  public $size;
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+  public function setBackupOption(Google_AdUnitContentAdsSettingsBackupOption $backupOption) {
+    $this->backupOption = $backupOption;
+  }
+  public function getBackupOption() {
+    return $this->backupOption;
+  }
+  public function setSize($size) {
+    $this->size = $size;
+  }
+  public function getSize() {
+    return $this->size;
+  }
+}
+
+class Google_AdUnitContentAdsSettingsBackupOption extends Google_Model {
+  public $color;
+  public $url;
+  public $type;
+  public function setColor($color) {
+    $this->color = $color;
+  }
+  public function getColor() {
+    return $this->color;
+  }
+  public function setUrl($url) {
+    $this->url = $url;
+  }
+  public function getUrl() {
+    return $this->url;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+}
+
+class Google_AdUnitMobileContentAdsSettings extends Google_Model {
+  public $scriptingLanguage;
+  public $type;
+  public $markupLanguage;
+  public $size;
+  public function setScriptingLanguage($scriptingLanguage) {
+    $this->scriptingLanguage = $scriptingLanguage;
+  }
+  public function getScriptingLanguage() {
+    return $this->scriptingLanguage;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+  public function setMarkupLanguage($markupLanguage) {
+    $this->markupLanguage = $markupLanguage;
+  }
+  public function getMarkupLanguage() {
+    return $this->markupLanguage;
+  }
+  public function setSize($size) {
+    $this->size = $size;
+  }
+  public function getSize() {
+    return $this->size;
+  }
+}
+
+class Google_AdUnits extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_AdUnit';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_AdUnit', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
+
+class Google_AssociationSession extends Google_Model {
+  public $status;
+  public $productCodes;
+  public $kind;
+  public $userLocale;
+  public $websiteLocale;
+  public $redirectUrl;
+  public $websiteUrl;
+  public $id;
+  public $accountId;
+  public function setStatus($status) {
+    $this->status = $status;
+  }
+  public function getStatus() {
+    return $this->status;
+  }
+  public function setProductCodes($productCodes) {
+    $this->productCodes = $productCodes;
+  }
+  public function getProductCodes() {
+    return $this->productCodes;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setUserLocale($userLocale) {
+    $this->userLocale = $userLocale;
+  }
+  public function getUserLocale() {
+    return $this->userLocale;
+  }
+  public function setWebsiteLocale($websiteLocale) {
+    $this->websiteLocale = $websiteLocale;
+  }
+  public function getWebsiteLocale() {
+    return $this->websiteLocale;
+  }
+  public function setRedirectUrl($redirectUrl) {
+    $this->redirectUrl = $redirectUrl;
+  }
+  public function getRedirectUrl() {
+    return $this->redirectUrl;
+  }
+  public function setWebsiteUrl($websiteUrl) {
+    $this->websiteUrl = $websiteUrl;
+  }
+  public function getWebsiteUrl() {
+    return $this->websiteUrl;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setAccountId($accountId) {
+    $this->accountId = $accountId;
+  }
+  public function getAccountId() {
+    return $this->accountId;
+  }
+}
+
+class Google_CustomChannel extends Google_Model {
+  public $kind;
+  public $code;
+  public $id;
+  public $name;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setCode($code) {
+    $this->code = $code;
+  }
+  public function getCode() {
+    return $this->code;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_CustomChannels extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_CustomChannel';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_CustomChannel', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
+
+class Google_Report extends Google_Model {
+  public $kind;
+  public $rows;
+  public $warnings;
+  public $totals;
+  protected $__headersType = 'Google_ReportHeaders';
+  protected $__headersDataType = 'array';
+  public $headers;
+  public $totalMatchedRows;
+  public $averages;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setRows($rows) {
+    $this->rows = $rows;
+  }
+  public function getRows() {
+    return $this->rows;
+  }
+  public function setWarnings($warnings) {
+    $this->warnings = $warnings;
+  }
+  public function getWarnings() {
+    return $this->warnings;
+  }
+  public function setTotals($totals) {
+    $this->totals = $totals;
+  }
+  public function getTotals() {
+    return $this->totals;
+  }
+  public function setHeaders($headers) {
+    $this->assertIsArray($headers, 'Google_ReportHeaders', __METHOD__);
+    $this->headers = $headers;
+  }
+  public function getHeaders() {
+    return $this->headers;
+  }
+  public function setTotalMatchedRows($totalMatchedRows) {
+    $this->totalMatchedRows = $totalMatchedRows;
+  }
+  public function getTotalMatchedRows() {
+    return $this->totalMatchedRows;
+  }
+  public function setAverages($averages) {
+    $this->averages = $averages;
+  }
+  public function getAverages() {
+    return $this->averages;
+  }
+}
+
+class Google_ReportHeaders extends Google_Model {
+  public $currency;
+  public $type;
+  public $name;
+  public function setCurrency($currency) {
+    $this->currency = $currency;
+  }
+  public function getCurrency() {
+    return $this->currency;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_UrlChannel extends Google_Model {
+  public $kind;
+  public $id;
+  public $urlPattern;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setUrlPattern($urlPattern) {
+    $this->urlPattern = $urlPattern;
+  }
+  public function getUrlPattern() {
+    return $this->urlPattern;
+  }
+}
+
+class Google_UrlChannels extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_UrlChannel';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems($items) {
+    $this->assertIsArray($items, 'Google_UrlChannel', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
diff --git a/lib/google/contrib/Google_AnalyticsService.php b/lib/google/contrib/Google_AnalyticsService.php
new file mode 100644 (file)
index 0000000..210a2e7
--- /dev/null
@@ -0,0 +1,1887 @@
+<?php
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+
+  /**
+   * The "management" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $analyticsService = new Google_AnalyticsService(...);
+   *   $management = $analyticsService->management;
+   *  </code>
+   */
+  class Google_ManagementServiceResource extends Google_ServiceResource {
+
+
+  }
+
+  /**
+   * The "webproperties" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $analyticsService = new Google_AnalyticsService(...);
+   *   $webproperties = $analyticsService->webproperties;
+   *  </code>
+   */
+  class Google_ManagementWebpropertiesServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Lists web properties to which the user has access. (webproperties.list)
+     *
+     * @param string $accountId Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param int max-results The maximum number of web properties to include in this response.
+     * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
+     * @return Google_Webproperties
+     */
+    public function listManagementWebproperties($accountId, $optParams = array()) {
+      $params = array('accountId' => $accountId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_Webproperties($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "segments" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $analyticsService = new Google_AnalyticsService(...);
+   *   $segments = $analyticsService->segments;
+   *  </code>
+   */
+  class Google_ManagementSegmentsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Lists advanced segments to which the user has access. (segments.list)
+     *
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param int max-results The maximum number of advanced segments to include in this response.
+     * @opt_param int start-index An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
+     * @return Google_Segments
+     */
+    public function listManagementSegments($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_Segments($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "accounts" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $analyticsService = new Google_AnalyticsService(...);
+   *   $accounts = $analyticsService->accounts;
+   *  </code>
+   */
+  class Google_ManagementAccountsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Lists all accounts to which the user has access. (accounts.list)
+     *
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param int max-results The maximum number of accounts to include in this response.
+     * @opt_param int start-index An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
+     * @return Google_Accounts
+     */
+    public function listManagementAccounts($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_Accounts($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "goals" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $analyticsService = new Google_AnalyticsService(...);
+   *   $goals = $analyticsService->goals;
+   *  </code>
+   */
+  class Google_ManagementGoalsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Lists goals to which the user has access. (goals.list)
+     *
+     * @param string $accountId Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
+     * @param string $webPropertyId Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
+     * @param string $profileId Profile ID to retrieve goals for. Can either be a specific profile ID or '~all', which refers to all the profiles that user has access to.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param int max-results The maximum number of goals to include in this response.
+     * @opt_param int start-index An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
+     * @return Google_Goals
+     */
+    public function listManagementGoals($accountId, $webPropertyId, $profileId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_Goals($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "profiles" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $analyticsService = new Google_AnalyticsService(...);
+   *   $profiles = $analyticsService->profiles;
+   *  </code>
+   */
+  class Google_ManagementProfilesServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Lists profiles to which the user has access. (profiles.list)
+     *
+     * @param string $accountId Account ID for the profiles to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access.
+     * @param string $webPropertyId Web property ID for the profiles to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param int max-results The maximum number of profiles to include in this response.
+     * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
+     * @return Google_Profiles
+     */
+    public function listManagementProfiles($accountId, $webPropertyId, $optParams = array()) {
+      $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_Profiles($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "data" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $analyticsService = new Google_AnalyticsService(...);
+   *   $data = $analyticsService->data;
+   *  </code>
+   */
+  class Google_DataServiceResource extends Google_ServiceResource {
+
+
+  }
+
+  /**
+   * The "mcf" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $analyticsService = new Google_AnalyticsService(...);
+   *   $mcf = $analyticsService->mcf;
+   *  </code>
+   */
+  class Google_DataMcfServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Returns Analytics Multi-Channel Funnels data for a profile. (mcf.get)
+     *
+     * @param string $ids Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics profile ID.
+     * @param string $start_date Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD.
+     * @param string $end_date End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD.
+     * @param string $metrics A comma-separated list of Multi-Channel Funnels metrics. E.g., 'mcf:totalConversions,mcf:totalConversionValue'. At least one metric must be specified.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param int max-results The maximum number of entries to include in this feed.
+     * @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for the Analytics data.
+     * @opt_param string dimensions A comma-separated list of Multi-Channel Funnels dimensions. E.g., 'mcf:source,mcf:medium'.
+     * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
+     * @opt_param string filters A comma-separated list of dimension or metric filters to be applied to the Analytics data.
+     * @return Google_McfData
+     */
+    public function get($ids, $start_date, $end_date, $metrics, $optParams = array()) {
+      $params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_McfData($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+  /**
+   * The "ga" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $analyticsService = new Google_AnalyticsService(...);
+   *   $ga = $analyticsService->ga;
+   *  </code>
+   */
+  class Google_DataGaServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Returns Analytics data for a profile. (ga.get)
+     *
+     * @param string $ids Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics profile ID.
+     * @param string $start_date Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD.
+     * @param string $end_date End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD.
+     * @param string $metrics A comma-separated list of Analytics metrics. E.g., 'ga:visits,ga:pageviews'. At least one metric must be specified.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param int max-results The maximum number of entries to include in this feed.
+     * @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for Analytics data.
+     * @opt_param string dimensions A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.
+     * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
+     * @opt_param string segment An Analytics advanced segment to be applied to data.
+     * @opt_param string filters A comma-separated list of dimension or metric filters to be applied to Analytics data.
+     * @return Google_GaData
+     */
+    public function get($ids, $start_date, $end_date, $metrics, $optParams = array()) {
+      $params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_GaData($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+/**
+ * Service definition for Google_Analytics (v3).
+ *
+ * <p>
+ * View and manage your Google Analytics data
+ * </p>
+ *
+ * <p>
+ * For more information about this service, see the
+ * <a href="http://code.google.com/apis/analytics" target="_blank">API Documentation</a>
+ * </p>
+ *
+ * @author Google, Inc.
+ */
+class Google_AnalyticsService extends Google_Service {
+  public $management_webproperties;
+  public $management_segments;
+  public $management_accounts;
+  public $management_goals;
+  public $management_profiles;
+  public $data_mcf;
+  public $data_ga;
+  /**
+   * Constructs the internal representation of the Analytics service.
+   *
+   * @param Google_Client $client
+   */
+  public function __construct(Google_Client $client) {
+    $this->servicePath = 'analytics/v3/';
+    $this->version = 'v3';
+    $this->serviceName = 'analytics';
+
+    $client->addService($this->serviceName, $this->version);
+    $this->management_webproperties = new Google_ManagementWebpropertiesServiceResource($this, $this->serviceName, 'webproperties', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "analytics.management.webproperties.list", "httpMethod": "GET", "path": "management/accounts/{accountId}/webproperties", "response": {"$ref": "Webproperties"}}}}', true));
+    $this->management_segments = new Google_ManagementSegmentsServiceResource($this, $this->serviceName, 'segments', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}}, "response": {"$ref": "Segments"}, "httpMethod": "GET", "path": "management/segments", "id": "analytics.management.segments.list"}}}', true));
+    $this->management_accounts = new Google_ManagementAccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}}, "response": {"$ref": "Accounts"}, "httpMethod": "GET", "path": "management/accounts", "id": "analytics.management.accounts.list"}}}', true));
+    $this->management_goals = new Google_ManagementGoalsServiceResource($this, $this->serviceName, 'goals', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "profileId": {"required": true, "type": "string", "location": "path"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "webPropertyId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "analytics.management.goals.list", "httpMethod": "GET", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals", "response": {"$ref": "Goals"}}}}', true));
+    $this->management_profiles = new Google_ManagementProfilesServiceResource($this, $this->serviceName, 'profiles', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "webPropertyId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "analytics.management.profiles.list", "httpMethod": "GET", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles", "response": {"$ref": "Profiles"}}}}', true));
+    $this->data_mcf = new Google_DataMcfServiceResource($this, $this->serviceName, 'mcf', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "sort": {"type": "string", "location": "query"}, "dimensions": {"type": "string", "location": "query"}, "start-date": {"required": true, "type": "string", "location": "query"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "ids": {"required": true, "type": "string", "location": "query"}, "metrics": {"required": true, "type": "string", "location": "query"}, "filters": {"type": "string", "location": "query"}, "end-date": {"required": true, "type": "string", "location": "query"}}, "id": "analytics.data.mcf.get", "httpMethod": "GET", "path": "data/mcf", "response": {"$ref": "McfData"}}}}', true));
+    $this->data_ga = new Google_DataGaServiceResource($this, $this->serviceName, 'ga', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/analytics.readonly"], "parameters": {"max-results": {"type": "integer", "location": "query", "format": "int32"}, "sort": {"type": "string", "location": "query"}, "dimensions": {"type": "string", "location": "query"}, "start-date": {"required": true, "type": "string", "location": "query"}, "start-index": {"minimum": "1", "type": "integer", "location": "query", "format": "int32"}, "segment": {"type": "string", "location": "query"}, "ids": {"required": true, "type": "string", "location": "query"}, "metrics": {"required": true, "type": "string", "location": "query"}, "filters": {"type": "string", "location": "query"}, "end-date": {"required": true, "type": "string", "location": "query"}}, "id": "analytics.data.ga.get", "httpMethod": "GET", "path": "data/ga", "response": {"$ref": "GaData"}}}}', true));
+
+  }
+}
+
+class Google_Account extends Google_Model {
+  public $kind;
+  public $name;
+  public $created;
+  public $updated;
+  protected $__childLinkType = 'Google_AccountChildLink';
+  protected $__childLinkDataType = '';
+  public $childLink;
+  public $id;
+  public $selfLink;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+  public function setCreated($created) {
+    $this->created = $created;
+  }
+  public function getCreated() {
+    return $this->created;
+  }
+  public function setUpdated($updated) {
+    $this->updated = $updated;
+  }
+  public function getUpdated() {
+    return $this->updated;
+  }
+  public function setChildLink(Google_AccountChildLink $childLink) {
+    $this->childLink = $childLink;
+  }
+  public function getChildLink() {
+    return $this->childLink;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+}
+
+class Google_AccountChildLink extends Google_Model {
+  public $href;
+  public $type;
+  public function setHref($href) {
+    $this->href = $href;
+  }
+  public function getHref() {
+    return $this->href;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+}
+
+class Google_Accounts extends Google_Model {
+  public $username;
+  public $kind;
+  protected $__itemsType = 'Google_Account';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $itemsPerPage;
+  public $previousLink;
+  public $startIndex;
+  public $nextLink;
+  public $totalResults;
+  public function setUsername($username) {
+    $this->username = $username;
+  }
+  public function getUsername() {
+    return $this->username;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setItems(/* array(Google_Account) */ $items) {
+    $this->assertIsArray($items, 'Google_Account', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setItemsPerPage($itemsPerPage) {
+    $this->itemsPerPage = $itemsPerPage;
+  }
+  public function getItemsPerPage() {
+    return $this->itemsPerPage;
+  }
+  public function setPreviousLink($previousLink) {
+    $this->previousLink = $previousLink;
+  }
+  public function getPreviousLink() {
+    return $this->previousLink;
+  }
+  public function setStartIndex($startIndex) {
+    $this->startIndex = $startIndex;
+  }
+  public function getStartIndex() {
+    return $this->startIndex;
+  }
+  public function setNextLink($nextLink) {
+    $this->nextLink = $nextLink;
+  }
+  public function getNextLink() {
+    return $this->nextLink;
+  }
+  public function setTotalResults($totalResults) {
+    $this->totalResults = $totalResults;
+  }
+  public function getTotalResults() {
+    return $this->totalResults;
+  }
+}
+
+class Google_GaData extends Google_Model {
+  public $kind;
+  public $rows;
+  public $containsSampledData;
+  public $totalResults;
+  public $itemsPerPage;
+  public $totalsForAllResults;
+  public $nextLink;
+  public $id;
+  protected $__queryType = 'Google_GaDataQuery';
+  protected $__queryDataType = '';
+  public $query;
+  public $previousLink;
+  protected $__profileInfoType = 'Google_GaDataProfileInfo';
+  protected $__profileInfoDataType = '';
+  public $profileInfo;
+  protected $__columnHeadersType = 'Google_GaDataColumnHeaders';
+  protected $__columnHeadersDataType = 'array';
+  public $columnHeaders;
+  public $selfLink;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setRows(/* array(Google_string) */ $rows) {
+    $this->assertIsArray($rows, 'Google_string', __METHOD__);
+    $this->rows = $rows;
+  }
+  public function getRows() {
+    return $this->rows;
+  }
+  public function setContainsSampledData($containsSampledData) {
+    $this->containsSampledData = $containsSampledData;
+  }
+  public function getContainsSampledData() {
+    return $this->containsSampledData;
+  }
+  public function setTotalResults($totalResults) {
+    $this->totalResults = $totalResults;
+  }
+  public function getTotalResults() {
+    return $this->totalResults;
+  }
+  public function setItemsPerPage($itemsPerPage) {
+    $this->itemsPerPage = $itemsPerPage;
+  }
+  public function getItemsPerPage() {
+    return $this->itemsPerPage;
+  }
+  public function setTotalsForAllResults($totalsForAllResults) {
+    $this->totalsForAllResults = $totalsForAllResults;
+  }
+  public function getTotalsForAllResults() {
+    return $this->totalsForAllResults;
+  }
+  public function setNextLink($nextLink) {
+    $this->nextLink = $nextLink;
+  }
+  public function getNextLink() {
+    return $this->nextLink;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setQuery(Google_GaDataQuery $query) {
+    $this->query = $query;
+  }
+  public function getQuery() {
+    return $this->query;
+  }
+  public function setPreviousLink($previousLink) {
+    $this->previousLink = $previousLink;
+  }
+  public function getPreviousLink() {
+    return $this->previousLink;
+  }
+  public function setProfileInfo(Google_GaDataProfileInfo $profileInfo) {
+    $this->profileInfo = $profileInfo;
+  }
+  public function getProfileInfo() {
+    return $this->profileInfo;
+  }
+  public function setColumnHeaders(/* array(Google_GaDataColumnHeaders) */ $columnHeaders) {
+    $this->assertIsArray($columnHeaders, 'Google_GaDataColumnHeaders', __METHOD__);
+    $this->columnHeaders = $columnHeaders;
+  }
+  public function getColumnHeaders() {
+    return $this->columnHeaders;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+}
+
+class Google_GaDataColumnHeaders extends Google_Model {
+  public $dataType;
+  public $columnType;
+  public $name;
+  public function setDataType($dataType) {
+    $this->dataType = $dataType;
+  }
+  public function getDataType() {
+    return $this->dataType;
+  }
+  public function setColumnType($columnType) {
+    $this->columnType = $columnType;
+  }
+  public function getColumnType() {
+    return $this->columnType;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_GaDataProfileInfo extends Google_Model {
+  public $webPropertyId;
+  public $internalWebPropertyId;
+  public $tableId;
+  public $profileId;
+  public $profileName;
+  public $accountId;
+  public function setWebPropertyId($webPropertyId) {
+    $this->webPropertyId = $webPropertyId;
+  }
+  public function getWebPropertyId() {
+    return $this->webPropertyId;
+  }
+  public function setInternalWebPropertyId($internalWebPropertyId) {
+    $this->internalWebPropertyId = $internalWebPropertyId;
+  }
+  public function getInternalWebPropertyId() {
+    return $this->internalWebPropertyId;
+  }
+  public function setTableId($tableId) {
+    $this->tableId = $tableId;
+  }
+  public function getTableId() {
+    return $this->tableId;
+  }
+  public function setProfileId($profileId) {
+    $this->profileId = $profileId;
+  }
+  public function getProfileId() {
+    return $this->profileId;
+  }
+  public function setProfileName($profileName) {
+    $this->profileName = $profileName;
+  }
+  public function getProfileName() {
+    return $this->profileName;
+  }
+  public function setAccountId($accountId) {
+    $this->accountId = $accountId;
+  }
+  public function getAccountId() {
+    return $this->accountId;
+  }
+}
+
+class Google_GaDataQuery extends Google_Model {
+  public $max_results;
+  public $sort;
+  public $dimensions;
+  public $start_date;
+  public $start_index;
+  public $segment;
+  public $ids;
+  public $metrics;
+  public $filters;
+  public $end_date;
+  public function setMax_results($max_results) {
+    $this->max_results = $max_results;
+  }
+  public function getMax_results() {
+    return $this->max_results;
+  }
+  public function setSort(/* array(Google_string) */ $sort) {
+    $this->assertIsArray($sort, 'Google_string', __METHOD__);
+    $this->sort = $sort;
+  }
+  public function getSort() {
+    return $this->sort;
+  }
+  public function setDimensions($dimensions) {
+    $this->dimensions = $dimensions;
+  }
+  public function getDimensions() {
+    return $this->dimensions;
+  }
+  public function setStart_date($start_date) {
+    $this->start_date = $start_date;
+  }
+  public function getStart_date() {
+    return $this->start_date;
+  }
+  public function setStart_index($start_index) {
+    $this->start_index = $start_index;
+  }
+  public function getStart_index() {
+    return $this->start_index;
+  }
+  public function setSegment($segment) {
+    $this->segment = $segment;
+  }
+  public function getSegment() {
+    return $this->segment;
+  }
+  public function setIds($ids) {
+    $this->ids = $ids;
+  }
+  public function getIds() {
+    return $this->ids;
+  }
+  public function setMetrics(/* array(Google_string) */ $metrics) {
+    $this->assertIsArray($metrics, 'Google_string', __METHOD__);
+    $this->metrics = $metrics;
+  }
+  public function getMetrics() {
+    return $this->metrics;
+  }
+  public function setFilters($filters) {
+    $this->filters = $filters;
+  }
+  public function getFilters() {
+    return $this->filters;
+  }
+  public function setEnd_date($end_date) {
+    $this->end_date = $end_date;
+  }
+  public function getEnd_date() {
+    return $this->end_date;
+  }
+}
+
+class Google_Goal extends Google_Model {
+  public $kind;
+  protected $__visitTimeOnSiteDetailsType = 'Google_GoalVisitTimeOnSiteDetails';
+  protected $__visitTimeOnSiteDetailsDataType = '';
+  public $visitTimeOnSiteDetails;
+  public $name;
+  public $created;
+  protected $__urlDestinationDetailsType = 'Google_GoalUrlDestinationDetails';
+  protected $__urlDestinationDetailsDataType = '';
+  public $urlDestinationDetails;
+  public $updated;
+  public $value;
+  protected $__visitNumPagesDetailsType = 'Google_GoalVisitNumPagesDetails';
+  protected $__visitNumPagesDetailsDataType = '';
+  public $visitNumPagesDetails;
+  public $internalWebPropertyId;
+  protected $__eventDetailsType = 'Google_GoalEventDetails';
+  protected $__eventDetailsDataType = '';
+  public $eventDetails;
+  public $webPropertyId;
+  public $active;
+  public $profileId;
+  protected $__parentLinkType = 'Google_GoalParentLink';
+  protected $__parentLinkDataType = '';
+  public $parentLink;
+  public $type;
+  public $id;
+  public $selfLink;
+  public $accountId;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setVisitTimeOnSiteDetails(Google_GoalVisitTimeOnSiteDetails $visitTimeOnSiteDetails) {
+    $this->visitTimeOnSiteDetails = $visitTimeOnSiteDetails;
+  }
+  public function getVisitTimeOnSiteDetails() {
+    return $this->visitTimeOnSiteDetails;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+  public function setCreated($created) {
+    $this->created = $created;
+  }
+  public function getCreated() {
+    return $this->created;
+  }
+  public function setUrlDestinationDetails(Google_GoalUrlDestinationDetails $urlDestinationDetails) {
+    $this->urlDestinationDetails = $urlDestinationDetails;
+  }
+  public function getUrlDestinationDetails() {
+    return $this->urlDestinationDetails;
+  }
+  public function setUpdated($updated) {
+    $this->updated = $updated;
+  }
+  public function getUpdated() {
+    return $this->updated;
+  }
+  public function setValue($value) {
+    $this->value = $value;
+  }
+  public function getValue() {
+    return $this->value;
+  }
+  public function setVisitNumPagesDetails(Google_GoalVisitNumPagesDetails $visitNumPagesDetails) {
+    $this->visitNumPagesDetails = $visitNumPagesDetails;
+  }
+  public function getVisitNumPagesDetails() {
+    return $this->visitNumPagesDetails;
+  }
+  public function setInternalWebPropertyId($internalWebPropertyId) {
+    $this->internalWebPropertyId = $internalWebPropertyId;
+  }
+  public function getInternalWebPropertyId() {
+    return $this->internalWebPropertyId;
+  }
+  public function setEventDetails(Google_GoalEventDetails $eventDetails) {
+    $this->eventDetails = $eventDetails;
+  }
+  public function getEventDetails() {
+    return $this->eventDetails;
+  }
+  public function setWebPropertyId($webPropertyId) {
+    $this->webPropertyId = $webPropertyId;
+  }
+  public function getWebPropertyId() {
+    return $this->webPropertyId;
+  }
+  public function setActive($active) {
+    $this->active = $active;
+  }
+  public function getActive() {
+    return $this->active;
+  }
+  public function setProfileId($profileId) {
+    $this->profileId = $profileId;
+  }
+  public function getProfileId() {
+    return $this->profileId;
+  }
+  public function setParentLink(Google_GoalParentLink $parentLink) {
+    $this->parentLink = $parentLink;
+  }
+  public function getParentLink() {
+    return $this->parentLink;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+  public function setAccountId($accountId) {
+    $this->accountId = $accountId;
+  }
+  public function getAccountId() {
+    return $this->accountId;
+  }
+}
+
+class Google_GoalEventDetails extends Google_Model {
+  protected $__eventConditionsType = 'Google_GoalEventDetailsEventConditions';
+  protected $__eventConditionsDataType = 'array';
+  public $eventConditions;
+  public $useEventValue;
+  public function setEventConditions(/* array(Google_GoalEventDetailsEventConditions) */ $eventConditions) {
+    $this->assertIsArray($eventConditions, 'Google_GoalEventDetailsEventConditions', __METHOD__);
+    $this->eventConditions = $eventConditions;
+  }
+  public function getEventConditions() {
+    return $this->eventConditions;
+  }
+  public function setUseEventValue($useEventValue) {
+    $this->useEventValue = $useEventValue;
+  }
+  public function getUseEventValue() {
+    return $this->useEventValue;
+  }
+}
+
+class Google_GoalEventDetailsEventConditions extends Google_Model {
+  public $type;
+  public $matchType;
+  public $expression;
+  public $comparisonType;
+  public $comparisonValue;
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+  public function setMatchType($matchType) {
+    $this->matchType = $matchType;
+  }
+  public function getMatchType() {
+    return $this->matchType;
+  }
+  public function setExpression($expression) {
+    $this->expression = $expression;
+  }
+  public function getExpression() {
+    return $this->expression;
+  }
+  public function setComparisonType($comparisonType) {
+    $this->comparisonType = $comparisonType;
+  }
+  public function getComparisonType() {
+    return $this->comparisonType;
+  }
+  public function setComparisonValue($comparisonValue) {
+    $this->comparisonValue = $comparisonValue;
+  }
+  public function getComparisonValue() {
+    return $this->comparisonValue;
+  }
+}
+
+class Google_GoalParentLink extends Google_Model {
+  public $href;
+  public $type;
+  public function setHref($href) {
+    $this->href = $href;
+  }
+  public function getHref() {
+    return $this->href;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+}
+
+class Google_GoalUrlDestinationDetails extends Google_Model {
+  public $url;
+  public $caseSensitive;
+  public $matchType;
+  protected $__stepsType = 'Google_GoalUrlDestinationDetailsSteps';
+  protected $__stepsDataType = 'array';
+  public $steps;
+  public $firstStepRequired;
+  public function setUrl($url) {
+    $this->url = $url;
+  }
+  public function getUrl() {
+    return $this->url;
+  }
+  public function setCaseSensitive($caseSensitive) {
+    $this->caseSensitive = $caseSensitive;
+  }
+  public function getCaseSensitive() {
+    return $this->caseSensitive;
+  }
+  public function setMatchType($matchType) {
+    $this->matchType = $matchType;
+  }
+  public function getMatchType() {
+    return $this->matchType;
+  }
+  public function setSteps(/* array(Google_GoalUrlDestinationDetailsSteps) */ $steps) {
+    $this->assertIsArray($steps, 'Google_GoalUrlDestinationDetailsSteps', __METHOD__);
+    $this->steps = $steps;
+  }
+  public function getSteps() {
+    return $this->steps;
+  }
+  public function setFirstStepRequired($firstStepRequired) {
+    $this->firstStepRequired = $firstStepRequired;
+  }
+  public function getFirstStepRequired() {
+    return $this->firstStepRequired;
+  }
+}
+
+class Google_GoalUrlDestinationDetailsSteps extends Google_Model {
+  public $url;
+  public $name;
+  public $number;
+  public function setUrl($url) {
+    $this->url = $url;
+  }
+  public function getUrl() {
+    return $this->url;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+  public function setNumber($number) {
+    $this->number = $number;
+  }
+  public function getNumber() {
+    return $this->number;
+  }
+}
+
+class Google_GoalVisitNumPagesDetails extends Google_Model {
+  public $comparisonType;
+  public $comparisonValue;
+  public function setComparisonType($comparisonType) {
+    $this->comparisonType = $comparisonType;
+  }
+  public function getComparisonType() {
+    return $this->comparisonType;
+  }
+  public function setComparisonValue($comparisonValue) {
+    $this->comparisonValue = $comparisonValue;
+  }
+  public function getComparisonValue() {
+    return $this->comparisonValue;
+  }
+}
+
+class Google_GoalVisitTimeOnSiteDetails extends Google_Model {
+  public $comparisonType;
+  public $comparisonValue;
+  public function setComparisonType($comparisonType) {
+    $this->comparisonType = $comparisonType;
+  }
+  public function getComparisonType() {
+    return $this->comparisonType;
+  }
+  public function setComparisonValue($comparisonValue) {
+    $this->comparisonValue = $comparisonValue;
+  }
+  public function getComparisonValue() {
+    return $this->comparisonValue;
+  }
+}
+
+class Google_Goals extends Google_Model {
+  public $username;
+  public $kind;
+  protected $__itemsType = 'Google_Goal';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $itemsPerPage;
+  public $previousLink;
+  public $startIndex;
+  public $nextLink;
+  public $totalResults;
+  public function setUsername($username) {
+    $this->username = $username;
+  }
+  public function getUsername() {
+    return $this->username;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setItems(/* array(Google_Goal) */ $items) {
+    $this->assertIsArray($items, 'Google_Goal', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setItemsPerPage($itemsPerPage) {
+    $this->itemsPerPage = $itemsPerPage;
+  }
+  public function getItemsPerPage() {
+    return $this->itemsPerPage;
+  }
+  public function setPreviousLink($previousLink) {
+    $this->previousLink = $previousLink;
+  }
+  public function getPreviousLink() {
+    return $this->previousLink;
+  }
+  public function setStartIndex($startIndex) {
+    $this->startIndex = $startIndex;
+  }
+  public function getStartIndex() {
+    return $this->startIndex;
+  }
+  public function setNextLink($nextLink) {
+    $this->nextLink = $nextLink;
+  }
+  public function getNextLink() {
+    return $this->nextLink;
+  }
+  public function setTotalResults($totalResults) {
+    $this->totalResults = $totalResults;
+  }
+  public function getTotalResults() {
+    return $this->totalResults;
+  }
+}
+
+class Google_McfData extends Google_Model {
+  public $kind;
+  protected $__rowsType = 'Google_McfDataRows';
+  protected $__rowsDataType = 'array';
+  public $rows;
+  public $containsSampledData;
+  public $totalResults;
+  public $itemsPerPage;
+  public $totalsForAllResults;
+  public $nextLink;
+  public $id;
+  protected $__queryType = 'Google_McfDataQuery';
+  protected $__queryDataType = '';
+  public $query;
+  public $previousLink;
+  protected $__profileInfoType = 'Google_McfDataProfileInfo';
+  protected $__profileInfoDataType = '';
+  public $profileInfo;
+  protected $__columnHeadersType = 'Google_McfDataColumnHeaders';
+  protected $__columnHeadersDataType = 'array';
+  public $columnHeaders;
+  public $selfLink;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setRows(/* array(Google_McfDataRows) */ $rows) {
+    $this->assertIsArray($rows, 'Google_McfDataRows', __METHOD__);
+    $this->rows = $rows;
+  }
+  public function getRows() {
+    return $this->rows;
+  }
+  public function setContainsSampledData($containsSampledData) {
+    $this->containsSampledData = $containsSampledData;
+  }
+  public function getContainsSampledData() {
+    return $this->containsSampledData;
+  }
+  public function setTotalResults($totalResults) {
+    $this->totalResults = $totalResults;
+  }
+  public function getTotalResults() {
+    return $this->totalResults;
+  }
+  public function setItemsPerPage($itemsPerPage) {
+    $this->itemsPerPage = $itemsPerPage;
+  }
+  public function getItemsPerPage() {
+    return $this->itemsPerPage;
+  }
+  public function setTotalsForAllResults($totalsForAllResults) {
+    $this->totalsForAllResults = $totalsForAllResults;
+  }
+  public function getTotalsForAllResults() {
+    return $this->totalsForAllResults;
+  }
+  public function setNextLink($nextLink) {
+    $this->nextLink = $nextLink;
+  }
+  public function getNextLink() {
+    return $this->nextLink;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setQuery(Google_McfDataQuery $query) {
+    $this->query = $query;
+  }
+  public function getQuery() {
+    return $this->query;
+  }
+  public function setPreviousLink($previousLink) {
+    $this->previousLink = $previousLink;
+  }
+  public function getPreviousLink() {
+    return $this->previousLink;
+  }
+  public function setProfileInfo(Google_McfDataProfileInfo $profileInfo) {
+    $this->profileInfo = $profileInfo;
+  }
+  public function getProfileInfo() {
+    return $this->profileInfo;
+  }
+  public function setColumnHeaders(/* array(Google_McfDataColumnHeaders) */ $columnHeaders) {
+    $this->assertIsArray($columnHeaders, 'Google_McfDataColumnHeaders', __METHOD__);
+    $this->columnHeaders = $columnHeaders;
+  }
+  public function getColumnHeaders() {
+    return $this->columnHeaders;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+}
+
+class Google_McfDataColumnHeaders extends Google_Model {
+  public $dataType;
+  public $columnType;
+  public $name;
+  public function setDataType($dataType) {
+    $this->dataType = $dataType;
+  }
+  public function getDataType() {
+    return $this->dataType;
+  }
+  public function setColumnType($columnType) {
+    $this->columnType = $columnType;
+  }
+  public function getColumnType() {
+    return $this->columnType;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_McfDataProfileInfo extends Google_Model {
+  public $webPropertyId;
+  public $internalWebPropertyId;
+  public $tableId;
+  public $profileId;
+  public $profileName;
+  public $accountId;
+  public function setWebPropertyId($webPropertyId) {
+    $this->webPropertyId = $webPropertyId;
+  }
+  public function getWebPropertyId() {
+    return $this->webPropertyId;
+  }
+  public function setInternalWebPropertyId($internalWebPropertyId) {
+    $this->internalWebPropertyId = $internalWebPropertyId;
+  }
+  public function getInternalWebPropertyId() {
+    return $this->internalWebPropertyId;
+  }
+  public function setTableId($tableId) {
+    $this->tableId = $tableId;
+  }
+  public function getTableId() {
+    return $this->tableId;
+  }
+  public function setProfileId($profileId) {
+    $this->profileId = $profileId;
+  }
+  public function getProfileId() {
+    return $this->profileId;
+  }
+  public function setProfileName($profileName) {
+    $this->profileName = $profileName;
+  }
+  public function getProfileName() {
+    return $this->profileName;
+  }
+  public function setAccountId($accountId) {
+    $this->accountId = $accountId;
+  }
+  public function getAccountId() {
+    return $this->accountId;
+  }
+}
+
+class Google_McfDataQuery extends Google_Model {
+  public $max_results;
+  public $sort;
+  public $dimensions;
+  public $start_date;
+  public $start_index;
+  public $segment;
+  public $ids;
+  public $metrics;
+  public $filters;
+  public $end_date;
+  public function setMax_results($max_results) {
+    $this->max_results = $max_results;
+  }
+  public function getMax_results() {
+    return $this->max_results;
+  }
+  public function setSort(/* array(Google_string) */ $sort) {
+    $this->assertIsArray($sort, 'Google_string', __METHOD__);
+    $this->sort = $sort;
+  }
+  public function getSort() {
+    return $this->sort;
+  }
+  public function setDimensions($dimensions) {
+    $this->dimensions = $dimensions;
+  }
+  public function getDimensions() {
+    return $this->dimensions;
+  }
+  public function setStart_date($start_date) {
+    $this->start_date = $start_date;
+  }
+  public function getStart_date() {
+    return $this->start_date;
+  }
+  public function setStart_index($start_index) {
+    $this->start_index = $start_index;
+  }
+  public function getStart_index() {
+    return $this->start_index;
+  }
+  public function setSegment($segment) {
+    $this->segment = $segment;
+  }
+  public function getSegment() {
+    return $this->segment;
+  }
+  public function setIds($ids) {
+    $this->ids = $ids;
+  }
+  public function getIds() {
+    return $this->ids;
+  }
+  public function setMetrics(/* array(Google_string) */ $metrics) {
+    $this->assertIsArray($metrics, 'Google_string', __METHOD__);
+    $this->metrics = $metrics;
+  }
+  public function getMetrics() {
+    return $this->metrics;
+  }
+  public function setFilters($filters) {
+    $this->filters = $filters;
+  }
+  public function getFilters() {
+    return $this->filters;
+  }
+  public function setEnd_date($end_date) {
+    $this->end_date = $end_date;
+  }
+  public function getEnd_date() {
+    return $this->end_date;
+  }
+}
+
+class Google_McfDataRows extends Google_Model {
+  public $primitiveValue;
+  protected $__conversionPathValueType = 'Google_McfDataRowsConversionPathValue';
+  protected $__conversionPathValueDataType = 'array';
+  public $conversionPathValue;
+  public function setPrimitiveValue($primitiveValue) {
+    $this->primitiveValue = $primitiveValue;
+  }
+  public function getPrimitiveValue() {
+    return $this->primitiveValue;
+  }
+  public function setConversionPathValue(/* array(Google_McfDataRowsConversionPathValue) */ $conversionPathValue) {
+    $this->assertIsArray($conversionPathValue, 'Google_McfDataRowsConversionPathValue', __METHOD__);
+    $this->conversionPathValue = $conversionPathValue;
+  }
+  public function getConversionPathValue() {
+    return $this->conversionPathValue;
+  }
+}
+
+class Google_McfDataRowsConversionPathValue extends Google_Model {
+  public $nodeValue;
+  public $interactionType;
+  public function setNodeValue($nodeValue) {
+    $this->nodeValue = $nodeValue;
+  }
+  public function getNodeValue() {
+    return $this->nodeValue;
+  }
+  public function setInteractionType($interactionType) {
+    $this->interactionType = $interactionType;
+  }
+  public function getInteractionType() {
+    return $this->interactionType;
+  }
+}
+
+class Google_Profile extends Google_Model {
+  public $defaultPage;
+  public $kind;
+  public $excludeQueryParameters;
+  public $name;
+  public $created;
+  public $webPropertyId;
+  public $updated;
+  public $siteSearchQueryParameters;
+  public $currency;
+  public $internalWebPropertyId;
+  protected $__childLinkType = 'Google_ProfileChildLink';
+  protected $__childLinkDataType = '';
+  public $childLink;
+  public $timezone;
+  public $siteSearchCategoryParameters;
+  protected $__parentLinkType = 'Google_ProfileParentLink';
+  protected $__parentLinkDataType = '';
+  public $parentLink;
+  public $id;
+  public $selfLink;
+  public $accountId;
+  public function setDefaultPage($defaultPage) {
+    $this->defaultPage = $defaultPage;
+  }
+  public function getDefaultPage() {
+    return $this->defaultPage;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setExcludeQueryParameters($excludeQueryParameters) {
+    $this->excludeQueryParameters = $excludeQueryParameters;
+  }
+  public function getExcludeQueryParameters() {
+    return $this->excludeQueryParameters;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+  public function setCreated($created) {
+    $this->created = $created;
+  }
+  public function getCreated() {
+    return $this->created;
+  }
+  public function setWebPropertyId($webPropertyId) {
+    $this->webPropertyId = $webPropertyId;
+  }
+  public function getWebPropertyId() {
+    return $this->webPropertyId;
+  }
+  public function setUpdated($updated) {
+    $this->updated = $updated;
+  }
+  public function getUpdated() {
+    return $this->updated;
+  }
+  public function setSiteSearchQueryParameters($siteSearchQueryParameters) {
+    $this->siteSearchQueryParameters = $siteSearchQueryParameters;
+  }
+  public function getSiteSearchQueryParameters() {
+    return $this->siteSearchQueryParameters;
+  }
+  public function setCurrency($currency) {
+    $this->currency = $currency;
+  }
+  public function getCurrency() {
+    return $this->currency;
+  }
+  public function setInternalWebPropertyId($internalWebPropertyId) {
+    $this->internalWebPropertyId = $internalWebPropertyId;
+  }
+  public function getInternalWebPropertyId() {
+    return $this->internalWebPropertyId;
+  }
+  public function setChildLink(Google_ProfileChildLink $childLink) {
+    $this->childLink = $childLink;
+  }
+  public function getChildLink() {
+    return $this->childLink;
+  }
+  public function setTimezone($timezone) {
+    $this->timezone = $timezone;
+  }
+  public function getTimezone() {
+    return $this->timezone;
+  }
+  public function setSiteSearchCategoryParameters($siteSearchCategoryParameters) {
+    $this->siteSearchCategoryParameters = $siteSearchCategoryParameters;
+  }
+  public function getSiteSearchCategoryParameters() {
+    return $this->siteSearchCategoryParameters;
+  }
+  public function setParentLink(Google_ProfileParentLink $parentLink) {
+    $this->parentLink = $parentLink;
+  }
+  public function getParentLink() {
+    return $this->parentLink;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+  public function setAccountId($accountId) {
+    $this->accountId = $accountId;
+  }
+  public function getAccountId() {
+    return $this->accountId;
+  }
+}
+
+class Google_ProfileChildLink extends Google_Model {
+  public $href;
+  public $type;
+  public function setHref($href) {
+    $this->href = $href;
+  }
+  public function getHref() {
+    return $this->href;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+}
+
+class Google_ProfileParentLink extends Google_Model {
+  public $href;
+  public $type;
+  public function setHref($href) {
+    $this->href = $href;
+  }
+  public function getHref() {
+    return $this->href;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+}
+
+class Google_Profiles extends Google_Model {
+  public $username;
+  public $kind;
+  protected $__itemsType = 'Google_Profile';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $itemsPerPage;
+  public $previousLink;
+  public $startIndex;
+  public $nextLink;
+  public $totalResults;
+  public function setUsername($username) {
+    $this->username = $username;
+  }
+  public function getUsername() {
+    return $this->username;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setItems(/* array(Google_Profile) */ $items) {
+    $this->assertIsArray($items, 'Google_Profile', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setItemsPerPage($itemsPerPage) {
+    $this->itemsPerPage = $itemsPerPage;
+  }
+  public function getItemsPerPage() {
+    return $this->itemsPerPage;
+  }
+  public function setPreviousLink($previousLink) {
+    $this->previousLink = $previousLink;
+  }
+  public function getPreviousLink() {
+    return $this->previousLink;
+  }
+  public function setStartIndex($startIndex) {
+    $this->startIndex = $startIndex;
+  }
+  public function getStartIndex() {
+    return $this->startIndex;
+  }
+  public function setNextLink($nextLink) {
+    $this->nextLink = $nextLink;
+  }
+  public function getNextLink() {
+    return $this->nextLink;
+  }
+  public function setTotalResults($totalResults) {
+    $this->totalResults = $totalResults;
+  }
+  public function getTotalResults() {
+    return $this->totalResults;
+  }
+}
+
+class Google_Segment extends Google_Model {
+  public $definition;
+  public $kind;
+  public $segmentId;
+  public $created;
+  public $updated;
+  public $id;
+  public $selfLink;
+  public $name;
+  public function setDefinition($definition) {
+    $this->definition = $definition;
+  }
+  public function getDefinition() {
+    return $this->definition;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setSegmentId($segmentId) {
+    $this->segmentId = $segmentId;
+  }
+  public function getSegmentId() {
+    return $this->segmentId;
+  }
+  public function setCreated($created) {
+    $this->created = $created;
+  }
+  public function getCreated() {
+    return $this->created;
+  }
+  public function setUpdated($updated) {
+    $this->updated = $updated;
+  }
+  public function getUpdated() {
+    return $this->updated;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_Segments extends Google_Model {
+  public $username;
+  public $kind;
+  protected $__itemsType = 'Google_Segment';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $itemsPerPage;
+  public $previousLink;
+  public $startIndex;
+  public $nextLink;
+  public $totalResults;
+  public function setUsername($username) {
+    $this->username = $username;
+  }
+  public function getUsername() {
+    return $this->username;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setItems(/* array(Google_Segment) */ $items) {
+    $this->assertIsArray($items, 'Google_Segment', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setItemsPerPage($itemsPerPage) {
+    $this->itemsPerPage = $itemsPerPage;
+  }
+  public function getItemsPerPage() {
+    return $this->itemsPerPage;
+  }
+  public function setPreviousLink($previousLink) {
+    $this->previousLink = $previousLink;
+  }
+  public function getPreviousLink() {
+    return $this->previousLink;
+  }
+  public function setStartIndex($startIndex) {
+    $this->startIndex = $startIndex;
+  }
+  public function getStartIndex() {
+    return $this->startIndex;
+  }
+  public function setNextLink($nextLink) {
+    $this->nextLink = $nextLink;
+  }
+  public function getNextLink() {
+    return $this->nextLink;
+  }
+  public function setTotalResults($totalResults) {
+    $this->totalResults = $totalResults;
+  }
+  public function getTotalResults() {
+    return $this->totalResults;
+  }
+}
+
+class Google_Webproperties extends Google_Model {
+  public $username;
+  public $kind;
+  protected $__itemsType = 'Google_Webproperty';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $itemsPerPage;
+  public $previousLink;
+  public $startIndex;
+  public $nextLink;
+  public $totalResults;
+  public function setUsername($username) {
+    $this->username = $username;
+  }
+  public function getUsername() {
+    return $this->username;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setItems(/* array(Google_Webproperty) */ $items) {
+    $this->assertIsArray($items, 'Google_Webproperty', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setItemsPerPage($itemsPerPage) {
+    $this->itemsPerPage = $itemsPerPage;
+  }
+  public function getItemsPerPage() {
+    return $this->itemsPerPage;
+  }
+  public function setPreviousLink($previousLink) {
+    $this->previousLink = $previousLink;
+  }
+  public function getPreviousLink() {
+    return $this->previousLink;
+  }
+  public function setStartIndex($startIndex) {
+    $this->startIndex = $startIndex;
+  }
+  public function getStartIndex() {
+    return $this->startIndex;
+  }
+  public function setNextLink($nextLink) {
+    $this->nextLink = $nextLink;
+  }
+  public function getNextLink() {
+    return $this->nextLink;
+  }
+  public function setTotalResults($totalResults) {
+    $this->totalResults = $totalResults;
+  }
+  public function getTotalResults() {
+    return $this->totalResults;
+  }
+}
+
+class Google_Webproperty extends Google_Model {
+  public $kind;
+  public $name;
+  public $created;
+  public $updated;
+  public $websiteUrl;
+  public $internalWebPropertyId;
+  protected $__childLinkType = 'Google_WebpropertyChildLink';
+  protected $__childLinkDataType = '';
+  public $childLink;
+  protected $__parentLinkType = 'Google_WebpropertyParentLink';
+  protected $__parentLinkDataType = '';
+  public $parentLink;
+  public $id;
+  public $selfLink;
+  public $accountId;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+  public function setCreated($created) {
+    $this->created = $created;
+  }
+  public function getCreated() {
+    return $this->created;
+  }
+  public function setUpdated($updated) {
+    $this->updated = $updated;
+  }
+  public function getUpdated() {
+    return $this->updated;
+  }
+  public function setWebsiteUrl($websiteUrl) {
+    $this->websiteUrl = $websiteUrl;
+  }
+  public function getWebsiteUrl() {
+    return $this->websiteUrl;
+  }
+  public function setInternalWebPropertyId($internalWebPropertyId) {
+    $this->internalWebPropertyId = $internalWebPropertyId;
+  }
+  public function getInternalWebPropertyId() {
+    return $this->internalWebPropertyId;
+  }
+  public function setChildLink(Google_WebpropertyChildLink $childLink) {
+    $this->childLink = $childLink;
+  }
+  public function getChildLink() {
+    return $this->childLink;
+  }
+  public function setParentLink(Google_WebpropertyParentLink $parentLink) {
+    $this->parentLink = $parentLink;
+  }
+  public function getParentLink() {
+    return $this->parentLink;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+  public function setAccountId($accountId) {
+    $this->accountId = $accountId;
+  }
+  public function getAccountId() {
+    return $this->accountId;
+  }
+}
+
+class Google_WebpropertyChildLink extends Google_Model {
+  public $href;
+  public $type;
+  public function setHref($href) {
+    $this->href = $href;
+  }
+  public function getHref() {
+    return $this->href;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+}
+
+class Google_WebpropertyParentLink extends Google_Model {
+  public $href;
+  public $type;
+  public function setHref($href) {
+    $this->href = $href;
+  }
+  public function getHref() {
+    return $this->href;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+}
diff --git a/lib/google/contrib/Google_BigqueryService.php b/lib/google/contrib/Google_BigqueryService.php
new file mode 100644 (file)
index 0000000..2568297
--- /dev/null
@@ -0,0 +1,1821 @@
+<?php
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+
+  /**
+   * The "tables" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bigqueryService = new Google_BigqueryService(...);
+   *   $tables = $bigqueryService->tables;
+   *  </code>
+   */
+  class Google_TablesServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Creates a new, empty table in the dataset. (tables.insert)
+     *
+     * @param string $projectId Project ID of the new table
+     * @param string $datasetId Dataset ID of the new table
+     * @param Google_Table $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Table
+     */
+    public function insert($projectId, $datasetId, Google_Table $postBody, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('insert', array($params));
+      if ($this->useObjects()) {
+        return new Google_Table($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Gets the specified table resource by table ID. This method does not return the data in the table,
+     * it only returns the table resource, which describes the structure of this table. (tables.get)
+     *
+     * @param string $projectId Project ID of the requested table
+     * @param string $datasetId Dataset ID of the requested table
+     * @param string $tableId Table ID of the requested table
+     * @param array $optParams Optional parameters.
+     * @return Google_Table
+     */
+    public function get($projectId, $datasetId, $tableId, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Table($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Lists all tables in the specified dataset. (tables.list)
+     *
+     * @param string $projectId Project ID of the tables to list
+     * @param string $datasetId Dataset ID of the tables to list
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results
+     * @opt_param string maxResults Maximum number of results to return
+     * @return Google_TableList
+     */
+    public function listTables($projectId, $datasetId, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_TableList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Updates information in an existing table, specified by tableId. (tables.update)
+     *
+     * @param string $projectId Project ID of the table to update
+     * @param string $datasetId Dataset ID of the table to update
+     * @param string $tableId Table ID of the table to update
+     * @param Google_Table $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Table
+     */
+    public function update($projectId, $datasetId, $tableId, Google_Table $postBody, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('update', array($params));
+      if ($this->useObjects()) {
+        return new Google_Table($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Updates information in an existing table, specified by tableId. This method supports patch
+     * semantics. (tables.patch)
+     *
+     * @param string $projectId Project ID of the table to update
+     * @param string $datasetId Dataset ID of the table to update
+     * @param string $tableId Table ID of the table to update
+     * @param Google_Table $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Table
+     */
+    public function patch($projectId, $datasetId, $tableId, Google_Table $postBody, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('patch', array($params));
+      if ($this->useObjects()) {
+        return new Google_Table($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Deletes the table specified by tableId from the dataset. If the table contains data, all the data
+     * will be deleted. (tables.delete)
+     *
+     * @param string $projectId Project ID of the table to delete
+     * @param string $datasetId Dataset ID of the table to delete
+     * @param string $tableId Table ID of the table to delete
+     * @param array $optParams Optional parameters.
+     */
+    public function delete($projectId, $datasetId, $tableId, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('delete', array($params));
+      return $data;
+    }
+  }
+
+  /**
+   * The "datasets" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bigqueryService = new Google_BigqueryService(...);
+   *   $datasets = $bigqueryService->datasets;
+   *  </code>
+   */
+  class Google_DatasetsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Creates a new empty dataset. (datasets.insert)
+     *
+     * @param string $projectId Project ID of the new dataset
+     * @param Google_Dataset $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Dataset
+     */
+    public function insert($projectId, Google_Dataset $postBody, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('insert', array($params));
+      if ($this->useObjects()) {
+        return new Google_Dataset($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Returns the dataset specified by datasetID. (datasets.get)
+     *
+     * @param string $projectId Project ID of the requested dataset
+     * @param string $datasetId Dataset ID of the requested dataset
+     * @param array $optParams Optional parameters.
+     * @return Google_Dataset
+     */
+    public function get($projectId, $datasetId, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Dataset($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Lists all the datasets in the specified project to which the caller has read access; however, a
+     * project owner can list (but not necessarily get) all datasets in his project. (datasets.list)
+     *
+     * @param string $projectId Project ID of the datasets to be listed
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results
+     * @opt_param string maxResults The maximum number of results to return
+     * @return Google_DatasetList
+     */
+    public function listDatasets($projectId, $optParams = array()) {
+      $params = array('projectId' => $projectId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_DatasetList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Updates information in an existing dataset, specified by datasetId. Properties not included in
+     * the submitted resource will not be changed. If you include the access property without any values
+     * assigned, the request will fail as you must specify at least one owner for a dataset.
+     * (datasets.update)
+     *
+     * @param string $projectId Project ID of the dataset being updated
+     * @param string $datasetId Dataset ID of the dataset being updated
+     * @param Google_Dataset $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Dataset
+     */
+    public function update($projectId, $datasetId, Google_Dataset $postBody, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('update', array($params));
+      if ($this->useObjects()) {
+        return new Google_Dataset($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Updates information in an existing dataset, specified by datasetId. Properties not included in
+     * the submitted resource will not be changed. If you include the access property without any values
+     * assigned, the request will fail as you must specify at least one owner for a dataset. This method
+     * supports patch semantics. (datasets.patch)
+     *
+     * @param string $projectId Project ID of the dataset being updated
+     * @param string $datasetId Dataset ID of the dataset being updated
+     * @param Google_Dataset $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Dataset
+     */
+    public function patch($projectId, $datasetId, Google_Dataset $postBody, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('patch', array($params));
+      if ($this->useObjects()) {
+        return new Google_Dataset($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Deletes the dataset specified by datasetId value. Before you can delete a dataset, you must
+     * delete all its tables, either manually or by specifying deleteContents. Immediately after
+     * deletion, you can create another dataset with the same name. (datasets.delete)
+     *
+     * @param string $projectId Project ID of the dataset being deleted
+     * @param string $datasetId Dataset ID of dataset being deleted
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param bool deleteContents If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False
+     */
+    public function delete($projectId, $datasetId, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('delete', array($params));
+      return $data;
+    }
+  }
+
+  /**
+   * The "jobs" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bigqueryService = new Google_BigqueryService(...);
+   *   $jobs = $bigqueryService->jobs;
+   *  </code>
+   */
+  class Google_JobsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Starts a new asynchronous job. (jobs.insert)
+     *
+     * @param string $projectId Project ID of the project that will be billed for the job
+     * @param Google_Job $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Job
+     */
+    public function insert($projectId, Google_Job $postBody, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('insert', array($params));
+      if ($this->useObjects()) {
+        return new Google_Job($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Runs a BigQuery SQL query synchronously and returns query results if the query completes within a
+     * specified timeout. (jobs.query)
+     *
+     * @param string $projectId Project ID of the project billed for the query
+     * @param Google_QueryRequest $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_QueryResponse
+     */
+    public function query($projectId, Google_QueryRequest $postBody, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('query', array($params));
+      if ($this->useObjects()) {
+        return new Google_QueryResponse($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Lists all the Jobs in the specified project that were started by the user. (jobs.list)
+     *
+     * @param string $projectId Project ID of the jobs to list
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string projection Restrict information returned to a set of selected fields
+     * @opt_param string stateFilter Filter for job state
+     * @opt_param bool allUsers Whether to display jobs owned by all users in the project. Default false
+     * @opt_param string maxResults Maximum number of results to return
+     * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results
+     * @return Google_JobList
+     */
+    public function listJobs($projectId, $optParams = array()) {
+      $params = array('projectId' => $projectId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_JobList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Retrieves the results of a query job. (jobs.getQueryResults)
+     *
+     * @param string $projectId Project ID of the query job
+     * @param string $jobId Job ID of the query job
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string timeoutMs How long to wait for the query to complete, in milliseconds, before returning. Default is to return immediately. If the timeout passes before the job completes, the request will fail with a TIMEOUT error
+     * @opt_param string startIndex Zero-based index of the starting row
+     * @opt_param string maxResults Maximum number of results to read
+     * @return Google_GetQueryResultsResponse
+     */
+    public function getQueryResults($projectId, $jobId, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'jobId' => $jobId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('getQueryResults', array($params));
+      if ($this->useObjects()) {
+        return new Google_GetQueryResultsResponse($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Retrieves the specified job by ID. (jobs.get)
+     *
+     * @param string $projectId Project ID of the requested job
+     * @param string $jobId Job ID of the requested job
+     * @param array $optParams Optional parameters.
+     * @return Google_Job
+     */
+    public function get($projectId, $jobId, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'jobId' => $jobId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Job($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "tabledata" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bigqueryService = new Google_BigqueryService(...);
+   *   $tabledata = $bigqueryService->tabledata;
+   *  </code>
+   */
+  class Google_TabledataServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Retrieves table data from a specified set of rows. (tabledata.list)
+     *
+     * @param string $projectId Project ID of the table to read
+     * @param string $datasetId Dataset ID of the table to read
+     * @param string $tableId Table ID of the table to read
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string maxResults Maximum number of results to return
+     * @opt_param string pageToken Page token, returned by a previous call, identifying the result set
+     * @opt_param string startIndex Zero-based index of the starting row to read
+     * @return Google_TableDataList
+     */
+    public function listTabledata($projectId, $datasetId, $tableId, $optParams = array()) {
+      $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_TableDataList($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "projects" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bigqueryService = new Google_BigqueryService(...);
+   *   $projects = $bigqueryService->projects;
+   *  </code>
+   */
+  class Google_ProjectsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Lists the projects to which you have at least read access. (projects.list)
+     *
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results
+     * @opt_param string maxResults Maximum number of results to return
+     * @return Google_ProjectList
+     */
+    public function listProjects($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_ProjectList($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+/**
+ * Service definition for Google_Bigquery (v2).
+ *
+ * <p>
+ * A data platform for customers to create, manage, share and query data.
+ * </p>
+ *
+ * <p>
+ * For more information about this service, see the
+ * <a href="https://code.google.com/apis/bigquery/docs/v2/" target="_blank">API Documentation</a>
+ * </p>
+ *
+ * @author Google, Inc.
+ */
+class Google_BigqueryService extends Google_Service {
+  public $tables;
+  public $datasets;
+  public $jobs;
+  public $tabledata;
+  public $projects;
+  /**
+   * Constructs the internal representation of the Bigquery service.
+   *
+   * @param Google_Client $client
+   */
+  public function __construct(Google_Client $client) {
+    $this->servicePath = 'bigquery/v2/';
+    $this->version = 'v2';
+    $this->serviceName = 'bigquery';
+
+    $client->addService($this->serviceName, $this->version);
+    $this->tables = new Google_TablesServiceResource($this, $this->serviceName, 'tables', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Table"}, "response": {"$ref": "Table"}, "httpMethod": "POST", "path": "projects/{projectId}/datasets/{datasetId}/tables", "id": "bigquery.tables.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "tableId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.tables.get", "httpMethod": "GET", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "response": {"$ref": "Table"}}, "list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "location": "query", "format": "uint32"}, "datasetId": {"required": true, "type": "string", "location": "path"}, "projectId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.tables.list", "httpMethod": "GET", "path": "projects/{projectId}/datasets/{datasetId}/tables", "response": {"$ref": "TableList"}}, "update": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "tableId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Table"}, "response": {"$ref": "Table"}, "httpMethod": "PUT", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "id": "bigquery.tables.update"}, "patch": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "tableId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Table"}, "response": {"$ref": "Table"}, "httpMethod": "PATCH", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "id": "bigquery.tables.patch"}, "delete": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "id": "bigquery.tables.delete", "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "tableId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE"}}}', true));
+    $this->datasets = new Google_DatasetsServiceResource($this, $this->serviceName, 'datasets', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Dataset"}, "response": {"$ref": "Dataset"}, "httpMethod": "POST", "path": "projects/{projectId}/datasets", "id": "bigquery.datasets.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.datasets.get", "httpMethod": "GET", "path": "projects/{projectId}/datasets/{datasetId}", "response": {"$ref": "Dataset"}}, "list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "location": "query", "format": "uint32"}, "projectId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.datasets.list", "httpMethod": "GET", "path": "projects/{projectId}/datasets", "response": {"$ref": "DatasetList"}}, "update": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Dataset"}, "response": {"$ref": "Dataset"}, "httpMethod": "PUT", "path": "projects/{projectId}/datasets/{datasetId}", "id": "bigquery.datasets.update"}, "patch": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Dataset"}, "response": {"$ref": "Dataset"}, "httpMethod": "PATCH", "path": "projects/{projectId}/datasets/{datasetId}", "id": "bigquery.datasets.patch"}, "delete": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "path": "projects/{projectId}/datasets/{datasetId}", "id": "bigquery.datasets.delete", "parameters": {"deleteContents": {"type": "boolean", "location": "query"}, "datasetId": {"required": true, "type": "string", "location": "path"}, "projectId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE"}}}', true));
+    $this->jobs = new Google_JobsServiceResource($this, $this->serviceName, 'jobs', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}}, "supportsMediaUpload": true, "request": {"$ref": "Job"}, "mediaUpload": {"protocols": {"simple": {"path": "/upload/bigquery/v2/projects/{projectId}/jobs", "multipart": true}, "resumable": {"path": "/resumable/upload/bigquery/v2/projects/{projectId}/jobs", "multipart": true}}, "accept": ["application/octet-stream"]}, "response": {"$ref": "Job"}, "httpMethod": "POST", "path": "projects/{projectId}/jobs", "id": "bigquery.jobs.insert"}, "query": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "QueryRequest"}, "response": {"$ref": "QueryResponse"}, "httpMethod": "POST", "path": "projects/{projectId}/queries", "id": "bigquery.jobs.query"}, "list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projection": {"enum": ["full", "minimal"], "type": "string", "location": "query"}, "stateFilter": {"repeated": true, "enum": ["done", "pending", "running"], "type": "string", "location": "query"}, "projectId": {"required": true, "type": "string", "location": "path"}, "allUsers": {"type": "boolean", "location": "query"}, "maxResults": {"type": "integer", "location": "query", "format": "uint32"}, "pageToken": {"type": "string", "location": "query"}}, "id": "bigquery.jobs.list", "httpMethod": "GET", "path": "projects/{projectId}/jobs", "response": {"$ref": "JobList"}}, "getQueryResults": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"timeoutMs": {"type": "integer", "location": "query", "format": "uint32"}, "projectId": {"required": true, "type": "string", "location": "path"}, "startIndex": {"type": "string", "location": "query", "format": "uint64"}, "maxResults": {"type": "integer", "location": "query", "format": "uint32"}, "jobId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.jobs.getQueryResults", "httpMethod": "GET", "path": "projects/{projectId}/queries/{jobId}", "response": {"$ref": "GetQueryResultsResponse"}}, "get": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "jobId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.jobs.get", "httpMethod": "GET", "path": "projects/{projectId}/jobs/{jobId}", "response": {"$ref": "Job"}}}}', true));
+    $this->tabledata = new Google_TabledataServiceResource($this, $this->serviceName, 'tabledata', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"projectId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"type": "integer", "location": "query", "format": "uint32"}, "pageToken": {"type": "string", "location": "query"}, "startIndex": {"type": "string", "location": "query", "format": "uint64"}, "tableId": {"required": true, "type": "string", "location": "path"}, "datasetId": {"required": true, "type": "string", "location": "path"}}, "id": "bigquery.tabledata.list", "httpMethod": "GET", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data", "response": {"$ref": "TableDataList"}}}}', true));
+    $this->projects = new Google_ProjectsServiceResource($this, $this->serviceName, 'projects', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/bigquery"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "location": "query", "format": "uint32"}}, "response": {"$ref": "ProjectList"}, "httpMethod": "GET", "path": "projects", "id": "bigquery.projects.list"}}}', true));
+
+  }
+}
+
+class Google_Dataset extends Google_Model {
+  public $kind;
+  public $description;
+  protected $__datasetReferenceType = 'Google_DatasetReference';
+  protected $__datasetReferenceDataType = '';
+  public $datasetReference;
+  public $creationTime;
+  protected $__accessType = 'Google_DatasetAccess';
+  protected $__accessDataType = 'array';
+  public $access;
+  public $etag;
+  public $friendlyName;
+  public $lastModifiedTime;
+  public $id;
+  public $selfLink;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setDescription($description) {
+    $this->description = $description;
+  }
+  public function getDescription() {
+    return $this->description;
+  }
+  public function setDatasetReference(Google_DatasetReference $datasetReference) {
+    $this->datasetReference = $datasetReference;
+  }
+  public function getDatasetReference() {
+    return $this->datasetReference;
+  }
+  public function setCreationTime($creationTime) {
+    $this->creationTime = $creationTime;
+  }
+  public function getCreationTime() {
+    return $this->creationTime;
+  }
+  public function setAccess(/* array(Google_DatasetAccess) */ $access) {
+    $this->assertIsArray($access, 'Google_DatasetAccess', __METHOD__);
+    $this->access = $access;
+  }
+  public function getAccess() {
+    return $this->access;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+  public function setFriendlyName($friendlyName) {
+    $this->friendlyName = $friendlyName;
+  }
+  public function getFriendlyName() {
+    return $this->friendlyName;
+  }
+  public function setLastModifiedTime($lastModifiedTime) {
+    $this->lastModifiedTime = $lastModifiedTime;
+  }
+  public function getLastModifiedTime() {
+    return $this->lastModifiedTime;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+}
+
+class Google_DatasetAccess extends Google_Model {
+  public $specialGroup;
+  public $domain;
+  public $role;
+  public $groupByEmail;
+  public $userByEmail;
+  public function setSpecialGroup($specialGroup) {
+    $this->specialGroup = $specialGroup;
+  }
+  public function getSpecialGroup() {
+    return $this->specialGroup;
+  }
+  public function setDomain($domain) {
+    $this->domain = $domain;
+  }
+  public function getDomain() {
+    return $this->domain;
+  }
+  public function setRole($role) {
+    $this->role = $role;
+  }
+  public function getRole() {
+    return $this->role;
+  }
+  public function setGroupByEmail($groupByEmail) {
+    $this->groupByEmail = $groupByEmail;
+  }
+  public function getGroupByEmail() {
+    return $this->groupByEmail;
+  }
+  public function setUserByEmail($userByEmail) {
+    $this->userByEmail = $userByEmail;
+  }
+  public function getUserByEmail() {
+    return $this->userByEmail;
+  }
+}
+
+class Google_DatasetList extends Google_Model {
+  public $nextPageToken;
+  public $kind;
+  protected $__datasetsType = 'Google_DatasetListDatasets';
+  protected $__datasetsDataType = 'array';
+  public $datasets;
+  public $etag;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setDatasets(/* array(Google_DatasetListDatasets) */ $datasets) {
+    $this->assertIsArray($datasets, 'Google_DatasetListDatasets', __METHOD__);
+    $this->datasets = $datasets;
+  }
+  public function getDatasets() {
+    return $this->datasets;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+}
+
+class Google_DatasetListDatasets extends Google_Model {
+  public $friendlyName;
+  public $kind;
+  public $id;
+  protected $__datasetReferenceType = 'Google_DatasetReference';
+  protected $__datasetReferenceDataType = '';
+  public $datasetReference;
+  public function setFriendlyName($friendlyName) {
+    $this->friendlyName = $friendlyName;
+  }
+  public function getFriendlyName() {
+    return $this->friendlyName;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setDatasetReference(Google_DatasetReference $datasetReference) {
+    $this->datasetReference = $datasetReference;
+  }
+  public function getDatasetReference() {
+    return $this->datasetReference;
+  }
+}
+
+class Google_DatasetReference extends Google_Model {
+  public $projectId;
+  public $datasetId;
+  public function setProjectId($projectId) {
+    $this->projectId = $projectId;
+  }
+  public function getProjectId() {
+    return $this->projectId;
+  }
+  public function setDatasetId($datasetId) {
+    $this->datasetId = $datasetId;
+  }
+  public function getDatasetId() {
+    return $this->datasetId;
+  }
+}
+
+class Google_ErrorProto extends Google_Model {
+  public $debugInfo;
+  public $message;
+  public $reason;
+  public $location;
+  public function setDebugInfo($debugInfo) {
+    $this->debugInfo = $debugInfo;
+  }
+  public function getDebugInfo() {
+    return $this->debugInfo;
+  }
+  public function setMessage($message) {
+    $this->message = $message;
+  }
+  public function getMessage() {
+    return $this->message;
+  }
+  public function setReason($reason) {
+    $this->reason = $reason;
+  }
+  public function getReason() {
+    return $this->reason;
+  }
+  public function setLocation($location) {
+    $this->location = $location;
+  }
+  public function getLocation() {
+    return $this->location;
+  }
+}
+
+class Google_GetQueryResultsResponse extends Google_Model {
+  public $kind;
+  protected $__rowsType = 'Google_TableRow';
+  protected $__rowsDataType = 'array';
+  public $rows;
+  protected $__jobReferenceType = 'Google_JobReference';
+  protected $__jobReferenceDataType = '';
+  public $jobReference;
+  public $jobComplete;
+  public $totalRows;
+  public $etag;
+  protected $__schemaType = 'Google_TableSchema';
+  protected $__schemaDataType = '';
+  public $schema;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setRows(/* array(Google_TableRow) */ $rows) {
+    $this->assertIsArray($rows, 'Google_TableRow', __METHOD__);
+    $this->rows = $rows;
+  }
+  public function getRows() {
+    return $this->rows;
+  }
+  public function setJobReference(Google_JobReference $jobReference) {
+    $this->jobReference = $jobReference;
+  }
+  public function getJobReference() {
+    return $this->jobReference;
+  }
+  public function setJobComplete($jobComplete) {
+    $this->jobComplete = $jobComplete;
+  }
+  public function getJobComplete() {
+    return $this->jobComplete;
+  }
+  public function setTotalRows($totalRows) {
+    $this->totalRows = $totalRows;
+  }
+  public function getTotalRows() {
+    return $this->totalRows;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+  public function setSchema(Google_TableSchema $schema) {
+    $this->schema = $schema;
+  }
+  public function getSchema() {
+    return $this->schema;
+  }
+}
+
+class Google_Job extends Google_Model {
+  protected $__statusType = 'Google_JobStatus';
+  protected $__statusDataType = '';
+  public $status;
+  public $kind;
+  protected $__statisticsType = 'Google_JobStatistics';
+  protected $__statisticsDataType = '';
+  public $statistics;
+  protected $__jobReferenceType = 'Google_JobReference';
+  protected $__jobReferenceDataType = '';
+  public $jobReference;
+  public $etag;
+  protected $__configurationType = 'Google_JobConfiguration';
+  protected $__configurationDataType = '';
+  public $configuration;
+  public $id;
+  public $selfLink;
+  public function setStatus(Google_JobStatus $status) {
+    $this->status = $status;
+  }
+  public function getStatus() {
+    return $this->status;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setStatistics(Google_JobStatistics $statistics) {
+    $this->statistics = $statistics;
+  }
+  public function getStatistics() {
+    return $this->statistics;
+  }
+  public function setJobReference(Google_JobReference $jobReference) {
+    $this->jobReference = $jobReference;
+  }
+  public function getJobReference() {
+    return $this->jobReference;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+  public function setConfiguration(Google_JobConfiguration $configuration) {
+    $this->configuration = $configuration;
+  }
+  public function getConfiguration() {
+    return $this->configuration;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+}
+
+class Google_JobConfiguration extends Google_Model {
+  protected $__loadType = 'Google_JobConfigurationLoad';
+  protected $__loadDataType = '';
+  public $load;
+  protected $__linkType = 'Google_JobConfigurationLink';
+  protected $__linkDataType = '';
+  public $link;
+  protected $__queryType = 'Google_JobConfigurationQuery';
+  protected $__queryDataType = '';
+  public $query;
+  protected $__copyType = 'Google_JobConfigurationTableCopy';
+  protected $__copyDataType = '';
+  public $copy;
+  protected $__extractType = 'Google_JobConfigurationExtract';
+  protected $__extractDataType = '';
+  public $extract;
+  public $properties;
+  public function setLoad(Google_JobConfigurationLoad $load) {
+    $this->load = $load;
+  }
+  public function getLoad() {
+    return $this->load;
+  }
+  public function setLink(Google_JobConfigurationLink $link) {
+    $this->link = $link;
+  }
+  public function getLink() {
+    return $this->link;
+  }
+  public function setQuery(Google_JobConfigurationQuery $query) {
+    $this->query = $query;
+  }
+  public function getQuery() {
+    return $this->query;
+  }
+  public function setCopy(Google_JobConfigurationTableCopy $copy) {
+    $this->copy = $copy;
+  }
+  public function getCopy() {
+    return $this->copy;
+  }
+  public function setExtract(Google_JobConfigurationExtract $extract) {
+    $this->extract = $extract;
+  }
+  public function getExtract() {
+    return $this->extract;
+  }
+  public function setProperties($properties) {
+    $this->properties = $properties;
+  }
+  public function getProperties() {
+    return $this->properties;
+  }
+}
+
+class Google_JobConfigurationExtract extends Google_Model {
+  public $destinationUri;
+  public $fieldDelimiter;
+  protected $__sourceTableType = 'Google_TableReference';
+  protected $__sourceTableDataType = '';
+  public $sourceTable;
+  public $printHeader;
+  public function setDestinationUri($destinationUri) {
+    $this->destinationUri = $destinationUri;
+  }
+  public function getDestinationUri() {
+    return $this->destinationUri;
+  }
+  public function setFieldDelimiter($fieldDelimiter) {
+    $this->fieldDelimiter = $fieldDelimiter;
+  }
+  public function getFieldDelimiter() {
+    return $this->fieldDelimiter;
+  }
+  public function setSourceTable(Google_TableReference $sourceTable) {
+    $this->sourceTable = $sourceTable;
+  }
+  public function getSourceTable() {
+    return $this->sourceTable;
+  }
+  public function setPrintHeader($printHeader) {
+    $this->printHeader = $printHeader;
+  }
+  public function getPrintHeader() {
+    return $this->printHeader;
+  }
+}
+
+class Google_JobConfigurationLink extends Google_Model {
+  public $createDisposition;
+  public $writeDisposition;
+  protected $__destinationTableType = 'Google_TableReference';
+  protected $__destinationTableDataType = '';
+  public $destinationTable;
+  public $sourceUri;
+  public function setCreateDisposition($createDisposition) {
+    $this->createDisposition = $createDisposition;
+  }
+  public function getCreateDisposition() {
+    return $this->createDisposition;
+  }
+  public function setWriteDisposition($writeDisposition) {
+    $this->writeDisposition = $writeDisposition;
+  }
+  public function getWriteDisposition() {
+    return $this->writeDisposition;
+  }
+  public function setDestinationTable(Google_TableReference $destinationTable) {
+    $this->destinationTable = $destinationTable;
+  }
+  public function getDestinationTable() {
+    return $this->destinationTable;
+  }
+  public function setSourceUri(/* array(Google_string) */ $sourceUri) {
+    $this->assertIsArray($sourceUri, 'Google_string', __METHOD__);
+    $this->sourceUri = $sourceUri;
+  }
+  public function getSourceUri() {
+    return $this->sourceUri;
+  }
+}
+
+class Google_JobConfigurationLoad extends Google_Model {
+  public $encoding;
+  public $fieldDelimiter;
+  protected $__destinationTableType = 'Google_TableReference';
+  protected $__destinationTableDataType = '';
+  public $destinationTable;
+  public $writeDisposition;
+  public $maxBadRecords;
+  public $skipLeadingRows;
+  public $sourceUris;
+  public $quote;
+  public $createDisposition;
+  public $schemaInlineFormat;
+  public $schemaInline;
+  protected $__schemaType = 'Google_TableSchema';
+  protected $__schemaDataType = '';
+  public $schema;
+  public function setEncoding($encoding) {
+    $this->encoding = $encoding;
+  }
+  public function getEncoding() {
+    return $this->encoding;
+  }
+  public function setFieldDelimiter($fieldDelimiter) {
+    $this->fieldDelimiter = $fieldDelimiter;
+  }
+  public function getFieldDelimiter() {
+    return $this->fieldDelimiter;
+  }
+  public function setDestinationTable(Google_TableReference $destinationTable) {
+    $this->destinationTable = $destinationTable;
+  }
+  public function getDestinationTable() {
+    return $this->destinationTable;
+  }
+  public function setWriteDisposition($writeDisposition) {
+    $this->writeDisposition = $writeDisposition;
+  }
+  public function getWriteDisposition() {
+    return $this->writeDisposition;
+  }
+  public function setMaxBadRecords($maxBadRecords) {
+    $this->maxBadRecords = $maxBadRecords;
+  }
+  public function getMaxBadRecords() {
+    return $this->maxBadRecords;
+  }
+  public function setSkipLeadingRows($skipLeadingRows) {
+    $this->skipLeadingRows = $skipLeadingRows;
+  }
+  public function getSkipLeadingRows() {
+    return $this->skipLeadingRows;
+  }
+  public function setSourceUris(/* array(Google_string) */ $sourceUris) {
+    $this->assertIsArray($sourceUris, 'Google_string', __METHOD__);
+    $this->sourceUris = $sourceUris;
+  }
+  public function getSourceUris() {
+    return $this->sourceUris;
+  }
+  public function setQuote($quote) {
+    $this->quote = $quote;
+  }
+  public function getQuote() {
+    return $this->quote;
+  }
+  public function setCreateDisposition($createDisposition) {
+    $this->createDisposition = $createDisposition;
+  }
+  public function getCreateDisposition() {
+    return $this->createDisposition;
+  }
+  public function setSchemaInlineFormat($schemaInlineFormat) {
+    $this->schemaInlineFormat = $schemaInlineFormat;
+  }
+  public function getSchemaInlineFormat() {
+    return $this->schemaInlineFormat;
+  }
+  public function setSchemaInline($schemaInline) {
+    $this->schemaInline = $schemaInline;
+  }
+  public function getSchemaInline() {
+    return $this->schemaInline;
+  }
+  public function setSchema(Google_TableSchema $schema) {
+    $this->schema = $schema;
+  }
+  public function getSchema() {
+    return $this->schema;
+  }
+}
+
+class Google_JobConfigurationQuery extends Google_Model {
+  protected $__defaultDatasetType = 'Google_DatasetReference';
+  protected $__defaultDatasetDataType = '';
+  public $defaultDataset;
+  protected $__destinationTableType = 'Google_TableReference';
+  protected $__destinationTableDataType = '';
+  public $destinationTable;
+  public $priority;
+  public $writeDisposition;
+  public $createDisposition;
+  public $query;
+  public function setDefaultDataset(Google_DatasetReference $defaultDataset) {
+    $this->defaultDataset = $defaultDataset;
+  }
+  public function getDefaultDataset() {
+    return $this->defaultDataset;
+  }
+  public function setDestinationTable(Google_TableReference $destinationTable) {
+    $this->destinationTable = $destinationTable;
+  }
+  public function getDestinationTable() {
+    return $this->destinationTable;
+  }
+  public function setPriority($priority) {
+    $this->priority = $priority;
+  }
+  public function getPriority() {
+    return $this->priority;
+  }
+  public function setWriteDisposition($writeDisposition) {
+    $this->writeDisposition = $writeDisposition;
+  }
+  public function getWriteDisposition() {
+    return $this->writeDisposition;
+  }
+  public function setCreateDisposition($createDisposition) {
+    $this->createDisposition = $createDisposition;
+  }
+  public function getCreateDisposition() {
+    return $this->createDisposition;
+  }
+  public function setQuery($query) {
+    $this->query = $query;
+  }
+  public function getQuery() {
+    return $this->query;
+  }
+}
+
+class Google_JobConfigurationTableCopy extends Google_Model {
+  public $createDisposition;
+  public $writeDisposition;
+  protected $__destinationTableType = 'Google_TableReference';
+  protected $__destinationTableDataType = '';
+  public $destinationTable;
+  protected $__sourceTableType = 'Google_TableReference';
+  protected $__sourceTableDataType = '';
+  public $sourceTable;
+  public function setCreateDisposition($createDisposition) {
+    $this->createDisposition = $createDisposition;
+  }
+  public function getCreateDisposition() {
+    return $this->createDisposition;
+  }
+  public function setWriteDisposition($writeDisposition) {
+    $this->writeDisposition = $writeDisposition;
+  }
+  public function getWriteDisposition() {
+    return $this->writeDisposition;
+  }
+  public function setDestinationTable(Google_TableReference $destinationTable) {
+    $this->destinationTable = $destinationTable;
+  }
+  public function getDestinationTable() {
+    return $this->destinationTable;
+  }
+  public function setSourceTable(Google_TableReference $sourceTable) {
+    $this->sourceTable = $sourceTable;
+  }
+  public function getSourceTable() {
+    return $this->sourceTable;
+  }
+}
+
+class Google_JobList extends Google_Model {
+  public $nextPageToken;
+  public $totalItems;
+  public $kind;
+  public $etag;
+  protected $__jobsType = 'Google_JobListJobs';
+  protected $__jobsDataType = 'array';
+  public $jobs;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setTotalItems($totalItems) {
+    $this->totalItems = $totalItems;
+  }
+  public function getTotalItems() {
+    return $this->totalItems;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+  public function setJobs(/* array(Google_JobListJobs) */ $jobs) {
+    $this->assertIsArray($jobs, 'Google_JobListJobs', __METHOD__);
+    $this->jobs = $jobs;
+  }
+  public function getJobs() {
+    return $this->jobs;
+  }
+}
+
+class Google_JobListJobs extends Google_Model {
+  protected $__statusType = 'Google_JobStatus';
+  protected $__statusDataType = '';
+  public $status;
+  public $kind;
+  protected $__statisticsType = 'Google_JobStatistics';
+  protected $__statisticsDataType = '';
+  public $statistics;
+  protected $__jobReferenceType = 'Google_JobReference';
+  protected $__jobReferenceDataType = '';
+  public $jobReference;
+  public $state;
+  protected $__configurationType = 'Google_JobConfiguration';
+  protected $__configurationDataType = '';
+  public $configuration;
+  public $id;
+  protected $__errorResultType = 'Google_ErrorProto';
+  protected $__errorResultDataType = '';
+  public $errorResult;
+  public function setStatus(Google_JobStatus $status) {
+    $this->status = $status;
+  }
+  public function getStatus() {
+    return $this->status;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setStatistics(Google_JobStatistics $statistics) {
+    $this->statistics = $statistics;
+  }
+  public function getStatistics() {
+    return $this->statistics;
+  }
+  public function setJobReference(Google_JobReference $jobReference) {
+    $this->jobReference = $jobReference;
+  }
+  public function getJobReference() {
+    return $this->jobReference;
+  }
+  public function setState($state) {
+    $this->state = $state;
+  }
+  public function getState() {
+    return $this->state;
+  }
+  public function setConfiguration(Google_JobConfiguration $configuration) {
+    $this->configuration = $configuration;
+  }
+  public function getConfiguration() {
+    return $this->configuration;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setErrorResult(Google_ErrorProto $errorResult) {
+    $this->errorResult = $errorResult;
+  }
+  public function getErrorResult() {
+    return $this->errorResult;
+  }
+}
+
+class Google_JobReference extends Google_Model {
+  public $projectId;
+  public $jobId;
+  public function setProjectId($projectId) {
+    $this->projectId = $projectId;
+  }
+  public function getProjectId() {
+    return $this->projectId;
+  }
+  public function setJobId($jobId) {
+    $this->jobId = $jobId;
+  }
+  public function getJobId() {
+    return $this->jobId;
+  }
+}
+
+class Google_JobStatistics extends Google_Model {
+  public $endTime;
+  public $totalBytesProcessed;
+  public $startTime;
+  public function setEndTime($endTime) {
+    $this->endTime = $endTime;
+  }
+  public function getEndTime() {
+    return $this->endTime;
+  }
+  public function setTotalBytesProcessed($totalBytesProcessed) {
+    $this->totalBytesProcessed = $totalBytesProcessed;
+  }
+  public function getTotalBytesProcessed() {
+    return $this->totalBytesProcessed;
+  }
+  public function setStartTime($startTime) {
+    $this->startTime = $startTime;
+  }
+  public function getStartTime() {
+    return $this->startTime;
+  }
+}
+
+class Google_JobStatus extends Google_Model {
+  public $state;
+  protected $__errorsType = 'Google_ErrorProto';
+  protected $__errorsDataType = 'array';
+  public $errors;
+  protected $__errorResultType = 'Google_ErrorProto';
+  protected $__errorResultDataType = '';
+  public $errorResult;
+  public function setState($state) {
+    $this->state = $state;
+  }
+  public function getState() {
+    return $this->state;
+  }
+  public function setErrors(/* array(Google_ErrorProto) */ $errors) {
+    $this->assertIsArray($errors, 'Google_ErrorProto', __METHOD__);
+    $this->errors = $errors;
+  }
+  public function getErrors() {
+    return $this->errors;
+  }
+  public function setErrorResult(Google_ErrorProto $errorResult) {
+    $this->errorResult = $errorResult;
+  }
+  public function getErrorResult() {
+    return $this->errorResult;
+  }
+}
+
+class Google_ProjectList extends Google_Model {
+  public $nextPageToken;
+  public $totalItems;
+  public $kind;
+  public $etag;
+  protected $__projectsType = 'Google_ProjectListProjects';
+  protected $__projectsDataType = 'array';
+  public $projects;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setTotalItems($totalItems) {
+    $this->totalItems = $totalItems;
+  }
+  public function getTotalItems() {
+    return $this->totalItems;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+  public function setProjects(/* array(Google_ProjectListProjects) */ $projects) {
+    $this->assertIsArray($projects, 'Google_ProjectListProjects', __METHOD__);
+    $this->projects = $projects;
+  }
+  public function getProjects() {
+    return $this->projects;
+  }
+}
+
+class Google_ProjectListProjects extends Google_Model {
+  public $friendlyName;
+  public $kind;
+  public $id;
+  protected $__projectReferenceType = 'Google_ProjectReference';
+  protected $__projectReferenceDataType = '';
+  public $projectReference;
+  public function setFriendlyName($friendlyName) {
+    $this->friendlyName = $friendlyName;
+  }
+  public function getFriendlyName() {
+    return $this->friendlyName;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setProjectReference(Google_ProjectReference $projectReference) {
+    $this->projectReference = $projectReference;
+  }
+  public function getProjectReference() {
+    return $this->projectReference;
+  }
+}
+
+class Google_ProjectReference extends Google_Model {
+  public $projectId;
+  public function setProjectId($projectId) {
+    $this->projectId = $projectId;
+  }
+  public function getProjectId() {
+    return $this->projectId;
+  }
+}
+
+class Google_QueryRequest extends Google_Model {
+  public $timeoutMs;
+  public $kind;
+  public $dryRun;
+  protected $__defaultDatasetType = 'Google_DatasetReference';
+  protected $__defaultDatasetDataType = '';
+  public $defaultDataset;
+  public $maxResults;
+  public $query;
+  public function setTimeoutMs($timeoutMs) {
+    $this->timeoutMs = $timeoutMs;
+  }
+  public function getTimeoutMs() {
+    return $this->timeoutMs;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setDryRun($dryRun) {
+    $this->dryRun = $dryRun;
+  }
+  public function getDryRun() {
+    return $this->dryRun;
+  }
+  public function setDefaultDataset(Google_DatasetReference $defaultDataset) {
+    $this->defaultDataset = $defaultDataset;
+  }
+  public function getDefaultDataset() {
+    return $this->defaultDataset;
+  }
+  public function setMaxResults($maxResults) {
+    $this->maxResults = $maxResults;
+  }
+  public function getMaxResults() {
+    return $this->maxResults;
+  }
+  public function setQuery($query) {
+    $this->query = $query;
+  }
+  public function getQuery() {
+    return $this->query;
+  }
+}
+
+class Google_QueryResponse extends Google_Model {
+  public $kind;
+  protected $__rowsType = 'Google_TableRow';
+  protected $__rowsDataType = 'array';
+  public $rows;
+  protected $__jobReferenceType = 'Google_JobReference';
+  protected $__jobReferenceDataType = '';
+  public $jobReference;
+  public $jobComplete;
+  public $totalRows;
+  protected $__schemaType = 'Google_TableSchema';
+  protected $__schemaDataType = '';
+  public $schema;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setRows(/* array(Google_TableRow) */ $rows) {
+    $this->assertIsArray($rows, 'Google_TableRow', __METHOD__);
+    $this->rows = $rows;
+  }
+  public function getRows() {
+    return $this->rows;
+  }
+  public function setJobReference(Google_JobReference $jobReference) {
+    $this->jobReference = $jobReference;
+  }
+  public function getJobReference() {
+    return $this->jobReference;
+  }
+  public function setJobComplete($jobComplete) {
+    $this->jobComplete = $jobComplete;
+  }
+  public function getJobComplete() {
+    return $this->jobComplete;
+  }
+  public function setTotalRows($totalRows) {
+    $this->totalRows = $totalRows;
+  }
+  public function getTotalRows() {
+    return $this->totalRows;
+  }
+  public function setSchema(Google_TableSchema $schema) {
+    $this->schema = $schema;
+  }
+  public function getSchema() {
+    return $this->schema;
+  }
+}
+
+class Google_Table extends Google_Model {
+  public $kind;
+  public $lastModifiedTime;
+  public $description;
+  public $creationTime;
+  protected $__tableReferenceType = 'Google_TableReference';
+  protected $__tableReferenceDataType = '';
+  public $tableReference;
+  public $numRows;
+  public $numBytes;
+  public $etag;
+  public $friendlyName;
+  public $expirationTime;
+  public $id;
+  public $selfLink;
+  protected $__schemaType = 'Google_TableSchema';
+  protected $__schemaDataType = '';
+  public $schema;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setLastModifiedTime($lastModifiedTime) {
+    $this->lastModifiedTime = $lastModifiedTime;
+  }
+  public function getLastModifiedTime() {
+    return $this->lastModifiedTime;
+  }
+  public function setDescription($description) {
+    $this->description = $description;
+  }
+  public function getDescription() {
+    return $this->description;
+  }
+  public function setCreationTime($creationTime) {
+    $this->creationTime = $creationTime;
+  }
+  public function getCreationTime() {
+    return $this->creationTime;
+  }
+  public function setTableReference(Google_TableReference $tableReference) {
+    $this->tableReference = $tableReference;
+  }
+  public function getTableReference() {
+    return $this->tableReference;
+  }
+  public function setNumRows($numRows) {
+    $this->numRows = $numRows;
+  }
+  public function getNumRows() {
+    return $this->numRows;
+  }
+  public function setNumBytes($numBytes) {
+    $this->numBytes = $numBytes;
+  }
+  public function getNumBytes() {
+    return $this->numBytes;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+  public function setFriendlyName($friendlyName) {
+    $this->friendlyName = $friendlyName;
+  }
+  public function getFriendlyName() {
+    return $this->friendlyName;
+  }
+  public function setExpirationTime($expirationTime) {
+    $this->expirationTime = $expirationTime;
+  }
+  public function getExpirationTime() {
+    return $this->expirationTime;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+  public function setSchema(Google_TableSchema $schema) {
+    $this->schema = $schema;
+  }
+  public function getSchema() {
+    return $this->schema;
+  }
+}
+
+class Google_TableDataList extends Google_Model {
+  public $pageToken;
+  public $kind;
+  public $etag;
+  protected $__rowsType = 'Google_TableRow';
+  protected $__rowsDataType = 'array';
+  public $rows;
+  public $totalRows;
+  public function setPageToken($pageToken) {
+    $this->pageToken = $pageToken;
+  }
+  public function getPageToken() {
+    return $this->pageToken;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+  public function setRows(/* array(Google_TableRow) */ $rows) {
+    $this->assertIsArray($rows, 'Google_TableRow', __METHOD__);
+    $this->rows = $rows;
+  }
+  public function getRows() {
+    return $this->rows;
+  }
+  public function setTotalRows($totalRows) {
+    $this->totalRows = $totalRows;
+  }
+  public function getTotalRows() {
+    return $this->totalRows;
+  }
+}
+
+class Google_TableFieldSchema extends Google_Model {
+  protected $__fieldsType = 'Google_TableFieldSchema';
+  protected $__fieldsDataType = 'array';
+  public $fields;
+  public $type;
+  public $mode;
+  public $name;
+  public function setFields(/* array(Google_TableFieldSchema) */ $fields) {
+    $this->assertIsArray($fields, 'Google_TableFieldSchema', __METHOD__);
+    $this->fields = $fields;
+  }
+  public function getFields() {
+    return $this->fields;
+  }
+  public function setType($type) {
+    $this->type = $type;
+  }
+  public function getType() {
+    return $this->type;
+  }
+  public function setMode($mode) {
+    $this->mode = $mode;
+  }
+  public function getMode() {
+    return $this->mode;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_TableList extends Google_Model {
+  public $nextPageToken;
+  protected $__tablesType = 'Google_TableListTables';
+  protected $__tablesDataType = 'array';
+  public $tables;
+  public $kind;
+  public $etag;
+  public $totalItems;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setTables(/* array(Google_TableListTables) */ $tables) {
+    $this->assertIsArray($tables, 'Google_TableListTables', __METHOD__);
+    $this->tables = $tables;
+  }
+  public function getTables() {
+    return $this->tables;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setEtag($etag) {
+    $this->etag = $etag;
+  }
+  public function getEtag() {
+    return $this->etag;
+  }
+  public function setTotalItems($totalItems) {
+    $this->totalItems = $totalItems;
+  }
+  public function getTotalItems() {
+    return $this->totalItems;
+  }
+}
+
+class Google_TableListTables extends Google_Model {
+  public $friendlyName;
+  public $kind;
+  public $id;
+  protected $__tableReferenceType = 'Google_TableReference';
+  protected $__tableReferenceDataType = '';
+  public $tableReference;
+  public function setFriendlyName($friendlyName) {
+    $this->friendlyName = $friendlyName;
+  }
+  public function getFriendlyName() {
+    return $this->friendlyName;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setTableReference(Google_TableReference $tableReference) {
+    $this->tableReference = $tableReference;
+  }
+  public function getTableReference() {
+    return $this->tableReference;
+  }
+}
+
+class Google_TableReference extends Google_Model {
+  public $projectId;
+  public $tableId;
+  public $datasetId;
+  public function setProjectId($projectId) {
+    $this->projectId = $projectId;
+  }
+  public function getProjectId() {
+    return $this->projectId;
+  }
+  public function setTableId($tableId) {
+    $this->tableId = $tableId;
+  }
+  public function getTableId() {
+    return $this->tableId;
+  }
+  public function setDatasetId($datasetId) {
+    $this->datasetId = $datasetId;
+  }
+  public function getDatasetId() {
+    return $this->datasetId;
+  }
+}
+
+class Google_TableRow extends Google_Model {
+  protected $__fType = 'Google_TableRowF';
+  protected $__fDataType = 'array';
+  public $f;
+  public function setF(/* array(Google_TableRowF) */ $f) {
+    $this->assertIsArray($f, 'Google_TableRowF', __METHOD__);
+    $this->f = $f;
+  }
+  public function getF() {
+    return $this->f;
+  }
+}
+
+class Google_TableRowF extends Google_Model {
+  public $v;
+  public function setV($v) {
+    $this->v = $v;
+  }
+  public function getV() {
+    return $this->v;
+  }
+}
+
+class Google_TableSchema extends Google_Model {
+  protected $__fieldsType = 'Google_TableFieldSchema';
+  protected $__fieldsDataType = 'array';
+  public $fields;
+  public function setFields(/* array(Google_TableFieldSchema) */ $fields) {
+    $this->assertIsArray($fields, 'Google_TableFieldSchema', __METHOD__);
+    $this->fields = $fields;
+  }
+  public function getFields() {
+    return $this->fields;
+  }
+}
diff --git a/lib/google/contrib/Google_BloggerService.php b/lib/google/contrib/Google_BloggerService.php
new file mode 100644 (file)
index 0000000..4cc954b
--- /dev/null
@@ -0,0 +1,1301 @@
+<?php
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+
+  /**
+   * The "blogs" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bloggerService = new Google_BloggerService(...);
+   *   $blogs = $bloggerService->blogs;
+   *  </code>
+   */
+  class Google_BlogsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Retrieves a list of blogs, possibly filtered. (blogs.listByUser)
+     *
+     * @param string $userId ID of the user whose blogs are to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.
+     * @param array $optParams Optional parameters.
+     * @return Google_BlogList
+     */
+    public function listByUser($userId, $optParams = array()) {
+      $params = array('userId' => $userId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('listByUser', array($params));
+      if ($this->useObjects()) {
+        return new Google_BlogList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Retrieve a Blog by URL. (blogs.getByUrl)
+     *
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string url The URL of the blog to retrieve.
+     * @return Google_Blog
+     */
+    public function getByUrl($optParams = array()) {
+      $params = array();
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('getByUrl', array($params));
+      if ($this->useObjects()) {
+        return new Google_Blog($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Gets one blog by id. (blogs.get)
+     *
+     * @param string $blogId The ID of the blog to get.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string maxPosts Maximum number of posts to pull back with the blog.
+     * @return Google_Blog
+     */
+    public function get($blogId, $optParams = array()) {
+      $params = array('blogId' => $blogId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Blog($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "posts" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bloggerService = new Google_BloggerService(...);
+   *   $posts = $bloggerService->posts;
+   *  </code>
+   */
+  class Google_PostsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Add a post. (posts.insert)
+     *
+     * @param string $blogId ID of the blog to fetch the post from.
+     * @param Google_Post $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Post
+     */
+    public function insert($blogId, Google_Post $postBody, $optParams = array()) {
+      $params = array('blogId' => $blogId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('insert', array($params));
+      if ($this->useObjects()) {
+        return new Google_Post($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Search for a post. (posts.search)
+     *
+     * @param string $blogId ID of the blog to fetch the post from.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string q Query terms to search this blog for matching posts.
+     * @return Google_PostList
+     */
+    public function search($blogId, $optParams = array()) {
+      $params = array('blogId' => $blogId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('search', array($params));
+      if ($this->useObjects()) {
+        return new Google_PostList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Get a post by id. (posts.get)
+     *
+     * @param string $blogId ID of the blog to fetch the post from.
+     * @param string $postId The ID of the post
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string maxComments Maximum number of comments to pull back on a post.
+     * @return Google_Post
+     */
+    public function get($blogId, $postId, $optParams = array()) {
+      $params = array('blogId' => $blogId, 'postId' => $postId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Post($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Retrieves a list of posts, possibly filtered. (posts.list)
+     *
+     * @param string $blogId ID of the blog to fetch posts from.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string startDate Earliest post date to fetch, a date-time with RFC 3339 formatting.
+     * @opt_param string endDate Latest post date to fetch, a date-time with RFC 3339 formatting.
+     * @opt_param string labels Comma-separated list of labels to search for.
+     * @opt_param string maxResults Maximum number of posts to fetch.
+     * @opt_param string pageToken Continuation token if the request is paged.
+     * @opt_param bool fetchBodies Whether the body content of posts is included.
+     * @return Google_PostList
+     */
+    public function listPosts($blogId, $optParams = array()) {
+      $params = array('blogId' => $blogId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_PostList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Update a post. (posts.update)
+     *
+     * @param string $blogId The ID of the Blog.
+     * @param string $postId The ID of the Post.
+     * @param Google_Post $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Post
+     */
+    public function update($blogId, $postId, Google_Post $postBody, $optParams = array()) {
+      $params = array('blogId' => $blogId, 'postId' => $postId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('update', array($params));
+      if ($this->useObjects()) {
+        return new Google_Post($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Retrieve a Post by Path. (posts.getByPath)
+     *
+     * @param string $blogId ID of the blog to fetch the post from.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string path Path of the Post to retrieve.
+     * @opt_param string maxComments Maximum number of comments to pull back on a post.
+     * @return Google_Post
+     */
+    public function getByPath($blogId, $optParams = array()) {
+      $params = array('blogId' => $blogId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('getByPath', array($params));
+      if ($this->useObjects()) {
+        return new Google_Post($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Update a post. This method supports patch semantics. (posts.patch)
+     *
+     * @param string $blogId The ID of the Blog.
+     * @param string $postId The ID of the Post.
+     * @param Google_Post $postBody
+     * @param array $optParams Optional parameters.
+     * @return Google_Post
+     */
+    public function patch($blogId, $postId, Google_Post $postBody, $optParams = array()) {
+      $params = array('blogId' => $blogId, 'postId' => $postId, 'postBody' => $postBody);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('patch', array($params));
+      if ($this->useObjects()) {
+        return new Google_Post($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Delete a post by id. (posts.delete)
+     *
+     * @param string $blogId The Id of the Blog.
+     * @param string $postId The ID of the Post.
+     * @param array $optParams Optional parameters.
+     */
+    public function delete($blogId, $postId, $optParams = array()) {
+      $params = array('blogId' => $blogId, 'postId' => $postId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('delete', array($params));
+      return $data;
+    }
+  }
+
+  /**
+   * The "pages" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bloggerService = new Google_BloggerService(...);
+   *   $pages = $bloggerService->pages;
+   *  </code>
+   */
+  class Google_PagesServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Retrieves pages for a blog, possibly filtered. (pages.list)
+     *
+     * @param string $blogId ID of the blog to fetch pages from.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param bool fetchBodies Whether to retrieve the Page bodies.
+     * @return Google_PageList
+     */
+    public function listPages($blogId, $optParams = array()) {
+      $params = array('blogId' => $blogId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_PageList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Gets one blog page by id. (pages.get)
+     *
+     * @param string $blogId ID of the blog containing the page.
+     * @param string $pageId The ID of the page to get.
+     * @param array $optParams Optional parameters.
+     * @return Google_Page
+     */
+    public function get($blogId, $pageId, $optParams = array()) {
+      $params = array('blogId' => $blogId, 'pageId' => $pageId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Page($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "comments" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bloggerService = new Google_BloggerService(...);
+   *   $comments = $bloggerService->comments;
+   *  </code>
+   */
+  class Google_CommentsServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Retrieves the comments for a blog, possibly filtered. (comments.list)
+     *
+     * @param string $blogId ID of the blog to fetch comments from.
+     * @param string $postId ID of the post to fetch posts from.
+     * @param array $optParams Optional parameters.
+     *
+     * @opt_param string startDate Earliest date of comment to fetch, a date-time with RFC 3339 formatting.
+     * @opt_param string endDate Latest date of comment to fetch, a date-time with RFC 3339 formatting.
+     * @opt_param string maxResults Maximum number of comments to include in the result.
+     * @opt_param string pageToken Continuation token if request is paged.
+     * @opt_param bool fetchBodies Whether the body content of the comments is included.
+     * @return Google_CommentList
+     */
+    public function listComments($blogId, $postId, $optParams = array()) {
+      $params = array('blogId' => $blogId, 'postId' => $postId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('list', array($params));
+      if ($this->useObjects()) {
+        return new Google_CommentList($data);
+      } else {
+        return $data;
+      }
+    }
+    /**
+     * Gets one comment by id. (comments.get)
+     *
+     * @param string $blogId ID of the blog to containing the comment.
+     * @param string $postId ID of the post to fetch posts from.
+     * @param string $commentId The ID of the comment to get.
+     * @param array $optParams Optional parameters.
+     * @return Google_Comment
+     */
+    public function get($blogId, $postId, $commentId, $optParams = array()) {
+      $params = array('blogId' => $blogId, 'postId' => $postId, 'commentId' => $commentId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_Comment($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+  /**
+   * The "users" collection of methods.
+   * Typical usage is:
+   *  <code>
+   *   $bloggerService = new Google_BloggerService(...);
+   *   $users = $bloggerService->users;
+   *  </code>
+   */
+  class Google_UsersServiceResource extends Google_ServiceResource {
+
+
+    /**
+     * Gets one user by id. (users.get)
+     *
+     * @param string $userId The ID of the user to get.
+     * @param array $optParams Optional parameters.
+     * @return Google_User
+     */
+    public function get($userId, $optParams = array()) {
+      $params = array('userId' => $userId);
+      $params = array_merge($params, $optParams);
+      $data = $this->__call('get', array($params));
+      if ($this->useObjects()) {
+        return new Google_User($data);
+      } else {
+        return $data;
+      }
+    }
+  }
+
+/**
+ * Service definition for Google_Blogger (v3).
+ *
+ * <p>
+ * API for access to the data within Blogger.
+ * </p>
+ *
+ * <p>
+ * For more information about this service, see the
+ * <a href="https://developers.google.com/blogger/docs/3.0/getting_started" target="_blank">API Documentation</a>
+ * </p>
+ *
+ * @author Google, Inc.
+ */
+class Google_BloggerService extends Google_Service {
+  public $blogs;
+  public $posts;
+  public $pages;
+  public $comments;
+  public $users;
+  /**
+   * Constructs the internal representation of the Blogger service.
+   *
+   * @param Google_Client $client
+   */
+  public function __construct(Google_Client $client) {
+    $this->servicePath = 'blogger/v3/';
+    $this->version = 'v3';
+    $this->serviceName = 'blogger';
+
+    $client->addService($this->serviceName, $this->version);
+    $this->blogs = new Google_BlogsServiceResource($this, $this->serviceName, 'blogs', json_decode('{"methods": {"listByUser": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.blogs.listByUser", "httpMethod": "GET", "path": "users/{userId}/blogs", "response": {"$ref": "BlogList"}}, "getByUrl": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"url": {"type": "string", "location": "query"}}, "response": {"$ref": "Blog"}, "httpMethod": "GET", "path": "blogs/byurl", "id": "blogger.blogs.getByUrl"}, "get": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"maxPosts": {"type": "integer", "location": "query", "format": "uint32"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.blogs.get", "httpMethod": "GET", "path": "blogs/{blogId}", "response": {"$ref": "Blog"}}}}', true));
+    $this->posts = new Google_PostsServiceResource($this, $this->serviceName, 'posts', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"blogId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Post"}, "response": {"$ref": "Post"}, "httpMethod": "POST", "path": "blogs/{blogId}/posts", "id": "blogger.posts.insert"}, "search": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"q": {"type": "string", "location": "query"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.posts.search", "httpMethod": "GET", "path": "blogs/{blogId}/posts/search", "response": {"$ref": "PostList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"maxComments": {"type": "integer", "location": "query", "format": "uint32"}, "blogId": {"required": true, "type": "string", "location": "path"}, "postId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.posts.get", "httpMethod": "GET", "path": "blogs/{blogId}/posts/{postId}", "response": {"$ref": "Post"}}, "list": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"startDate": {"type": "string", "location": "query", "format": "date-time"}, "endDate": {"type": "string", "location": "query", "format": "date-time"}, "labels": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "location": "query", "format": "uint32"}, "pageToken": {"type": "string", "location": "query"}, "fetchBodies": {"type": "boolean", "location": "query"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.posts.list", "httpMethod": "GET", "path": "blogs/{blogId}/posts", "response": {"$ref": "PostList"}}, "update": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"postId": {"required": true, "type": "string", "location": "path"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Post"}, "response": {"$ref": "Post"}, "httpMethod": "PUT", "path": "blogs/{blogId}/posts/{postId}", "id": "blogger.posts.update"}, "getByPath": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"path": {"type": "string", "location": "query"}, "maxComments": {"type": "integer", "location": "query", "format": "uint32"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.posts.getByPath", "httpMethod": "GET", "path": "blogs/{blogId}/posts/bypath", "response": {"$ref": "Post"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/blogger"], "parameters": {"postId": {"required": true, "type": "string", "location": "path"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Post"}, "response": {"$ref": "Post"}, "httpMethod": "PATCH", "path": "blogs/{blogId}/posts/{postId}", "id": "blogger.posts.patch"}, "delete": {"scopes": ["https://www.googleapis.com/auth/blogger"], "path": "blogs/{blogId}/posts/{postId}", "id": "blogger.posts.delete", "parameters": {"postId": {"required": true, "type": "string", "location": "path"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE"}}}', true));
+    $this->pages = new Google_PagesServiceResource($this, $this->serviceName, 'pages', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"fetchBodies": {"type": "boolean", "location": "query"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.pages.list", "httpMethod": "GET", "path": "blogs/{blogId}/pages", "response": {"$ref": "PageList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"pageId": {"required": true, "type": "string", "location": "path"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.pages.get", "httpMethod": "GET", "path": "blogs/{blogId}/pages/{pageId}", "response": {"$ref": "Page"}}}}', true));
+    $this->comments = new Google_CommentsServiceResource($this, $this->serviceName, 'comments', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"startDate": {"type": "string", "location": "query", "format": "date-time"}, "postId": {"required": true, "type": "string", "location": "path"}, "endDate": {"type": "string", "location": "query", "format": "date-time"}, "maxResults": {"type": "integer", "location": "query", "format": "uint32"}, "pageToken": {"type": "string", "location": "query"}, "fetchBodies": {"type": "boolean", "location": "query"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.comments.list", "httpMethod": "GET", "path": "blogs/{blogId}/posts/{postId}/comments", "response": {"$ref": "CommentList"}}, "get": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"commentId": {"required": true, "type": "string", "location": "path"}, "postId": {"required": true, "type": "string", "location": "path"}, "blogId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.comments.get", "httpMethod": "GET", "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}", "response": {"$ref": "Comment"}}}}', true));
+    $this->users = new Google_UsersServiceResource($this, $this->serviceName, 'users', json_decode('{"methods": {"get": {"scopes": ["https://www.googleapis.com/auth/blogger", "https://www.googleapis.com/auth/blogger.readonly"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}}, "id": "blogger.users.get", "httpMethod": "GET", "path": "users/{userId}", "response": {"$ref": "User"}}}}', true));
+
+  }
+}
+
+class Google_Blog extends Google_Model {
+  public $kind;
+  public $description;
+  protected $__localeType = 'Google_BlogLocale';
+  protected $__localeDataType = '';
+  public $locale;
+  protected $__postsType = 'Google_BlogPosts';
+  protected $__postsDataType = '';
+  public $posts;
+  public $customMetaData;
+  public $updated;
+  protected $__pagesType = 'Google_BlogPages';
+  protected $__pagesDataType = '';
+  public $pages;
+  public $url;
+  public $published;
+  public $id;
+  public $selfLink;
+  public $name;
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setDescription($description) {
+    $this->description = $description;
+  }
+  public function getDescription() {
+    return $this->description;
+  }
+  public function setLocale(Google_BlogLocale $locale) {
+    $this->locale = $locale;
+  }
+  public function getLocale() {
+    return $this->locale;
+  }
+  public function setPosts(Google_BlogPosts $posts) {
+    $this->posts = $posts;
+  }
+  public function getPosts() {
+    return $this->posts;
+  }
+  public function setCustomMetaData($customMetaData) {
+    $this->customMetaData = $customMetaData;
+  }
+  public function getCustomMetaData() {
+    return $this->customMetaData;
+  }
+  public function setUpdated($updated) {
+    $this->updated = $updated;
+  }
+  public function getUpdated() {
+    return $this->updated;
+  }
+  public function setPages(Google_BlogPages $pages) {
+    $this->pages = $pages;
+  }
+  public function getPages() {
+    return $this->pages;
+  }
+  public function setUrl($url) {
+    $this->url = $url;
+  }
+  public function getUrl() {
+    return $this->url;
+  }
+  public function setPublished($published) {
+    $this->published = $published;
+  }
+  public function getPublished() {
+    return $this->published;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+  public function setName($name) {
+    $this->name = $name;
+  }
+  public function getName() {
+    return $this->name;
+  }
+}
+
+class Google_BlogList extends Google_Model {
+  protected $__itemsType = 'Google_Blog';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public function setItems(/* array(Google_Blog) */ $items) {
+    $this->assertIsArray($items, 'Google_Blog', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+}
+
+class Google_BlogLocale extends Google_Model {
+  public $country;
+  public $variant;
+  public $language;
+  public function setCountry($country) {
+    $this->country = $country;
+  }
+  public function getCountry() {
+    return $this->country;
+  }
+  public function setVariant($variant) {
+    $this->variant = $variant;
+  }
+  public function getVariant() {
+    return $this->variant;
+  }
+  public function setLanguage($language) {
+    $this->language = $language;
+  }
+  public function getLanguage() {
+    return $this->language;
+  }
+}
+
+class Google_BlogPages extends Google_Model {
+  public $totalItems;
+  public $selfLink;
+  public function setTotalItems($totalItems) {
+    $this->totalItems = $totalItems;
+  }
+  public function getTotalItems() {
+    return $this->totalItems;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+}
+
+class Google_BlogPosts extends Google_Model {
+  public $totalItems;
+  protected $__itemsType = 'Google_Post';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $selfLink;
+  public function setTotalItems($totalItems) {
+    $this->totalItems = $totalItems;
+  }
+  public function getTotalItems() {
+    return $this->totalItems;
+  }
+  public function setItems(/* array(Google_Post) */ $items) {
+    $this->assertIsArray($items, 'Google_Post', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+}
+
+class Google_Comment extends Google_Model {
+  public $content;
+  public $kind;
+  protected $__inReplyToType = 'Google_CommentInReplyTo';
+  protected $__inReplyToDataType = '';
+  public $inReplyTo;
+  protected $__authorType = 'Google_CommentAuthor';
+  protected $__authorDataType = '';
+  public $author;
+  public $updated;
+  protected $__blogType = 'Google_CommentBlog';
+  protected $__blogDataType = '';
+  public $blog;
+  public $published;
+  protected $__postType = 'Google_CommentPost';
+  protected $__postDataType = '';
+  public $post;
+  public $id;
+  public $selfLink;
+  public function setContent($content) {
+    $this->content = $content;
+  }
+  public function getContent() {
+    return $this->content;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setInReplyTo(Google_CommentInReplyTo $inReplyTo) {
+    $this->inReplyTo = $inReplyTo;
+  }
+  public function getInReplyTo() {
+    return $this->inReplyTo;
+  }
+  public function setAuthor(Google_CommentAuthor $author) {
+    $this->author = $author;
+  }
+  public function getAuthor() {
+    return $this->author;
+  }
+  public function setUpdated($updated) {
+    $this->updated = $updated;
+  }
+  public function getUpdated() {
+    return $this->updated;
+  }
+  public function setBlog(Google_CommentBlog $blog) {
+    $this->blog = $blog;
+  }
+  public function getBlog() {
+    return $this->blog;
+  }
+  public function setPublished($published) {
+    $this->published = $published;
+  }
+  public function getPublished() {
+    return $this->published;
+  }
+  public function setPost(Google_CommentPost $post) {
+    $this->post = $post;
+  }
+  public function getPost() {
+    return $this->post;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+  public function setSelfLink($selfLink) {
+    $this->selfLink = $selfLink;
+  }
+  public function getSelfLink() {
+    return $this->selfLink;
+  }
+}
+
+class Google_CommentAuthor extends Google_Model {
+  public $url;
+  protected $__imageType = 'Google_CommentAuthorImage';
+  protected $__imageDataType = '';
+  public $image;
+  public $displayName;
+  public $id;
+  public function setUrl($url) {
+    $this->url = $url;
+  }
+  public function getUrl() {
+    return $this->url;
+  }
+  public function setImage(Google_CommentAuthorImage $image) {
+    $this->image = $image;
+  }
+  public function getImage() {
+    return $this->image;
+  }
+  public function setDisplayName($displayName) {
+    $this->displayName = $displayName;
+  }
+  public function getDisplayName() {
+    return $this->displayName;
+  }
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+}
+
+class Google_CommentAuthorImage extends Google_Model {
+  public $url;
+  public function setUrl($url) {
+    $this->url = $url;
+  }
+  public function getUrl() {
+    return $this->url;
+  }
+}
+
+class Google_CommentBlog extends Google_Model {
+  public $id;
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+}
+
+class Google_CommentInReplyTo extends Google_Model {
+  public $id;
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+}
+
+class Google_CommentList extends Google_Model {
+  public $nextPageToken;
+  protected $__itemsType = 'Google_Comment';
+  protected $__itemsDataType = 'array';
+  public $items;
+  public $kind;
+  public $prevPageToken;
+  public function setNextPageToken($nextPageToken) {
+    $this->nextPageToken = $nextPageToken;
+  }
+  public function getNextPageToken() {
+    return $this->nextPageToken;
+  }
+  public function setItems(/* array(Google_Comment) */ $items) {
+    $this->assertIsArray($items, 'Google_Comment', __METHOD__);
+    $this->items = $items;
+  }
+  public function getItems() {
+    return $this->items;
+  }
+  public function setKind($kind) {
+    $this->kind = $kind;
+  }
+  public function getKind() {
+    return $this->kind;
+  }
+  public function setPrevPageToken($prevPageToken) {
+    $this->prevPageToken = $prevPageToken;
+  }
+  public function getPrevPageToken() {
+    return $this->prevPageToken;
+  }
+}
+
+class Google_CommentPost extends Google_Model {
+  public $id;
+  public function setId($id) {
+    $this->id = $id;
+  }
+  public function getId() {
+    return $this->id;
+  }
+}
+
+class Google_Page extends Google_Model {
+  public $content;
+  public $kind;
+  protected $__authorType = 'Google_PageAuthor';
+  protected $__authorDataType = '&