diff --git a/apps/files_external/3rdparty/google-api-php-client/NOTICE b/apps/files_external/3rdparty/google-api-php-client/NOTICE deleted file mode 100644 index 22d7cb5986..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/NOTICE +++ /dev/null @@ -1,4 +0,0 @@ -This product contains the following libraries: - -XRDS-Simple library from http://code.google.com/p/diso/ -Apache License 2.0 diff --git a/apps/files_external/3rdparty/google-api-php-client/README b/apps/files_external/3rdparty/google-api-php-client/README deleted file mode 100644 index 42c42c0d5c..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/README +++ /dev/null @@ -1,40 +0,0 @@ -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 - 'free-ebooks'); - $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams); - - foreach ($results['items'] as $item) { - print($item['volumeInfo']['title'] . '
'); - } diff --git a/apps/files_external/3rdparty/google-api-php-client/README.md b/apps/files_external/3rdparty/google-api-php-client/README.md new file mode 100644 index 0000000000..9f7949c179 --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/README.md @@ -0,0 +1,57 @@ +# Google APIs Client Library for PHP # + +## Description ## +The Google API Client Library enables you to work with Google APIs such as Google+, Drive, or YouTube on your server. + +## Requirements ## +* [PHP 5.2.1 or higher](http://www.php.net/) +* [PHP JSON extension](http://php.net/manual/en/book.json.php) + +## Developer Documentation ## +http://developers.google.com/api-client-library/php + +## Basic Example ## +See the examples/ directory for examples of the key client features. +```PHP +setApplicationName("Client_Library_Examples"); + $client->setDeveloperKey("YOUR_APP_KEY"); + $service = new Google_Service_Books($client); + $optParams = array('filter' => 'free-ebooks'); + $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams); + + foreach ($results as $item) { + echo $item['volumeInfo']['title'], "
\n"; + } +``` + +## Frequently Asked Questions ## + +### What do I do if something isn't working? ### + +For support with the library the best place to ask is via the google-api-php-client tag on StackOverflow: http://stackoverflow.com/questions/tagged/google-api-php-client + +If there is a specific bug with the library, please file a issue in the Github issues tracker, including a (minimal) example of the failing code and any specific errors retrieved. Feature requests can also be filed, as long as they are core library requests, and not-API specific: for those, refer to the documentation for the individual APIs for the best place to file requests. Please try to provide a clear statement of the problem that the feature would address. + +### How do I contribute? ### + +We accept contributions via Github Pull Requests, but all contributors need to be covered by the standard Google Contributor License Agreement. You can find links, and more instructions, in the documentation: https://developers.google.com/api-client-library/php/contribute + +### Why do you still support 5.2? ### + +When we started working on the 1.0.0 branch we knew there were several fundamental issues to fix with the 0.6 releases of the library. At that time we looked at the usage of the library, and other related projects, and determined that there was still a large and active base of PHP 5.2 installs. You can see this in statistics such as the PHP versions chart in the Wordpress stats: http://wordpress.org/about/stats/. We will keep looking at the types of usage we see, and try to take advantage of newer PHP features where possible. + +### Why does Google_..._Service have weird names? ### + +The _Service classes are generally automatically generated from the API discovery documents: https://developers.google.com/discovery/. Sometimes new features are added to APIs with unusual names, which can cause some unexpected or non-standard style naming in the PHP classes. + +## Code Quality ## + +Copy the ruleset.xml in style/ into a new directory named GAPI/ in your +/usr/share/php/PHP/CodeSniffer/Standards (or appropriate equivalent directory), +and run code sniffs with: + + phpcs --standard=GAPI src/ diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Auth.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Abstract.php similarity index 61% rename from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Auth.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Abstract.php index 010782d4a6..344aad874f 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Auth.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Abstract.php @@ -14,23 +14,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -require_once "Google_AuthNone.php"; -require_once "Google_OAuth2.php"; +require_once "Google/Http/Request.php"; /** * Abstract class for the Authentication in the API client * @author Chris Chabot * */ -abstract class Google_Auth { - abstract public function authenticate($service); - abstract public function sign(Google_HttpRequest $request); +abstract class Google_Auth_Abstract +{ + /** + * An utility function that first calls $this->auth->sign($request) and then + * executes makeRequest() on that signed request. Used for when a request + * should be authenticated + * @param Google_Http_Request $request + * @return Google_Http_Request $request + */ + abstract public function authenticatedRequest(Google_Http_Request $request); + + abstract public function authenticate($code); + abstract public function sign(Google_Http_Request $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/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AssertionCredentials.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/AssertionCredentials.php similarity index 72% rename from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AssertionCredentials.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/AssertionCredentials.php index d9b4394ba3..be93df33d5 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AssertionCredentials.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/AssertionCredentials.php @@ -15,12 +15,17 @@ * limitations under the License. */ +require_once "Google/Auth/OAuth2.php"; +require_once "Google/Signer/P12.php"; +require_once "Google/Utils.php"; + /** * Credentials object used for OAuth 2.0 Signed JWT assertion grants. * * @author Chirag Shah */ -class Google_AssertionCredentials { +class Google_Auth_AssertionCredentials +{ const MAX_TOKEN_LIFETIME_SECS = 3600; public $serviceAccountName; @@ -34,6 +39,7 @@ class Google_AssertionCredentials { * @link http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06 */ public $prn; + private $useCache; /** * @param $serviceAccountName @@ -42,8 +48,9 @@ class Google_AssertionCredentials { * @param string $privateKeyPassword * @param string $assertionType * @param bool|string $sub The email address of the user for which the - * application is requesting delegated access. - * + * application is requesting delegated access. + * @param bool useCache Whether to generate a cache key and allow + * automatic caching of the generated token. */ public function __construct( $serviceAccountName, @@ -51,7 +58,9 @@ class Google_AssertionCredentials { $privateKey, $privateKeyPassword = 'notasecret', $assertionType = 'http://oauth.net/grant_type/jwt/1.0/bearer', - $sub = false) { + $sub = false, + $useCache = true + ) { $this->serviceAccountName = $serviceAccountName; $this->scopes = is_string($scopes) ? $scopes : implode(' ', $scopes); $this->privateKey = $privateKey; @@ -59,13 +68,32 @@ class Google_AssertionCredentials { $this->assertionType = $assertionType; $this->sub = $sub; $this->prn = $sub; + $this->useCache = $useCache; + } + + /** + * Generate a unique key to represent this credential. + * @return string + */ + public function getCacheKey() + { + if (!$this->useCache) { + return false; + } + $h = $this->sub; + $h .= $this->assertionType; + $h .= $this->privateKey; + $h .= $this->scopes; + $h .= $this->serviceAccountName; + return md5($h); } - public function generateAssertion() { + public function generateAssertion() + { $now = time(); $jwtParams = array( - 'aud' => Google_OAuth2::OAUTH2_TOKEN_URI, + 'aud' => Google_Auth_OAuth2::OAUTH2_TOKEN_URI, 'scope' => $this->scopes, 'iat' => $now, 'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS, @@ -86,7 +114,8 @@ class Google_AssertionCredentials { * @param array $payload * @return string The signed JWT. */ - private function makeSignedJwt($payload) { + private function makeSignedJwt($payload) + { $header = array('typ' => 'JWT', 'alg' => 'RS256'); $segments = array( @@ -95,7 +124,7 @@ class Google_AssertionCredentials { ); $signingInput = implode('.', $segments); - $signer = new Google_P12Signer($this->privateKey, $this->privateKeyPassword); + $signer = new Google_Signer_P12($this->privateKey, $this->privateKeyPassword); $signature = $signer->sign($signingInput); $segments[] = Google_Utils::urlSafeB64Encode($signature); diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Exception.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Exception.php new file mode 100644 index 0000000000..65067ee443 --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Exception.php @@ -0,0 +1,22 @@ + */ -class Google_LoginTicket { - const USER_ATTR = "id"; +class Google_Auth_LoginTicket +{ + const USER_ATTR = "sub"; // Information from id token envelope. private $envelope; @@ -35,21 +38,23 @@ class Google_LoginTicket { * @param string $envelope Header from a verified authentication token. * @param string $payload Information from a verified authentication token. */ - public function __construct($envelope, $payload) { + public function __construct($envelope, $payload) + { $this->envelope = $envelope; $this->payload = $payload; } /** * Returns the numeric identifier for the user. - * @throws Google_AuthException + * @throws Google_Auth_Exception * @return */ - public function getUserId() { + 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"); + throw new Google_Auth_Exception("No user_id in token"); } /** @@ -57,7 +62,8 @@ class Google_LoginTicket { * various information about the user session. * @return array */ - public function getAttributes() { + public function getAttributes() + { return array("envelope" => $this->envelope, "payload" => $this->payload); } } diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/OAuth2.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/OAuth2.php new file mode 100644 index 0000000000..e66f34c1ef --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/OAuth2.php @@ -0,0 +1,579 @@ + + * @author Chirag Shah + * + */ +class Google_Auth_OAuth2 extends Google_Auth_Abstract +{ + 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 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 + const OAUTH2_ISSUER = 'accounts.google.com'; + + /** @var Google_Auth_AssertionCredentials $assertionCredentials */ + private $assertionCredentials; + + /** + * @var string The state parameters for CSRF and other forgery protection. + */ + private $state; + + /** + * @var string The token bundle. + */ + private $token; + + /** + * @var Google_Client the base client + */ + private $client; + + /** + * Instantiates the class, but does not initiate the login flow, leaving it + * to the discretion of the caller. + */ + public function __construct(Google_Client $client) + { + $this->client = $client; + } + + /** + * Perform an authenticated / signed apiHttpRequest. + * This function takes the apiHttpRequest, calls apiAuth->sign on it + * (which can modify the request in what ever way fits the auth mechanism) + * and then calls apiCurlIO::makeRequest on the signed request + * + * @param Google_Http_Request $request + * @return Google_Http_Request The resulting HTTP response including the + * responseHttpCode, responseHeaders and responseBody. + */ + public function authenticatedRequest(Google_Http_Request $request) + { + $request = $this->sign($request); + return $this->client->getIo()->makeRequest($request); + } + + /** + * @param string $code + * @throws Google_Auth_Exception + * @return string + */ + public function authenticate($code) + { + if (strlen($code) == 0) { + throw new Google_Auth_Exception("Invalid code"); + } + + // We got here from the redirect from a successful authorization grant, + // fetch the access token + $request = $this->client->getIo()->makeRequest( + new Google_Http_Request( + self::OAUTH2_TOKEN_URI, + 'POST', + array(), + array( + 'code' => $code, + 'grant_type' => 'authorization_code', + 'redirect_uri' => $this->client->getClassConfig($this, 'redirect_uri'), + 'client_id' => $this->client->getClassConfig($this, 'client_id'), + 'client_secret' => $this->client->getClassConfig($this, 'client_secret') + ) + ) + ); + + 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_Auth_Exception( + sprintf( + "Error fetching OAuth2 access token, message: '%s'", + $response + ), + $request->getResponseHttpCode() + ); + } + } + + /** + * 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' => $this->client->getClassConfig($this, 'redirect_uri'), + 'client_id' => $this->client->getClassConfig($this, 'client_id'), + 'scope' => $scope, + 'access_type' => $this->client->getClassConfig($this, 'access_type'), + 'approval_prompt' => $this->client->getClassConfig($this, 'approval_prompt'), + ); + + // If the list of scopes contains plus.login, add request_visible_actions + // to auth URL. + $rva = $this->client->getClassConfig($this, 'request_visible_actions'); + if (strpos($scope, 'plus.login') && strlen($rva) > 0) { + $params['request_visible_actions'] = $rva; + } + + if (isset($this->state)) { + $params['state'] = $this->state; + } + + return self::OAUTH2_AUTH_URL . "?" . http_build_query($params); + } + + /** + * @param string $token + * @throws Google_Auth_Exception + */ + public function setAccessToken($token) + { + $token = json_decode($token, true); + if ($token == null) { + throw new Google_Auth_Exception('Could not json decode the token'); + } + if (! isset($token['access_token'])) { + throw new Google_Auth_Exception("Invalid token format"); + } + $this->token = $token; + } + + public function getAccessToken() + { + return json_encode($this->token); + } + + public function setState($state) + { + $this->state = $state; + } + + public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds) + { + $this->assertionCredentials = $creds; + } + + /** + * Include an accessToken in a given apiHttpRequest. + * @param Google_Http_Request $request + * @return Google_Http_Request + * @throws Google_Auth_Exception + */ + public function sign(Google_Http_Request $request) + { + // add the developer key to the request before signing it + if ($this->client->getClassConfig($this, 'developer_key')) { + $request->setQueryParam('key', $this->client->getClassConfig($this, 'developer_key')); + } + + // 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_Auth_Exception( + "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->client->getClassConfig($this, 'client_id'), + 'client_secret' => $this->client->getClassConfig($this, 'client_secret'), + 'refresh_token' => $refreshToken, + 'grant_type' => 'refresh_token' + ) + ); + } + + /** + * Fetches a fresh access token with a given assertion token. + * @param Google_Auth_AssertionCredentials $assertionCredentials optional. + * @return void + */ + public function refreshTokenWithAssertion($assertionCredentials = null) + { + if (!$assertionCredentials) { + $assertionCredentials = $this->assertionCredentials; + } + + $cacheKey = $assertionCredentials->getCacheKey(); + + if ($cacheKey) { + // We can check whether we have a token available in the + // cache. If it is expired, we can retrieve a new one from + // the assertion. + $token = $this->client->getCache()->get($cacheKey); + if ($token) { + $this->setAccessToken($token); + } + if (!$this->isAccessTokenExpired()) { + return; + } + } + + $this->refreshTokenRequest( + array( + 'grant_type' => 'assertion', + 'assertion_type' => $assertionCredentials->assertionType, + 'assertion' => $assertionCredentials->generateAssertion(), + ) + ); + + if ($cacheKey) { + // Attempt to cache the token. + $this->client->getCache()->set( + $cacheKey, + $this->getAccessToken() + ); + } + } + + private function refreshTokenRequest($params) + { + $http = new Google_Http_Request( + self::OAUTH2_TOKEN_URI, + 'POST', + array(), + $params + ); + $request = $this->client->getIo()->makeRequest($http); + + $code = $request->getResponseHttpCode(); + $body = $request->getResponseBody(); + if (200 == $code) { + $token = json_decode($body, true); + if ($token == null) { + throw new Google_Auth_Exception("Could not json decode the access token"); + } + + if (! isset($token['access_token']) || ! isset($token['expires_in'])) { + throw new Google_Auth_Exception("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_Auth_Exception("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_Auth_Exception + * @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_Http_Request( + self::OAUTH2_REVOKE_URI, + 'POST', + array(), + "token=$token" + ); + $response = $this->client->getIo()->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 (!$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() + { + return $this->retrieveCertsFromLocation( + $this->client->getClassConfig($this, 'federated_signon_certs_url') + ); + } + + /** + * Retrieve and cache a certificates file. + * @param $url location + * @return array certificates + */ + public function retrieveCertsFromLocation($url) + { + // If we're retrieving a local file, just grab it. + if ("http" != substr($url, 0, 4)) { + $file = file_get_contents($url); + if ($file) { + return json_decode($file, true); + } else { + throw new Google_Auth_Exception( + "Failed to retrieve verification certificates: '" . + $url . "'." + ); + } + } + + // This relies on makeRequest caching certificate responses. + $request = $this->client->getIo()->makeRequest( + new Google_Http_Request( + $url + ) + ); + if ($request->getResponseHttpCode() == 200) { + $certs = json_decode($request->getResponseBody(), true); + if ($certs) { + return $certs; + } + } + throw new Google_Auth_Exception( + "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_Auth_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->client->getClassConfig($this, 'client_id'); + } + + return $this->verifySignedJwtWithCerts($id_token, $certs, $audience, self::OAUTH2_ISSUER); + } + + /** + * Verifies the id token, returns the verified token contents. + * + * @param $jwt the token + * @param $certs array of certificates + * @param $required_audience the expected consumer of the token + * @param [$issuer] the expected issues, defaults to Google + * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS + * @return token information if valid, false if not + */ + public function verifySignedJwtWithCerts( + $jwt, + $certs, + $required_audience, + $issuer = null, + $max_expiry = null + ) { + if (!$max_expiry) { + // Set the maximum time we will accept a token for. + $max_expiry = self::MAX_TOKEN_LIFETIME_SECS; + } + + $segments = explode(".", $jwt); + if (count($segments) != 3) { + throw new Google_Auth_Exception("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_Auth_Exception("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_Auth_Exception("Can't parse token payload: " . $segments[1]); + } + + // Check signature + $verified = false; + foreach ($certs as $keyName => $pem) { + $public_key = new Google_Verifier_Pem($pem); + if ($public_key->verify($signed, $signature)) { + $verified = true; + break; + } + } + + if (!$verified) { + throw new Google_Auth_Exception("Invalid token signature: $jwt"); + } + + // Check issued-at timestamp + $iat = 0; + if (array_key_exists("iat", $payload)) { + $iat = $payload["iat"]; + } + if (!$iat) { + throw new Google_Auth_Exception("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_Auth_Exception("No expiration time in token: $json_body"); + } + if ($exp >= $now + $max_expiry) { + throw new Google_Auth_Exception( + sprintf("Expiration time too far in future: %s", $json_body) + ); + } + + $latest = $exp + self::CLOCK_SKEW_SECS; + if ($now < $earliest) { + throw new Google_Auth_Exception( + sprintf( + "Token used too early, %s < %s: %s", + $now, + $earliest, + $json_body + ) + ); + } + if ($now > $latest) { + throw new Google_Auth_Exception( + sprintf( + "Token used too late, %s > %s: %s", + $now, + $latest, + $json_body + ) + ); + } + + $iss = $payload['iss']; + if ($issuer && $iss != $issuer) { + throw new Google_Auth_Exception( + sprintf( + "Invalid issuer, %s != %s: %s", + $iss, + $issuer, + $json_body + ) + ); + } + + // Check audience + $aud = $payload["aud"]; + if ($aud != $required_audience) { + throw new Google_Auth_Exception( + sprintf( + "Wrong recipient, %s != %s:", + $aud, + $required_audience, + $json_body + ) + ); + } + + // All good. + return new Google_Auth_LoginTicket($envelope, $payload); + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Simple.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Simple.php new file mode 100644 index 0000000000..8fcf61e52e --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Simple.php @@ -0,0 +1,92 @@ + + * @author Chirag Shah + */ +class Google_Auth_Simple extends Google_Auth_Abstract +{ + private $key = null; + private $client; + + public function __construct(Google_Client $client, $config = null) + { + $this->client = $client; + } + + /** + * Perform an authenticated / signed apiHttpRequest. + * This function takes the apiHttpRequest, calls apiAuth->sign on it + * (which can modify the request in what ever way fits the auth mechanism) + * and then calls apiCurlIO::makeRequest on the signed request + * + * @param Google_Http_Request $request + * @return Google_Http_Request The resulting HTTP response including the + * responseHttpCode, responseHeaders and responseBody. + */ + public function authenticatedRequest(Google_Http_Request $request) + { + $request = $this->sign($request); + return $this->io->makeRequest($request); + } + + public function authenticate($code) + { + throw new Google_Auth_Exception("Simple auth does not exchange tokens."); + } + + 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_Http_Request $request) + { + $key = $this->client->getClassConfig($this, 'developer_key'); + if ($key) { + $request->setQueryParam('key', $key); + } + return $request; + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_Cache.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Abstract.php similarity index 82% rename from apps/files_external/3rdparty/google-api-php-client/src/cache/Google_Cache.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Abstract.php index 809c55e2b1..ff19f36ac4 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_Cache.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Abstract.php @@ -15,15 +15,15 @@ * limitations under the License. */ -require_once "Google_FileCache.php"; -require_once "Google_MemcacheCache.php"; - /** * Abstract storage class * * @author Chris Chabot */ -abstract class Google_Cache { +abstract class Google_Cache_Abstract +{ + + abstract public function __construct(Google_Client $client); /** * Retrieves the data for the given key, or false if they @@ -33,7 +33,7 @@ abstract class Google_Cache { * @param boolean|int $expiration Expiration time in seconds * */ - abstract function get($key, $expiration = false); + abstract public function get($key, $expiration = false); /** * Store the key => $value set. The $value is serialized @@ -42,14 +42,12 @@ abstract class Google_Cache { * @param string $key Key of the data * @param string $value data */ - abstract function set($key, $value); + abstract public function set($key, $value); /** * Removes the key/data pair for the given $key * * @param String $key */ - abstract function delete($key); + abstract public function delete($key); } - - diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Apc.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Apc.php new file mode 100644 index 0000000000..051b537a4e --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Apc.php @@ -0,0 +1,73 @@ + + */ +class Google_Cache_Apc extends Google_Cache_Abstract +{ + public function __construct(Google_Client $client) + { + if (! function_exists('apc_add') ) { + throw new Google_Cache_Exception("Apc functions not available"); + } + } + + /** + * @inheritDoc + */ + public function get($key, $expiration = false) + { + $ret = apc_fetch($key); + if ($ret === false) { + return false; + } + if (is_numeric($expiration) && (time() - $ret['time'] > $expiration)) { + $this->delete($key); + return false; + } + return $ret['data']; + } + + /** + * @inheritDoc + */ + public function set($key, $value) + { + $rc = apc_store($key, array('time' => time(), 'data' => $value)); + if ($rc == false) { + throw new Google_Cache_Exception("Couldn't store data"); + } + } + + /** + * @inheritDoc + * @param String $key + */ + public function delete($key) + { + apc_delete($key); + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Exception.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Exception.php new file mode 100644 index 0000000000..23b624608e --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Exception.php @@ -0,0 +1,21 @@ + + */ +class Google_Cache_File extends Google_Cache_Abstract +{ + const MAX_LOCK_RETRIES = 10; + private $path; + private $fh; + + public function __construct(Google_Client $client) + { + $this->path = $client->getClassConfig($this, 'directory'); + } + + public function get($key, $expiration = false) + { + $storageFile = $this->getCacheFile($key); + $data = false; + + if (!file_exists($storageFile)) { + return false; + } + + if ($expiration) { + $mtime = filemtime($storageFile); + if (($now - $mtime) >= $expiration) { + $this->delete($key); + return false; + } + } + + if ($this->acquireReadLock($storageFile)) { + $data = file_get_contents($storageFile); + $data = unserialize($data); + $this->unlock($storageFile); + } + + return $data; + } + + public function set($key, $value) + { + $storageFile = $this->getWriteableCacheFile($key); + if ($this->acquireWriteLock($storageFile)) { + // 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); + $result = fwrite($this->fh, $data); + $this->unlock($storageFile); + } + } + + public function delete($key) + { + $file = $this->getCacheFile($key); + if (file_exists($file) && !unlink($file)) { + throw new Google_Cache_Exception("Cache file could not be deleted"); + } + } + + private function getWriteableCacheFile($file) + { + return $this->getCacheFile($file, true); + } + + private function getCacheFile($file, $forWrite = false) + { + return $this->getCacheDir($file, $forWrite) . '/' . md5($file); + } + + private function getCacheDir($file, $forWrite) + { + // 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 + $storageDir = $this->path . '/' . substr(md5($file), 0, 2); + if ($forWrite && ! is_dir($storageDir)) { + if (! mkdir($storageDir, 0755, true)) { + throw new Google_Cache_Exception("Could not create storage directory: $storageDir"); + } + } + return $storageDir; + } + + private function acquireReadLock($storageFile) + { + return $this->acquireLock(LOCK_SH, $storageFile); + } + + private function acquireWriteLock($storageFile) + { + $rc = $this->acquireLock(LOCK_EX, $storageFile); + if (!$rc) { + $this->delete($storageFile); + } + return $rc; + } + + private function acquireLock($type, $storageFile) + { + $mode = $type == LOCK_EX ? "w" : "r"; + $this->fh = fopen($storageFile, $mode); + $count = 0; + while (!flock($this->fh, $type | LOCK_NB)) { + // Sleep for 10ms. + usleep(10000); + if (++$count < self::MAX_LOCK_RETRIES) { + return false; + } + } + return true; + } + + public function unlock($storageFile) + { + if ($this->fh) { + flock($this->fh, LOCK_UN); + } + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Memcache.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Memcache.php new file mode 100644 index 0000000000..56676c2472 --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Memcache.php @@ -0,0 +1,137 @@ + + */ +class Google_Cache_Memcache extends Google_Cache_Abstract +{ + private $connection = false; + private $mc = false; + private $host; + private $port; + + public function __construct(Google_Client $client) + { + if (!function_exists('memcache_connect') && !class_exists("Memcached")) { + throw new Google_Cache_Exception("Memcache functions not available"); + } + if ($client->isAppEngine()) { + // No credentials needed for GAE. + $this->mc = new Memcached(); + $this->connection = true; + } else { + $this->host = $client->getClassConfig($this, 'host'); + $this->port = $client->getClassConfig($this, 'port'); + if (empty($this->host) || empty($this->port)) { + throw new Google_Cache_Exception("You need to supply a valid memcache host and port"); + } + } + } + + /** + * @inheritDoc + */ + public function get($key, $expiration = false) + { + $this->connect(); + $ret = false; + if ($this->mc) { + $ret = $this->mc->get($key); + } else { + $ret = memcache_get($this->connection, $key); + } + if ($ret === false) { + return false; + } + if (is_numeric($expiration) && (time() - $ret['time'] > $expiration)) { + $this->delete($key); + return false; + } + return $ret['data']; + } + + /** + * @inheritDoc + * @param string $key + * @param string $value + * @throws Google_Cache_Exception + */ + public function set($key, $value) + { + $this->connect(); + // we store it with the cache_time default expiration so objects will at + // least get cleaned eventually. + $data = array('time' => time(), 'data' => $value); + $rc = false; + if ($this->mc) { + $rc = $this->mc->set($key, $data); + } else { + $rc = memcache_set($this->connection, $key, $data, false); + } + if ($rc == false) { + throw new Google_Cache_Exception("Couldn't store data in cache"); + } + } + + /** + * @inheritDoc + * @param String $key + */ + public function delete($key) + { + $this->connect(); + if ($this->mc) { + $this->mc->delete($key, 0); + } else { + memcache_delete($this->connection, $key, 0); + } + } + + /** + * Lazy initialiser for memcache connection. Uses pconnect for to take + * advantage of the persistence pool where possible. + */ + private function connect() + { + if ($this->connection) { + return; + } + + if (class_exists("Memcached")) { + $this->mc = new Memcached(); + $this->mc->addServer($this->host, $this->port); + $this->connection = true; + } else { + $this->connection = memcache_pconnect($this->host, $this->port); + } + + if (! $this->connection) { + throw new Google_Cache_Exception("Couldn't connect to memcache server"); + } + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php new file mode 100644 index 0000000000..daf1cb151c --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php @@ -0,0 +1,596 @@ + + * @author Chirag Shah + */ +class Google_Client +{ + const LIBVER = "1.0.2-beta"; + const USER_AGENT_SUFFIX = "google-api-php-client/"; + /** + * @var Google_Auth_Abstract $auth + */ + private $auth; + + /** + * @var Google_IO_Abstract $io + */ + private $io; + + /** + * @var Google_Cache_Abstract $cache + */ + private $cache; + + /** + * @var Google_Config $config + */ + private $config; + + /** + * @var boolean $deferExecution + */ + private $deferExecution = false; + + /** @var array $scopes */ + // Scopes requested by the client + protected $requestedScopes = array(); + + // definitions of services that are discovered. + protected $services = array(); + + // Used to track authenticated state, can't discover services after doing authenticate() + private $authenticated = false; + + /** + * Construct the Google Client. + * + * @param $config Google_Config or string for the ini file to load + */ + public function __construct($config = null) + { + if (! ini_get('date.timezone') && + function_exists('date_default_timezone_set')) { + date_default_timezone_set('UTC'); + } + + if (is_string($config) && strlen($config)) { + $config = new Google_Config($config); + } else if ( !($config instanceof Google_Config)) { + $config = new Google_Config(); + + if ($this->isAppEngine()) { + // Automatically use Memcache if we're in AppEngine. + $config->setCacheClass('Google_Cache_Memcache'); + // Automatically disable compress.zlib, as currently unsupported. + $config->setClassConfig('Google_Http_Request', 'disable_gzip', true); + } + } + + $this->config = $config; + } + + /** + * Get a string containing the version of the library. + * + * @return string + */ + public function getLibraryVersion() + { + return self::LIBVER; + } + + /** + * Attempt to exchange a code for an valid authentication token. + * Helper wrapped around the OAuth 2.0 implementation. + * + * @param $code string code from accounts.google.com + * @return string token + */ + public function authenticate($code) + { + $this->authenticated = true; + return $this->getAuth()->authenticate($code); + } + + /** + * Set the auth config from the JSON string provided. + * This structure should match the file downloaded from + * the "Download JSON" button on in the Google Developer + * Console. + * @param string $json the configuration json + */ + public function setAuthConfig($json) + { + $data = json_decode($json); + $key = isset($data->installed) ? 'installed' : 'web'; + if (!isset($data->$key)) { + throw new Google_Exception("Invalid client secret JSON file."); + } + $this->setClientId($data->$key->client_id); + $this->setClientSecret($data->$key->client_secret); + if (isset($data->$key->redirect_uris)) { + $this->setRedirectUri($data->$key->redirect_uris[0]); + } + } + + /** + * Set the auth config from the JSON file in the path + * provided. This should match the file downloaded from + * the "Download JSON" button on in the Google Developer + * Console. + * @param string $file the file location of the client json + */ + public function setAuthConfigFile($file) + { + $this->setAuthConfig(file_get_contents($file)); + } + + /** + * @return array + * @visible For Testing + */ + public function prepareScopes() + { + if (empty($this->requestedScopes)) { + throw new Google_Auth_Exception("No scopes specified"); + } + $scopes = implode(' ', $this->requestedScopes); + return $scopes; + } + + /** + * Set the OAuth 2.0 access token using the string that resulted from calling createAuthUrl() + * 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; + } + $this->getAuth()->setAccessToken($accessToken); + } + + + + /** + * Set the authenticator object + * @param Google_Auth_Abstract $auth + */ + public function setAuth(Google_Auth_Abstract $auth) + { + $this->config->setAuthClass(get_class($auth)); + $this->auth = $auth; + } + + /** + * Set the IO object + * @param Google_Io_Abstract $auth + */ + public function setIo(Google_Io_Abstract $io) + { + $this->config->setIoClass(get_class($io)); + $this->io = $io; + } + + /** + * Set the Cache object + * @param Google_Cache_Abstract $auth + */ + public function setCache(Google_Cache_Abstract $cache) + { + $this->config->setCacheClass(get_class($cache)); + $this->cache = $cache; + } + + /** + * Construct the OAuth 2.0 authorization request URI. + * @return string + */ + public function createAuthUrl() + { + $scopes = $this->prepareScopes(); + return $this->getAuth()->createAuthUrl($scopes); + } + + /** + * 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 = $this->getAuth()->getAccessToken(); + // The response is json encoded, so could be the string null. + // It is arguable whether this check should be here or lower + // in the library. + 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 $this->getAuth()->isAccessTokenExpired(); + } + + /** + * 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) + { + $this->getAuth()->setState($state); + } + + /** + * @param string $accessType Possible values for access_type include: + * {@code "offline"} to request offline access from the user. + * {@code "online"} to request online access from the user. + */ + public function setAccessType($accessType) + { + $this->config->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) + { + $this->config->setApprovalPrompt($approvalPrompt); + } + + /** + * Set the application name, this is included in the User-Agent HTTP header. + * @param string $applicationName + */ + public function setApplicationName($applicationName) + { + $this->config->setApplicationName($applicationName); + } + + /** + * Set the OAuth 2.0 Client ID. + * @param string $clientId + */ + public function setClientId($clientId) + { + $this->config->setClientId($clientId); + } + + /** + * Set the OAuth 2.0 Client Secret. + * @param string $clientSecret + */ + public function setClientSecret($clientSecret) + { + $this->config->setClientSecret($clientSecret); + } + + /** + * Set the OAuth 2.0 Redirect URI. + * @param string $redirectUri + */ + public function setRedirectUri($redirectUri) + { + $this->config->setRedirectUri($redirectUri); + } + + /** + * If 'plus.login' is included in the list of requested scopes, you can use + * this method to define types of app activities that your app will write. + * You can find a list of available types here: + * @link https://developers.google.com/+/api/moment-types + * + * @param array $requestVisibleActions Array of app activity types + */ + public function setRequestVisibleActions($requestVisibleActions) + { + if (is_array($requestVisibleActions)) { + $requestVisibleActions = join(" ", $requestVisibleActions); + } + $this->config->setRequestVisibleActions($requestVisibleActions); + } + + /** + * 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) + { + $this->config->setDeveloperKey($developerKey); + } + + /** + * Fetches a fresh OAuth 2.0 access token with the given refresh token. + * @param string $refreshToken + * @return void + */ + public function refreshToken($refreshToken) + { + return $this->getAuth()->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_Auth_Exception + * @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) + { + return $this->getAuth()->revokeToken($token); + } + + /** + * Verify an id_token. This method will verify the current id_token, if one + * isn't provided. + * @throws Google_Auth_Exception + * @param string|null $token The token (id_token) that should be verified. + * @return Google_Auth_LoginTicket Returns an apiLoginTicket if the verification was + * successful. + */ + public function verifyIdToken($token = null) + { + return $this->getAuth()->verifyIdToken($token); + } + + /** + * Verify a JWT that was signed with your own certificates. + * + * @param $jwt the token + * @param $certs array of certificates + * @param $required_audience the expected consumer of the token + * @param [$issuer] the expected issues, defaults to Google + * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS + * @return token information if valid, false if not + */ + public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null) + { + $auth = new Google_Auth_OAuth2($this); + $certs = $auth->retrieveCertsFromLocation($cert_location); + return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry); + } + + /** + * @param Google_Auth_AssertionCredentials $creds + * @return void + */ + public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds) + { + $this->getAuth()->setAssertionCredentials($creds); + } + + /** + * Set the scopes to be requested. Must be called before createAuthUrl(). + * Will remove any previously configured scopes. + * @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.login', + * 'https://www.googleapis.com/auth/moderator') + */ + public function setScopes($scopes) + { + $this->requestedScopes = array(); + $this->addScope($scopes); + } + + /** + * This functions adds a scope to be requested as part of the OAuth2.0 flow. + * Will append any scopes not previously requested to the scope parameter. + * A single string will be treated as a scope to request. An array of strings + * will each be appended. + * @param $scope_or_scopes string|array e.g. "profile" + */ + public function addScope($scope_or_scopes) + { + if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) { + $this->requestedScopes[] = $scope_or_scopes; + } else if (is_array($scope_or_scopes)) { + foreach ($scope_or_scopes as $scope) { + $this->addScope($scope); + } + } + } + + /** + * Returns the list of scopes requested by the client + * @return array the list of scopes + * + */ + public function getScopes() + { + return $this->requestedScopes; + } + + /** + * Declare whether batch calls should be used. This may increase throughput + * by making multiple requests in one connection. + * + * @param boolean $useBatch True if the batch support should + * be enabled. Defaults to False. + */ + public function setUseBatch($useBatch) + { + // This is actually an alias for setDefer. + $this->setDefer($useBatch); + } + + /** + * Declare whether making API calls should make the call immediately, or + * return a request which can be called with ->execute(); + * + * @param boolean $defer True if calls should not be executed right away. + */ + public function setDefer($defer) + { + $this->deferExecution = $defer; + } + + /** + * Helper method to execute deferred HTTP requests. + * + * @returns object of the type of the expected class or array. + */ + public function execute($request) + { + if ($request instanceof Google_Http_Request) { + $request->setUserAgent( + $this->getApplicationName() + . " " . self::USER_AGENT_SUFFIX + . $this->getLibraryVersion() + ); + if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) { + $request->enableGzip(); + } + $request->maybeMoveParametersToBody(); + return Google_Http_REST::execute($this, $request); + } else if ($request instanceof Google_Http_Batch) { + return $request->execute(); + } else { + throw new Google_Exception("Do not know how to execute this type of object."); + } + } + + /** + * Whether or not to return raw requests + * @return boolean + */ + public function shouldDefer() + { + return $this->deferExecution; + } + + /** + * @return Google_Auth_Abstract Authentication implementation + */ + public function getAuth() + { + if (!isset($this->auth)) { + $class = $this->config->getAuthClass(); + $this->auth = new $class($this); + } + return $this->auth; + } + + /** + * @return Google_IO_Abstract IO implementation + */ + public function getIo() + { + if (!isset($this->io)) { + $class = $this->config->getIoClass(); + $this->io = new $class($this); + } + return $this->io; + } + + /** + * @return Google_Cache_Abstract Cache implementation + */ + public function getCache() + { + if (!isset($this->cache)) { + $class = $this->config->getCacheClass(); + $this->cache = new $class($this); + } + return $this->cache; + } + + /** + * Retrieve custom configuration for a specific class. + * @param $class string|object - class or instance of class to retrieve + * @param $key string optional - key to retrieve + */ + public function getClassConfig($class, $key = null) + { + if (!is_string($class)) { + $class = get_class($class); + } + return $this->config->getClassConfig($class, $key); + } + + /** + * Set configuration specific to a given class. + * $config->setClassConfig('Google_Cache_File', + * array('directory' => '/tmp/cache')); + * @param $class The class name for the configuration + * @param $config string key or an array of configuration values + * @param $value optional - if $config is a key, the value + * + */ + public function setClassConfig($class, $config, $value = null) + { + if (!is_string($class)) { + $class = get_class($class); + } + return $this->config->setClassConfig($class, $config, $value); + + } + + /** + * @return string the base URL to use for calls to the APIs + */ + public function getBasePath() + { + return $this->config->getBasePath(); + } + + /** + * @return string the name of the application + */ + public function getApplicationName() + { + return $this->config->getApplicationName(); + } + + /** + * Are we running in Google AppEngine? + * return bool + */ + public function isAppEngine() + { + return (isset($_SERVER['SERVER_SOFTWARE']) && + strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false); + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Collection.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Collection.php new file mode 100644 index 0000000000..60909a967a --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Collection.php @@ -0,0 +1,94 @@ +data[$this->collection_key])) { + reset($this->data[$this->collection_key]); + } + } + + public function current() + { + $this->coerceType($this->key()); + if (is_array($this->data[$this->collection_key])) { + return current($this->data[$this->collection_key]); + } + } + + public function key() + { + if (is_array($this->data[$this->collection_key])) { + return key($this->data[$this->collection_key]); + } + } + + public function next() + { + return next($this->data[$this->collection_key]); + } + + public function valid() + { + $key = $this->key(); + return $key !== null && $key !== false; + } + + public function count() + { + return count($this->data[$this->collection_key]); + } + + public function offsetExists ($offset) + { + if (!is_numeric($offset)) { + return parent::offsetExists($offset); + } + return isset($this->data[$this->collection_key][$offset]); + } + + public function offsetGet($offset) + { + if (!is_numeric($offset)) { + return parent::offsetGet($offset); + } + $this->coerceType($offset); + return $this->data[$this->collection_key][$offset]; + } + + public function offsetSet($offset, $value) + { + if (!is_numeric($offset)) { + return parent::offsetSet($offset, $value); + } + $this->data[$this->collection_key][$offset] = $value; + } + + public function offsetUnset($offset) + { + if (!is_numeric($offset)) { + return parent::offsetUnset($offset); + } + unset($this->data[$this->collection_key][$offset]); + } + + private function coerceType($offset) + { + $typeKey = $this->keyType($this->collection_key); + if (isset($this->$typeKey) && !is_object($this->data[$this->collection_key][$offset])) { + $type = $this->$typeKey; + $this->data[$this->collection_key][$offset] = + new $type($this->data[$this->collection_key][$offset]); + } + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php new file mode 100644 index 0000000000..972c97fedd --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php @@ -0,0 +1,301 @@ +configuration = array( + // The application_name is included in the User-Agent HTTP header. + 'application_name' => '', + + // Which Authentication, Storage and HTTP IO classes to use. + 'auth_class' => 'Google_Auth_OAuth2', + 'io_class' => 'Google_IO_Stream', + 'cache_class' => 'Google_Cache_File', + + // Don't change these unless you're working against a special development + // or testing environment. + 'base_path' => 'https://www.googleapis.com', + + // Definition of class specific values, like file paths and so on. + 'classes' => array( + // If you want to pass in OAuth 2.0 settings, they will need to be + // structured like this. + 'Google_Http_Request' => array( + // Disable the use of gzip on calls if set to true. + 'disable_gzip' => false + ), + 'Google_Auth_OAuth2' => array( + // Keys for OAuth 2.0 access, see the API console at + // https://developers.google.com/console + 'client_id' => '', + 'client_secret' => '', + 'redirect_uri' => '', + + // Simple API access key, also from the API console. Ensure you get + // a Server key, and not a Browser key. + 'developer_key' => '', + + // Other parameters. + 'access_type' => 'online', + 'approval_prompt' => 'auto', + 'request_visible_actions' => '', + 'federated_signon_certs_url' => + 'https://www.googleapis.com/oauth2/v1/certs', + ), + // Set a default directory for the file cache. + 'Google_Cache_File' => array( + 'directory' => sys_get_temp_dir() . '/Google_Client' + ) + ), + + // Definition of service specific values like scopes, oauth token URLs, + // etc. Example: + 'services' => array( + ), + ); + if ($ini_file_location) { + $ini = parse_ini_file($ini_file_location, true); + if (is_array($ini) && count($ini)) { + $this->configuration = array_merge($this->configuration, $ini); + } + } + } + + /** + * Set configuration specific to a given class. + * $config->setClassConfig('Google_Cache_File', + * array('directory' => '/tmp/cache')); + * @param $class The class name for the configuration + * @param $config string key or an array of configuration values + * @param $value optional - if $config is a key, the value + */ + public function setClassConfig($class, $config, $value = null) + { + if (!is_array($config)) { + if (!isset($this->configuration['classes'][$class])) { + $this->configuration['classes'][$class] = array(); + } + $this->configuration['classes'][$class][$config] = $value; + } else { + $this->configuration['classes'][$class] = $config; + } + } + + public function getClassConfig($class, $key = null) + { + if (!isset($this->configuration['classes'][$class])) { + return null; + } + if ($key === null) { + return $this->configuration['classes'][$class]; + } else { + return $this->configuration['classes'][$class][$key]; + } + } + + /** + * Return the configured cache class. + * @return string + */ + public function getCacheClass() + { + return $this->configuration['cache_class']; + } + + /** + * Return the configured Auth class. + * @return string + */ + public function getAuthClass() + { + return $this->configuration['auth_class']; + } + + /** + * Set the auth class. + * + * @param $class the class name to set + */ + public function setAuthClass($class) + { + $prev = $this->configuration['auth_class']; + if (!isset($this->configuration['classes'][$class]) && + isset($this->configuration['classes'][$prev])) { + $this->configuration['classes'][$class] = + $this->configuration['classes'][$prev]; + } + $this->configuration['auth_class'] = $class; + } + + /** + * Set the IO class. + * + * @param $class the class name to set + */ + public function setIoClass($class) + { + $prev = $this->configuration['io_class']; + if (!isset($this->configuration['classes'][$class]) && + isset($this->configuration['classes'][$prev])) { + $this->configuration['classes'][$class] = + $this->configuration['classes'][$prev]; + } + $this->configuration['io_class'] = $class; + } + + /** + * Set the cache class. + * + * @param $class the class name to set + */ + public function setCacheClass($class) + { + $prev = $this->configuration['cache_class']; + if (!isset($this->configuration['classes'][$class]) && + isset($this->configuration['classes'][$prev])) { + $this->configuration['classes'][$class] = + $this->configuration['classes'][$prev]; + } + $this->configuration['cache_class'] = $class; + } + + /** + * Return the configured IO class. + * @return string + */ + public function getIoClass() + { + return $this->configuration['io_class']; + } + + /** + * Set the application name, this is included in the User-Agent HTTP header. + * @param string $name + */ + public function setApplicationName($name) + { + $this->configuration['application_name'] = $name; + } + + /** + * @return string the name of the application + */ + public function getApplicationName() + { + return $this->configuration['application_name']; + } + + /** + * Set the client ID for the auth class. + * @param $key string - the API console client ID + */ + public function setClientId($clientId) + { + $this->setAuthConfig('client_id', $clientId); + } + + /** + * Set the client secret for the auth class. + * @param $key string - the API console client secret + */ + public function setClientSecret($secret) + { + $this->setAuthConfig('client_secret', $secret); + } + + /** + * Set the redirect uri for the auth class. Note that if using the + * Javascript based sign in flow, this should be the string 'postmessage'. + * @param $key string - the URI that users should be redirected to + */ + public function setRedirectUri($uri) + { + $this->setAuthConfig('redirect_uri', $uri); + } + + /** + * Set the app activities for the auth class. + * @param $rva string a space separated list of app activity types + */ + public function setRequestVisibleActions($rva) + { + $this->setAuthConfig('request_visible_actions', $rva); + } + + /** + * Set the the access type requested (offline or online.) + * @param $access string - the access type + */ + public function setAccessType($access) + { + $this->setAuthConfig('access_type', $access); + } + + /** + * Set when to show the approval prompt (auto or force) + * @param $approval string - the approval request + */ + public function setApprovalPrompt($approval) + { + $this->setAuthConfig('approval_prompt', $approval); + } + + /** + * Set the developer key for the auth class. Note that this is separate value + * from the client ID - if it looks like a URL, its a client ID! + * @param $key string - the API console developer key + */ + public function setDeveloperKey($key) + { + $this->setAuthConfig('developer_key', $key); + } + + /** + * @return string the base URL to use for API calls + */ + public function getBasePath() + { + return $this->configuration['base_path']; + } + + /** + * Set the auth configuration for the current auth class. + * @param $key - the key to set + * @param $value - the parameter value + */ + private function setAuthConfig($key, $value) + { + if (!isset($this->configuration['classes'][$this->getAuthClass()])) { + $this->configuration['classes'][$this->getAuthClass()] = array(); + } + $this->configuration['classes'][$this->getAuthClass()][$key] = $value; + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Service.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Exception.php similarity index 83% rename from apps/files_external/3rdparty/google-api-php-client/src/service/Google_Service.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Exception.php index 1f4731fb2f..af80269718 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Service.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Exception.php @@ -1,6 +1,6 @@ */ -class Google_BatchRequest { +class Google_Http_Batch +{ /** @var string Multipart Boundary. */ private $boundary; /** @var array service requests to be executed. */ private $requests = array(); - public function __construct($boundary = false) { + /** @var Google_Client */ + private $client; + + private $expected_classes = array(); + + private $base_path; + + public function __construct(Google_Client $client, $boundary = false) + { + $this->client = $client; + $this->base_path = $this->client->getBasePath(); + $this->expected_classes = array(); $boundary = (false == $boundary) ? mt_rand() : $boundary; $this->boundary = str_replace('"', '', $boundary); } - public function add(Google_HttpRequest $request, $key = false) { + public function add(Google_Http_Request $request, $key = false) + { if (false == $key) { $key = mt_rand(); } @@ -38,36 +55,38 @@ class Google_BatchRequest { $this->requests[$key] = $request; } - public function execute() { + public function execute() + { $body = ''; - /** @var Google_HttpRequest $req */ - foreach($this->requests as $key => $req) { + /** @var Google_Http_Request $req */ + foreach ($this->requests as $key => $req) { $body .= "--{$this->boundary}\n"; $body .= $req->toBatchString($key) . "\n"; + $this->expected_classes["response-" . $key] = $req->getExpectedClass(); } $body = rtrim($body); $body .= "\n--{$this->boundary}--"; - global $apiConfig; - $url = $apiConfig['basePath'] . '/batch'; - $httpRequest = new Google_HttpRequest($url, 'POST'); - $httpRequest->setRequestHeaders(array( - 'Content-Type' => 'multipart/mixed; boundary=' . $this->boundary)); + $url = $this->base_path . '/batch'; + $httpRequest = new Google_Http_Request($url, 'POST'); + $httpRequest->setRequestHeaders( + array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary) + ); $httpRequest->setPostBody($body); - $response = Google_Client::$io->makeRequest($httpRequest); + $response = $this->client->getIo()->makeRequest($httpRequest); - $response = $this->parseResponse($response); - return $response; + return $this->parseResponse($response); } - public function parseResponse(Google_HttpRequest $response) { + public function parseResponse(Google_Http_Request $response) + { $contentType = $response->getResponseHeader('content-type'); $contentType = explode(';', $contentType); $boundary = false; - foreach($contentType as $part) { + foreach ($contentType as $part) { $part = (explode('=', $part, 2)); if (isset($part[0]) && 'boundary' == trim($part[0])) { $boundary = $part[1]; @@ -80,25 +99,39 @@ class Google_BatchRequest { $parts = explode("--$boundary", $body); $responses = array(); - foreach($parts as $part) { + foreach ($parts as $part) { $part = trim($part); if (!empty($part)) { list($metaHeaders, $part) = explode("\r\n\r\n", $part, 2); - $metaHeaders = Google_CurlIO::parseResponseHeaders($metaHeaders); + $metaHeaders = $this->client->getIo()->getHttpResponseHeaders($metaHeaders); $status = substr($part, 0, strpos($part, "\n")); $status = explode(" ", $status); $status = $status[1]; - list($partHeaders, $partBody) = Google_CurlIO::parseHttpResponse($part, false); - $response = new Google_HttpRequest(""); + list($partHeaders, $partBody) = $this->client->getIo()->ParseHttpResponse($part, false); + $response = new Google_Http_Request(""); $response->setResponseHttpCode($status); $response->setResponseHeaders($partHeaders); $response->setResponseBody($partBody); - $response = Google_REST::decodeHttpResponse($response); // Need content id. - $responses[$metaHeaders['content-id']] = $response; + $key = $metaHeaders['content-id']; + + if (isset($this->expected_classes[$key]) && + strlen($this->expected_classes[$key]) > 0) { + $class = $this->expected_classes[$key]; + $response->setExpectedClass($class); + } + + try { + $response = Google_Http_REST::decodeHttpResponse($response); + $responses[$key] = $response; + } catch (Google_Service_Exception $e) { + // Store the exception as the response, so succesful responses + // can be processed. + $responses[$key] = $e; + } } } @@ -107,4 +140,4 @@ class Google_BatchRequest { return null; } -} \ No newline at end of file +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CacheParser.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/CacheParser.php similarity index 87% rename from apps/files_external/3rdparty/google-api-php-client/src/io/Google_CacheParser.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Http/CacheParser.php index 7f5accfefe..83f1c8d2f4 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CacheParser.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/CacheParser.php @@ -14,26 +14,29 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +require_once 'Google/Http/Request.php'; + /** * Implement the caching directives specified in rfc2616. This * implementation is guided by the guidance offered in rfc2616-sec13. * @author Chirag Shah */ -class Google_CacheParser { +class Google_Http_CacheParser +{ public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD'); public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301'); - private function __construct() {} - /** * Check if an HTTP request can be cached by a private local cache. * * @static - * @param Google_HttpRequest $resp + * @param Google_Http_Request $resp * @return bool True if the request is cacheable. * False if the request is uncacheable. */ - public static function isRequestCacheable (Google_HttpRequest $resp) { + public static function isRequestCacheable(Google_Http_Request $resp) + { $method = $resp->getRequestMethod(); if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) { return false; @@ -54,11 +57,12 @@ class Google_CacheParser { * Check if an HTTP response can be cached by a private local cache. * * @static - * @param Google_HttpRequest $resp + * @param Google_Http_Request $resp * @return bool True if the response is cacheable. * False if the response is un-cacheable. */ - public static function isResponseCacheable (Google_HttpRequest $resp) { + public static function isResponseCacheable(Google_Http_Request $resp) + { // First, check if the HTTP request was cacheable before inspecting the // HTTP response. if (false == self::isRequestCacheable($resp)) { @@ -105,15 +109,17 @@ class Google_CacheParser { /** * @static - * @param Google_HttpRequest $resp + * @param Google_Http_Request $resp * @return bool True if the HTTP response is considered to be expired. * False if it is considered to be fresh. */ - public static function isExpired(Google_HttpRequest $resp) { + public static function isExpired(Google_Http_Request $resp) + { // HTTP/1.1 clients and caches MUST treat other invalid date formats, // especially including the value “0”, as in the past. $parsedExpires = false; $responseHeaders = $resp->getResponseHeaders(); + if (isset($responseHeaders['expires'])) { $rawExpires = $responseHeaders['expires']; // Check for a malformed expires header first. @@ -139,8 +145,12 @@ class Google_CacheParser { $parsedDate = strtotime($rawDate); if (empty($rawDate) || false == $parsedDate) { - $parsedDate = time(); + // We can't default this to now, as that means future cache reads + // will always pass with the logic below, so we will require a + // date be injected if not supplied. + throw new Google_Exception("All cacheable requests must have creation dates."); } + if (false == $freshnessLifetime && isset($responseHeaders['expires'])) { $freshnessLifetime = $parsedExpires - $parsedDate; } @@ -161,13 +171,14 @@ class Google_CacheParser { /** * Determine if a cache entry should be revalidated with by the origin. * - * @param Google_HttpRequest $response + * @param Google_Http_Request $response * @return bool True if the entry is expired, else return false. */ - public static function mustRevalidate(Google_HttpRequest $response) { + public static function mustRevalidate(Google_Http_Request $response) + { // [13.3] When a cache has a stale entry that it would like to use as a // response to a client's request, it first has to check with the origin // server to see if its cached entry is still usable. return self::isExpired($response); } -} \ No newline at end of file +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/MediaFileUpload.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/MediaFileUpload.php new file mode 100644 index 0000000000..b96db84b3e --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/MediaFileUpload.php @@ -0,0 +1,270 @@ + + * + */ +class Google_Http_MediaFileUpload +{ + const UPLOAD_MEDIA_TYPE = 'media'; + const UPLOAD_MULTIPART_TYPE = 'multipart'; + const UPLOAD_RESUMABLE_TYPE = 'resumable'; + + /** @var string $mimeType */ + private $mimeType; + + /** @var string $data */ + private $data; + + /** @var bool $resumable */ + private $resumable; + + /** @var int $chunkSize */ + private $chunkSize; + + /** @var int $size */ + private $size; + + /** @var string $resumeUri */ + private $resumeUri; + + /** @var int $progress */ + private $progress; + + /** @var Google_Client */ + private $client; + + /** @var Google_Http_Request */ + private $request; + + /** @var string */ + private $boundary; + + /** + * @param $mimeType string + * @param $data string The bytes you want to upload. + * @param $resumable bool + * @param bool $chunkSize File will be uploaded in chunks of this many bytes. + * only used if resumable=True + */ + public function __construct( + Google_Client $client, + Google_Http_Request $request, + $mimeType, + $data, + $resumable = false, + $chunkSize = false, + $boundary = false + ) { + $this->client = $client; + $this->request = $request; + $this->mimeType = $mimeType; + $this->data = $data; + $this->size = strlen($this->data); + $this->resumable = $resumable; + if (!$chunkSize) { + $chunkSize = 256 * 1024; + } + $this->chunkSize = $chunkSize; + $this->progress = 0; + $this->boundary = $boundary; + + // Process Media Request + $this->process(); + } + + /** + * Set the size of the file that is being uploaded. + * @param $size - int file size in bytes + */ + public function setFileSize($size) + { + $this->size = $size; + } + + /** + * Return the progress on the upload + * @return int progress in bytes uploaded. + */ + public function getProgress() + { + return $this->progress; + } + + /** + * Send the next part of the file to upload. + * @param [$chunk] the next set of bytes to send. If false will used $data passed + * at construct time. + */ + public function nextChunk($chunk = false) + { + if (false == $this->resumeUri) { + $this->resumeUri = $this->getResumeUri(); + } + + if (false == $chunk) { + $chunk = substr($this->data, $this->progress, $this->chunkSize); + } + + $lastBytePos = $this->progress + strlen($chunk) - 1; + $headers = array( + 'content-range' => "bytes $this->progress-$lastBytePos/$this->size", + 'content-type' => $this->request->getRequestHeader('content-type'), + 'content-length' => $this->chunkSize, + 'expect' => '', + ); + + $httpRequest = new Google_Http_Request( + $this->resumeUri, + 'PUT', + $headers, + $chunk + ); + $httpRequest->disableGzip(); // Disable gzip for uploads. + $response = $this->client->getIo()->makeRequest($httpRequest); + $response->setExpectedClass($this->request->getExpectedClass()); + $code = $response->getResponseHttpCode(); + + if (308 == $code) { + // Track the amount uploaded. + $range = explode('-', $response->getResponseHeader('range')); + $this->progress = $range[1] + 1; + + // Allow for changing upload URLs. + $location = $response->getResponseHeader('location'); + if ($location) { + $this->resumeUri = $location; + } + + // No problems, but upload not complete. + return false; + } else { + return Google_Http_REST::decodeHttpResponse($response); + } + } + + /** + * @param $meta + * @param $params + * @return array|bool + * @visible for testing + */ + private function process() + { + $postBody = false; + $contentType = false; + + $meta = $this->request->getPostBody(); + $meta = is_string($meta) ? json_decode($meta, true) : $meta; + + $uploadType = $this->getUploadType($meta); + $this->request->setQueryParam('uploadType', $uploadType); + $this->transformToUploadUrl(); + $mimeType = $this->mimeType ? + $this->mimeType : + $this->request->getRequestHeader('content-type'); + + if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) { + $contentType = $mimeType; + $postBody = is_string($meta) ? $meta : json_encode($meta); + } else if (self::UPLOAD_MEDIA_TYPE == $uploadType) { + $contentType = $mimeType; + $postBody = $this->data; + } else if (self::UPLOAD_MULTIPART_TYPE == $uploadType) { + // This is a multipart/related upload. + $boundary = $this->boundary ? $this->boundary : mt_rand(); + $boundary = str_replace('"', '', $boundary); + $contentType = 'multipart/related; boundary=' . $boundary; + $related = "--$boundary\r\n"; + $related .= "Content-Type: application/json; charset=UTF-8\r\n"; + $related .= "\r\n" . json_encode($meta) . "\r\n"; + $related .= "--$boundary\r\n"; + $related .= "Content-Type: $mimeType\r\n"; + $related .= "Content-Transfer-Encoding: base64\r\n"; + $related .= "\r\n" . base64_encode($this->data) . "\r\n"; + $related .= "--$boundary--"; + $postBody = $related; + } + + $this->request->setPostBody($postBody); + + if (isset($contentType) && $contentType) { + $contentTypeHeader['content-type'] = $contentType; + $this->request->setRequestHeaders($contentTypeHeader); + } + } + + private function transformToUploadUrl() + { + $base = $this->request->getBaseComponent(); + $this->request->setBaseComponent($base . '/upload'); + } + + /** + * Valid upload types: + * - resumable (UPLOAD_RESUMABLE_TYPE) + * - media (UPLOAD_MEDIA_TYPE) + * - multipart (UPLOAD_MULTIPART_TYPE) + * @param $meta + * @return string + * @visible for testing + */ + public function getUploadType($meta) + { + if ($this->resumable) { + return self::UPLOAD_RESUMABLE_TYPE; + } + + if (false == $meta && $this->data) { + return self::UPLOAD_MEDIA_TYPE; + } + + return self::UPLOAD_MULTIPART_TYPE; + } + + private function getResumeUri() + { + $result = null; + $body = $this->request->getPostBody(); + if ($body) { + $headers = array( + 'content-type' => 'application/json; charset=UTF-8', + 'content-length' => Google_Utils::getStrLen($body), + 'x-upload-content-type' => $this->mimeType, + 'x-upload-content-length' => $this->size, + 'expect' => '', + ); + $this->request->setRequestHeaders($headers); + } + + $response = $this->client->getIo()->makeRequest($this->request); + $location = $response->getResponseHeader('location'); + $code = $response->getResponseHttpCode(); + + if (200 == $code && true == $location) { + return $location; + } + throw new Google_Exception("Failed to start the resumable upload"); + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_REST.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php similarity index 64% rename from apps/files_external/3rdparty/google-api-php-client/src/io/Google_REST.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php index d0f3b3d564..43d46b1a85 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_REST.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php @@ -15,39 +15,45 @@ * limitations under the License. */ +require_once 'Google/Client.php'; +require_once 'Google/Http/Request.php'; +require_once 'Google/Service/Exception.php'; +require_once 'Google/Utils/URITemplate.php'; + /** * This class implements the RESTful transport of apiServiceRequest()'s * * @author Chris Chabot * @author Chirag Shah */ -class Google_REST { +class Google_Http_REST +{ /** - * Executes a apiServiceRequest using a RESTful call by transforming it into - * an apiHttpRequest, and executed via apiIO::authenticatedRequest(). + * Executes a Google_Http_Request * - * @param Google_HttpRequest $req + * @param Google_Client $client + * @param Google_Http_Request $req * @return array decoded result - * @throws Google_ServiceException on server side error (ie: not authenticated, + * @throws Google_Service_Exception on server side error (ie: not authenticated, * invalid or malformed post body, invalid url) */ - static public function execute(Google_HttpRequest $req) { - $httpRequest = Google_Client::$io->makeRequest($req); - $decodedResponse = self::decodeHttpResponse($httpRequest); - $ret = isset($decodedResponse['data']) - ? $decodedResponse['data'] : $decodedResponse; - return $ret; + public static function execute(Google_Client $client, Google_Http_Request $req) + { + $httpRequest = $client->getIo()->makeRequest($req); + $httpRequest->setExpectedClass($req->getExpectedClass()); + return self::decodeHttpResponse($httpRequest); } /** * Decode an HTTP Response. * @static - * @throws Google_ServiceException - * @param Google_HttpRequest $response The http response to be decoded. + * @throws Google_Service_Exception + * @param Google_Http_Request $response The http response to be decoded. * @return mixed|null */ - public static function decodeHttpResponse($response) { + public static function decodeHttpResponse($response) + { $code = $response->getResponseHttpCode(); $body = $response->getResponseBody(); $decoded = null; @@ -55,7 +61,9 @@ class Google_REST { if ((intVal($code)) >= 300) { $decoded = json_decode($body, true); $err = 'Error calling ' . $response->getRequestMethod() . ' ' . $response->getUrl(); - if ($decoded != null && isset($decoded['error']['message']) && isset($decoded['error']['code'])) { + if (isset($decoded['error']) && + isset($decoded['error']['message']) && + isset($decoded['error']['code'])) { // if we're getting a json encoded error definition, use that instead of the raw response // body for improved readability $err .= ": ({$decoded['error']['code']}) {$decoded['error']['message']}"; @@ -63,14 +71,21 @@ class Google_REST { $err .= ": ($code) $body"; } - throw new Google_ServiceException($err, $code, null, $decoded['error']['errors']); + throw new Google_Service_Exception($err, $code, null, $decoded['error']['errors']); } // Only attempt to decode the response, if the response code wasn't (204) 'no content' if ($code != '204') { $decoded = json_decode($body, true); if ($decoded === null || $decoded === "") { - throw new Google_ServiceException("Invalid json in service response: $body"); + throw new Google_Service_Exception("Invalid json in service response: $body"); + } + + $decoded = isset($decoded['data']) ? $decoded['data'] : $decoded; + + if ($response->getExpectedClass()) { + $class = $response->getExpectedClass(); + $decoded = new $class($decoded); } } return $decoded; @@ -85,22 +100,18 @@ class Google_REST { * @param array $params * @return string $requestUrl */ - static function createRequestUri($servicePath, $restPath, $params) { + public static function createRequestUri($servicePath, $restPath, $params) + { $requestUrl = $servicePath . $restPath; $uriTemplateVars = array(); $queryVars = array(); foreach ($params as $paramName => $paramSpec) { - // Discovery v1.0 puts the canonical location under the 'location' field. - if (! isset($paramSpec['location'])) { - $paramSpec['location'] = $paramSpec['restParameterType']; - } - if ($paramSpec['type'] == 'boolean') { $paramSpec['value'] = ($paramSpec['value']) ? 'true' : 'false'; } if ($paramSpec['location'] == 'path') { $uriTemplateVars[$paramName] = $paramSpec['value']; - } else { + } else if ($paramSpec['location'] == 'query') { if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) { foreach ($paramSpec['value'] as $value) { $queryVars[] = $paramName . '=' . rawurlencode($value); @@ -112,12 +123,9 @@ class Google_REST { } if (count($uriTemplateVars)) { - $uriTemplateParser = new URI_Template_Parser($requestUrl); - $requestUrl = $uriTemplateParser->expand($uriTemplateVars); + $uriTemplateParser = new Google_Utils_URITemplate(); + $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars); } - //FIXME work around for the the uri template lib which url encodes - // the @'s & confuses our servers. - $requestUrl = str_replace('%40', '@', $requestUrl); if (count($queryVars)) { $requestUrl .= '?' . implode($queryVars, '&'); diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php new file mode 100644 index 0000000000..f1e9a42227 --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php @@ -0,0 +1,474 @@ + + * @author Chirag Shah + * + */ +class Google_Http_Request +{ + const GZIP_UA = " (gzip)"; + + private $batchHeaders = array( + 'Content-Type' => 'application/http', + 'Content-Transfer-Encoding' => 'binary', + 'MIME-Version' => '1.0', + ); + + protected $queryParams; + protected $requestMethod; + protected $requestHeaders; + protected $baseComponent = null; + protected $path; + protected $postBody; + protected $userAgent; + protected $canGzip = null; + + protected $responseHttpCode; + protected $responseHeaders; + protected $responseBody; + + protected $expectedClass; + + public $accessKey; + + public function __construct( + $url, + $method = 'GET', + $headers = array(), + $postBody = null + ) { + $this->setUrl($url); + $this->setRequestMethod($method); + $this->setRequestHeaders($headers); + $this->setPostBody($postBody); + } + + /** + * Misc function that returns the base url component of the $url + * used by the OAuth signing class to calculate the base string + * @return string The base url component of the $url. + */ + public function getBaseComponent() + { + return $this->baseComponent; + } + + /** + * Set the base URL that path and query parameters will be added to. + * @param $baseComponent string + */ + public function setBaseComponent($baseComponent) + { + $this->baseComponent = $baseComponent; + } + + /** + * Enable support for gzipped responses with this request. + */ + public function enableGzip() + { + $this->setRequestHeaders(array("Accept-Encoding" => "gzip")); + $this->canGzip = true; + $this->setUserAgent($this->userAgent); + } + + /** + * Disable support for gzip responses with this request. + */ + public function disableGzip() + { + if ( + isset($this->requestHeaders['accept-encoding']) && + $this->requestHeaders['accept-encoding'] == "gzip" + ) { + unset($this->requestHeaders['accept-encoding']); + } + $this->canGzip = false; + $this->userAgent = str_replace(self::GZIP_UA, "", $this->userAgent); + } + + /** + * Can this request accept a gzip response? + * @return bool + */ + public function canGzip() + { + return $this->canGzip; + } + + /** + * Misc function that returns an array of the query parameters of the current + * url used by the OAuth signing class to calculate the signature + * @return array Query parameters in the query string. + */ + public function getQueryParams() + { + return $this->queryParams; + } + + /** + * Set a new query parameter. + * @param $key - string to set, does not need to be URL encoded + * @param $value - string to set, does not need to be URL encoded + */ + public function setQueryParam($key, $value) + { + $this->queryParams[$key] = $value; + } + + /** + * @return string HTTP Response Code. + */ + public function getResponseHttpCode() + { + return (int) $this->responseHttpCode; + } + + /** + * @param int $responseHttpCode HTTP Response Code. + */ + public function setResponseHttpCode($responseHttpCode) + { + $this->responseHttpCode = $responseHttpCode; + } + + /** + * @return $responseHeaders (array) HTTP Response Headers. + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * @return string HTTP Response Body + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Set the class the response to this request should expect. + * + * @param $class string the class name + */ + public function setExpectedClass($class) + { + $this->expectedClass = $class; + } + + /** + * Retrieve the expected class the response should expect. + * @return string class name + */ + public function getExpectedClass() + { + return $this->expectedClass; + } + + /** + * @param array $headers The HTTP response headers + * to be normalized. + */ + public function setResponseHeaders($headers) + { + $headers = Google_Utils::normalize($headers); + if ($this->responseHeaders) { + $headers = array_merge($this->responseHeaders, $headers); + } + + $this->responseHeaders = $headers; + } + + /** + * @param string $key + * @return array|boolean Returns the requested HTTP header or + * false if unavailable. + */ + public function getResponseHeader($key) + { + return isset($this->responseHeaders[$key]) + ? $this->responseHeaders[$key] + : false; + } + + /** + * @param string $responseBody The HTTP response body. + */ + public function setResponseBody($responseBody) + { + $this->responseBody = $responseBody; + } + + /** + * @return string $url The request URL. + */ + public function getUrl() + { + return $this->baseComponent . $this->path . + (count($this->queryParams) ? + "?" . $this->buildQuery($this->queryParams) : + ''); + } + + /** + * @return string $method HTTP Request Method. + */ + public function getRequestMethod() + { + return $this->requestMethod; + } + + /** + * @return array $headers HTTP Request Headers. + */ + public function getRequestHeaders() + { + return $this->requestHeaders; + } + + /** + * @param string $key + * @return array|boolean Returns the requested HTTP header or + * false if unavailable. + */ + public function getRequestHeader($key) + { + return isset($this->requestHeaders[$key]) + ? $this->requestHeaders[$key] + : false; + } + + /** + * @return string $postBody HTTP Request Body. + */ + public function getPostBody() + { + return $this->postBody; + } + + /** + * @param string $url the url to set + */ + public function setUrl($url) + { + if (substr($url, 0, 4) != 'http') { + // Force the path become relative. + if (substr($url, 0, 1) !== '/') { + $url = '/' . $url; + } + } + $parts = parse_url($url); + if (isset($parts['host'])) { + $this->baseComponent = sprintf( + "%s%s%s", + isset($parts['scheme']) ? $parts['scheme'] . "://" : '', + isset($parts['host']) ? $parts['host'] : '', + isset($parts['port']) ? ":" . $parts['port'] : '' + ); + } + $this->path = isset($parts['path']) ? $parts['path'] : ''; + $this->queryParams = array(); + if (isset($parts['query'])) { + $this->queryParams = $this->parseQuery($parts['query']); + } + } + + /** + * @param string $method Set he HTTP Method and normalize + * it to upper-case, as required by HTTP. + * + */ + public function setRequestMethod($method) + { + $this->requestMethod = strtoupper($method); + } + + /** + * @param array $headers The HTTP request headers + * to be set and normalized. + */ + public function setRequestHeaders($headers) + { + $headers = Google_Utils::normalize($headers); + if ($this->requestHeaders) { + $headers = array_merge($this->requestHeaders, $headers); + } + $this->requestHeaders = $headers; + } + + /** + * @param string $postBody the postBody to set + */ + public function setPostBody($postBody) + { + $this->postBody = $postBody; + } + + /** + * Set the User-Agent Header. + * @param string $userAgent The User-Agent. + */ + public function setUserAgent($userAgent) + { + $this->userAgent = $userAgent; + if ($this->canGzip) { + $this->userAgent = $userAgent . self::GZIP_UA; + } + } + + /** + * @return string The User-Agent. + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Returns a cache key depending on if this was an OAuth signed request + * in which case it will use the non-signed url and access key to make this + * cache key unique per authenticated user, else use the plain request url + * @return string The md5 hash of the request cache key. + */ + public function getCacheKey() + { + $key = $this->getUrl(); + + if (isset($this->accessKey)) { + $key .= $this->accessKey; + } + + if (isset($this->requestHeaders['authorization'])) { + $key .= $this->requestHeaders['authorization']; + } + + return md5($key); + } + + public function getParsedCacheControl() + { + $parsed = array(); + $rawCacheControl = $this->getResponseHeader('cache-control'); + if ($rawCacheControl) { + $rawCacheControl = str_replace(', ', '&', $rawCacheControl); + parse_str($rawCacheControl, $parsed); + } + + return $parsed; + } + + /** + * @param string $id + * @return string A string representation of the HTTP Request. + */ + public function toBatchString($id) + { + $str = ''; + $path = parse_url($this->getUrl(), PHP_URL_PATH) . "?" . + http_build_query($this->queryParams); + $str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n"; + + foreach ($this->getRequestHeaders() as $key => $val) { + $str .= $key . ': ' . $val . "\n"; + } + + if ($this->getPostBody()) { + $str .= "\n"; + $str .= $this->getPostBody(); + } + + $headers = ''; + foreach ($this->batchHeaders as $key => $val) { + $headers .= $key . ': ' . $val . "\n"; + } + + $headers .= "Content-ID: $id\n"; + $str = $headers . "\n" . $str; + + return $str; + } + + /** + * Our own version of parse_str that allows for multiple variables + * with the same name. + * @param $string - the query string to parse + */ + private function parseQuery($string) + { + $return = array(); + $parts = explode("&", $string); + foreach ($parts as $part) { + list($key, $value) = explode('=', $part, 2); + $value = urldecode($value); + if (isset($return[$key])) { + $return[$key] = array($return[$key]); + $return[$key][] = $value; + } else { + $return[$key] = $value; + } + } + return $return; + } + + /** + * A version of build query that allows for multiple + * duplicate keys. + * @param $parts array of key value pairs + */ + private function buildQuery($parts) + { + $return = array(); + foreach ($parts as $key => $value) { + if (is_array($value)) { + foreach ($value as $v) { + $return[] = urlencode($key) . "=" . urlencode($v); + } + } else { + $return[] = urlencode($key) . "=" . urlencode($value); + } + } + return implode('&', $return); + } + + /** + * If we're POSTing and have no body to send, we can send the query + * parameters in there, which avoids length issues with longer query + * params. + */ + public function maybeMoveParametersToBody() + { + if ($this->getRequestMethod() == "POST" && empty($this->postBody)) { + $this->setRequestHeaders( + array( + "content-type" => + "application/x-www-form-urlencoded; charset=UTF-8" + ) + ); + $this->setPostBody($this->buildQuery($this->queryParams)); + $this->queryParams = array(); + } + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Abstract.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Abstract.php new file mode 100644 index 0000000000..6367b5da40 --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Abstract.php @@ -0,0 +1,244 @@ +client = $client; + } + + /** + * Executes a Google_Http_Request and returns the resulting populated Google_Http_Request + * @param Google_Http_Request $request + * @return Google_Http_Request $request + */ + abstract public function makeRequest(Google_Http_Request $request); + + /** + * Set options that update the transport implementation's behavior. + * @param $options + */ + abstract public function setOptions($options); + + /** + * @visible for testing. + * Cache the response to an HTTP request if it is cacheable. + * @param Google_Http_Request $request + * @return bool Returns true if the insertion was successful. + * Otherwise, return false. + */ + public function setCachedRequest(Google_Http_Request $request) + { + // Determine if the request is cacheable. + if (Google_Http_CacheParser::isResponseCacheable($request)) { + $this->client->getCache()->set($request->getCacheKey(), $request); + return true; + } + + return false; + } + + /** + * @visible for testing. + * @param Google_Http_Request $request + * @return Google_Http_Request|bool Returns the cached object or + * false if the operation was unsuccessful. + */ + public function getCachedRequest(Google_Http_Request $request) + { + if (false === Google_Http_CacheParser::isRequestCacheable($request)) { + return false; + } + + return $this->client->getCache()->get($request->getCacheKey()); + } + + /** + * @visible for testing + * Process an http request that contains an enclosed entity. + * @param Google_Http_Request $request + * @return Google_Http_Request Processed request with the enclosed entity. + */ + public function processEntityRequest(Google_Http_Request $request) + { + $postBody = $request->getPostBody(); + $contentType = $request->getRequestHeader("content-type"); + + // Set the default content-type as application/x-www-form-urlencoded. + if (false == $contentType) { + $contentType = self::FORM_URLENCODED; + $request->setRequestHeaders(array('content-type' => $contentType)); + } + + // Force the payload to match the content-type asserted in the header. + if ($contentType == self::FORM_URLENCODED && is_array($postBody)) { + $postBody = http_build_query($postBody, '', '&'); + $request->setPostBody($postBody); + } + + // Make sure the content-length header is set. + if (!$postBody || is_string($postBody)) { + $postsLength = strlen($postBody); + $request->setRequestHeaders(array('content-length' => $postsLength)); + } + + return $request; + } + + /** + * Check if an already cached request must be revalidated, and if so update + * the request with the correct ETag headers. + * @param Google_Http_Request $cached A previously cached response. + * @param Google_Http_Request $request The outbound request. + * return bool If the cached object needs to be revalidated, false if it is + * still current and can be re-used. + */ + protected function checkMustRevalidateCachedRequest($cached, $request) + { + if (Google_Http_CacheParser::mustRevalidate($cached)) { + $addHeaders = array(); + if ($cached->getResponseHeader('etag')) { + // [13.3.4] If an entity tag has been provided by the origin server, + // we must use that entity tag in any cache-conditional request. + $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag'); + } elseif ($cached->getResponseHeader('date')) { + $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date'); + } + + $request->setRequestHeaders($addHeaders); + return true; + } else { + return false; + } + } + + /** + * Update a cached request, using the headers from the last response. + * @param Google_HttpRequest $cached A previously cached response. + * @param mixed Associative array of response headers from the last request. + */ + protected function updateCachedRequest($cached, $responseHeaders) + { + if (isset($responseHeaders['connection'])) { + $hopByHop = array_merge( + self::$HOP_BY_HOP, + explode( + ',', + $responseHeaders['connection'] + ) + ); + + $endToEnd = array(); + foreach ($hopByHop as $key) { + if (isset($responseHeaders[$key])) { + $endToEnd[$key] = $responseHeaders[$key]; + } + } + $cached->setResponseHeaders($endToEnd); + } + } + + /** + * Used by the IO lib and also the batch processing. + * + * @param $respData + * @param $headerSize + * @return array + */ + public function parseHttpResponse($respData, $headerSize) + { + if (stripos($respData, self::CONNECTION_ESTABLISHED) !== false) { + $respData = str_ireplace(self::CONNECTION_ESTABLISHED, '', $respData); + } + + if ($headerSize) { + $responseBody = substr($respData, $headerSize); + $responseHeaders = substr($respData, 0, $headerSize); + } else { + list($responseHeaders, $responseBody) = explode("\r\n\r\n", $respData, 2); + } + + $responseHeaders = $this->getHttpResponseHeaders($responseHeaders); + return array($responseHeaders, $responseBody); + } + + /** + * Parse out headers from raw headers + * @param rawHeaders array or string + * @return array + */ + public function getHttpResponseHeaders($rawHeaders) + { + if (is_array($rawHeaders)) { + return $this->parseArrayHeaders($rawHeaders); + } else { + return $this->parseStringHeaders($rawHeaders); + } + } + + private function parseStringHeaders($rawHeaders) + { + $headers = array(); + + $responseHeaderLines = explode("\r\n", $rawHeaders); + foreach ($responseHeaderLines as $headerLine) { + if ($headerLine && strpos($headerLine, ':') !== false) { + list($header, $value) = explode(': ', $headerLine, 2); + $header = strtolower($header); + if (isset($responseHeaders[$header])) { + $headers[$header] .= "\n" . $value; + } else { + $headers[$header] = $value; + } + } + } + return $headers; + } + + private function parseArrayHeaders($rawHeaders) + { + $header_count = count($rawHeaders); + $headers = array(); + + for ($i = 0; $i < $header_count; $i++) { + $header = $rawHeaders[$i]; + // Times will have colons in - so we just want the first match. + $header_parts = explode(': ', $header, 2); + if (count($header_parts) == 2) { + $headers[$header_parts[0]] = $header_parts[1]; + } + } + + return $headers; + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Exception.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Exception.php new file mode 100644 index 0000000000..28c2d8ce64 --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Exception.php @@ -0,0 +1,22 @@ + + */ + +require_once 'Google/IO/Abstract.php'; + +class Google_IO_Stream extends Google_IO_Abstract +{ + const ZLIB = "compress.zlib://"; + private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null); + + private static $DEFAULT_HTTP_CONTEXT = array( + "follow_location" => 0, + "ignore_errors" => 1, + ); + + private static $DEFAULT_SSL_CONTEXT = array( + "verify_peer" => true, + ); + + /** + * Execute an HTTP Request + * + * @param Google_HttpRequest $request the http request to be executed + * @return Google_HttpRequest http request with the response http code, + * response headers and response body filled in + * @throws Google_IO_Exception on curl or IO error + */ + public function makeRequest(Google_Http_Request $request) + { + // First, check to see if we have a valid cached version. + $cached = $this->getCachedRequest($request); + if ($cached !== false) { + if (!$this->checkMustRevalidateCachedRequest($cached, $request)) { + return $cached; + } + } + + $default_options = stream_context_get_options(stream_context_get_default()); + + $requestHttpContext = array_key_exists('http', $default_options) ? + $default_options['http'] : array(); + if (array_key_exists( + $request->getRequestMethod(), + self::$ENTITY_HTTP_METHODS + )) { + $request = $this->processEntityRequest($request); + } + + if ($request->getPostBody()) { + $requestHttpContext["content"] = $request->getPostBody(); + } + + $requestHeaders = $request->getRequestHeaders(); + if ($requestHeaders && is_array($requestHeaders)) { + $headers = ""; + foreach ($requestHeaders as $k => $v) { + $headers .= "$k: $v\r\n"; + } + $requestHttpContext["header"] = $headers; + } + + $requestHttpContext["method"] = $request->getRequestMethod(); + $requestHttpContext["user_agent"] = $request->getUserAgent(); + + $requestSslContext = array_key_exists('ssl', $default_options) ? + $default_options['ssl'] : array(); + + if (!array_key_exists("cafile", $requestSslContext)) { + $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem'; + } + + $options = array( + "http" => array_merge( + self::$DEFAULT_HTTP_CONTEXT, + $requestHttpContext + ), + "ssl" => array_merge( + self::$DEFAULT_SSL_CONTEXT, + $requestSslContext + ) + ); + + $context = stream_context_create($options); + + $url = $request->getUrl(); + + if ($request->canGzip()) { + $url = self::ZLIB . $url; + } + + $response_data = file_get_contents( + $url, + false, + $context + ); + + if (false === $response_data) { + throw new Google_IO_Exception("HTTP Error: Unable to connect"); + } + + $respHttpCode = $this->getHttpResponseCode($http_response_header); + $responseHeaders = $this->getHttpResponseHeaders($http_response_header); + + if ($respHttpCode == 304 && $cached) { + // If the server responded NOT_MODIFIED, return the cached request. + $this->updateCachedRequest($cached, $responseHeaders); + return $cached; + } + + if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) { + $responseHeaders['Date'] = date("r"); + } + + $request->setResponseHttpCode($respHttpCode); + $request->setResponseHeaders($responseHeaders); + $request->setResponseBody($response_data); + // Store the request in cache (the function checks to see if the request + // can actually be cached) + $this->setCachedRequest($request); + return $request; + } + + /** + * Set options that update the transport implementation's behavior. + * @param $options + */ + public function setOptions($options) + { + // NO-OP + } + + private function getHttpResponseCode($response_headers) + { + $header_count = count($response_headers); + + for ($i = 0; $i < $header_count; $i++) { + $header = $response_headers[$i]; + if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) { + $response = explode(' ', $header); + return $response[1]; + } + } + return 'UNKNOWN'; + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/cacerts.pem b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/cacerts.pem similarity index 96% rename from apps/files_external/3rdparty/google-api-php-client/src/io/cacerts.pem rename to apps/files_external/3rdparty/google-api-php-client/src/Google/IO/cacerts.pem index da36ed1ba6..79a49289cb 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/io/cacerts.pem +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/cacerts.pem @@ -712,3 +712,27 @@ IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd -----END CERTIFICATE----- +GeoTrust Global CA +================== + +-----BEGIN CERTIFICATE----- +MIIDfTCCAuagAwIBAgIDErvmMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT +MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0 +aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDIwNTIxMDQwMDAwWhcNMTgwODIxMDQwMDAw +WjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UE +AxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9m +OSm9BXiLnTjoBbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIu +T8rxh0PBFpVXLVDviS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6c +JmTM386DGXHKTubU1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmR +Cw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5asz +PeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo4HwMIHtMB8GA1UdIwQYMBaAFEjm +aPkr0rKV10fYIyAQTzOYkJ/UMB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrM +TjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjA6BgNVHR8EMzAxMC+g +LaArhilodHRwOi8vY3JsLmdlb3RydXN0LmNvbS9jcmxzL3NlY3VyZWNhLmNybDBO +BgNVHSAERzBFMEMGBFUdIAAwOzA5BggrBgEFBQcCARYtaHR0cHM6Ly93d3cuZ2Vv +dHJ1c3QuY29tL3Jlc291cmNlcy9yZXBvc2l0b3J5MA0GCSqGSIb3DQEBBQUAA4GB +AHbhEm5OSxYShjAGsoEIz/AIx8dxfmbuwu3UOx//8PDITtZDOLC5MH0Y0FWDomrL +NhGc6Ehmo21/uBPUR/6LWlxz/K7ZGzIZOKuXNBSqltLroxwUCEm2u+WR74M26x1W +b8ravHNjkOR/ez4iyz0H7V84dJzjA1BOoa+Y7mHyhD8S +-----END CERTIFICATE----- diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php new file mode 100644 index 0000000000..d5d25e3c12 --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php @@ -0,0 +1,218 @@ + + * + */ +class Google_Model implements ArrayAccess +{ + protected $data = array(); + protected $processed = array(); + + /** + * Polymorphic - accepts a variable number of arguments dependent + * on the type of the model subclass. + */ + public function __construct() + { + if (func_num_args() == 1 && is_array(func_get_arg(0))) { + // Initialize the model with the array's contents. + $array = func_get_arg(0); + $this->mapTypes($array); + } + } + + public function __get($key) + { + $keyTypeName = $this->keyType($key); + $keyDataType = $this->dataType($key); + if (isset($this->$keyTypeName) && !isset($this->processed[$key])) { + if (isset($this->data[$key])) { + $val = $this->data[$key]; + } else { + $val = null; + } + + if ($this->isAssociativeArray($val)) { + if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) { + foreach ($val as $arrayKey => $arrayItem) { + $this->data[$key][$arrayKey] = + $this->createObjectFromName($keyTypeName, $arrayItem); + } + } else { + $this->data[$key] = $this->createObjectFromName($keyTypeName, $val); + } + } else if (is_array($val)) { + $arrayObject = array(); + foreach ($val as $arrayIndex => $arrayItem) { + $arrayObject[$arrayIndex] = + $this->createObjectFromName($keyTypeName, $arrayItem); + } + $this->data[$key] = $arrayObject; + } + $this->processed[$key] = true; + } + + return $this->data[$key]; + } + + /** + * Initialize this object's properties from an array. + * + * @param array $array Used to seed this object's properties. + * @return void + */ + protected function mapTypes($array) + { + // Hard initilise simple types, lazy load more complex ones. + foreach ($array as $key => $val) { + if ( !property_exists($this, $this->keyType($key)) && + property_exists($this, $key)) { + $this->$key = $val; + unset($array[$key]); + } elseif (property_exists($this, $camelKey = Google_Utils::camelCase($key))) { + // This checks if property exists as camelCase, leaving it in array as snake_case + // in case of backwards compatibility issues. + $this->$camelKey = $val; + } + } + $this->data = $array; + } + + /** + * Create a simplified object suitable for straightforward + * conversion to JSON. This is relatively expensive + * due to the usage of reflection, but shouldn't be called + * a whole lot, and is the most straightforward way to filter. + */ + public function toSimpleObject() + { + $object = new stdClass(); + + // Process all public properties. + $reflect = new ReflectionObject($this); + $props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC); + foreach ($props as $member) { + $name = $member->getName(); + if ($this->$name instanceof Google_Model) { + $object->$name = $this->$name->toSimpleObject(); + } else if ($this->$name !== null) { + $object->$name = $this->$name; + } + } + + // Process all other data. + foreach ($this->data as $key => $val) { + if ($val instanceof Google_Model) { + $object->$key = $val->toSimpleObject(); + } else if ($val !== null) { + $object->$key = $val; + } + } + return $object; + } + + /** + * Returns true only if the array is associative. + * @param array $array + * @return bool True if the array is associative. + */ + protected function isAssociativeArray($array) + { + if (!is_array($array)) { + return false; + } + $keys = array_keys($array); + foreach ($keys as $key) { + if (is_string($key)) { + return true; + } + } + return false; + } + + /** + * Given a variable name, discover its type. + * + * @param $name + * @param $item + * @return object The object from the item. + */ + private function createObjectFromName($name, $item) + { + $type = $this->$name; + return new $type($item); + } + + /** + * Verify if $obj is an array. + * @throws Google_Exception Thrown if $obj isn't an array. + * @param array $obj Items that should be validated. + * @param string $method Method expecting an array as an argument. + */ + public function assertIsArray($obj, $method) + { + if ($obj && !is_array($obj)) { + throw new Google_Exception( + "Incorrect parameter type passed to $method()," + . " expected an array." + ); + } + } + + public function offsetExists($offset) + { + return isset($this->$offset) || isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return isset($this->$offset) ? + $this->$offset : + $this->__get($offset); + } + + public function offsetSet($offset, $value) + { + if (property_exists($this, $offset)) { + $this->$offset = $value; + } else { + $this->data[$offset] = $value; + $this->processed[$offset] = true; + } + } + + public function offsetUnset($offset) + { + unset($this->data[$offset]); + } + + protected function keyType($key) + { + return $key . "Type"; + } + + protected function dataType($key) + { + return $key . "DataType"; + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Service.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service.php new file mode 100644 index 0000000000..2e0b6c5228 --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service.php @@ -0,0 +1,39 @@ +client = $client; + } + + /** + * Return the associated Google_Client class. + * @return Google_Client + */ + public function getClient() + { + return $this->client; + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Drive.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Drive.php new file mode 100644 index 0000000000..a9ce7f2a1c --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Drive.php @@ -0,0 +1,5732 @@ + + * The API to interact with Drive. + *

+ * + *

+ * For more information about this service, see the API + * Documentation + *

+ * + * @author Google, Inc. + */ +class Google_Service_Drive extends Google_Service +{ + /** View and manage the files and documents in your Google Drive. */ + const DRIVE = "https://www.googleapis.com/auth/drive"; + /** View and manage its own configuration data in your Google Drive. */ + const DRIVE_APPDATA = "https://www.googleapis.com/auth/drive.appdata"; + /** View your Google Drive apps. */ + const DRIVE_APPS_READONLY = "https://www.googleapis.com/auth/drive.apps.readonly"; + /** View and manage Google Drive files that you have opened or created with this app. */ + const DRIVE_FILE = "https://www.googleapis.com/auth/drive.file"; + /** View metadata for files and documents in your Google Drive. */ + const DRIVE_METADATA_READONLY = "https://www.googleapis.com/auth/drive.metadata.readonly"; + /** View the files and documents in your Google Drive. */ + const DRIVE_READONLY = "https://www.googleapis.com/auth/drive.readonly"; + /** Modify your Google Apps Script scripts' behavior. */ + const DRIVE_SCRIPTS = "https://www.googleapis.com/auth/drive.scripts"; + + public $about; + public $apps; + public $changes; + public $channels; + public $children; + public $comments; + public $files; + public $parents; + public $permissions; + public $properties; + public $realtime; + public $replies; + public $revisions; + + + /** + * Constructs the internal representation of the Drive service. + * + * @param Google_Client $client + */ + public function __construct(Google_Client $client) + { + parent::__construct($client); + $this->servicePath = 'drive/v2/'; + $this->version = 'v2'; + $this->serviceName = 'drive'; + + $this->about = new Google_Service_Drive_About_Resource( + $this, + $this->serviceName, + 'about', + array( + 'methods' => array( + 'get' => array( + 'path' => 'about', + 'httpMethod' => 'GET', + 'parameters' => array( + 'includeSubscribed' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'maxChangeIdCount' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'startChangeId' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ), + ) + ) + ); + $this->apps = new Google_Service_Drive_Apps_Resource( + $this, + $this->serviceName, + 'apps', + array( + 'methods' => array( + 'get' => array( + 'path' => 'apps/{appId}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'appId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'list' => array( + 'path' => 'apps', + 'httpMethod' => 'GET', + 'parameters' => array(), + ), + ) + ) + ); + $this->changes = new Google_Service_Drive_Changes_Resource( + $this, + $this->serviceName, + 'changes', + array( + 'methods' => array( + 'get' => array( + 'path' => 'changes/{changeId}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'changeId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'list' => array( + 'path' => 'changes', + 'httpMethod' => 'GET', + 'parameters' => array( + 'includeSubscribed' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'startChangeId' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'includeDeleted' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'maxResults' => array( + 'location' => 'query', + 'type' => 'integer', + ), + 'pageToken' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ),'watch' => array( + 'path' => 'changes/watch', + 'httpMethod' => 'POST', + 'parameters' => array( + 'includeSubscribed' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'startChangeId' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'includeDeleted' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'maxResults' => array( + 'location' => 'query', + 'type' => 'integer', + ), + 'pageToken' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ), + ) + ) + ); + $this->channels = new Google_Service_Drive_Channels_Resource( + $this, + $this->serviceName, + 'channels', + array( + 'methods' => array( + 'stop' => array( + 'path' => 'channels/stop', + 'httpMethod' => 'POST', + 'parameters' => array(), + ), + ) + ) + ); + $this->children = new Google_Service_Drive_Children_Resource( + $this, + $this->serviceName, + 'children', + array( + 'methods' => array( + 'delete' => array( + 'path' => 'files/{folderId}/children/{childId}', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'folderId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'childId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'get' => array( + 'path' => 'files/{folderId}/children/{childId}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'folderId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'childId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'insert' => array( + 'path' => 'files/{folderId}/children', + 'httpMethod' => 'POST', + 'parameters' => array( + 'folderId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'list' => array( + 'path' => 'files/{folderId}/children', + 'httpMethod' => 'GET', + 'parameters' => array( + 'folderId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'q' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'pageToken' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'maxResults' => array( + 'location' => 'query', + 'type' => 'integer', + ), + ), + ), + ) + ) + ); + $this->comments = new Google_Service_Drive_Comments_Resource( + $this, + $this->serviceName, + 'comments', + array( + 'methods' => array( + 'delete' => array( + 'path' => 'files/{fileId}/comments/{commentId}', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'get' => array( + 'path' => 'files/{fileId}/comments/{commentId}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'includeDeleted' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + ), + ),'insert' => array( + 'path' => 'files/{fileId}/comments', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'list' => array( + 'path' => 'files/{fileId}/comments', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'pageToken' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'updatedMin' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'includeDeleted' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'maxResults' => array( + 'location' => 'query', + 'type' => 'integer', + ), + ), + ),'patch' => array( + 'path' => 'files/{fileId}/comments/{commentId}', + 'httpMethod' => 'PATCH', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'update' => array( + 'path' => 'files/{fileId}/comments/{commentId}', + 'httpMethod' => 'PUT', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ), + ) + ) + ); + $this->files = new Google_Service_Drive_Files_Resource( + $this, + $this->serviceName, + 'files', + array( + 'methods' => array( + 'copy' => array( + 'path' => 'files/{fileId}/copy', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'convert' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'ocrLanguage' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'visibility' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'pinned' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'ocr' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'timedTextTrackName' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'timedTextLanguage' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ),'delete' => array( + 'path' => 'files/{fileId}', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'get' => array( + 'path' => 'files/{fileId}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'updateViewedDate' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'projection' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ),'insert' => array( + 'path' => 'files', + 'httpMethod' => 'POST', + 'parameters' => array( + 'convert' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'useContentAsIndexableText' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'ocrLanguage' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'visibility' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'pinned' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'ocr' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'timedTextTrackName' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'timedTextLanguage' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ),'list' => array( + 'path' => 'files', + 'httpMethod' => 'GET', + 'parameters' => array( + 'q' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'pageToken' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'projection' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'maxResults' => array( + 'location' => 'query', + 'type' => 'integer', + ), + ), + ),'patch' => array( + 'path' => 'files/{fileId}', + 'httpMethod' => 'PATCH', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'convert' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'updateViewedDate' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'setModifiedDate' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'useContentAsIndexableText' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'ocrLanguage' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'pinned' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'newRevision' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'ocr' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'timedTextLanguage' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'timedTextTrackName' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ),'touch' => array( + 'path' => 'files/{fileId}/touch', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'trash' => array( + 'path' => 'files/{fileId}/trash', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'untrash' => array( + 'path' => 'files/{fileId}/untrash', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'update' => array( + 'path' => 'files/{fileId}', + 'httpMethod' => 'PUT', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'convert' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'updateViewedDate' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'setModifiedDate' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'useContentAsIndexableText' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'ocrLanguage' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'pinned' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'newRevision' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'ocr' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'timedTextLanguage' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'timedTextTrackName' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ),'watch' => array( + 'path' => 'files/{fileId}/watch', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'updateViewedDate' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'projection' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ), + ) + ) + ); + $this->parents = new Google_Service_Drive_Parents_Resource( + $this, + $this->serviceName, + 'parents', + array( + 'methods' => array( + 'delete' => array( + 'path' => 'files/{fileId}/parents/{parentId}', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'parentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'get' => array( + 'path' => 'files/{fileId}/parents/{parentId}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'parentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'insert' => array( + 'path' => 'files/{fileId}/parents', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'list' => array( + 'path' => 'files/{fileId}/parents', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ), + ) + ) + ); + $this->permissions = new Google_Service_Drive_Permissions_Resource( + $this, + $this->serviceName, + 'permissions', + array( + 'methods' => array( + 'delete' => array( + 'path' => 'files/{fileId}/permissions/{permissionId}', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'permissionId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'get' => array( + 'path' => 'files/{fileId}/permissions/{permissionId}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'permissionId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'getIdForEmail' => array( + 'path' => 'permissionIds/{email}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'email' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'insert' => array( + 'path' => 'files/{fileId}/permissions', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'emailMessage' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'sendNotificationEmails' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + ), + ),'list' => array( + 'path' => 'files/{fileId}/permissions', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'patch' => array( + 'path' => 'files/{fileId}/permissions/{permissionId}', + 'httpMethod' => 'PATCH', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'permissionId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'transferOwnership' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + ), + ),'update' => array( + 'path' => 'files/{fileId}/permissions/{permissionId}', + 'httpMethod' => 'PUT', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'permissionId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'transferOwnership' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + ), + ), + ) + ) + ); + $this->properties = new Google_Service_Drive_Properties_Resource( + $this, + $this->serviceName, + 'properties', + array( + 'methods' => array( + 'delete' => array( + 'path' => 'files/{fileId}/properties/{propertyKey}', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'propertyKey' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'visibility' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ),'get' => array( + 'path' => 'files/{fileId}/properties/{propertyKey}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'propertyKey' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'visibility' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ),'insert' => array( + 'path' => 'files/{fileId}/properties', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'list' => array( + 'path' => 'files/{fileId}/properties', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'patch' => array( + 'path' => 'files/{fileId}/properties/{propertyKey}', + 'httpMethod' => 'PATCH', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'propertyKey' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'visibility' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ),'update' => array( + 'path' => 'files/{fileId}/properties/{propertyKey}', + 'httpMethod' => 'PUT', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'propertyKey' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'visibility' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ), + ) + ) + ); + $this->realtime = new Google_Service_Drive_Realtime_Resource( + $this, + $this->serviceName, + 'realtime', + array( + 'methods' => array( + 'get' => array( + 'path' => 'files/{fileId}/realtime', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'update' => array( + 'path' => 'files/{fileId}/realtime', + 'httpMethod' => 'PUT', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'baseRevision' => array( + 'location' => 'query', + 'type' => 'string', + ), + ), + ), + ) + ) + ); + $this->replies = new Google_Service_Drive_Replies_Resource( + $this, + $this->serviceName, + 'replies', + array( + 'methods' => array( + 'delete' => array( + 'path' => 'files/{fileId}/comments/{commentId}/replies/{replyId}', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'replyId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'get' => array( + 'path' => 'files/{fileId}/comments/{commentId}/replies/{replyId}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'replyId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'includeDeleted' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + ), + ),'insert' => array( + 'path' => 'files/{fileId}/comments/{commentId}/replies', + 'httpMethod' => 'POST', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'list' => array( + 'path' => 'files/{fileId}/comments/{commentId}/replies', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'pageToken' => array( + 'location' => 'query', + 'type' => 'string', + ), + 'includeDeleted' => array( + 'location' => 'query', + 'type' => 'boolean', + ), + 'maxResults' => array( + 'location' => 'query', + 'type' => 'integer', + ), + ), + ),'patch' => array( + 'path' => 'files/{fileId}/comments/{commentId}/replies/{replyId}', + 'httpMethod' => 'PATCH', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'replyId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'update' => array( + 'path' => 'files/{fileId}/comments/{commentId}/replies/{replyId}', + 'httpMethod' => 'PUT', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'commentId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'replyId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ), + ) + ) + ); + $this->revisions = new Google_Service_Drive_Revisions_Resource( + $this, + $this->serviceName, + 'revisions', + array( + 'methods' => array( + 'delete' => array( + 'path' => 'files/{fileId}/revisions/{revisionId}', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'revisionId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'get' => array( + 'path' => 'files/{fileId}/revisions/{revisionId}', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'revisionId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'list' => array( + 'path' => 'files/{fileId}/revisions', + 'httpMethod' => 'GET', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'patch' => array( + 'path' => 'files/{fileId}/revisions/{revisionId}', + 'httpMethod' => 'PATCH', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'revisionId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ),'update' => array( + 'path' => 'files/{fileId}/revisions/{revisionId}', + 'httpMethod' => 'PUT', + 'parameters' => array( + 'fileId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + 'revisionId' => array( + 'location' => 'path', + 'type' => 'string', + 'required' => true, + ), + ), + ), + ) + ) + ); + } +} + + +/** + * The "about" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $about = $driveService->about; + * + */ +class Google_Service_Drive_About_Resource extends Google_Service_Resource +{ + + /** + * Gets the information about the current user along with Drive API settings + * (about.get) + * + * @param array $optParams Optional parameters. + * + * @opt_param bool includeSubscribed + * When calculating the number of remaining change IDs, whether to include shared files and public + * files the user has opened. When set to false, this counts only change IDs for owned files and + * any shared or public files that the user has explictly added to a folder in Drive. + * @opt_param string maxChangeIdCount + * Maximum number of remaining change IDs to count + * @opt_param string startChangeId + * Change ID to start counting from when calculating number of remaining change IDs + * @return Google_Service_Drive_About + */ + public function get($optParams = array()) + { + $params = array(); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_About"); + } +} + +/** + * The "apps" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $apps = $driveService->apps; + * + */ +class Google_Service_Drive_Apps_Resource extends Google_Service_Resource +{ + + /** + * Gets a specific app. (apps.get) + * + * @param string $appId + * The ID of the app. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_App + */ + public function get($appId, $optParams = array()) + { + $params = array('appId' => $appId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_App"); + } + /** + * Lists a user's installed apps. (apps.listApps) + * + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_AppList + */ + public function listApps($optParams = array()) + { + $params = array(); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_AppList"); + } +} + +/** + * The "changes" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $changes = $driveService->changes; + * + */ +class Google_Service_Drive_Changes_Resource extends Google_Service_Resource +{ + + /** + * Gets a specific change. (changes.get) + * + * @param string $changeId + * The ID of the change. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_Change + */ + public function get($changeId, $optParams = array()) + { + $params = array('changeId' => $changeId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_Change"); + } + /** + * Lists the changes for a user. (changes.listChanges) + * + * @param array $optParams Optional parameters. + * + * @opt_param bool includeSubscribed + * Whether to include shared files and public files the user has opened. When set to false, the + * list will include owned files plus any shared or public files the user has explictly added to a + * folder in Drive. + * @opt_param string startChangeId + * Change ID to start listing changes from. + * @opt_param bool includeDeleted + * Whether to include deleted items. + * @opt_param int maxResults + * Maximum number of changes to return. + * @opt_param string pageToken + * Page token for changes. + * @return Google_Service_Drive_ChangeList + */ + public function listChanges($optParams = array()) + { + $params = array(); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_ChangeList"); + } + /** + * Subscribe to changes for a user. (changes.watch) + * + * @param Google_Channel $postBody + * @param array $optParams Optional parameters. + * + * @opt_param bool includeSubscribed + * Whether to include shared files and public files the user has opened. When set to false, the + * list will include owned files plus any shared or public files the user has explictly added to a + * folder in Drive. + * @opt_param string startChangeId + * Change ID to start listing changes from. + * @opt_param bool includeDeleted + * Whether to include deleted items. + * @opt_param int maxResults + * Maximum number of changes to return. + * @opt_param string pageToken + * Page token for changes. + * @return Google_Service_Drive_Channel + */ + public function watch(Google_Service_Drive_Channel $postBody, $optParams = array()) + { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('watch', array($params), "Google_Service_Drive_Channel"); + } +} + +/** + * The "channels" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $channels = $driveService->channels; + * + */ +class Google_Service_Drive_Channels_Resource extends Google_Service_Resource +{ + + /** + * Stop watching resources through this channel (channels.stop) + * + * @param Google_Channel $postBody + * @param array $optParams Optional parameters. + */ + public function stop(Google_Service_Drive_Channel $postBody, $optParams = array()) + { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('stop', array($params)); + } +} + +/** + * The "children" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $children = $driveService->children; + * + */ +class Google_Service_Drive_Children_Resource extends Google_Service_Resource +{ + + /** + * Removes a child from a folder. (children.delete) + * + * @param string $folderId + * The ID of the folder. + * @param string $childId + * The ID of the child. + * @param array $optParams Optional parameters. + */ + public function delete($folderId, $childId, $optParams = array()) + { + $params = array('folderId' => $folderId, 'childId' => $childId); + $params = array_merge($params, $optParams); + return $this->call('delete', array($params)); + } + /** + * Gets a specific child reference. (children.get) + * + * @param string $folderId + * The ID of the folder. + * @param string $childId + * The ID of the child. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_ChildReference + */ + public function get($folderId, $childId, $optParams = array()) + { + $params = array('folderId' => $folderId, 'childId' => $childId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_ChildReference"); + } + /** + * Inserts a file into a folder. (children.insert) + * + * @param string $folderId + * The ID of the folder. + * @param Google_ChildReference $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_ChildReference + */ + public function insert($folderId, Google_Service_Drive_ChildReference $postBody, $optParams = array()) + { + $params = array('folderId' => $folderId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('insert', array($params), "Google_Service_Drive_ChildReference"); + } + /** + * Lists a folder's children. (children.listChildren) + * + * @param string $folderId + * The ID of the folder. + * @param array $optParams Optional parameters. + * + * @opt_param string q + * Query string for searching children. + * @opt_param string pageToken + * Page token for children. + * @opt_param int maxResults + * Maximum number of children to return. + * @return Google_Service_Drive_ChildList + */ + public function listChildren($folderId, $optParams = array()) + { + $params = array('folderId' => $folderId); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_ChildList"); + } +} + +/** + * The "comments" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $comments = $driveService->comments; + * + */ +class Google_Service_Drive_Comments_Resource extends Google_Service_Resource +{ + + /** + * Deletes a comment. (comments.delete) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param array $optParams Optional parameters. + */ + public function delete($fileId, $commentId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId); + $params = array_merge($params, $optParams); + return $this->call('delete', array($params)); + } + /** + * Gets a comment by ID. (comments.get) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param array $optParams Optional parameters. + * + * @opt_param bool includeDeleted + * If set, this will succeed when retrieving a deleted comment, and will include any deleted + * replies. + * @return Google_Service_Drive_Comment + */ + public function get($fileId, $commentId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_Comment"); + } + /** + * Creates a new comment on the given file. (comments.insert) + * + * @param string $fileId + * The ID of the file. + * @param Google_Comment $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_Comment + */ + public function insert($fileId, Google_Service_Drive_Comment $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('insert', array($params), "Google_Service_Drive_Comment"); + } + /** + * Lists a file's comments. (comments.listComments) + * + * @param string $fileId + * The ID of the file. + * @param array $optParams Optional parameters. + * + * @opt_param string pageToken + * The continuation token, used to page through large result sets. To get the next page of results, + * set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param string updatedMin + * Only discussions that were updated after this timestamp will be returned. Formatted as an RFC + * 3339 timestamp. + * @opt_param bool includeDeleted + * If set, all comments and replies, including deleted comments and replies (with content stripped) + * will be returned. + * @opt_param int maxResults + * The maximum number of discussions to include in the response, used for paging. + * @return Google_Service_Drive_CommentList + */ + public function listComments($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_CommentList"); + } + /** + * Updates an existing comment. This method supports patch semantics. + * (comments.patch) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param Google_Comment $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_Comment + */ + public function patch($fileId, $commentId, Google_Service_Drive_Comment $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('patch', array($params), "Google_Service_Drive_Comment"); + } + /** + * Updates an existing comment. (comments.update) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param Google_Comment $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_Comment + */ + public function update($fileId, $commentId, Google_Service_Drive_Comment $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('update', array($params), "Google_Service_Drive_Comment"); + } +} + +/** + * The "files" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $files = $driveService->files; + * + */ +class Google_Service_Drive_Files_Resource extends Google_Service_Resource +{ + + /** + * Creates a copy of the specified file. (files.copy) + * + * @param string $fileId + * The ID of the file to copy. + * @param Google_DriveFile $postBody + * @param array $optParams Optional parameters. + * + * @opt_param bool convert + * Whether to convert this file to the corresponding Google Docs format. + * @opt_param string ocrLanguage + * If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes. + * @opt_param string visibility + * The visibility of the new file. This parameter is only relevant when the source is not a native + * Google Doc and convert=false. + * @opt_param bool pinned + * Whether to pin the head revision of the new copy. + * @opt_param bool ocr + * Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads. + * @opt_param string timedTextTrackName + * The timed text track name. + * @opt_param string timedTextLanguage + * The language of the timed text. + * @return Google_Service_Drive_DriveFile + */ + public function copy($fileId, Google_Service_Drive_DriveFile $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('copy', array($params), "Google_Service_Drive_DriveFile"); + } + /** + * Permanently deletes a file by ID. Skips the trash. (files.delete) + * + * @param string $fileId + * The ID of the file to delete. + * @param array $optParams Optional parameters. + */ + public function delete($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('delete', array($params)); + } + /** + * Gets a file's metadata by ID. (files.get) + * + * @param string $fileId + * The ID for the file in question. + * @param array $optParams Optional parameters. + * + * @opt_param bool updateViewedDate + * Whether to update the view date after successfully retrieving the file. + * @opt_param string projection + * This parameter is deprecated and has no function. + * @return Google_Service_Drive_DriveFile + */ + public function get($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_DriveFile"); + } + /** + * Insert a new file. (files.insert) + * + * @param Google_DriveFile $postBody + * @param array $optParams Optional parameters. + * + * @opt_param bool convert + * Whether to convert this file to the corresponding Google Docs format. + * @opt_param bool useContentAsIndexableText + * Whether to use the content as indexable text. + * @opt_param string ocrLanguage + * If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes. + * @opt_param string visibility + * The visibility of the new file. This parameter is only relevant when convert=false. + * @opt_param bool pinned + * Whether to pin the head revision of the uploaded file. + * @opt_param bool ocr + * Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads. + * @opt_param string timedTextTrackName + * The timed text track name. + * @opt_param string timedTextLanguage + * The language of the timed text. + * @return Google_Service_Drive_DriveFile + */ + public function insert(Google_Service_Drive_DriveFile $postBody, $optParams = array()) + { + $params = array('postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('insert', array($params), "Google_Service_Drive_DriveFile"); + } + /** + * Lists the user's files. (files.listFiles) + * + * @param array $optParams Optional parameters. + * + * @opt_param string q + * Query string for searching files. + * @opt_param string pageToken + * Page token for files. + * @opt_param string projection + * This parameter is deprecated and has no function. + * @opt_param int maxResults + * Maximum number of files to return. + * @return Google_Service_Drive_FileList + */ + public function listFiles($optParams = array()) + { + $params = array(); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_FileList"); + } + /** + * Updates file metadata and/or content. This method supports patch semantics. + * (files.patch) + * + * @param string $fileId + * The ID of the file to update. + * @param Google_DriveFile $postBody + * @param array $optParams Optional parameters. + * + * @opt_param bool convert + * Whether to convert this file to the corresponding Google Docs format. + * @opt_param bool updateViewedDate + * Whether to update the view date after successfully updating the file. + * @opt_param bool setModifiedDate + * Whether to set the modified date with the supplied modified date. + * @opt_param bool useContentAsIndexableText + * Whether to use the content as indexable text. + * @opt_param string ocrLanguage + * If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes. + * @opt_param bool pinned + * Whether to pin the new revision. + * @opt_param bool newRevision + * Whether a blob upload should create a new revision. If false, the blob data in the current head + * revision is replaced. If not set or true, a new blob is created as head revision, and previous + * revisions are preserved (causing increased use of the user's data storage quota). + * @opt_param bool ocr + * Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads. + * @opt_param string timedTextLanguage + * The language of the timed text. + * @opt_param string timedTextTrackName + * The timed text track name. + * @return Google_Service_Drive_DriveFile + */ + public function patch($fileId, Google_Service_Drive_DriveFile $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('patch', array($params), "Google_Service_Drive_DriveFile"); + } + /** + * Set the file's updated time to the current server time. (files.touch) + * + * @param string $fileId + * The ID of the file to update. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_DriveFile + */ + public function touch($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('touch', array($params), "Google_Service_Drive_DriveFile"); + } + /** + * Moves a file to the trash. (files.trash) + * + * @param string $fileId + * The ID of the file to trash. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_DriveFile + */ + public function trash($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('trash', array($params), "Google_Service_Drive_DriveFile"); + } + /** + * Restores a file from the trash. (files.untrash) + * + * @param string $fileId + * The ID of the file to untrash. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_DriveFile + */ + public function untrash($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('untrash', array($params), "Google_Service_Drive_DriveFile"); + } + /** + * Updates file metadata and/or content. (files.update) + * + * @param string $fileId + * The ID of the file to update. + * @param Google_DriveFile $postBody + * @param array $optParams Optional parameters. + * + * @opt_param bool convert + * Whether to convert this file to the corresponding Google Docs format. + * @opt_param bool updateViewedDate + * Whether to update the view date after successfully updating the file. + * @opt_param bool setModifiedDate + * Whether to set the modified date with the supplied modified date. + * @opt_param bool useContentAsIndexableText + * Whether to use the content as indexable text. + * @opt_param string ocrLanguage + * If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes. + * @opt_param bool pinned + * Whether to pin the new revision. + * @opt_param bool newRevision + * Whether a blob upload should create a new revision. If false, the blob data in the current head + * revision is replaced. If not set or true, a new blob is created as head revision, and previous + * revisions are preserved (causing increased use of the user's data storage quota). + * @opt_param bool ocr + * Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads. + * @opt_param string timedTextLanguage + * The language of the timed text. + * @opt_param string timedTextTrackName + * The timed text track name. + * @return Google_Service_Drive_DriveFile + */ + public function update($fileId, Google_Service_Drive_DriveFile $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('update', array($params), "Google_Service_Drive_DriveFile"); + } + /** + * Subscribe to changes on a file (files.watch) + * + * @param string $fileId + * The ID for the file in question. + * @param Google_Channel $postBody + * @param array $optParams Optional parameters. + * + * @opt_param bool updateViewedDate + * Whether to update the view date after successfully retrieving the file. + * @opt_param string projection + * This parameter is deprecated and has no function. + * @return Google_Service_Drive_Channel + */ + public function watch($fileId, Google_Service_Drive_Channel $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('watch', array($params), "Google_Service_Drive_Channel"); + } +} + +/** + * The "parents" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $parents = $driveService->parents; + * + */ +class Google_Service_Drive_Parents_Resource extends Google_Service_Resource +{ + + /** + * Removes a parent from a file. (parents.delete) + * + * @param string $fileId + * The ID of the file. + * @param string $parentId + * The ID of the parent. + * @param array $optParams Optional parameters. + */ + public function delete($fileId, $parentId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'parentId' => $parentId); + $params = array_merge($params, $optParams); + return $this->call('delete', array($params)); + } + /** + * Gets a specific parent reference. (parents.get) + * + * @param string $fileId + * The ID of the file. + * @param string $parentId + * The ID of the parent. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_ParentReference + */ + public function get($fileId, $parentId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'parentId' => $parentId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_ParentReference"); + } + /** + * Adds a parent folder for a file. (parents.insert) + * + * @param string $fileId + * The ID of the file. + * @param Google_ParentReference $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_ParentReference + */ + public function insert($fileId, Google_Service_Drive_ParentReference $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('insert', array($params), "Google_Service_Drive_ParentReference"); + } + /** + * Lists a file's parents. (parents.listParents) + * + * @param string $fileId + * The ID of the file. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_ParentList + */ + public function listParents($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_ParentList"); + } +} + +/** + * The "permissions" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $permissions = $driveService->permissions; + * + */ +class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource +{ + + /** + * Deletes a permission from a file. (permissions.delete) + * + * @param string $fileId + * The ID for the file. + * @param string $permissionId + * The ID for the permission. + * @param array $optParams Optional parameters. + */ + public function delete($fileId, $permissionId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'permissionId' => $permissionId); + $params = array_merge($params, $optParams); + return $this->call('delete', array($params)); + } + /** + * Gets a permission by ID. (permissions.get) + * + * @param string $fileId + * The ID for the file. + * @param string $permissionId + * The ID for the permission. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_Permission + */ + public function get($fileId, $permissionId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'permissionId' => $permissionId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_Permission"); + } + /** + * Returns the permission ID for an email address. (permissions.getIdForEmail) + * + * @param string $email + * The email address for which to return a permission ID + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_PermissionId + */ + public function getIdForEmail($email, $optParams = array()) + { + $params = array('email' => $email); + $params = array_merge($params, $optParams); + return $this->call('getIdForEmail', array($params), "Google_Service_Drive_PermissionId"); + } + /** + * Inserts a permission for a file. (permissions.insert) + * + * @param string $fileId + * The ID for the file. + * @param Google_Permission $postBody + * @param array $optParams Optional parameters. + * + * @opt_param string emailMessage + * A custom message to include in notification emails. + * @opt_param bool sendNotificationEmails + * Whether to send notification emails when sharing to users or groups. + * @return Google_Service_Drive_Permission + */ + public function insert($fileId, Google_Service_Drive_Permission $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('insert', array($params), "Google_Service_Drive_Permission"); + } + /** + * Lists a file's permissions. (permissions.listPermissions) + * + * @param string $fileId + * The ID for the file. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_PermissionList + */ + public function listPermissions($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_PermissionList"); + } + /** + * Updates a permission. This method supports patch semantics. + * (permissions.patch) + * + * @param string $fileId + * The ID for the file. + * @param string $permissionId + * The ID for the permission. + * @param Google_Permission $postBody + * @param array $optParams Optional parameters. + * + * @opt_param bool transferOwnership + * Whether changing a role to 'owner' should also downgrade the current owners to writers. + * @return Google_Service_Drive_Permission + */ + public function patch($fileId, $permissionId, Google_Service_Drive_Permission $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('patch', array($params), "Google_Service_Drive_Permission"); + } + /** + * Updates a permission. (permissions.update) + * + * @param string $fileId + * The ID for the file. + * @param string $permissionId + * The ID for the permission. + * @param Google_Permission $postBody + * @param array $optParams Optional parameters. + * + * @opt_param bool transferOwnership + * Whether changing a role to 'owner' should also downgrade the current owners to writers. + * @return Google_Service_Drive_Permission + */ + public function update($fileId, $permissionId, Google_Service_Drive_Permission $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('update', array($params), "Google_Service_Drive_Permission"); + } +} + +/** + * The "properties" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $properties = $driveService->properties; + * + */ +class Google_Service_Drive_Properties_Resource extends Google_Service_Resource +{ + + /** + * Deletes a property. (properties.delete) + * + * @param string $fileId + * The ID of the file. + * @param string $propertyKey + * The key of the property. + * @param array $optParams Optional parameters. + * + * @opt_param string visibility + * The visibility of the property. + */ + public function delete($fileId, $propertyKey, $optParams = array()) + { + $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey); + $params = array_merge($params, $optParams); + return $this->call('delete', array($params)); + } + /** + * Gets a property by its key. (properties.get) + * + * @param string $fileId + * The ID of the file. + * @param string $propertyKey + * The key of the property. + * @param array $optParams Optional parameters. + * + * @opt_param string visibility + * The visibility of the property. + * @return Google_Service_Drive_Property + */ + public function get($fileId, $propertyKey, $optParams = array()) + { + $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_Property"); + } + /** + * Adds a property to a file. (properties.insert) + * + * @param string $fileId + * The ID of the file. + * @param Google_Property $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_Property + */ + public function insert($fileId, Google_Service_Drive_Property $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('insert', array($params), "Google_Service_Drive_Property"); + } + /** + * Lists a file's properties. (properties.listProperties) + * + * @param string $fileId + * The ID of the file. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_PropertyList + */ + public function listProperties($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_PropertyList"); + } + /** + * Updates a property. This method supports patch semantics. (properties.patch) + * + * @param string $fileId + * The ID of the file. + * @param string $propertyKey + * The key of the property. + * @param Google_Property $postBody + * @param array $optParams Optional parameters. + * + * @opt_param string visibility + * The visibility of the property. + * @return Google_Service_Drive_Property + */ + public function patch($fileId, $propertyKey, Google_Service_Drive_Property $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('patch', array($params), "Google_Service_Drive_Property"); + } + /** + * Updates a property. (properties.update) + * + * @param string $fileId + * The ID of the file. + * @param string $propertyKey + * The key of the property. + * @param Google_Property $postBody + * @param array $optParams Optional parameters. + * + * @opt_param string visibility + * The visibility of the property. + * @return Google_Service_Drive_Property + */ + public function update($fileId, $propertyKey, Google_Service_Drive_Property $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('update', array($params), "Google_Service_Drive_Property"); + } +} + +/** + * The "realtime" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $realtime = $driveService->realtime; + * + */ +class Google_Service_Drive_Realtime_Resource extends Google_Service_Resource +{ + + /** + * Exports the contents of the Realtime API data model associated with this file + * as JSON. (realtime.get) + * + * @param string $fileId + * The ID of the file that the Realtime API data model is associated with. + * @param array $optParams Optional parameters. + */ + public function get($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params)); + } + /** + * Overwrites the Realtime API data model associated with this file with the + * provided JSON data model. (realtime.update) + * + * @param string $fileId + * The ID of the file that the Realtime API data model is associated with. + * @param array $optParams Optional parameters. + * + * @opt_param string baseRevision + * The revision of the model to diff the uploaded model against. If set, the uploaded model is + * diffed against the provided revision and those differences are merged with any changes made to + * the model after the provided revision. If not set, the uploaded model replaces the current model + * on the server. + */ + public function update($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('update', array($params)); + } +} + +/** + * The "replies" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $replies = $driveService->replies; + * + */ +class Google_Service_Drive_Replies_Resource extends Google_Service_Resource +{ + + /** + * Deletes a reply. (replies.delete) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param string $replyId + * The ID of the reply. + * @param array $optParams Optional parameters. + */ + public function delete($fileId, $commentId, $replyId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId); + $params = array_merge($params, $optParams); + return $this->call('delete', array($params)); + } + /** + * Gets a reply. (replies.get) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param string $replyId + * The ID of the reply. + * @param array $optParams Optional parameters. + * + * @opt_param bool includeDeleted + * If set, this will succeed when retrieving a deleted reply. + * @return Google_Service_Drive_CommentReply + */ + public function get($fileId, $commentId, $replyId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_CommentReply"); + } + /** + * Creates a new reply to the given comment. (replies.insert) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param Google_CommentReply $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_CommentReply + */ + public function insert($fileId, $commentId, Google_Service_Drive_CommentReply $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('insert', array($params), "Google_Service_Drive_CommentReply"); + } + /** + * Lists all of the replies to a comment. (replies.listReplies) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param array $optParams Optional parameters. + * + * @opt_param string pageToken + * The continuation token, used to page through large result sets. To get the next page of results, + * set this parameter to the value of "nextPageToken" from the previous response. + * @opt_param bool includeDeleted + * If set, all replies, including deleted replies (with content stripped) will be returned. + * @opt_param int maxResults + * The maximum number of replies to include in the response, used for paging. + * @return Google_Service_Drive_CommentReplyList + */ + public function listReplies($fileId, $commentId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_CommentReplyList"); + } + /** + * Updates an existing reply. This method supports patch semantics. + * (replies.patch) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param string $replyId + * The ID of the reply. + * @param Google_CommentReply $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_CommentReply + */ + public function patch($fileId, $commentId, $replyId, Google_Service_Drive_CommentReply $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('patch', array($params), "Google_Service_Drive_CommentReply"); + } + /** + * Updates an existing reply. (replies.update) + * + * @param string $fileId + * The ID of the file. + * @param string $commentId + * The ID of the comment. + * @param string $replyId + * The ID of the reply. + * @param Google_CommentReply $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_CommentReply + */ + public function update($fileId, $commentId, $replyId, Google_Service_Drive_CommentReply $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('update', array($params), "Google_Service_Drive_CommentReply"); + } +} + +/** + * The "revisions" collection of methods. + * Typical usage is: + * + * $driveService = new Google_Service_Drive(...); + * $revisions = $driveService->revisions; + * + */ +class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource +{ + + /** + * Removes a revision. (revisions.delete) + * + * @param string $fileId + * The ID of the file. + * @param string $revisionId + * The ID of the revision. + * @param array $optParams Optional parameters. + */ + public function delete($fileId, $revisionId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'revisionId' => $revisionId); + $params = array_merge($params, $optParams); + return $this->call('delete', array($params)); + } + /** + * Gets a specific revision. (revisions.get) + * + * @param string $fileId + * The ID of the file. + * @param string $revisionId + * The ID of the revision. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_Revision + */ + public function get($fileId, $revisionId, $optParams = array()) + { + $params = array('fileId' => $fileId, 'revisionId' => $revisionId); + $params = array_merge($params, $optParams); + return $this->call('get', array($params), "Google_Service_Drive_Revision"); + } + /** + * Lists a file's revisions. (revisions.listRevisions) + * + * @param string $fileId + * The ID of the file. + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_RevisionList + */ + public function listRevisions($fileId, $optParams = array()) + { + $params = array('fileId' => $fileId); + $params = array_merge($params, $optParams); + return $this->call('list', array($params), "Google_Service_Drive_RevisionList"); + } + /** + * Updates a revision. This method supports patch semantics. (revisions.patch) + * + * @param string $fileId + * The ID for the file. + * @param string $revisionId + * The ID for the revision. + * @param Google_Revision $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_Revision + */ + public function patch($fileId, $revisionId, Google_Service_Drive_Revision $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('patch', array($params), "Google_Service_Drive_Revision"); + } + /** + * Updates a revision. (revisions.update) + * + * @param string $fileId + * The ID for the file. + * @param string $revisionId + * The ID for the revision. + * @param Google_Revision $postBody + * @param array $optParams Optional parameters. + * @return Google_Service_Drive_Revision + */ + public function update($fileId, $revisionId, Google_Service_Drive_Revision $postBody, $optParams = array()) + { + $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody); + $params = array_merge($params, $optParams); + return $this->call('update', array($params), "Google_Service_Drive_Revision"); + } +} + + + + +class Google_Service_Drive_About extends Google_Collection +{ + protected $additionalRoleInfoType = 'Google_Service_Drive_AboutAdditionalRoleInfo'; + protected $additionalRoleInfoDataType = 'array'; + public $domainSharingPolicy; + public $etag; + protected $exportFormatsType = 'Google_Service_Drive_AboutExportFormats'; + protected $exportFormatsDataType = 'array'; + protected $featuresType = 'Google_Service_Drive_AboutFeatures'; + protected $featuresDataType = 'array'; + protected $importFormatsType = 'Google_Service_Drive_AboutImportFormats'; + protected $importFormatsDataType = 'array'; + public $isCurrentAppInstalled; + public $kind; + public $largestChangeId; + protected $maxUploadSizesType = 'Google_Service_Drive_AboutMaxUploadSizes'; + protected $maxUploadSizesDataType = 'array'; + public $name; + public $permissionId; + public $quotaBytesTotal; + public $quotaBytesUsed; + public $quotaBytesUsedAggregate; + public $quotaBytesUsedInTrash; + public $remainingChangeIds; + public $rootFolderId; + public $selfLink; + protected $userType = 'Google_Service_Drive_User'; + protected $userDataType = ''; + + public function setAdditionalRoleInfo($additionalRoleInfo) + { + $this->additionalRoleInfo = $additionalRoleInfo; + } + + public function getAdditionalRoleInfo() + { + return $this->additionalRoleInfo; + } + + public function setDomainSharingPolicy($domainSharingPolicy) + { + $this->domainSharingPolicy = $domainSharingPolicy; + } + + public function getDomainSharingPolicy() + { + return $this->domainSharingPolicy; + } + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setExportFormats($exportFormats) + { + $this->exportFormats = $exportFormats; + } + + public function getExportFormats() + { + return $this->exportFormats; + } + + public function setFeatures($features) + { + $this->features = $features; + } + + public function getFeatures() + { + return $this->features; + } + + public function setImportFormats($importFormats) + { + $this->importFormats = $importFormats; + } + + public function getImportFormats() + { + return $this->importFormats; + } + + public function setIsCurrentAppInstalled($isCurrentAppInstalled) + { + $this->isCurrentAppInstalled = $isCurrentAppInstalled; + } + + public function getIsCurrentAppInstalled() + { + return $this->isCurrentAppInstalled; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setLargestChangeId($largestChangeId) + { + $this->largestChangeId = $largestChangeId; + } + + public function getLargestChangeId() + { + return $this->largestChangeId; + } + + public function setMaxUploadSizes($maxUploadSizes) + { + $this->maxUploadSizes = $maxUploadSizes; + } + + public function getMaxUploadSizes() + { + return $this->maxUploadSizes; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function setPermissionId($permissionId) + { + $this->permissionId = $permissionId; + } + + public function getPermissionId() + { + return $this->permissionId; + } + + public function setQuotaBytesTotal($quotaBytesTotal) + { + $this->quotaBytesTotal = $quotaBytesTotal; + } + + public function getQuotaBytesTotal() + { + return $this->quotaBytesTotal; + } + + public function setQuotaBytesUsed($quotaBytesUsed) + { + $this->quotaBytesUsed = $quotaBytesUsed; + } + + public function getQuotaBytesUsed() + { + return $this->quotaBytesUsed; + } + + public function setQuotaBytesUsedAggregate($quotaBytesUsedAggregate) + { + $this->quotaBytesUsedAggregate = $quotaBytesUsedAggregate; + } + + public function getQuotaBytesUsedAggregate() + { + return $this->quotaBytesUsedAggregate; + } + + public function setQuotaBytesUsedInTrash($quotaBytesUsedInTrash) + { + $this->quotaBytesUsedInTrash = $quotaBytesUsedInTrash; + } + + public function getQuotaBytesUsedInTrash() + { + return $this->quotaBytesUsedInTrash; + } + + public function setRemainingChangeIds($remainingChangeIds) + { + $this->remainingChangeIds = $remainingChangeIds; + } + + public function getRemainingChangeIds() + { + return $this->remainingChangeIds; + } + + public function setRootFolderId($rootFolderId) + { + $this->rootFolderId = $rootFolderId; + } + + public function getRootFolderId() + { + return $this->rootFolderId; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } + + public function setUser(Google_Service_Drive_User $user) + { + $this->user = $user; + } + + public function getUser() + { + return $this->user; + } +} + +class Google_Service_Drive_AboutAdditionalRoleInfo extends Google_Collection +{ + protected $roleSetsType = 'Google_Service_Drive_AboutAdditionalRoleInfoRoleSets'; + protected $roleSetsDataType = 'array'; + public $type; + + public function setRoleSets($roleSets) + { + $this->roleSets = $roleSets; + } + + public function getRoleSets() + { + return $this->roleSets; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getType() + { + return $this->type; + } +} + +class Google_Service_Drive_AboutAdditionalRoleInfoRoleSets extends Google_Collection +{ + public $additionalRoles; + public $primaryRole; + + public function setAdditionalRoles($additionalRoles) + { + $this->additionalRoles = $additionalRoles; + } + + public function getAdditionalRoles() + { + return $this->additionalRoles; + } + + public function setPrimaryRole($primaryRole) + { + $this->primaryRole = $primaryRole; + } + + public function getPrimaryRole() + { + return $this->primaryRole; + } +} + +class Google_Service_Drive_AboutExportFormats extends Google_Collection +{ + public $source; + public $targets; + + public function setSource($source) + { + $this->source = $source; + } + + public function getSource() + { + return $this->source; + } + + public function setTargets($targets) + { + $this->targets = $targets; + } + + public function getTargets() + { + return $this->targets; + } +} + +class Google_Service_Drive_AboutFeatures extends Google_Model +{ + public $featureName; + public $featureRate; + + public function setFeatureName($featureName) + { + $this->featureName = $featureName; + } + + public function getFeatureName() + { + return $this->featureName; + } + + public function setFeatureRate($featureRate) + { + $this->featureRate = $featureRate; + } + + public function getFeatureRate() + { + return $this->featureRate; + } +} + +class Google_Service_Drive_AboutImportFormats extends Google_Collection +{ + public $source; + public $targets; + + public function setSource($source) + { + $this->source = $source; + } + + public function getSource() + { + return $this->source; + } + + public function setTargets($targets) + { + $this->targets = $targets; + } + + public function getTargets() + { + return $this->targets; + } +} + +class Google_Service_Drive_AboutMaxUploadSizes extends Google_Model +{ + public $size; + public $type; + + public function setSize($size) + { + $this->size = $size; + } + + public function getSize() + { + return $this->size; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getType() + { + return $this->type; + } +} + +class Google_Service_Drive_App extends Google_Collection +{ + public $authorized; + public $createInFolderTemplate; + public $createUrl; + protected $iconsType = 'Google_Service_Drive_AppIcons'; + protected $iconsDataType = 'array'; + public $id; + public $installed; + public $kind; + public $longDescription; + public $name; + public $objectType; + public $openUrlTemplate; + public $primaryFileExtensions; + public $primaryMimeTypes; + public $productId; + public $productUrl; + public $secondaryFileExtensions; + public $secondaryMimeTypes; + public $shortDescription; + public $supportsCreate; + public $supportsImport; + public $supportsMultiOpen; + public $useByDefault; + + public function setAuthorized($authorized) + { + $this->authorized = $authorized; + } + + public function getAuthorized() + { + return $this->authorized; + } + + public function setCreateInFolderTemplate($createInFolderTemplate) + { + $this->createInFolderTemplate = $createInFolderTemplate; + } + + public function getCreateInFolderTemplate() + { + return $this->createInFolderTemplate; + } + + public function setCreateUrl($createUrl) + { + $this->createUrl = $createUrl; + } + + public function getCreateUrl() + { + return $this->createUrl; + } + + public function setIcons($icons) + { + $this->icons = $icons; + } + + public function getIcons() + { + return $this->icons; + } + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setInstalled($installed) + { + $this->installed = $installed; + } + + public function getInstalled() + { + return $this->installed; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setLongDescription($longDescription) + { + $this->longDescription = $longDescription; + } + + public function getLongDescription() + { + return $this->longDescription; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function setObjectType($objectType) + { + $this->objectType = $objectType; + } + + public function getObjectType() + { + return $this->objectType; + } + + public function setOpenUrlTemplate($openUrlTemplate) + { + $this->openUrlTemplate = $openUrlTemplate; + } + + public function getOpenUrlTemplate() + { + return $this->openUrlTemplate; + } + + public function setPrimaryFileExtensions($primaryFileExtensions) + { + $this->primaryFileExtensions = $primaryFileExtensions; + } + + public function getPrimaryFileExtensions() + { + return $this->primaryFileExtensions; + } + + public function setPrimaryMimeTypes($primaryMimeTypes) + { + $this->primaryMimeTypes = $primaryMimeTypes; + } + + public function getPrimaryMimeTypes() + { + return $this->primaryMimeTypes; + } + + public function setProductId($productId) + { + $this->productId = $productId; + } + + public function getProductId() + { + return $this->productId; + } + + public function setProductUrl($productUrl) + { + $this->productUrl = $productUrl; + } + + public function getProductUrl() + { + return $this->productUrl; + } + + public function setSecondaryFileExtensions($secondaryFileExtensions) + { + $this->secondaryFileExtensions = $secondaryFileExtensions; + } + + public function getSecondaryFileExtensions() + { + return $this->secondaryFileExtensions; + } + + public function setSecondaryMimeTypes($secondaryMimeTypes) + { + $this->secondaryMimeTypes = $secondaryMimeTypes; + } + + public function getSecondaryMimeTypes() + { + return $this->secondaryMimeTypes; + } + + public function setShortDescription($shortDescription) + { + $this->shortDescription = $shortDescription; + } + + public function getShortDescription() + { + return $this->shortDescription; + } + + public function setSupportsCreate($supportsCreate) + { + $this->supportsCreate = $supportsCreate; + } + + public function getSupportsCreate() + { + return $this->supportsCreate; + } + + public function setSupportsImport($supportsImport) + { + $this->supportsImport = $supportsImport; + } + + public function getSupportsImport() + { + return $this->supportsImport; + } + + public function setSupportsMultiOpen($supportsMultiOpen) + { + $this->supportsMultiOpen = $supportsMultiOpen; + } + + public function getSupportsMultiOpen() + { + return $this->supportsMultiOpen; + } + + public function setUseByDefault($useByDefault) + { + $this->useByDefault = $useByDefault; + } + + public function getUseByDefault() + { + return $this->useByDefault; + } +} + +class Google_Service_Drive_AppIcons extends Google_Model +{ + public $category; + public $iconUrl; + public $size; + + public function setCategory($category) + { + $this->category = $category; + } + + public function getCategory() + { + return $this->category; + } + + public function setIconUrl($iconUrl) + { + $this->iconUrl = $iconUrl; + } + + public function getIconUrl() + { + return $this->iconUrl; + } + + public function setSize($size) + { + $this->size = $size; + } + + public function getSize() + { + return $this->size; + } +} + +class Google_Service_Drive_AppList extends Google_Collection +{ + public $etag; + protected $itemsType = 'Google_Service_Drive_App'; + protected $itemsDataType = 'array'; + public $kind; + public $selfLink; + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_Change extends Google_Model +{ + public $deleted; + protected $fileType = 'Google_Service_Drive_DriveFile'; + protected $fileDataType = ''; + public $fileId; + public $id; + public $kind; + public $modificationDate; + public $selfLink; + + public function setDeleted($deleted) + { + $this->deleted = $deleted; + } + + public function getDeleted() + { + return $this->deleted; + } + + public function setFile(Google_Service_Drive_DriveFile $file) + { + $this->file = $file; + } + + public function getFile() + { + return $this->file; + } + + public function setFileId($fileId) + { + $this->fileId = $fileId; + } + + public function getFileId() + { + return $this->fileId; + } + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setModificationDate($modificationDate) + { + $this->modificationDate = $modificationDate; + } + + public function getModificationDate() + { + return $this->modificationDate; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_ChangeList extends Google_Collection +{ + public $etag; + protected $itemsType = 'Google_Service_Drive_Change'; + protected $itemsDataType = 'array'; + public $kind; + public $largestChangeId; + public $nextLink; + public $nextPageToken; + public $selfLink; + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setLargestChangeId($largestChangeId) + { + $this->largestChangeId = $largestChangeId; + } + + public function getLargestChangeId() + { + return $this->largestChangeId; + } + + public function setNextLink($nextLink) + { + $this->nextLink = $nextLink; + } + + public function getNextLink() + { + return $this->nextLink; + } + + public function setNextPageToken($nextPageToken) + { + $this->nextPageToken = $nextPageToken; + } + + public function getNextPageToken() + { + return $this->nextPageToken; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_Channel extends Google_Model +{ + public $address; + public $expiration; + public $id; + public $kind; + public $params; + public $payload; + public $resourceId; + public $resourceUri; + public $token; + public $type; + + public function setAddress($address) + { + $this->address = $address; + } + + public function getAddress() + { + return $this->address; + } + + public function setExpiration($expiration) + { + $this->expiration = $expiration; + } + + public function getExpiration() + { + return $this->expiration; + } + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setParams($params) + { + $this->params = $params; + } + + public function getParams() + { + return $this->params; + } + + public function setPayload($payload) + { + $this->payload = $payload; + } + + public function getPayload() + { + return $this->payload; + } + + public function setResourceId($resourceId) + { + $this->resourceId = $resourceId; + } + + public function getResourceId() + { + return $this->resourceId; + } + + public function setResourceUri($resourceUri) + { + $this->resourceUri = $resourceUri; + } + + public function getResourceUri() + { + return $this->resourceUri; + } + + public function setToken($token) + { + $this->token = $token; + } + + public function getToken() + { + return $this->token; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getType() + { + return $this->type; + } +} + +class Google_Service_Drive_ChildList extends Google_Collection +{ + public $etag; + protected $itemsType = 'Google_Service_Drive_ChildReference'; + protected $itemsDataType = 'array'; + public $kind; + public $nextLink; + public $nextPageToken; + public $selfLink; + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setNextLink($nextLink) + { + $this->nextLink = $nextLink; + } + + public function getNextLink() + { + return $this->nextLink; + } + + public function setNextPageToken($nextPageToken) + { + $this->nextPageToken = $nextPageToken; + } + + public function getNextPageToken() + { + return $this->nextPageToken; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_ChildReference extends Google_Model +{ + public $childLink; + public $id; + public $kind; + public $selfLink; + + public function setChildLink($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 setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_Comment extends Google_Collection +{ + public $anchor; + protected $authorType = 'Google_Service_Drive_User'; + protected $authorDataType = ''; + public $commentId; + public $content; + protected $contextType = 'Google_Service_Drive_CommentContext'; + protected $contextDataType = ''; + public $createdDate; + public $deleted; + public $fileId; + public $fileTitle; + public $htmlContent; + public $kind; + public $modifiedDate; + protected $repliesType = 'Google_Service_Drive_CommentReply'; + protected $repliesDataType = 'array'; + public $selfLink; + public $status; + + public function setAnchor($anchor) + { + $this->anchor = $anchor; + } + + public function getAnchor() + { + return $this->anchor; + } + + public function setAuthor(Google_Service_Drive_User $author) + { + $this->author = $author; + } + + public function getAuthor() + { + return $this->author; + } + + public function setCommentId($commentId) + { + $this->commentId = $commentId; + } + + public function getCommentId() + { + return $this->commentId; + } + + public function setContent($content) + { + $this->content = $content; + } + + public function getContent() + { + return $this->content; + } + + public function setContext(Google_Service_Drive_CommentContext $context) + { + $this->context = $context; + } + + public function getContext() + { + return $this->context; + } + + public function setCreatedDate($createdDate) + { + $this->createdDate = $createdDate; + } + + public function getCreatedDate() + { + return $this->createdDate; + } + + public function setDeleted($deleted) + { + $this->deleted = $deleted; + } + + public function getDeleted() + { + return $this->deleted; + } + + public function setFileId($fileId) + { + $this->fileId = $fileId; + } + + public function getFileId() + { + return $this->fileId; + } + + public function setFileTitle($fileTitle) + { + $this->fileTitle = $fileTitle; + } + + public function getFileTitle() + { + return $this->fileTitle; + } + + public function setHtmlContent($htmlContent) + { + $this->htmlContent = $htmlContent; + } + + public function getHtmlContent() + { + return $this->htmlContent; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setModifiedDate($modifiedDate) + { + $this->modifiedDate = $modifiedDate; + } + + public function getModifiedDate() + { + return $this->modifiedDate; + } + + public function setReplies($replies) + { + $this->replies = $replies; + } + + public function getReplies() + { + return $this->replies; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } + + public function setStatus($status) + { + $this->status = $status; + } + + public function getStatus() + { + return $this->status; + } +} + +class Google_Service_Drive_CommentContext extends Google_Model +{ + public $type; + public $value; + + public function setType($type) + { + $this->type = $type; + } + + public function getType() + { + return $this->type; + } + + public function setValue($value) + { + $this->value = $value; + } + + public function getValue() + { + return $this->value; + } +} + +class Google_Service_Drive_CommentList extends Google_Collection +{ + protected $itemsType = 'Google_Service_Drive_Comment'; + protected $itemsDataType = 'array'; + public $kind; + public $nextLink; + public $nextPageToken; + public $selfLink; + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setNextLink($nextLink) + { + $this->nextLink = $nextLink; + } + + public function getNextLink() + { + return $this->nextLink; + } + + public function setNextPageToken($nextPageToken) + { + $this->nextPageToken = $nextPageToken; + } + + public function getNextPageToken() + { + return $this->nextPageToken; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_CommentReply extends Google_Model +{ + protected $authorType = 'Google_Service_Drive_User'; + protected $authorDataType = ''; + public $content; + public $createdDate; + public $deleted; + public $htmlContent; + public $kind; + public $modifiedDate; + public $replyId; + public $verb; + + public function setAuthor(Google_Service_Drive_User $author) + { + $this->author = $author; + } + + public function getAuthor() + { + return $this->author; + } + + public function setContent($content) + { + $this->content = $content; + } + + public function getContent() + { + return $this->content; + } + + public function setCreatedDate($createdDate) + { + $this->createdDate = $createdDate; + } + + public function getCreatedDate() + { + return $this->createdDate; + } + + public function setDeleted($deleted) + { + $this->deleted = $deleted; + } + + public function getDeleted() + { + return $this->deleted; + } + + public function setHtmlContent($htmlContent) + { + $this->htmlContent = $htmlContent; + } + + public function getHtmlContent() + { + return $this->htmlContent; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setModifiedDate($modifiedDate) + { + $this->modifiedDate = $modifiedDate; + } + + public function getModifiedDate() + { + return $this->modifiedDate; + } + + public function setReplyId($replyId) + { + $this->replyId = $replyId; + } + + public function getReplyId() + { + return $this->replyId; + } + + public function setVerb($verb) + { + $this->verb = $verb; + } + + public function getVerb() + { + return $this->verb; + } +} + +class Google_Service_Drive_CommentReplyList extends Google_Collection +{ + protected $itemsType = 'Google_Service_Drive_CommentReply'; + protected $itemsDataType = 'array'; + public $kind; + public $nextLink; + public $nextPageToken; + public $selfLink; + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setNextLink($nextLink) + { + $this->nextLink = $nextLink; + } + + public function getNextLink() + { + return $this->nextLink; + } + + public function setNextPageToken($nextPageToken) + { + $this->nextPageToken = $nextPageToken; + } + + public function getNextPageToken() + { + return $this->nextPageToken; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_DriveFile extends Google_Collection +{ + public $alternateLink; + public $appDataContents; + public $copyable; + public $createdDate; + public $defaultOpenWithLink; + public $description; + public $downloadUrl; + public $editable; + public $embedLink; + public $etag; + public $explicitlyTrashed; + public $exportLinks; + public $fileExtension; + public $fileSize; + public $headRevisionId; + public $iconLink; + public $id; + protected $imageMediaMetadataType = 'Google_Service_Drive_DriveFileImageMediaMetadata'; + protected $imageMediaMetadataDataType = ''; + protected $indexableTextType = 'Google_Service_Drive_DriveFileIndexableText'; + protected $indexableTextDataType = ''; + public $kind; + protected $labelsType = 'Google_Service_Drive_DriveFileLabels'; + protected $labelsDataType = ''; + protected $lastModifyingUserType = 'Google_Service_Drive_User'; + protected $lastModifyingUserDataType = ''; + public $lastModifyingUserName; + public $lastViewedByMeDate; + public $md5Checksum; + public $mimeType; + public $modifiedByMeDate; + public $modifiedDate; + public $openWithLinks; + public $originalFilename; + public $ownerNames; + protected $ownersType = 'Google_Service_Drive_User'; + protected $ownersDataType = 'array'; + protected $parentsType = 'Google_Service_Drive_ParentReference'; + protected $parentsDataType = 'array'; + protected $propertiesType = 'Google_Service_Drive_Property'; + protected $propertiesDataType = 'array'; + public $quotaBytesUsed; + public $selfLink; + public $shared; + public $sharedWithMeDate; + protected $thumbnailType = 'Google_Service_Drive_DriveFileThumbnail'; + protected $thumbnailDataType = ''; + public $thumbnailLink; + public $title; + protected $userPermissionType = 'Google_Service_Drive_Permission'; + protected $userPermissionDataType = ''; + public $webContentLink; + public $webViewLink; + public $writersCanShare; + + public function setAlternateLink($alternateLink) + { + $this->alternateLink = $alternateLink; + } + + public function getAlternateLink() + { + return $this->alternateLink; + } + + public function setAppDataContents($appDataContents) + { + $this->appDataContents = $appDataContents; + } + + public function getAppDataContents() + { + return $this->appDataContents; + } + + public function setCopyable($copyable) + { + $this->copyable = $copyable; + } + + public function getCopyable() + { + return $this->copyable; + } + + public function setCreatedDate($createdDate) + { + $this->createdDate = $createdDate; + } + + public function getCreatedDate() + { + return $this->createdDate; + } + + public function setDefaultOpenWithLink($defaultOpenWithLink) + { + $this->defaultOpenWithLink = $defaultOpenWithLink; + } + + public function getDefaultOpenWithLink() + { + return $this->defaultOpenWithLink; + } + + public function setDescription($description) + { + $this->description = $description; + } + + public function getDescription() + { + return $this->description; + } + + public function setDownloadUrl($downloadUrl) + { + $this->downloadUrl = $downloadUrl; + } + + public function getDownloadUrl() + { + return $this->downloadUrl; + } + + public function setEditable($editable) + { + $this->editable = $editable; + } + + public function getEditable() + { + return $this->editable; + } + + public function setEmbedLink($embedLink) + { + $this->embedLink = $embedLink; + } + + public function getEmbedLink() + { + return $this->embedLink; + } + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setExplicitlyTrashed($explicitlyTrashed) + { + $this->explicitlyTrashed = $explicitlyTrashed; + } + + public function getExplicitlyTrashed() + { + return $this->explicitlyTrashed; + } + + public function setExportLinks($exportLinks) + { + $this->exportLinks = $exportLinks; + } + + public function getExportLinks() + { + return $this->exportLinks; + } + + public function setFileExtension($fileExtension) + { + $this->fileExtension = $fileExtension; + } + + public function getFileExtension() + { + return $this->fileExtension; + } + + public function setFileSize($fileSize) + { + $this->fileSize = $fileSize; + } + + public function getFileSize() + { + return $this->fileSize; + } + + public function setHeadRevisionId($headRevisionId) + { + $this->headRevisionId = $headRevisionId; + } + + public function getHeadRevisionId() + { + return $this->headRevisionId; + } + + public function setIconLink($iconLink) + { + $this->iconLink = $iconLink; + } + + public function getIconLink() + { + return $this->iconLink; + } + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setImageMediaMetadata(Google_Service_Drive_DriveFileImageMediaMetadata $imageMediaMetadata) + { + $this->imageMediaMetadata = $imageMediaMetadata; + } + + public function getImageMediaMetadata() + { + return $this->imageMediaMetadata; + } + + public function setIndexableText(Google_Service_Drive_DriveFileIndexableText $indexableText) + { + $this->indexableText = $indexableText; + } + + public function getIndexableText() + { + return $this->indexableText; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setLabels(Google_Service_Drive_DriveFileLabels $labels) + { + $this->labels = $labels; + } + + public function getLabels() + { + return $this->labels; + } + + public function setLastModifyingUser(Google_Service_Drive_User $lastModifyingUser) + { + $this->lastModifyingUser = $lastModifyingUser; + } + + public function getLastModifyingUser() + { + return $this->lastModifyingUser; + } + + public function setLastModifyingUserName($lastModifyingUserName) + { + $this->lastModifyingUserName = $lastModifyingUserName; + } + + public function getLastModifyingUserName() + { + return $this->lastModifyingUserName; + } + + public function setLastViewedByMeDate($lastViewedByMeDate) + { + $this->lastViewedByMeDate = $lastViewedByMeDate; + } + + public function getLastViewedByMeDate() + { + return $this->lastViewedByMeDate; + } + + public function setMd5Checksum($md5Checksum) + { + $this->md5Checksum = $md5Checksum; + } + + public function getMd5Checksum() + { + return $this->md5Checksum; + } + + public function setMimeType($mimeType) + { + $this->mimeType = $mimeType; + } + + public function getMimeType() + { + return $this->mimeType; + } + + public function setModifiedByMeDate($modifiedByMeDate) + { + $this->modifiedByMeDate = $modifiedByMeDate; + } + + public function getModifiedByMeDate() + { + return $this->modifiedByMeDate; + } + + public function setModifiedDate($modifiedDate) + { + $this->modifiedDate = $modifiedDate; + } + + public function getModifiedDate() + { + return $this->modifiedDate; + } + + public function setOpenWithLinks($openWithLinks) + { + $this->openWithLinks = $openWithLinks; + } + + public function getOpenWithLinks() + { + return $this->openWithLinks; + } + + public function setOriginalFilename($originalFilename) + { + $this->originalFilename = $originalFilename; + } + + public function getOriginalFilename() + { + return $this->originalFilename; + } + + public function setOwnerNames($ownerNames) + { + $this->ownerNames = $ownerNames; + } + + public function getOwnerNames() + { + return $this->ownerNames; + } + + public function setOwners($owners) + { + $this->owners = $owners; + } + + public function getOwners() + { + return $this->owners; + } + + public function setParents($parents) + { + $this->parents = $parents; + } + + public function getParents() + { + return $this->parents; + } + + public function setProperties($properties) + { + $this->properties = $properties; + } + + public function getProperties() + { + return $this->properties; + } + + public function setQuotaBytesUsed($quotaBytesUsed) + { + $this->quotaBytesUsed = $quotaBytesUsed; + } + + public function getQuotaBytesUsed() + { + return $this->quotaBytesUsed; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } + + public function setShared($shared) + { + $this->shared = $shared; + } + + public function getShared() + { + return $this->shared; + } + + public function setSharedWithMeDate($sharedWithMeDate) + { + $this->sharedWithMeDate = $sharedWithMeDate; + } + + public function getSharedWithMeDate() + { + return $this->sharedWithMeDate; + } + + public function setThumbnail(Google_Service_Drive_DriveFileThumbnail $thumbnail) + { + $this->thumbnail = $thumbnail; + } + + public function getThumbnail() + { + return $this->thumbnail; + } + + public function setThumbnailLink($thumbnailLink) + { + $this->thumbnailLink = $thumbnailLink; + } + + public function getThumbnailLink() + { + return $this->thumbnailLink; + } + + public function setTitle($title) + { + $this->title = $title; + } + + public function getTitle() + { + return $this->title; + } + + public function setUserPermission(Google_Service_Drive_Permission $userPermission) + { + $this->userPermission = $userPermission; + } + + public function getUserPermission() + { + return $this->userPermission; + } + + public function setWebContentLink($webContentLink) + { + $this->webContentLink = $webContentLink; + } + + public function getWebContentLink() + { + return $this->webContentLink; + } + + public function setWebViewLink($webViewLink) + { + $this->webViewLink = $webViewLink; + } + + public function getWebViewLink() + { + return $this->webViewLink; + } + + public function setWritersCanShare($writersCanShare) + { + $this->writersCanShare = $writersCanShare; + } + + public function getWritersCanShare() + { + return $this->writersCanShare; + } +} + +class Google_Service_Drive_DriveFileImageMediaMetadata extends Google_Model +{ + public $aperture; + public $cameraMake; + public $cameraModel; + public $colorSpace; + public $date; + public $exposureBias; + public $exposureMode; + public $exposureTime; + public $flashUsed; + public $focalLength; + public $height; + public $isoSpeed; + public $lens; + protected $locationType = 'Google_Service_Drive_DriveFileImageMediaMetadataLocation'; + protected $locationDataType = ''; + public $maxApertureValue; + public $meteringMode; + public $rotation; + public $sensor; + public $subjectDistance; + public $whiteBalance; + public $width; + + public function setAperture($aperture) + { + $this->aperture = $aperture; + } + + public function getAperture() + { + return $this->aperture; + } + + public function setCameraMake($cameraMake) + { + $this->cameraMake = $cameraMake; + } + + public function getCameraMake() + { + return $this->cameraMake; + } + + public function setCameraModel($cameraModel) + { + $this->cameraModel = $cameraModel; + } + + public function getCameraModel() + { + return $this->cameraModel; + } + + public function setColorSpace($colorSpace) + { + $this->colorSpace = $colorSpace; + } + + public function getColorSpace() + { + return $this->colorSpace; + } + + public function setDate($date) + { + $this->date = $date; + } + + public function getDate() + { + return $this->date; + } + + public function setExposureBias($exposureBias) + { + $this->exposureBias = $exposureBias; + } + + public function getExposureBias() + { + return $this->exposureBias; + } + + public function setExposureMode($exposureMode) + { + $this->exposureMode = $exposureMode; + } + + public function getExposureMode() + { + return $this->exposureMode; + } + + public function setExposureTime($exposureTime) + { + $this->exposureTime = $exposureTime; + } + + public function getExposureTime() + { + return $this->exposureTime; + } + + public function setFlashUsed($flashUsed) + { + $this->flashUsed = $flashUsed; + } + + public function getFlashUsed() + { + return $this->flashUsed; + } + + public function setFocalLength($focalLength) + { + $this->focalLength = $focalLength; + } + + public function getFocalLength() + { + return $this->focalLength; + } + + public function setHeight($height) + { + $this->height = $height; + } + + public function getHeight() + { + return $this->height; + } + + public function setIsoSpeed($isoSpeed) + { + $this->isoSpeed = $isoSpeed; + } + + public function getIsoSpeed() + { + return $this->isoSpeed; + } + + public function setLens($lens) + { + $this->lens = $lens; + } + + public function getLens() + { + return $this->lens; + } + + public function setLocation(Google_Service_Drive_DriveFileImageMediaMetadataLocation $location) + { + $this->location = $location; + } + + public function getLocation() + { + return $this->location; + } + + public function setMaxApertureValue($maxApertureValue) + { + $this->maxApertureValue = $maxApertureValue; + } + + public function getMaxApertureValue() + { + return $this->maxApertureValue; + } + + public function setMeteringMode($meteringMode) + { + $this->meteringMode = $meteringMode; + } + + public function getMeteringMode() + { + return $this->meteringMode; + } + + public function setRotation($rotation) + { + $this->rotation = $rotation; + } + + public function getRotation() + { + return $this->rotation; + } + + public function setSensor($sensor) + { + $this->sensor = $sensor; + } + + public function getSensor() + { + return $this->sensor; + } + + public function setSubjectDistance($subjectDistance) + { + $this->subjectDistance = $subjectDistance; + } + + public function getSubjectDistance() + { + return $this->subjectDistance; + } + + public function setWhiteBalance($whiteBalance) + { + $this->whiteBalance = $whiteBalance; + } + + public function getWhiteBalance() + { + return $this->whiteBalance; + } + + public function setWidth($width) + { + $this->width = $width; + } + + public function getWidth() + { + return $this->width; + } +} + +class Google_Service_Drive_DriveFileImageMediaMetadataLocation extends Google_Model +{ + public $altitude; + public $latitude; + public $longitude; + + public function setAltitude($altitude) + { + $this->altitude = $altitude; + } + + public function getAltitude() + { + return $this->altitude; + } + + public function setLatitude($latitude) + { + $this->latitude = $latitude; + } + + public function getLatitude() + { + return $this->latitude; + } + + public function setLongitude($longitude) + { + $this->longitude = $longitude; + } + + public function getLongitude() + { + return $this->longitude; + } +} + +class Google_Service_Drive_DriveFileIndexableText extends Google_Model +{ + public $text; + + public function setText($text) + { + $this->text = $text; + } + + public function getText() + { + return $this->text; + } +} + +class Google_Service_Drive_DriveFileLabels extends Google_Model +{ + public $hidden; + public $restricted; + public $starred; + public $trashed; + public $viewed; + + public function setHidden($hidden) + { + $this->hidden = $hidden; + } + + public function getHidden() + { + return $this->hidden; + } + + public function setRestricted($restricted) + { + $this->restricted = $restricted; + } + + public function getRestricted() + { + return $this->restricted; + } + + public function setStarred($starred) + { + $this->starred = $starred; + } + + public function getStarred() + { + return $this->starred; + } + + public function setTrashed($trashed) + { + $this->trashed = $trashed; + } + + public function getTrashed() + { + return $this->trashed; + } + + public function setViewed($viewed) + { + $this->viewed = $viewed; + } + + public function getViewed() + { + return $this->viewed; + } +} + +class Google_Service_Drive_DriveFileThumbnail extends Google_Model +{ + public $image; + public $mimeType; + + public function setImage($image) + { + $this->image = $image; + } + + public function getImage() + { + return $this->image; + } + + public function setMimeType($mimeType) + { + $this->mimeType = $mimeType; + } + + public function getMimeType() + { + return $this->mimeType; + } +} + +class Google_Service_Drive_FileList extends Google_Collection +{ + public $etag; + protected $itemsType = 'Google_Service_Drive_DriveFile'; + protected $itemsDataType = 'array'; + public $kind; + public $nextLink; + public $nextPageToken; + public $selfLink; + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setNextLink($nextLink) + { + $this->nextLink = $nextLink; + } + + public function getNextLink() + { + return $this->nextLink; + } + + public function setNextPageToken($nextPageToken) + { + $this->nextPageToken = $nextPageToken; + } + + public function getNextPageToken() + { + return $this->nextPageToken; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_ParentList extends Google_Collection +{ + public $etag; + protected $itemsType = 'Google_Service_Drive_ParentReference'; + protected $itemsDataType = 'array'; + public $kind; + public $selfLink; + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_ParentReference extends Google_Model +{ + public $id; + public $isRoot; + public $kind; + public $parentLink; + public $selfLink; + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setIsRoot($isRoot) + { + $this->isRoot = $isRoot; + } + + public function getIsRoot() + { + return $this->isRoot; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setParentLink($parentLink) + { + $this->parentLink = $parentLink; + } + + public function getParentLink() + { + return $this->parentLink; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_Permission extends Google_Collection +{ + public $additionalRoles; + public $authKey; + public $domain; + public $emailAddress; + public $etag; + public $id; + public $kind; + public $name; + public $photoLink; + public $role; + public $selfLink; + public $type; + public $value; + public $withLink; + + public function setAdditionalRoles($additionalRoles) + { + $this->additionalRoles = $additionalRoles; + } + + public function getAdditionalRoles() + { + return $this->additionalRoles; + } + + public function setAuthKey($authKey) + { + $this->authKey = $authKey; + } + + public function getAuthKey() + { + return $this->authKey; + } + + public function setDomain($domain) + { + $this->domain = $domain; + } + + public function getDomain() + { + return $this->domain; + } + + public function setEmailAddress($emailAddress) + { + $this->emailAddress = $emailAddress; + } + + public function getEmailAddress() + { + return $this->emailAddress; + } + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + 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 setPhotoLink($photoLink) + { + $this->photoLink = $photoLink; + } + + public function getPhotoLink() + { + return $this->photoLink; + } + + public function setRole($role) + { + $this->role = $role; + } + + public function getRole() + { + return $this->role; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getType() + { + return $this->type; + } + + public function setValue($value) + { + $this->value = $value; + } + + public function getValue() + { + return $this->value; + } + + public function setWithLink($withLink) + { + $this->withLink = $withLink; + } + + public function getWithLink() + { + return $this->withLink; + } +} + +class Google_Service_Drive_PermissionId extends Google_Model +{ + public $id; + public $kind; + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } +} + +class Google_Service_Drive_PermissionList extends Google_Collection +{ + public $etag; + protected $itemsType = 'Google_Service_Drive_Permission'; + protected $itemsDataType = 'array'; + public $kind; + public $selfLink; + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_Property extends Google_Model +{ + public $etag; + public $key; + public $kind; + public $selfLink; + public $value; + public $visibility; + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setKey($key) + { + $this->key = $key; + } + + public function getKey() + { + return $this->key; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } + + public function setValue($value) + { + $this->value = $value; + } + + public function getValue() + { + return $this->value; + } + + public function setVisibility($visibility) + { + $this->visibility = $visibility; + } + + public function getVisibility() + { + return $this->visibility; + } +} + +class Google_Service_Drive_PropertyList extends Google_Collection +{ + public $etag; + protected $itemsType = 'Google_Service_Drive_Property'; + protected $itemsDataType = 'array'; + public $kind; + public $selfLink; + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_Revision extends Google_Model +{ + public $downloadUrl; + public $etag; + public $exportLinks; + public $fileSize; + public $id; + public $kind; + protected $lastModifyingUserType = 'Google_Service_Drive_User'; + protected $lastModifyingUserDataType = ''; + public $lastModifyingUserName; + public $md5Checksum; + public $mimeType; + public $modifiedDate; + public $originalFilename; + public $pinned; + public $publishAuto; + public $published; + public $publishedLink; + public $publishedOutsideDomain; + public $selfLink; + + public function setDownloadUrl($downloadUrl) + { + $this->downloadUrl = $downloadUrl; + } + + public function getDownloadUrl() + { + return $this->downloadUrl; + } + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setExportLinks($exportLinks) + { + $this->exportLinks = $exportLinks; + } + + public function getExportLinks() + { + return $this->exportLinks; + } + + public function setFileSize($fileSize) + { + $this->fileSize = $fileSize; + } + + public function getFileSize() + { + return $this->fileSize; + } + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setLastModifyingUser(Google_Service_Drive_User $lastModifyingUser) + { + $this->lastModifyingUser = $lastModifyingUser; + } + + public function getLastModifyingUser() + { + return $this->lastModifyingUser; + } + + public function setLastModifyingUserName($lastModifyingUserName) + { + $this->lastModifyingUserName = $lastModifyingUserName; + } + + public function getLastModifyingUserName() + { + return $this->lastModifyingUserName; + } + + public function setMd5Checksum($md5Checksum) + { + $this->md5Checksum = $md5Checksum; + } + + public function getMd5Checksum() + { + return $this->md5Checksum; + } + + public function setMimeType($mimeType) + { + $this->mimeType = $mimeType; + } + + public function getMimeType() + { + return $this->mimeType; + } + + public function setModifiedDate($modifiedDate) + { + $this->modifiedDate = $modifiedDate; + } + + public function getModifiedDate() + { + return $this->modifiedDate; + } + + public function setOriginalFilename($originalFilename) + { + $this->originalFilename = $originalFilename; + } + + public function getOriginalFilename() + { + return $this->originalFilename; + } + + public function setPinned($pinned) + { + $this->pinned = $pinned; + } + + public function getPinned() + { + return $this->pinned; + } + + public function setPublishAuto($publishAuto) + { + $this->publishAuto = $publishAuto; + } + + public function getPublishAuto() + { + return $this->publishAuto; + } + + public function setPublished($published) + { + $this->published = $published; + } + + public function getPublished() + { + return $this->published; + } + + public function setPublishedLink($publishedLink) + { + $this->publishedLink = $publishedLink; + } + + public function getPublishedLink() + { + return $this->publishedLink; + } + + public function setPublishedOutsideDomain($publishedOutsideDomain) + { + $this->publishedOutsideDomain = $publishedOutsideDomain; + } + + public function getPublishedOutsideDomain() + { + return $this->publishedOutsideDomain; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_RevisionList extends Google_Collection +{ + public $etag; + protected $itemsType = 'Google_Service_Drive_Revision'; + protected $itemsDataType = 'array'; + public $kind; + public $selfLink; + + public function setEtag($etag) + { + $this->etag = $etag; + } + + public function getEtag() + { + return $this->etag; + } + + public function setItems($items) + { + $this->items = $items; + } + + public function getItems() + { + return $this->items; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setSelfLink($selfLink) + { + $this->selfLink = $selfLink; + } + + public function getSelfLink() + { + return $this->selfLink; + } +} + +class Google_Service_Drive_User extends Google_Model +{ + public $displayName; + public $isAuthenticatedUser; + public $kind; + public $permissionId; + protected $pictureType = 'Google_Service_Drive_UserPicture'; + protected $pictureDataType = ''; + + public function setDisplayName($displayName) + { + $this->displayName = $displayName; + } + + public function getDisplayName() + { + return $this->displayName; + } + + public function setIsAuthenticatedUser($isAuthenticatedUser) + { + $this->isAuthenticatedUser = $isAuthenticatedUser; + } + + public function getIsAuthenticatedUser() + { + return $this->isAuthenticatedUser; + } + + public function setKind($kind) + { + $this->kind = $kind; + } + + public function getKind() + { + return $this->kind; + } + + public function setPermissionId($permissionId) + { + $this->permissionId = $permissionId; + } + + public function getPermissionId() + { + return $this->permissionId; + } + + public function setPicture(Google_Service_Drive_UserPicture $picture) + { + $this->picture = $picture; + } + + public function getPicture() + { + return $this->picture; + } +} + +class Google_Service_Drive_UserPicture extends Google_Model +{ + public $url; + + public function setUrl($url) + { + $this->url = $url; + } + + public function getUrl() + { + return $this->url; + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Exception.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Exception.php new file mode 100644 index 0000000000..a780ff7b47 --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Exception.php @@ -0,0 +1,53 @@ += 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/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Resource.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Resource.php new file mode 100644 index 0000000000..d396907e1d --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Resource.php @@ -0,0 +1,210 @@ + + * @author Chirag Shah + * + */ +class Google_Service_Resource +{ + // Valid query parameters that work, but don't appear in discovery. + private $stackParameters = array( + 'alt' => array('type' => 'string', 'location' => 'query'), + 'fields' => array('type' => 'string', 'location' => 'query'), + 'trace' => array('type' => 'string', 'location' => 'query'), + 'userIp' => array('type' => 'string', 'location' => 'query'), + 'userip' => array('type' => 'string', 'location' => 'query'), + 'quotaUser' => array('type' => 'string', 'location' => 'query'), + 'data' => array('type' => 'string', 'location' => 'body'), + 'mimeType' => array('type' => 'string', 'location' => 'header'), + 'uploadType' => array('type' => 'string', 'location' => 'query'), + 'mediaUpload' => array('type' => 'complex', 'location' => 'query'), + ); + + /** @var Google_Service $service */ + private $service; + + /** @var Google_Client $client */ + private $client; + + /** @var string $serviceName */ + private $serviceName; + + /** @var string $resourceName */ + private $resourceName; + + /** @var array $methods */ + private $methods; + + public function __construct($service, $serviceName, $resourceName, $resource) + { + $this->service = $service; + $this->client = $service->getClient(); + $this->serviceName = $serviceName; + $this->resourceName = $resourceName; + $this->methods = isset($resource['methods']) ? + $resource['methods'] : + array($resourceName => $resource); + } + + /** + * TODO(ianbarber): This function needs simplifying. + * @param $name + * @param $arguments + * @param $expected_class - optional, the expected class name + * @return Google_Http_Request|expected_class + * @throws Google_Exception + */ + public function call($name, $arguments, $expected_class = null) + { + if (! isset($this->methods[$name])) { + throw new Google_Exception( + "Unknown function: " . + "{$this->serviceName}->{$this->resourceName}->{$name}()" + ); + } + $method = $this->methods[$name]; + $parameters = $arguments[0]; + + // postBody is a special case since it's not defined in the discovery + // document as parameter, but we abuse the param entry for storing it. + $postBody = null; + if (isset($parameters['postBody'])) { + if ($parameters['postBody'] instanceof Google_Model) { + // In the cases the post body is an existing object, we want + // to use the smart method to create a simple object for + // for JSONification. + $parameters['postBody'] = $parameters['postBody']->toSimpleObject(); + } else if (is_object($parameters['postBody'])) { + // If the post body is another kind of object, we will try and + // wrangle it into a sensible format. + $parameters['postBody'] = + $this->convertToArrayAndStripNulls($parameters['postBody']); + } + $postBody = json_encode($parameters['postBody']); + unset($parameters['postBody']); + } + + // TODO(ianbarber): optParams here probably should have been + // handled already - this may well be redundant code. + if (isset($parameters['optParams'])) { + $optParams = $parameters['optParams']; + unset($parameters['optParams']); + $parameters = array_merge($parameters, $optParams); + } + + if (!isset($method['parameters'])) { + $method['parameters'] = array(); + } + + $method['parameters'] = array_merge( + $method['parameters'], + $this->stackParameters + ); + foreach ($parameters as $key => $val) { + if ($key != 'postBody' && ! isset($method['parameters'][$key])) { + throw new Google_Exception("($name) unknown parameter: '$key'"); + } + } + + foreach ($method['parameters'] as $paramName => $paramSpec) { + if (isset($paramSpec['required']) && + $paramSpec['required'] && + ! isset($parameters[$paramName]) + ) { + throw new Google_Exception("($name) missing required param: '$paramName'"); + } + if (isset($parameters[$paramName])) { + $value = $parameters[$paramName]; + $parameters[$paramName] = $paramSpec; + $parameters[$paramName]['value'] = $value; + unset($parameters[$paramName]['required']); + } else { + // Ensure we don't pass nulls. + unset($parameters[$paramName]); + } + } + + $servicePath = $this->service->servicePath; + + $url = Google_Http_REST::createRequestUri( + $servicePath, + $method['path'], + $parameters + ); + $httpRequest = new Google_Http_Request( + $url, + $method['httpMethod'], + null, + $postBody + ); + $httpRequest->setBaseComponent($this->client->getBasePath()); + + if ($postBody) { + $contentTypeHeader = array(); + $contentTypeHeader['content-type'] = 'application/json; charset=UTF-8'; + $httpRequest->setRequestHeaders($contentTypeHeader); + $httpRequest->setPostBody($postBody); + } + + $httpRequest = $this->client->getAuth()->sign($httpRequest); + $httpRequest->setExpectedClass($expected_class); + + if (isset($parameters['data']) && + ($parameters['uploadType']['value'] == 'media' || $parameters['uploadType']['value'] == 'multipart')) { + // If we are doing a simple media upload, trigger that as a convenience. + $mfu = new Google_Http_MediaFileUpload( + $this->client, + $httpRequest, + isset($parameters['mimeType']) ? $parameters['mimeType']['value'] : 'application/octet-stream', + $parameters['data']['value'] + ); + } + + if ($this->client->shouldDefer()) { + // If we are in batch or upload mode, return the raw request. + return $httpRequest; + } + + return $this->client->execute($httpRequest); + } + + protected function convertToArrayAndStripNulls($o) + { + $o = (array) $o; + foreach ($o as $k => $v) { + if ($v === null) { + unset($o[$k]); + } elseif (is_object($v) || is_array($v)) { + $o[$k] = $this->convertToArrayAndStripNulls($o[$k]); + } + } + return $o; + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Signer.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/Abstract.php similarity index 91% rename from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Signer.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/Abstract.php index 7892baac8d..250180920d 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Signer.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/Abstract.php @@ -15,14 +15,13 @@ * limitations under the License. */ -require_once "Google_P12Signer.php"; - /** * Signs data. * * @author Brian Eaton */ -abstract class Google_Signer { +abstract class Google_Signer_Abstract +{ /** * Signs data, returns the signature as binary data. */ diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_P12Signer.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/P12.php similarity index 66% rename from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_P12Signer.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/P12.php index 1bed590991..2c9d17927c 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_P12Signer.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/P12.php @@ -15,6 +15,9 @@ * limitations under the License. */ +require_once 'Google/Auth/Exception.php'; +require_once 'Google/Signer/Abstract.php'; + /** * Signs data. * @@ -22,48 +25,56 @@ * * @author Brian Eaton */ -class Google_P12Signer extends Google_Signer { +class Google_Signer_P12 extends Google_Signer_Abstract +{ // OpenSSL private key resource private $privateKey; // Creates a new signer from a .p12 file. - function __construct($p12, $password) { + public function __construct($p12, $password) + { if (!function_exists('openssl_x509_read')) { - throw new Exception( - 'The Google PHP API library needs the openssl PHP extension'); + throw new Google_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. " . + throw new Google_Auth_Exception( + "Unable to parse the p12 file. " . "Is this a .p12 file? Is the password correct? OpenSSL error: " . - openssl_error_string()); + 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."); + throw new Google_Auth_Exception("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 "); + throw new Google_Auth_Exception("Unable to load private key in "); } } - function __destruct() { + public 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."); + public function sign($data) + { + if (version_compare(PHP_VERSION, '5.3.0') < 0) { + throw new Google_Auth_Exception( + "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"); + throw new Google_Auth_Exception("Unable to sign data"); } return $signature; } diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Utils.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils.php similarity index 79% rename from apps/files_external/3rdparty/google-api-php-client/src/service/Google_Utils.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Utils.php index be94902c2e..a991066f2d 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Utils.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils.php @@ -21,25 +21,33 @@ * * @author Chirag Shah */ -class Google_Utils { - public static function urlSafeB64Encode($data) { +class Google_Utils +{ + public static function urlSafeB64Encode($data) + { $b64 = base64_encode($data); - $b64 = str_replace(array('+', '/', '\r', '\n', '='), - array('-', '_'), - $b64); + $b64 = str_replace( + array('+', '/', '\r', '\n', '='), + array('-', '_'), + $b64 + ); return $b64; } - public static function urlSafeB64Decode($b64) { - $b64 = str_replace(array('-', '_'), - array('+', '/'), - $b64); + public static function urlSafeB64Decode($b64) + { + $b64 = str_replace( + array('-', '_'), + array('+', '/'), + $b64 + ); return base64_decode($b64); } /** - * Misc function used to count the number of bytes in a post body, in the world of multi-byte chars - * and the unpredictability of strlen/mb_strlen/sizeof, this is the only way to do that in a sane + * Misc function used to count the number of bytes in a post body, in the + * world of multi-byte chars and the unpredictability of + * strlen/mb_strlen/sizeof, this is the only way to do that in a sane * manner at the moment. * * This algorithm was originally developed for the @@ -51,7 +59,8 @@ class Google_Utils { * @param string $str * @return int The number of bytes in a string. */ - static public function getStrLen($str) { + public static function getStrLen($str) + { $strlenVar = strlen($str); $d = $ret = 0; for ($count = 0; $count < $strlenVar; ++ $count) { @@ -61,31 +70,26 @@ class Google_Utils { // characters U-00000000 - U-0000007F (same as ASCII) $ret ++; break; - case (($ordinalValue & 0xE0) == 0xC0): // characters U-00000080 - U-000007FF, mask 110XXXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $ret += 2; break; - case (($ordinalValue & 0xF0) == 0xE0): // characters U-00000800 - U-0000FFFF, mask 1110XXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $ret += 3; break; - case (($ordinalValue & 0xF8) == 0xF0): // characters U-00010000 - U-001FFFFF, mask 11110XXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $ret += 4; break; - case (($ordinalValue & 0xFC) == 0xF8): // characters U-00200000 - U-03FFFFFF, mask 111110XX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $ret += 5; break; - case (($ordinalValue & 0xFE) == 0xFC): // characters U-04000000 - U-7FFFFFFF, mask 1111110X // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 @@ -103,7 +107,8 @@ class Google_Utils { * @param array $arr * @return array Normalized array. */ - public static function normalize($arr) { + public static function normalize($arr) + { if (!is_array($arr)) { return array(); } @@ -114,4 +119,15 @@ class Google_Utils { } return $normalized; } -} \ No newline at end of file + + /** + * Convert a string to camelCase + * @param string $value + * @return string + */ + public static function camelCase($value) + { + $value = ucwords(str_replace(array('-', '_'), ' ', $value)); + return lcfirst(str_replace(' ', '', $value)); + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils/URITemplate.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils/URITemplate.php new file mode 100644 index 0000000000..fee56725da --- /dev/null +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils/URITemplate.php @@ -0,0 +1,333 @@ + "reserved", + "/" => "segments", + "." => "dotprefix", + "#" => "fragment", + ";" => "semicolon", + "?" => "form", + "&" => "continuation" + ); + + /** + * @var reserved array + * These are the characters which should not be URL encoded in reserved + * strings. + */ + private $reserved = array( + "=", ",", "!", "@", "|", ":", "/", "?", "#", + "[", "]","$", "&", "'", "(", ")", "*", "+", ";" + ); + private $reservedEncoded = array( + "%3D", "%2C", "%21", "%40", "%7C", "%3A", "%2F", "%3F", + "%23", "%5B", "%5D", "%24", "%26", "%27", "%28", "%29", + "%2A", "%2B", "%3B" + ); + + public function parse($string, array $parameters) + { + return $this->resolveNextSection($string, $parameters); + } + + /** + * This function finds the first matching {...} block and + * executes the replacement. It then calls itself to find + * subsequent blocks, if any. + */ + private function resolveNextSection($string, $parameters) + { + $start = strpos($string, "{"); + if ($start === false) { + return $string; + } + $end = strpos($string, "}"); + if ($end === false) { + return $string; + } + $string = $this->replace($string, $start, $end, $parameters); + return $this->resolveNextSection($string, $parameters); + } + + private function replace($string, $start, $end, $parameters) + { + // We know a data block will have {} round it, so we can strip that. + $data = substr($string, $start + 1, $end - $start - 1); + + // If the first character is one of the reserved operators, it effects + // the processing of the stream. + if (isset($this->operators[$data[0]])) { + $op = $this->operators[$data[0]]; + $data = substr($data, 1); + $prefix = ""; + $prefix_on_missing = false; + + switch ($op) { + case "reserved": + // Reserved means certain characters should not be URL encoded + $data = $this->replaceVars($data, $parameters, ",", null, true); + break; + case "fragment": + // Comma separated with fragment prefix. Bare values only. + $prefix = "#"; + $prefix_on_missing = true; + $data = $this->replaceVars($data, $parameters, ",", null, true); + break; + case "segments": + // Slash separated data. Bare values only. + $prefix = "/"; + $data =$this->replaceVars($data, $parameters, "/"); + break; + case "dotprefix": + // Dot separated data. Bare values only. + $prefix = "."; + $prefix_on_missing = true; + $data = $this->replaceVars($data, $parameters, "."); + break; + case "semicolon": + // Semicolon prefixed and separated. Uses the key name + $prefix = ";"; + $data = $this->replaceVars($data, $parameters, ";", "=", false, true, false); + break; + case "form": + // Standard URL format. Uses the key name + $prefix = "?"; + $data = $this->replaceVars($data, $parameters, "&", "="); + break; + case "continuation": + // Standard URL, but with leading ampersand. Uses key name. + $prefix = "&"; + $data = $this->replaceVars($data, $parameters, "&", "="); + break; + } + + // Add the initial prefix character if data is valid. + if ($data || ($data !== false && $prefix_on_missing)) { + $data = $prefix . $data; + } + + } else { + // If no operator we replace with the defaults. + $data = $this->replaceVars($data, $parameters); + } + // This is chops out the {...} and replaces with the new section. + return substr($string, 0, $start) . $data . substr($string, $end + 1); + } + + private function replaceVars( + $section, + $parameters, + $sep = ",", + $combine = null, + $reserved = false, + $tag_empty = false, + $combine_on_empty = true + ) { + if (strpos($section, ",") === false) { + // If we only have a single value, we can immediately process. + return $this->combine( + $section, + $parameters, + $sep, + $combine, + $reserved, + $tag_empty, + $combine_on_empty + ); + } else { + // If we have multiple values, we need to split and loop over them. + // Each is treated individually, then glued together with the + // separator character. + $vars = explode(",", $section); + return $this->combineList( + $vars, + $sep, + $parameters, + $combine, + $reserved, + false, // Never emit empty strings in multi-param replacements + $combine_on_empty + ); + } + } + + public function combine( + $key, + $parameters, + $sep, + $combine, + $reserved, + $tag_empty, + $combine_on_empty + ) { + $length = false; + $explode = false; + $skip_final_combine = false; + $value = false; + + // Check for length restriction. + if (strpos($key, ":") !== false) { + list($key, $length) = explode(":", $key); + } + + // Check for explode parameter. + if ($key[strlen($key) - 1] == "*") { + $explode = true; + $key = substr($key, 0, -1); + $skip_final_combine = true; + } + + // Define the list separator. + $list_sep = $explode ? $sep : ","; + + if (isset($parameters[$key])) { + $data_type = $this->getDataType($parameters[$key]); + switch($data_type) { + case self::TYPE_SCALAR: + $value = $this->getValue($parameters[$key], $length); + break; + case self::TYPE_LIST: + $values = array(); + foreach ($parameters[$key] as $pkey => $pvalue) { + $pvalue = $this->getValue($pvalue, $length); + if ($combine && $explode) { + $values[$pkey] = $key . $combine . $pvalue; + } else { + $values[$pkey] = $pvalue; + } + } + $value = implode($list_sep, $values); + if ($value == '') { + return ''; + } + break; + case self::TYPE_MAP: + $values = array(); + foreach ($parameters[$key] as $pkey => $pvalue) { + $pvalue = $this->getValue($pvalue, $length); + if ($explode) { + $pkey = $this->getValue($pkey, $length); + $values[] = $pkey . "=" . $pvalue; // Explode triggers = combine. + } else { + $values[] = $pkey; + $values[] = $pvalue; + } + } + $value = implode($list_sep, $values); + if ($value == '') { + return false; + } + break; + } + } else if ($tag_empty) { + // If we are just indicating empty values with their key name, return that. + return $key; + } else { + // Otherwise we can skip this variable due to not being defined. + return false; + } + + if ($reserved) { + $value = str_replace($this->reservedEncoded, $this->reserved, $value); + } + + // If we do not need to include the key name, we just return the raw + // value. + if (!$combine || $skip_final_combine) { + return $value; + } + + // Else we combine the key name: foo=bar, if value is not the empty string. + return $key . ($value != '' || $combine_on_empty ? $combine . $value : ''); + } + + /** + * Return the type of a passed in value + */ + private function getDataType($data) + { + if (is_array($data)) { + reset($data); + if (key($data) !== 0) { + return self::TYPE_MAP; + } + return self::TYPE_LIST; + } + return self::TYPE_SCALAR; + } + + /** + * Utility function that merges multiple combine calls + * for multi-key templates. + */ + private function combineList( + $vars, + $sep, + $parameters, + $combine, + $reserved, + $tag_empty, + $combine_on_empty + ) { + $ret = array(); + foreach ($vars as $var) { + $response = $this->combine( + $var, + $parameters, + $sep, + $combine, + $reserved, + $tag_empty, + $combine_on_empty + ); + if ($response === false) { + continue; + } + $ret[] = $response; + } + return implode($sep, $ret); + } + + /** + * Utility function to encode and trim values + */ + private function getValue($value, $length) + { + if ($length) { + $value = substr($value, 0, $length); + } + $value = rawurlencode($value); + return $value; + } +} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Verifier.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Abstract.php similarity index 91% rename from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Verifier.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Abstract.php index 2839a371df..e6c9eeb03c 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Verifier.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Abstract.php @@ -15,14 +15,13 @@ * limitations under the License. */ -require_once "Google_PemVerifier.php"; - /** * Verifies signatures. * * @author Brian Eaton */ -abstract class Google_Verifier { +abstract class Google_Verifier_Abstract +{ /** * Checks a signature, returns true if the signature is correct, * false otherwise. diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_PemVerifier.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Pem.php similarity index 75% rename from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_PemVerifier.php rename to apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Pem.php index 6c1c85fa20..8b4d1ab164 100644 --- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_PemVerifier.php +++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Pem.php @@ -14,13 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +require_once 'Google/Auth/Exception.php'; +require_once 'Google/Verifier/Abstract.php'; /** * Verifies signatures using PEM encoded certificates. * * @author Brian Eaton */ -class Google_PemVerifier extends Google_Verifier { +class Google_Verifier_Pem extends Google_Verifier_Abstract +{ private $publicKey; /** @@ -28,20 +32,22 @@ class Google_PemVerifier extends Google_Verifier { * * $pem: a PEM encoded certificate (not a file). * @param $pem - * @throws Google_AuthException + * @throws Google_Auth_Exception * @throws Google_Exception */ - function __construct($pem) { + public 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"); + throw new Google_Auth_Exception("Unable to parse PEM: $pem"); } } - function __destruct() { + public function __destruct() + { if ($this->publicKey) { openssl_x509_free($this->publicKey); } @@ -53,13 +59,14 @@ class Google_PemVerifier extends Google_Verifier { * Returns true if the signature is valid, false otherwise. * @param $data * @param $signature - * @throws Google_AuthException + * @throws Google_Auth_Exception * @return bool */ - function verify($data, $signature) { + public 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()); + throw new Google_Auth_Exception('Signature verification error: ' . openssl_error_string()); } return $status === 1; } diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google_Client.php b/apps/files_external/3rdparty/google-api-php-client/src/Google_Client.php deleted file mode 100644 index 498d3a8e9d..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/Google_Client.php +++ /dev/null @@ -1,462 +0,0 @@ - - * @author Chirag Shah - */ -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; - } - - /** - * Returns the list of scopes set on the client - * @return array the list of scopes - * - */ - public function getScopes() { - return $this->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/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AuthNone.php b/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AuthNone.php deleted file mode 100644 index 6ca6bc2b0d..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AuthNone.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @author Chirag Shah - */ -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/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_OAuth2.php b/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_OAuth2.php deleted file mode 100644 index a07d4365a7..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_OAuth2.php +++ /dev/null @@ -1,445 +0,0 @@ - - * @author Chirag Shah - * - */ -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/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_ApcCache.php b/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_ApcCache.php deleted file mode 100644 index 3523c98dcc..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_ApcCache.php +++ /dev/null @@ -1,98 +0,0 @@ - - */ -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/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_FileCache.php b/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_FileCache.php deleted file mode 100644 index 1e32859a48..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_FileCache.php +++ /dev/null @@ -1,137 +0,0 @@ - - */ -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 up to 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 hiccups - $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/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_MemcacheCache.php b/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_MemcacheCache.php deleted file mode 100644 index 22493f8b1e..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_MemcacheCache.php +++ /dev/null @@ -1,130 +0,0 @@ - - */ -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/apps/files_external/3rdparty/google-api-php-client/src/config.php b/apps/files_external/3rdparty/google-api-php-client/src/config.php deleted file mode 100644 index e3a57138d0..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/config.php +++ /dev/null @@ -1,81 +0,0 @@ - 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.login'), - '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') - ) -); diff --git a/apps/files_external/3rdparty/google-api-php-client/src/contrib/Google_DriveService.php b/apps/files_external/3rdparty/google-api-php-client/src/contrib/Google_DriveService.php deleted file mode 100644 index 896e8b9382..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/contrib/Google_DriveService.php +++ /dev/null @@ -1,3143 +0,0 @@ - - * $driveService = new Google_DriveService(...); - * $about = $driveService->about; - * - */ - class Google_AboutServiceResource extends Google_ServiceResource { - - - /** - * Gets the information about the current user along with Drive API settings (about.get) - * - * @param array $optParams Optional parameters. - * - * @opt_param bool includeSubscribed When calculating the number of remaining change IDs, whether to include shared files and public files the user has opened. When set to false, this counts only change IDs for owned files and any shared or public files that the user has explictly added to a folder in Drive. - * @opt_param string maxChangeIdCount Maximum number of remaining change IDs to count - * @opt_param string startChangeId Change ID to start counting from when calculating number of remaining change IDs - * @return Google_About - */ - public function get($optParams = array()) { - $params = array(); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_About($data); - } else { - return $data; - } - } - } - - /** - * The "apps" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $apps = $driveService->apps; - * - */ - class Google_AppsServiceResource extends Google_ServiceResource { - - - /** - * Gets a specific app. (apps.get) - * - * @param string $appId The ID of the app. - * @param array $optParams Optional parameters. - * @return Google_App - */ - public function get($appId, $optParams = array()) { - $params = array('appId' => $appId); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_App($data); - } else { - return $data; - } - } - /** - * Lists a user's installed apps. (apps.list) - * - * @param array $optParams Optional parameters. - * @return Google_AppList - */ - public function listApps($optParams = array()) { - $params = array(); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_AppList($data); - } else { - return $data; - } - } - } - - /** - * The "changes" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $changes = $driveService->changes; - * - */ - class Google_ChangesServiceResource extends Google_ServiceResource { - - - /** - * Gets a specific change. (changes.get) - * - * @param string $changeId The ID of the change. - * @param array $optParams Optional parameters. - * @return Google_Change - */ - public function get($changeId, $optParams = array()) { - $params = array('changeId' => $changeId); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_Change($data); - } else { - return $data; - } - } - /** - * Lists the changes for a user. (changes.list) - * - * @param array $optParams Optional parameters. - * - * @opt_param bool includeDeleted Whether to include deleted items. - * @opt_param bool includeSubscribed Whether to include shared files and public files the user has opened. When set to false, the list will include owned files plus any shared or public files the user has explictly added to a folder in Drive. - * @opt_param int maxResults Maximum number of changes to return. - * @opt_param string pageToken Page token for changes. - * @opt_param string startChangeId Change ID to start listing changes from. - * @return Google_ChangeList - */ - public function listChanges($optParams = array()) { - $params = array(); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_ChangeList($data); - } else { - return $data; - } - } - } - - /** - * The "children" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $children = $driveService->children; - * - */ - class Google_ChildrenServiceResource extends Google_ServiceResource { - - - /** - * Removes a child from a folder. (children.delete) - * - * @param string $folderId The ID of the folder. - * @param string $childId The ID of the child. - * @param array $optParams Optional parameters. - */ - public function delete($folderId, $childId, $optParams = array()) { - $params = array('folderId' => $folderId, 'childId' => $childId); - $params = array_merge($params, $optParams); - $data = $this->__call('delete', array($params)); - return $data; - } - /** - * Gets a specific child reference. (children.get) - * - * @param string $folderId The ID of the folder. - * @param string $childId The ID of the child. - * @param array $optParams Optional parameters. - * @return Google_ChildReference - */ - public function get($folderId, $childId, $optParams = array()) { - $params = array('folderId' => $folderId, 'childId' => $childId); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_ChildReference($data); - } else { - return $data; - } - } - /** - * Inserts a file into a folder. (children.insert) - * - * @param string $folderId The ID of the folder. - * @param Google_ChildReference $postBody - * @param array $optParams Optional parameters. - * @return Google_ChildReference - */ - public function insert($folderId, Google_ChildReference $postBody, $optParams = array()) { - $params = array('folderId' => $folderId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('insert', array($params)); - if ($this->useObjects()) { - return new Google_ChildReference($data); - } else { - return $data; - } - } - /** - * Lists a folder's children. (children.list) - * - * @param string $folderId The ID of the folder. - * @param array $optParams Optional parameters. - * - * @opt_param int maxResults Maximum number of children to return. - * @opt_param string pageToken Page token for children. - * @opt_param string q Query string for searching children. - * @return Google_ChildList - */ - public function listChildren($folderId, $optParams = array()) { - $params = array('folderId' => $folderId); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_ChildList($data); - } else { - return $data; - } - } - } - - /** - * The "comments" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $comments = $driveService->comments; - * - */ - class Google_CommentsServiceResource extends Google_ServiceResource { - - - /** - * Deletes a comment. (comments.delete) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param array $optParams Optional parameters. - */ - public function delete($fileId, $commentId, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId); - $params = array_merge($params, $optParams); - $data = $this->__call('delete', array($params)); - return $data; - } - /** - * Gets a comment by ID. (comments.get) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param array $optParams Optional parameters. - * - * @opt_param bool includeDeleted If set, this will succeed when retrieving a deleted comment, and will include any deleted replies. - * @return Google_Comment - */ - public function get($fileId, $commentId, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_Comment($data); - } else { - return $data; - } - } - /** - * Creates a new comment on the given file. (comments.insert) - * - * @param string $fileId The ID of the file. - * @param Google_Comment $postBody - * @param array $optParams Optional parameters. - * @return Google_Comment - */ - public function insert($fileId, Google_Comment $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('insert', array($params)); - if ($this->useObjects()) { - return new Google_Comment($data); - } else { - return $data; - } - } - /** - * Lists a file's comments. (comments.list) - * - * @param string $fileId The ID of the file. - * @param array $optParams Optional parameters. - * - * @opt_param bool includeDeleted If set, all comments and replies, including deleted comments and replies (with content stripped) will be returned. - * @opt_param int maxResults The maximum number of discussions to include in the response, used for paging. - * @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. - * @opt_param string updatedMin Only discussions that were updated after this timestamp will be returned. Formatted as an RFC 3339 timestamp. - * @return Google_CommentList - */ - public function listComments($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_CommentList($data); - } else { - return $data; - } - } - /** - * Updates an existing comment. This method supports patch semantics. (comments.patch) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param Google_Comment $postBody - * @param array $optParams Optional parameters. - * @return Google_Comment - */ - public function patch($fileId, $commentId, Google_Comment $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('patch', array($params)); - if ($this->useObjects()) { - return new Google_Comment($data); - } else { - return $data; - } - } - /** - * Updates an existing comment. (comments.update) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param Google_Comment $postBody - * @param array $optParams Optional parameters. - * @return Google_Comment - */ - public function update($fileId, $commentId, Google_Comment $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('update', array($params)); - if ($this->useObjects()) { - return new Google_Comment($data); - } else { - return $data; - } - } - } - - /** - * The "files" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $files = $driveService->files; - * - */ - class Google_FilesServiceResource extends Google_ServiceResource { - - - /** - * Creates a copy of the specified file. (files.copy) - * - * @param string $fileId The ID of the file to copy. - * @param Google_DriveFile $postBody - * @param array $optParams Optional parameters. - * - * @opt_param bool convert Whether to convert this file to the corresponding Google Docs format. - * @opt_param bool ocr Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads. - * @opt_param string ocrLanguage If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes. - * @opt_param bool pinned Whether to pin the head revision of the new copy. - * @opt_param string timedTextLanguage The language of the timed text. - * @opt_param string timedTextTrackName The timed text track name. - * @return Google_DriveFile - */ - public function copy($fileId, Google_DriveFile $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('copy', array($params)); - if ($this->useObjects()) { - return new Google_DriveFile($data); - } else { - return $data; - } - } - /** - * Permanently deletes a file by ID. Skips the trash. (files.delete) - * - * @param string $fileId The ID of the file to delete. - * @param array $optParams Optional parameters. - */ - public function delete($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('delete', array($params)); - return $data; - } - /** - * Gets a file's metadata by ID. (files.get) - * - * @param string $fileId The ID for the file in question. - * @param array $optParams Optional parameters. - * - * @opt_param string projection This parameter is deprecated and has no function. - * @opt_param bool updateViewedDate Whether to update the view date after successfully retrieving the file. - * @return Google_DriveFile - */ - public function get($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_DriveFile($data); - } else { - return $data; - } - } - /** - * Insert a new file. (files.insert) - * - * @param Google_DriveFile $postBody - * @param array $optParams Optional parameters. - * - * @opt_param bool convert Whether to convert this file to the corresponding Google Docs format. - * @opt_param bool ocr Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads. - * @opt_param string ocrLanguage If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes. - * @opt_param bool pinned Whether to pin the head revision of the uploaded file. - * @opt_param string timedTextLanguage The language of the timed text. - * @opt_param string timedTextTrackName The timed text track name. - * @opt_param bool useContentAsIndexableText Whether to use the content as indexable text. - * @return Google_DriveFile - */ - public function insert(Google_DriveFile $postBody, $optParams = array()) { - $params = array('postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('insert', array($params)); - if ($this->useObjects()) { - return new Google_DriveFile($data); - } else { - return $data; - } - } - /** - * Lists the user's files. (files.list) - * - * @param array $optParams Optional parameters. - * - * @opt_param int maxResults Maximum number of files to return. - * @opt_param string pageToken Page token for files. - * @opt_param string projection This parameter is deprecated and has no function. - * @opt_param string q Query string for searching files. - * @return Google_FileList - */ - public function listFiles($optParams = array()) { - $params = array(); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_FileList($data); - } else { - return $data; - } - } - /** - * Updates file metadata and/or content. This method supports patch semantics. (files.patch) - * - * @param string $fileId The ID of the file to update. - * @param Google_DriveFile $postBody - * @param array $optParams Optional parameters. - * - * @opt_param bool convert Whether to convert this file to the corresponding Google Docs format. - * @opt_param bool newRevision Whether a blob upload should create a new revision. If not set or false, the blob data in the current head revision is replaced. If true, a new blob is created as head revision, and previous revisions are preserved (causing increased use of the user's data storage quota). - * @opt_param bool ocr Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads. - * @opt_param string ocrLanguage If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes. - * @opt_param bool pinned Whether to pin the new revision. - * @opt_param bool setModifiedDate Whether to set the modified date with the supplied modified date. - * @opt_param string timedTextLanguage The language of the timed text. - * @opt_param string timedTextTrackName The timed text track name. - * @opt_param bool updateViewedDate Whether to update the view date after successfully updating the file. - * @opt_param bool useContentAsIndexableText Whether to use the content as indexable text. - * @return Google_DriveFile - */ - public function patch($fileId, Google_DriveFile $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('patch', array($params)); - if ($this->useObjects()) { - return new Google_DriveFile($data); - } else { - return $data; - } - } - /** - * Set the file's updated time to the current server time. (files.touch) - * - * @param string $fileId The ID of the file to update. - * @param array $optParams Optional parameters. - * @return Google_DriveFile - */ - public function touch($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('touch', array($params)); - if ($this->useObjects()) { - return new Google_DriveFile($data); - } else { - return $data; - } - } - /** - * Moves a file to the trash. (files.trash) - * - * @param string $fileId The ID of the file to trash. - * @param array $optParams Optional parameters. - * @return Google_DriveFile - */ - public function trash($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('trash', array($params)); - if ($this->useObjects()) { - return new Google_DriveFile($data); - } else { - return $data; - } - } - /** - * Restores a file from the trash. (files.untrash) - * - * @param string $fileId The ID of the file to untrash. - * @param array $optParams Optional parameters. - * @return Google_DriveFile - */ - public function untrash($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('untrash', array($params)); - if ($this->useObjects()) { - return new Google_DriveFile($data); - } else { - return $data; - } - } - /** - * Updates file metadata and/or content. (files.update) - * - * @param string $fileId The ID of the file to update. - * @param Google_DriveFile $postBody - * @param array $optParams Optional parameters. - * - * @opt_param bool convert Whether to convert this file to the corresponding Google Docs format. - * @opt_param bool newRevision Whether a blob upload should create a new revision. If not set or false, the blob data in the current head revision is replaced. If true, a new blob is created as head revision, and previous revisions are preserved (causing increased use of the user's data storage quota). - * @opt_param bool ocr Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads. - * @opt_param string ocrLanguage If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes. - * @opt_param bool pinned Whether to pin the new revision. - * @opt_param bool setModifiedDate Whether to set the modified date with the supplied modified date. - * @opt_param string timedTextLanguage The language of the timed text. - * @opt_param string timedTextTrackName The timed text track name. - * @opt_param bool updateViewedDate Whether to update the view date after successfully updating the file. - * @opt_param bool useContentAsIndexableText Whether to use the content as indexable text. - * @return Google_DriveFile - */ - public function update($fileId, Google_DriveFile $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('update', array($params)); - if ($this->useObjects()) { - return new Google_DriveFile($data); - } else { - return $data; - } - } - } - - /** - * The "parents" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $parents = $driveService->parents; - * - */ - class Google_ParentsServiceResource extends Google_ServiceResource { - - - /** - * Removes a parent from a file. (parents.delete) - * - * @param string $fileId The ID of the file. - * @param string $parentId The ID of the parent. - * @param array $optParams Optional parameters. - */ - public function delete($fileId, $parentId, $optParams = array()) { - $params = array('fileId' => $fileId, 'parentId' => $parentId); - $params = array_merge($params, $optParams); - $data = $this->__call('delete', array($params)); - return $data; - } - /** - * Gets a specific parent reference. (parents.get) - * - * @param string $fileId The ID of the file. - * @param string $parentId The ID of the parent. - * @param array $optParams Optional parameters. - * @return Google_ParentReference - */ - public function get($fileId, $parentId, $optParams = array()) { - $params = array('fileId' => $fileId, 'parentId' => $parentId); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_ParentReference($data); - } else { - return $data; - } - } - /** - * Adds a parent folder for a file. (parents.insert) - * - * @param string $fileId The ID of the file. - * @param Google_ParentReference $postBody - * @param array $optParams Optional parameters. - * @return Google_ParentReference - */ - public function insert($fileId, Google_ParentReference $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('insert', array($params)); - if ($this->useObjects()) { - return new Google_ParentReference($data); - } else { - return $data; - } - } - /** - * Lists a file's parents. (parents.list) - * - * @param string $fileId The ID of the file. - * @param array $optParams Optional parameters. - * @return Google_ParentList - */ - public function listParents($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_ParentList($data); - } else { - return $data; - } - } - } - - /** - * The "permissions" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $permissions = $driveService->permissions; - * - */ - class Google_PermissionsServiceResource extends Google_ServiceResource { - - - /** - * Deletes a permission from a file. (permissions.delete) - * - * @param string $fileId The ID for the file. - * @param string $permissionId The ID for the permission. - * @param array $optParams Optional parameters. - */ - public function delete($fileId, $permissionId, $optParams = array()) { - $params = array('fileId' => $fileId, 'permissionId' => $permissionId); - $params = array_merge($params, $optParams); - $data = $this->__call('delete', array($params)); - return $data; - } - /** - * Gets a permission by ID. (permissions.get) - * - * @param string $fileId The ID for the file. - * @param string $permissionId The ID for the permission. - * @param array $optParams Optional parameters. - * @return Google_Permission - */ - public function get($fileId, $permissionId, $optParams = array()) { - $params = array('fileId' => $fileId, 'permissionId' => $permissionId); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_Permission($data); - } else { - return $data; - } - } - /** - * Inserts a permission for a file. (permissions.insert) - * - * @param string $fileId The ID for the file. - * @param Google_Permission $postBody - * @param array $optParams Optional parameters. - * - * @opt_param string emailMessage A custom message to include in notification emails. - * @opt_param bool sendNotificationEmails Whether to send notification emails when sharing to users or groups. - * @return Google_Permission - */ - public function insert($fileId, Google_Permission $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('insert', array($params)); - if ($this->useObjects()) { - return new Google_Permission($data); - } else { - return $data; - } - } - /** - * Lists a file's permissions. (permissions.list) - * - * @param string $fileId The ID for the file. - * @param array $optParams Optional parameters. - * @return Google_PermissionList - */ - public function listPermissions($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_PermissionList($data); - } else { - return $data; - } - } - /** - * Updates a permission. This method supports patch semantics. (permissions.patch) - * - * @param string $fileId The ID for the file. - * @param string $permissionId The ID for the permission. - * @param Google_Permission $postBody - * @param array $optParams Optional parameters. - * - * @opt_param bool transferOwnership Whether changing a role to 'owner' should also downgrade the current owners to writers. - * @return Google_Permission - */ - public function patch($fileId, $permissionId, Google_Permission $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('patch', array($params)); - if ($this->useObjects()) { - return new Google_Permission($data); - } else { - return $data; - } - } - /** - * Updates a permission. (permissions.update) - * - * @param string $fileId The ID for the file. - * @param string $permissionId The ID for the permission. - * @param Google_Permission $postBody - * @param array $optParams Optional parameters. - * - * @opt_param bool transferOwnership Whether changing a role to 'owner' should also downgrade the current owners to writers. - * @return Google_Permission - */ - public function update($fileId, $permissionId, Google_Permission $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('update', array($params)); - if ($this->useObjects()) { - return new Google_Permission($data); - } else { - return $data; - } - } - } - - /** - * The "properties" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $properties = $driveService->properties; - * - */ - class Google_PropertiesServiceResource extends Google_ServiceResource { - - - /** - * Deletes a property. (properties.delete) - * - * @param string $fileId The ID of the file. - * @param string $propertyKey The key of the property. - * @param array $optParams Optional parameters. - * - * @opt_param string visibility The visibility of the property. - */ - public function delete($fileId, $propertyKey, $optParams = array()) { - $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey); - $params = array_merge($params, $optParams); - $data = $this->__call('delete', array($params)); - return $data; - } - /** - * Gets a property by its key. (properties.get) - * - * @param string $fileId The ID of the file. - * @param string $propertyKey The key of the property. - * @param array $optParams Optional parameters. - * - * @opt_param string visibility The visibility of the property. - * @return Google_Property - */ - public function get($fileId, $propertyKey, $optParams = array()) { - $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_Property($data); - } else { - return $data; - } - } - /** - * Adds a property to a file. (properties.insert) - * - * @param string $fileId The ID of the file. - * @param Google_Property $postBody - * @param array $optParams Optional parameters. - * @return Google_Property - */ - public function insert($fileId, Google_Property $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('insert', array($params)); - if ($this->useObjects()) { - return new Google_Property($data); - } else { - return $data; - } - } - /** - * Lists a file's properties. (properties.list) - * - * @param string $fileId The ID of the file. - * @param array $optParams Optional parameters. - * @return Google_PropertyList - */ - public function listProperties($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_PropertyList($data); - } else { - return $data; - } - } - /** - * Updates a property. This method supports patch semantics. (properties.patch) - * - * @param string $fileId The ID of the file. - * @param string $propertyKey The key of the property. - * @param Google_Property $postBody - * @param array $optParams Optional parameters. - * - * @opt_param string visibility The visibility of the property. - * @return Google_Property - */ - public function patch($fileId, $propertyKey, Google_Property $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('patch', array($params)); - if ($this->useObjects()) { - return new Google_Property($data); - } else { - return $data; - } - } - /** - * Updates a property. (properties.update) - * - * @param string $fileId The ID of the file. - * @param string $propertyKey The key of the property. - * @param Google_Property $postBody - * @param array $optParams Optional parameters. - * - * @opt_param string visibility The visibility of the property. - * @return Google_Property - */ - public function update($fileId, $propertyKey, Google_Property $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('update', array($params)); - if ($this->useObjects()) { - return new Google_Property($data); - } else { - return $data; - } - } - } - - /** - * The "replies" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $replies = $driveService->replies; - * - */ - class Google_RepliesServiceResource extends Google_ServiceResource { - - - /** - * Deletes a reply. (replies.delete) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param string $replyId The ID of the reply. - * @param array $optParams Optional parameters. - */ - public function delete($fileId, $commentId, $replyId, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId); - $params = array_merge($params, $optParams); - $data = $this->__call('delete', array($params)); - return $data; - } - /** - * Gets a reply. (replies.get) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param string $replyId The ID of the reply. - * @param array $optParams Optional parameters. - * - * @opt_param bool includeDeleted If set, this will succeed when retrieving a deleted reply. - * @return Google_CommentReply - */ - public function get($fileId, $commentId, $replyId, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_CommentReply($data); - } else { - return $data; - } - } - /** - * Creates a new reply to the given comment. (replies.insert) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param Google_CommentReply $postBody - * @param array $optParams Optional parameters. - * @return Google_CommentReply - */ - public function insert($fileId, $commentId, Google_CommentReply $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('insert', array($params)); - if ($this->useObjects()) { - return new Google_CommentReply($data); - } else { - return $data; - } - } - /** - * Lists all of the replies to a comment. (replies.list) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param array $optParams Optional parameters. - * - * @opt_param bool includeDeleted If set, all replies, including deleted replies (with content stripped) will be returned. - * @opt_param int maxResults The maximum number of replies to include in the response, used for paging. - * @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. - * @return Google_CommentReplyList - */ - public function listReplies($fileId, $commentId, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_CommentReplyList($data); - } else { - return $data; - } - } - /** - * Updates an existing reply. This method supports patch semantics. (replies.patch) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param string $replyId The ID of the reply. - * @param Google_CommentReply $postBody - * @param array $optParams Optional parameters. - * @return Google_CommentReply - */ - public function patch($fileId, $commentId, $replyId, Google_CommentReply $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('patch', array($params)); - if ($this->useObjects()) { - return new Google_CommentReply($data); - } else { - return $data; - } - } - /** - * Updates an existing reply. (replies.update) - * - * @param string $fileId The ID of the file. - * @param string $commentId The ID of the comment. - * @param string $replyId The ID of the reply. - * @param Google_CommentReply $postBody - * @param array $optParams Optional parameters. - * @return Google_CommentReply - */ - public function update($fileId, $commentId, $replyId, Google_CommentReply $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('update', array($params)); - if ($this->useObjects()) { - return new Google_CommentReply($data); - } else { - return $data; - } - } - } - - /** - * The "revisions" collection of methods. - * Typical usage is: - * - * $driveService = new Google_DriveService(...); - * $revisions = $driveService->revisions; - * - */ - class Google_RevisionsServiceResource extends Google_ServiceResource { - - - /** - * Removes a revision. (revisions.delete) - * - * @param string $fileId The ID of the file. - * @param string $revisionId The ID of the revision. - * @param array $optParams Optional parameters. - */ - public function delete($fileId, $revisionId, $optParams = array()) { - $params = array('fileId' => $fileId, 'revisionId' => $revisionId); - $params = array_merge($params, $optParams); - $data = $this->__call('delete', array($params)); - return $data; - } - /** - * Gets a specific revision. (revisions.get) - * - * @param string $fileId The ID of the file. - * @param string $revisionId The ID of the revision. - * @param array $optParams Optional parameters. - * @return Google_Revision - */ - public function get($fileId, $revisionId, $optParams = array()) { - $params = array('fileId' => $fileId, 'revisionId' => $revisionId); - $params = array_merge($params, $optParams); - $data = $this->__call('get', array($params)); - if ($this->useObjects()) { - return new Google_Revision($data); - } else { - return $data; - } - } - /** - * Lists a file's revisions. (revisions.list) - * - * @param string $fileId The ID of the file. - * @param array $optParams Optional parameters. - * @return Google_RevisionList - */ - public function listRevisions($fileId, $optParams = array()) { - $params = array('fileId' => $fileId); - $params = array_merge($params, $optParams); - $data = $this->__call('list', array($params)); - if ($this->useObjects()) { - return new Google_RevisionList($data); - } else { - return $data; - } - } - /** - * Updates a revision. This method supports patch semantics. (revisions.patch) - * - * @param string $fileId The ID for the file. - * @param string $revisionId The ID for the revision. - * @param Google_Revision $postBody - * @param array $optParams Optional parameters. - * @return Google_Revision - */ - public function patch($fileId, $revisionId, Google_Revision $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('patch', array($params)); - if ($this->useObjects()) { - return new Google_Revision($data); - } else { - return $data; - } - } - /** - * Updates a revision. (revisions.update) - * - * @param string $fileId The ID for the file. - * @param string $revisionId The ID for the revision. - * @param Google_Revision $postBody - * @param array $optParams Optional parameters. - * @return Google_Revision - */ - public function update($fileId, $revisionId, Google_Revision $postBody, $optParams = array()) { - $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody); - $params = array_merge($params, $optParams); - $data = $this->__call('update', array($params)); - if ($this->useObjects()) { - return new Google_Revision($data); - } else { - return $data; - } - } - } - -/** - * Service definition for Google_Drive (v2). - * - *

- * The API to interact with Drive. - *

- * - *

- * For more information about this service, see the - * API Documentation - *

- * - * @author Google, Inc. - */ -class Google_DriveService extends Google_Service { - public $about; - public $apps; - public $changes; - public $children; - public $comments; - public $files; - public $parents; - public $permissions; - public $properties; - public $replies; - public $revisions; - /** - * Constructs the internal representation of the Drive service. - * - * @param Google_Client $client - */ - public function __construct(Google_Client $client) { - $this->servicePath = 'drive/v2/'; - $this->version = 'v2'; - $this->serviceName = 'drive'; - - $client->addService($this->serviceName, $this->version); - $this->about = new Google_AboutServiceResource($this, $this->serviceName, 'about', json_decode('{"methods": {"get": {"id": "drive.about.get", "path": "about", "httpMethod": "GET", "parameters": {"includeSubscribed": {"type": "boolean", "default": "true", "location": "query"}, "maxChangeIdCount": {"type": "string", "default": "1", "format": "int64", "location": "query"}, "startChangeId": {"type": "string", "format": "int64", "location": "query"}}, "response": {"$ref": "About"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}}}', true)); - $this->apps = new Google_AppsServiceResource($this, $this->serviceName, 'apps', json_decode('{"methods": {"get": {"id": "drive.apps.get", "path": "apps/{appId}", "httpMethod": "GET", "parameters": {"appId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "App"}, "scopes": ["https://www.googleapis.com/auth/drive.apps.readonly"]}, "list": {"id": "drive.apps.list", "path": "apps", "httpMethod": "GET", "response": {"$ref": "AppList"}, "scopes": ["https://www.googleapis.com/auth/drive.apps.readonly"]}}}', true)); - $this->changes = new Google_ChangesServiceResource($this, $this->serviceName, 'changes', json_decode('{"methods": {"get": {"id": "drive.changes.get", "path": "changes/{changeId}", "httpMethod": "GET", "parameters": {"changeId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Change"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "list": {"id": "drive.changes.list", "path": "changes", "httpMethod": "GET", "parameters": {"includeDeleted": {"type": "boolean", "default": "true", "location": "query"}, "includeSubscribed": {"type": "boolean", "default": "true", "location": "query"}, "maxResults": {"type": "integer", "default": "100", "format": "int32", "minimum": "0", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "startChangeId": {"type": "string", "format": "int64", "location": "query"}}, "response": {"$ref": "ChangeList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"], "supportsSubscription": true}}}', true)); - $this->children = new Google_ChildrenServiceResource($this, $this->serviceName, 'children', json_decode('{"methods": {"delete": {"id": "drive.children.delete", "path": "files/{folderId}/children/{childId}", "httpMethod": "DELETE", "parameters": {"childId": {"type": "string", "required": true, "location": "path"}, "folderId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.children.get", "path": "files/{folderId}/children/{childId}", "httpMethod": "GET", "parameters": {"childId": {"type": "string", "required": true, "location": "path"}, "folderId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "ChildReference"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.children.insert", "path": "files/{folderId}/children", "httpMethod": "POST", "parameters": {"folderId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "ChildReference"}, "response": {"$ref": "ChildReference"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.children.list", "path": "files/{folderId}/children", "httpMethod": "GET", "parameters": {"folderId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "default": "100", "format": "int32", "minimum": "0", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "q": {"type": "string", "location": "query"}}, "response": {"$ref": "ChildList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}}}', true)); - $this->comments = new Google_CommentsServiceResource($this, $this->serviceName, 'comments', json_decode('{"methods": {"delete": {"id": "drive.comments.delete", "path": "files/{fileId}/comments/{commentId}", "httpMethod": "DELETE", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "get": {"id": "drive.comments.get", "path": "files/{fileId}/comments/{commentId}", "httpMethod": "GET", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "includeDeleted": {"type": "boolean", "default": "false", "location": "query"}}, "response": {"$ref": "Comment"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.comments.insert", "path": "files/{fileId}/comments", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Comment"}, "response": {"$ref": "Comment"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "list": {"id": "drive.comments.list", "path": "files/{fileId}/comments", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "includeDeleted": {"type": "boolean", "default": "false", "location": "query"}, "maxResults": {"type": "integer", "default": "20", "format": "int32", "minimum": "0", "maximum": "100", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "updatedMin": {"type": "string", "location": "query"}}, "response": {"$ref": "CommentList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.comments.patch", "path": "files/{fileId}/comments/{commentId}", "httpMethod": "PATCH", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Comment"}, "response": {"$ref": "Comment"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.comments.update", "path": "files/{fileId}/comments/{commentId}", "httpMethod": "PUT", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Comment"}, "response": {"$ref": "Comment"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true)); - $this->files = new Google_FilesServiceResource($this, $this->serviceName, 'files', json_decode('{"methods": {"copy": {"id": "drive.files.copy", "path": "files/{fileId}/copy", "httpMethod": "POST", "parameters": {"convert": {"type": "boolean", "default": "false", "location": "query"}, "fileId": {"type": "string", "required": true, "location": "path"}, "ocr": {"type": "boolean", "default": "false", "location": "query"}, "ocrLanguage": {"type": "string", "location": "query"}, "pinned": {"type": "boolean", "default": "false", "location": "query"}, "timedTextLanguage": {"type": "string", "location": "query"}, "timedTextTrackName": {"type": "string", "location": "query"}}, "request": {"$ref": "File"}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "delete": {"id": "drive.files.delete", "path": "files/{fileId}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.files.get", "path": "files/{fileId}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "projection": {"type": "string", "enum": ["BASIC", "FULL"], "location": "query"}, "updateViewedDate": {"type": "boolean", "default": "false", "location": "query"}}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"], "supportsSubscription": true}, "insert": {"id": "drive.files.insert", "path": "files", "httpMethod": "POST", "parameters": {"convert": {"type": "boolean", "default": "false", "location": "query"}, "ocr": {"type": "boolean", "default": "false", "location": "query"}, "ocrLanguage": {"type": "string", "location": "query"}, "pinned": {"type": "boolean", "default": "false", "location": "query"}, "timedTextLanguage": {"type": "string", "location": "query"}, "timedTextTrackName": {"type": "string", "location": "query"}, "useContentAsIndexableText": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "File"}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"], "supportsMediaUpload": true, "mediaUpload": {"accept": ["*/*"], "maxSize": "10GB", "protocols": {"simple": {"multipart": true, "path": "/upload/drive/v2/files"}, "resumable": {"multipart": true, "path": "/resumable/upload/drive/v2/files"}}}, "supportsSubscription": true}, "list": {"id": "drive.files.list", "path": "files", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "default": "100", "format": "int32", "minimum": "0", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "projection": {"type": "string", "enum": ["BASIC", "FULL"], "location": "query"}, "q": {"type": "string", "location": "query"}}, "response": {"$ref": "FileList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.files.patch", "path": "files/{fileId}", "httpMethod": "PATCH", "parameters": {"convert": {"type": "boolean", "default": "false", "location": "query"}, "fileId": {"type": "string", "required": true, "location": "path"}, "newRevision": {"type": "boolean", "default": "true", "location": "query"}, "ocr": {"type": "boolean", "default": "false", "location": "query"}, "ocrLanguage": {"type": "string", "location": "query"}, "pinned": {"type": "boolean", "default": "false", "location": "query"}, "setModifiedDate": {"type": "boolean", "default": "false", "location": "query"}, "timedTextLanguage": {"type": "string", "location": "query"}, "timedTextTrackName": {"type": "string", "location": "query"}, "updateViewedDate": {"type": "boolean", "default": "true", "location": "query"}, "useContentAsIndexableText": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "File"}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.scripts"]}, "touch": {"id": "drive.files.touch", "path": "files/{fileId}/touch", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "trash": {"id": "drive.files.trash", "path": "files/{fileId}/trash", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "untrash": {"id": "drive.files.untrash", "path": "files/{fileId}/untrash", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.files.update", "path": "files/{fileId}", "httpMethod": "PUT", "parameters": {"convert": {"type": "boolean", "default": "false", "location": "query"}, "fileId": {"type": "string", "required": true, "location": "path"}, "newRevision": {"type": "boolean", "default": "true", "location": "query"}, "ocr": {"type": "boolean", "default": "false", "location": "query"}, "ocrLanguage": {"type": "string", "location": "query"}, "pinned": {"type": "boolean", "default": "false", "location": "query"}, "setModifiedDate": {"type": "boolean", "default": "false", "location": "query"}, "timedTextLanguage": {"type": "string", "location": "query"}, "timedTextTrackName": {"type": "string", "location": "query"}, "updateViewedDate": {"type": "boolean", "default": "true", "location": "query"}, "useContentAsIndexableText": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "File"}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.scripts"], "supportsMediaUpload": true, "mediaUpload": {"accept": ["*/*"], "maxSize": "10GB", "protocols": {"simple": {"multipart": true, "path": "/upload/drive/v2/files/{fileId}"}, "resumable": {"multipart": true, "path": "/resumable/upload/drive/v2/files/{fileId}"}}}}}}', true)); - $this->parents = new Google_ParentsServiceResource($this, $this->serviceName, 'parents', json_decode('{"methods": {"delete": {"id": "drive.parents.delete", "path": "files/{fileId}/parents/{parentId}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "parentId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.parents.get", "path": "files/{fileId}/parents/{parentId}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "parentId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "ParentReference"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.parents.insert", "path": "files/{fileId}/parents", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "ParentReference"}, "response": {"$ref": "ParentReference"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.parents.list", "path": "files/{fileId}/parents", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "ParentList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}}}', true)); - $this->permissions = new Google_PermissionsServiceResource($this, $this->serviceName, 'permissions', json_decode('{"methods": {"delete": {"id": "drive.permissions.delete", "path": "files/{fileId}/permissions/{permissionId}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "permissionId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.permissions.get", "path": "files/{fileId}/permissions/{permissionId}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "permissionId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Permission"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.permissions.insert", "path": "files/{fileId}/permissions", "httpMethod": "POST", "parameters": {"emailMessage": {"type": "string", "location": "query"}, "fileId": {"type": "string", "required": true, "location": "path"}, "sendNotificationEmails": {"type": "boolean", "default": "true", "location": "query"}}, "request": {"$ref": "Permission"}, "response": {"$ref": "Permission"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.permissions.list", "path": "files/{fileId}/permissions", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "PermissionList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.permissions.patch", "path": "files/{fileId}/permissions/{permissionId}", "httpMethod": "PATCH", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "permissionId": {"type": "string", "required": true, "location": "path"}, "transferOwnership": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "Permission"}, "response": {"$ref": "Permission"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.permissions.update", "path": "files/{fileId}/permissions/{permissionId}", "httpMethod": "PUT", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "permissionId": {"type": "string", "required": true, "location": "path"}, "transferOwnership": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "Permission"}, "response": {"$ref": "Permission"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true)); - $this->properties = new Google_PropertiesServiceResource($this, $this->serviceName, 'properties', json_decode('{"methods": {"delete": {"id": "drive.properties.delete", "path": "files/{fileId}/properties/{propertyKey}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "propertyKey": {"type": "string", "required": true, "location": "path"}, "visibility": {"type": "string", "default": "private", "location": "query"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.properties.get", "path": "files/{fileId}/properties/{propertyKey}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "propertyKey": {"type": "string", "required": true, "location": "path"}, "visibility": {"type": "string", "default": "private", "location": "query"}}, "response": {"$ref": "Property"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.properties.insert", "path": "files/{fileId}/properties", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Property"}, "response": {"$ref": "Property"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.properties.list", "path": "files/{fileId}/properties", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "PropertyList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.properties.patch", "path": "files/{fileId}/properties/{propertyKey}", "httpMethod": "PATCH", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "propertyKey": {"type": "string", "required": true, "location": "path"}, "visibility": {"type": "string", "default": "private", "location": "query"}}, "request": {"$ref": "Property"}, "response": {"$ref": "Property"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.properties.update", "path": "files/{fileId}/properties/{propertyKey}", "httpMethod": "PUT", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "propertyKey": {"type": "string", "required": true, "location": "path"}, "visibility": {"type": "string", "default": "private", "location": "query"}}, "request": {"$ref": "Property"}, "response": {"$ref": "Property"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true)); - $this->replies = new Google_RepliesServiceResource($this, $this->serviceName, 'replies', json_decode('{"methods": {"delete": {"id": "drive.replies.delete", "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", "httpMethod": "DELETE", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "replyId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.replies.get", "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", "httpMethod": "GET", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "includeDeleted": {"type": "boolean", "default": "false", "location": "query"}, "replyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "CommentReply"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.replies.insert", "path": "files/{fileId}/comments/{commentId}/replies", "httpMethod": "POST", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "CommentReply"}, "response": {"$ref": "CommentReply"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.replies.list", "path": "files/{fileId}/comments/{commentId}/replies", "httpMethod": "GET", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "includeDeleted": {"type": "boolean", "default": "false", "location": "query"}, "maxResults": {"type": "integer", "default": "20", "format": "int32", "minimum": "0", "maximum": "100", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "CommentReplyList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.replies.patch", "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", "httpMethod": "PATCH", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "replyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "CommentReply"}, "response": {"$ref": "CommentReply"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.replies.update", "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", "httpMethod": "PUT", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "replyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "CommentReply"}, "response": {"$ref": "CommentReply"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true)); - $this->revisions = new Google_RevisionsServiceResource($this, $this->serviceName, 'revisions', json_decode('{"methods": {"delete": {"id": "drive.revisions.delete", "path": "files/{fileId}/revisions/{revisionId}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "revisionId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.revisions.get", "path": "files/{fileId}/revisions/{revisionId}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "revisionId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Revision"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "list": {"id": "drive.revisions.list", "path": "files/{fileId}/revisions", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "RevisionList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.revisions.patch", "path": "files/{fileId}/revisions/{revisionId}", "httpMethod": "PATCH", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "revisionId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Revision"}, "response": {"$ref": "Revision"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.revisions.update", "path": "files/{fileId}/revisions/{revisionId}", "httpMethod": "PUT", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "revisionId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Revision"}, "response": {"$ref": "Revision"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true)); - - } -} - - - -class Google_About extends Google_Model { - protected $__additionalRoleInfoType = 'Google_AboutAdditionalRoleInfo'; - protected $__additionalRoleInfoDataType = 'array'; - public $additionalRoleInfo; - public $domainSharingPolicy; - public $etag; - protected $__exportFormatsType = 'Google_AboutExportFormats'; - protected $__exportFormatsDataType = 'array'; - public $exportFormats; - protected $__featuresType = 'Google_AboutFeatures'; - protected $__featuresDataType = 'array'; - public $features; - protected $__importFormatsType = 'Google_AboutImportFormats'; - protected $__importFormatsDataType = 'array'; - public $importFormats; - public $isCurrentAppInstalled; - public $kind; - public $largestChangeId; - protected $__maxUploadSizesType = 'Google_AboutMaxUploadSizes'; - protected $__maxUploadSizesDataType = 'array'; - public $maxUploadSizes; - public $name; - public $permissionId; - public $quotaBytesTotal; - public $quotaBytesUsed; - public $quotaBytesUsedAggregate; - public $quotaBytesUsedInTrash; - public $remainingChangeIds; - public $rootFolderId; - public $selfLink; - protected $__userType = 'Google_User'; - protected $__userDataType = ''; - public $user; - public function setAdditionalRoleInfo(/* array(Google_AboutAdditionalRoleInfo) */ $additionalRoleInfo) { - $this->assertIsArray($additionalRoleInfo, 'Google_AboutAdditionalRoleInfo', __METHOD__); - $this->additionalRoleInfo = $additionalRoleInfo; - } - public function getAdditionalRoleInfo() { - return $this->additionalRoleInfo; - } - public function setDomainSharingPolicy($domainSharingPolicy) { - $this->domainSharingPolicy = $domainSharingPolicy; - } - public function getDomainSharingPolicy() { - return $this->domainSharingPolicy; - } - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setExportFormats(/* array(Google_AboutExportFormats) */ $exportFormats) { - $this->assertIsArray($exportFormats, 'Google_AboutExportFormats', __METHOD__); - $this->exportFormats = $exportFormats; - } - public function getExportFormats() { - return $this->exportFormats; - } - public function setFeatures(/* array(Google_AboutFeatures) */ $features) { - $this->assertIsArray($features, 'Google_AboutFeatures', __METHOD__); - $this->features = $features; - } - public function getFeatures() { - return $this->features; - } - public function setImportFormats(/* array(Google_AboutImportFormats) */ $importFormats) { - $this->assertIsArray($importFormats, 'Google_AboutImportFormats', __METHOD__); - $this->importFormats = $importFormats; - } - public function getImportFormats() { - return $this->importFormats; - } - public function setIsCurrentAppInstalled($isCurrentAppInstalled) { - $this->isCurrentAppInstalled = $isCurrentAppInstalled; - } - public function getIsCurrentAppInstalled() { - return $this->isCurrentAppInstalled; - } - public function setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setLargestChangeId($largestChangeId) { - $this->largestChangeId = $largestChangeId; - } - public function getLargestChangeId() { - return $this->largestChangeId; - } - public function setMaxUploadSizes(/* array(Google_AboutMaxUploadSizes) */ $maxUploadSizes) { - $this->assertIsArray($maxUploadSizes, 'Google_AboutMaxUploadSizes', __METHOD__); - $this->maxUploadSizes = $maxUploadSizes; - } - public function getMaxUploadSizes() { - return $this->maxUploadSizes; - } - public function setName($name) { - $this->name = $name; - } - public function getName() { - return $this->name; - } - public function setPermissionId($permissionId) { - $this->permissionId = $permissionId; - } - public function getPermissionId() { - return $this->permissionId; - } - public function setQuotaBytesTotal($quotaBytesTotal) { - $this->quotaBytesTotal = $quotaBytesTotal; - } - public function getQuotaBytesTotal() { - return $this->quotaBytesTotal; - } - public function setQuotaBytesUsed($quotaBytesUsed) { - $this->quotaBytesUsed = $quotaBytesUsed; - } - public function getQuotaBytesUsed() { - return $this->quotaBytesUsed; - } - public function setQuotaBytesUsedAggregate($quotaBytesUsedAggregate) { - $this->quotaBytesUsedAggregate = $quotaBytesUsedAggregate; - } - public function getQuotaBytesUsedAggregate() { - return $this->quotaBytesUsedAggregate; - } - public function setQuotaBytesUsedInTrash($quotaBytesUsedInTrash) { - $this->quotaBytesUsedInTrash = $quotaBytesUsedInTrash; - } - public function getQuotaBytesUsedInTrash() { - return $this->quotaBytesUsedInTrash; - } - public function setRemainingChangeIds($remainingChangeIds) { - $this->remainingChangeIds = $remainingChangeIds; - } - public function getRemainingChangeIds() { - return $this->remainingChangeIds; - } - public function setRootFolderId($rootFolderId) { - $this->rootFolderId = $rootFolderId; - } - public function getRootFolderId() { - return $this->rootFolderId; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } - public function setUser(Google_User $user) { - $this->user = $user; - } - public function getUser() { - return $this->user; - } -} - -class Google_AboutAdditionalRoleInfo extends Google_Model { - protected $__roleSetsType = 'Google_AboutAdditionalRoleInfoRoleSets'; - protected $__roleSetsDataType = 'array'; - public $roleSets; - public $type; - public function setRoleSets(/* array(Google_AboutAdditionalRoleInfoRoleSets) */ $roleSets) { - $this->assertIsArray($roleSets, 'Google_AboutAdditionalRoleInfoRoleSets', __METHOD__); - $this->roleSets = $roleSets; - } - public function getRoleSets() { - return $this->roleSets; - } - public function setType($type) { - $this->type = $type; - } - public function getType() { - return $this->type; - } -} - -class Google_AboutAdditionalRoleInfoRoleSets extends Google_Model { - public $additionalRoles; - public $primaryRole; - public function setAdditionalRoles(/* array(Google_string) */ $additionalRoles) { - $this->assertIsArray($additionalRoles, 'Google_string', __METHOD__); - $this->additionalRoles = $additionalRoles; - } - public function getAdditionalRoles() { - return $this->additionalRoles; - } - public function setPrimaryRole($primaryRole) { - $this->primaryRole = $primaryRole; - } - public function getPrimaryRole() { - return $this->primaryRole; - } -} - -class Google_AboutExportFormats extends Google_Model { - public $source; - public $targets; - public function setSource($source) { - $this->source = $source; - } - public function getSource() { - return $this->source; - } - public function setTargets(/* array(Google_string) */ $targets) { - $this->assertIsArray($targets, 'Google_string', __METHOD__); - $this->targets = $targets; - } - public function getTargets() { - return $this->targets; - } -} - -class Google_AboutFeatures extends Google_Model { - public $featureName; - public $featureRate; - public function setFeatureName($featureName) { - $this->featureName = $featureName; - } - public function getFeatureName() { - return $this->featureName; - } - public function setFeatureRate($featureRate) { - $this->featureRate = $featureRate; - } - public function getFeatureRate() { - return $this->featureRate; - } -} - -class Google_AboutImportFormats extends Google_Model { - public $source; - public $targets; - public function setSource($source) { - $this->source = $source; - } - public function getSource() { - return $this->source; - } - public function setTargets(/* array(Google_string) */ $targets) { - $this->assertIsArray($targets, 'Google_string', __METHOD__); - $this->targets = $targets; - } - public function getTargets() { - return $this->targets; - } -} - -class Google_AboutMaxUploadSizes extends Google_Model { - public $size; - public $type; - public function setSize($size) { - $this->size = $size; - } - public function getSize() { - return $this->size; - } - public function setType($type) { - $this->type = $type; - } - public function getType() { - return $this->type; - } -} - -class Google_App extends Google_Model { - public $authorized; - protected $__iconsType = 'Google_AppIcons'; - protected $__iconsDataType = 'array'; - public $icons; - public $id; - public $installed; - public $kind; - public $name; - public $objectType; - public $primaryFileExtensions; - public $primaryMimeTypes; - public $productUrl; - public $secondaryFileExtensions; - public $secondaryMimeTypes; - public $supportsCreate; - public $supportsImport; - public $useByDefault; - public function setAuthorized($authorized) { - $this->authorized = $authorized; - } - public function getAuthorized() { - return $this->authorized; - } - public function setIcons(/* array(Google_AppIcons) */ $icons) { - $this->assertIsArray($icons, 'Google_AppIcons', __METHOD__); - $this->icons = $icons; - } - public function getIcons() { - return $this->icons; - } - public function setId($id) { - $this->id = $id; - } - public function getId() { - return $this->id; - } - public function setInstalled($installed) { - $this->installed = $installed; - } - public function getInstalled() { - return $this->installed; - } - 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 setObjectType($objectType) { - $this->objectType = $objectType; - } - public function getObjectType() { - return $this->objectType; - } - public function setPrimaryFileExtensions(/* array(Google_string) */ $primaryFileExtensions) { - $this->assertIsArray($primaryFileExtensions, 'Google_string', __METHOD__); - $this->primaryFileExtensions = $primaryFileExtensions; - } - public function getPrimaryFileExtensions() { - return $this->primaryFileExtensions; - } - public function setPrimaryMimeTypes(/* array(Google_string) */ $primaryMimeTypes) { - $this->assertIsArray($primaryMimeTypes, 'Google_string', __METHOD__); - $this->primaryMimeTypes = $primaryMimeTypes; - } - public function getPrimaryMimeTypes() { - return $this->primaryMimeTypes; - } - public function setProductUrl($productUrl) { - $this->productUrl = $productUrl; - } - public function getProductUrl() { - return $this->productUrl; - } - public function setSecondaryFileExtensions(/* array(Google_string) */ $secondaryFileExtensions) { - $this->assertIsArray($secondaryFileExtensions, 'Google_string', __METHOD__); - $this->secondaryFileExtensions = $secondaryFileExtensions; - } - public function getSecondaryFileExtensions() { - return $this->secondaryFileExtensions; - } - public function setSecondaryMimeTypes(/* array(Google_string) */ $secondaryMimeTypes) { - $this->assertIsArray($secondaryMimeTypes, 'Google_string', __METHOD__); - $this->secondaryMimeTypes = $secondaryMimeTypes; - } - public function getSecondaryMimeTypes() { - return $this->secondaryMimeTypes; - } - public function setSupportsCreate($supportsCreate) { - $this->supportsCreate = $supportsCreate; - } - public function getSupportsCreate() { - return $this->supportsCreate; - } - public function setSupportsImport($supportsImport) { - $this->supportsImport = $supportsImport; - } - public function getSupportsImport() { - return $this->supportsImport; - } - public function setUseByDefault($useByDefault) { - $this->useByDefault = $useByDefault; - } - public function getUseByDefault() { - return $this->useByDefault; - } -} - -class Google_AppIcons extends Google_Model { - public $category; - public $iconUrl; - public $size; - public function setCategory($category) { - $this->category = $category; - } - public function getCategory() { - return $this->category; - } - public function setIconUrl($iconUrl) { - $this->iconUrl = $iconUrl; - } - public function getIconUrl() { - return $this->iconUrl; - } - public function setSize($size) { - $this->size = $size; - } - public function getSize() { - return $this->size; - } -} - -class Google_AppList extends Google_Model { - public $etag; - protected $__itemsType = 'Google_App'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $selfLink; - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setItems(/* array(Google_App) */ $items) { - $this->assertIsArray($items, 'Google_App', __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 setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_Change extends Google_Model { - public $deleted; - protected $__fileType = 'Google_DriveFile'; - protected $__fileDataType = ''; - public $file; - public $fileId; - public $id; - public $kind; - public $selfLink; - public function setDeleted($deleted) { - $this->deleted = $deleted; - } - public function getDeleted() { - return $this->deleted; - } - public function setFile(Google_DriveFile $file) { - $this->file = $file; - } - public function getFile() { - return $this->file; - } - public function setFileId($fileId) { - $this->fileId = $fileId; - } - public function getFileId() { - return $this->fileId; - } - public function setId($id) { - $this->id = $id; - } - public function getId() { - return $this->id; - } - public function setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_ChangeList extends Google_Model { - public $etag; - protected $__itemsType = 'Google_Change'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $largestChangeId; - public $nextLink; - public $nextPageToken; - public $selfLink; - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setItems(/* array(Google_Change) */ $items) { - $this->assertIsArray($items, 'Google_Change', __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 setLargestChangeId($largestChangeId) { - $this->largestChangeId = $largestChangeId; - } - public function getLargestChangeId() { - return $this->largestChangeId; - } - public function setNextLink($nextLink) { - $this->nextLink = $nextLink; - } - public function getNextLink() { - return $this->nextLink; - } - public function setNextPageToken($nextPageToken) { - $this->nextPageToken = $nextPageToken; - } - public function getNextPageToken() { - return $this->nextPageToken; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_ChildList extends Google_Model { - public $etag; - protected $__itemsType = 'Google_ChildReference'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $nextLink; - public $nextPageToken; - public $selfLink; - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setItems(/* array(Google_ChildReference) */ $items) { - $this->assertIsArray($items, 'Google_ChildReference', __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 setNextLink($nextLink) { - $this->nextLink = $nextLink; - } - public function getNextLink() { - return $this->nextLink; - } - public function setNextPageToken($nextPageToken) { - $this->nextPageToken = $nextPageToken; - } - public function getNextPageToken() { - return $this->nextPageToken; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_ChildReference extends Google_Model { - public $childLink; - public $id; - public $kind; - public $selfLink; - public function setChildLink($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 setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_Comment extends Google_Model { - public $anchor; - protected $__authorType = 'Google_User'; - protected $__authorDataType = ''; - public $author; - public $commentId; - public $content; - protected $__contextType = 'Google_CommentContext'; - protected $__contextDataType = ''; - public $context; - public $createdDate; - public $deleted; - public $fileId; - public $fileTitle; - public $htmlContent; - public $kind; - public $modifiedDate; - protected $__repliesType = 'Google_CommentReply'; - protected $__repliesDataType = 'array'; - public $replies; - public $selfLink; - public $status; - public function setAnchor($anchor) { - $this->anchor = $anchor; - } - public function getAnchor() { - return $this->anchor; - } - public function setAuthor(Google_User $author) { - $this->author = $author; - } - public function getAuthor() { - return $this->author; - } - public function setCommentId($commentId) { - $this->commentId = $commentId; - } - public function getCommentId() { - return $this->commentId; - } - public function setContent($content) { - $this->content = $content; - } - public function getContent() { - return $this->content; - } - public function setContext(Google_CommentContext $context) { - $this->context = $context; - } - public function getContext() { - return $this->context; - } - public function setCreatedDate($createdDate) { - $this->createdDate = $createdDate; - } - public function getCreatedDate() { - return $this->createdDate; - } - public function setDeleted($deleted) { - $this->deleted = $deleted; - } - public function getDeleted() { - return $this->deleted; - } - public function setFileId($fileId) { - $this->fileId = $fileId; - } - public function getFileId() { - return $this->fileId; - } - public function setFileTitle($fileTitle) { - $this->fileTitle = $fileTitle; - } - public function getFileTitle() { - return $this->fileTitle; - } - public function setHtmlContent($htmlContent) { - $this->htmlContent = $htmlContent; - } - public function getHtmlContent() { - return $this->htmlContent; - } - public function setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setModifiedDate($modifiedDate) { - $this->modifiedDate = $modifiedDate; - } - public function getModifiedDate() { - return $this->modifiedDate; - } - public function setReplies(/* array(Google_CommentReply) */ $replies) { - $this->assertIsArray($replies, 'Google_CommentReply', __METHOD__); - $this->replies = $replies; - } - public function getReplies() { - return $this->replies; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } - public function setStatus($status) { - $this->status = $status; - } - public function getStatus() { - return $this->status; - } -} - -class Google_CommentContext extends Google_Model { - public $type; - public $value; - public function setType($type) { - $this->type = $type; - } - public function getType() { - return $this->type; - } - public function setValue($value) { - $this->value = $value; - } - public function getValue() { - return $this->value; - } -} - -class Google_CommentList extends Google_Model { - protected $__itemsType = 'Google_Comment'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $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 setNextPageToken($nextPageToken) { - $this->nextPageToken = $nextPageToken; - } - public function getNextPageToken() { - return $this->nextPageToken; - } -} - -class Google_CommentReply extends Google_Model { - protected $__authorType = 'Google_User'; - protected $__authorDataType = ''; - public $author; - public $content; - public $createdDate; - public $deleted; - public $htmlContent; - public $kind; - public $modifiedDate; - public $replyId; - public $verb; - public function setAuthor(Google_User $author) { - $this->author = $author; - } - public function getAuthor() { - return $this->author; - } - public function setContent($content) { - $this->content = $content; - } - public function getContent() { - return $this->content; - } - public function setCreatedDate($createdDate) { - $this->createdDate = $createdDate; - } - public function getCreatedDate() { - return $this->createdDate; - } - public function setDeleted($deleted) { - $this->deleted = $deleted; - } - public function getDeleted() { - return $this->deleted; - } - public function setHtmlContent($htmlContent) { - $this->htmlContent = $htmlContent; - } - public function getHtmlContent() { - return $this->htmlContent; - } - public function setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setModifiedDate($modifiedDate) { - $this->modifiedDate = $modifiedDate; - } - public function getModifiedDate() { - return $this->modifiedDate; - } - public function setReplyId($replyId) { - $this->replyId = $replyId; - } - public function getReplyId() { - return $this->replyId; - } - public function setVerb($verb) { - $this->verb = $verb; - } - public function getVerb() { - return $this->verb; - } -} - -class Google_CommentReplyList extends Google_Model { - protected $__itemsType = 'Google_CommentReply'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $nextPageToken; - public function setItems(/* array(Google_CommentReply) */ $items) { - $this->assertIsArray($items, 'Google_CommentReply', __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 setNextPageToken($nextPageToken) { - $this->nextPageToken = $nextPageToken; - } - public function getNextPageToken() { - return $this->nextPageToken; - } -} - -class Google_DriveFile extends Google_Model { - public $alternateLink; - public $appDataContents; - public $createdDate; - public $description; - public $downloadUrl; - public $editable; - public $embedLink; - public $etag; - public $explicitlyTrashed; - public $exportLinks; - public $fileExtension; - public $fileSize; - public $iconLink; - public $id; - protected $__imageMediaMetadataType = 'Google_DriveFileImageMediaMetadata'; - protected $__imageMediaMetadataDataType = ''; - public $imageMediaMetadata; - protected $__indexableTextType = 'Google_DriveFileIndexableText'; - protected $__indexableTextDataType = ''; - public $indexableText; - public $kind; - protected $__labelsType = 'Google_DriveFileLabels'; - protected $__labelsDataType = ''; - public $labels; - protected $__lastModifyingUserType = 'Google_User'; - protected $__lastModifyingUserDataType = ''; - public $lastModifyingUser; - public $lastModifyingUserName; - public $lastViewedByMeDate; - public $md5Checksum; - public $mimeType; - public $modifiedByMeDate; - public $modifiedDate; - public $originalFilename; - public $ownerNames; - protected $__ownersType = 'Google_User'; - protected $__ownersDataType = 'array'; - public $owners; - protected $__parentsType = 'Google_ParentReference'; - protected $__parentsDataType = 'array'; - public $parents; - public $quotaBytesUsed; - public $selfLink; - public $shared; - public $sharedWithMeDate; - protected $__thumbnailType = 'Google_DriveFileThumbnail'; - protected $__thumbnailDataType = ''; - public $thumbnail; - public $thumbnailLink; - public $title; - protected $__userPermissionType = 'Google_Permission'; - protected $__userPermissionDataType = ''; - public $userPermission; - public $webContentLink; - public $webViewLink; - public $writersCanShare; - public function setAlternateLink($alternateLink) { - $this->alternateLink = $alternateLink; - } - public function getAlternateLink() { - return $this->alternateLink; - } - public function setAppDataContents($appDataContents) { - $this->appDataContents = $appDataContents; - } - public function getAppDataContents() { - return $this->appDataContents; - } - public function setCreatedDate($createdDate) { - $this->createdDate = $createdDate; - } - public function getCreatedDate() { - return $this->createdDate; - } - public function setDescription($description) { - $this->description = $description; - } - public function getDescription() { - return $this->description; - } - public function setDownloadUrl($downloadUrl) { - $this->downloadUrl = $downloadUrl; - } - public function getDownloadUrl() { - return $this->downloadUrl; - } - public function setEditable($editable) { - $this->editable = $editable; - } - public function getEditable() { - return $this->editable; - } - public function setEmbedLink($embedLink) { - $this->embedLink = $embedLink; - } - public function getEmbedLink() { - return $this->embedLink; - } - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setExplicitlyTrashed($explicitlyTrashed) { - $this->explicitlyTrashed = $explicitlyTrashed; - } - public function getExplicitlyTrashed() { - return $this->explicitlyTrashed; - } - public function setExportLinks($exportLinks) { - $this->exportLinks = $exportLinks; - } - public function getExportLinks() { - return $this->exportLinks; - } - public function setFileExtension($fileExtension) { - $this->fileExtension = $fileExtension; - } - public function getFileExtension() { - return $this->fileExtension; - } - public function setFileSize($fileSize) { - $this->fileSize = $fileSize; - } - public function getFileSize() { - return $this->fileSize; - } - public function setIconLink($iconLink) { - $this->iconLink = $iconLink; - } - public function getIconLink() { - return $this->iconLink; - } - public function setId($id) { - $this->id = $id; - } - public function getId() { - return $this->id; - } - public function setImageMediaMetadata(Google_DriveFileImageMediaMetadata $imageMediaMetadata) { - $this->imageMediaMetadata = $imageMediaMetadata; - } - public function getImageMediaMetadata() { - return $this->imageMediaMetadata; - } - public function setIndexableText(Google_DriveFileIndexableText $indexableText) { - $this->indexableText = $indexableText; - } - public function getIndexableText() { - return $this->indexableText; - } - public function setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setLabels(Google_DriveFileLabels $labels) { - $this->labels = $labels; - } - public function getLabels() { - return $this->labels; - } - public function setLastModifyingUser(Google_User $lastModifyingUser) { - $this->lastModifyingUser = $lastModifyingUser; - } - public function getLastModifyingUser() { - return $this->lastModifyingUser; - } - public function setLastModifyingUserName($lastModifyingUserName) { - $this->lastModifyingUserName = $lastModifyingUserName; - } - public function getLastModifyingUserName() { - return $this->lastModifyingUserName; - } - public function setLastViewedByMeDate($lastViewedByMeDate) { - $this->lastViewedByMeDate = $lastViewedByMeDate; - } - public function getLastViewedByMeDate() { - return $this->lastViewedByMeDate; - } - public function setMd5Checksum($md5Checksum) { - $this->md5Checksum = $md5Checksum; - } - public function getMd5Checksum() { - return $this->md5Checksum; - } - public function setMimeType($mimeType) { - $this->mimeType = $mimeType; - } - public function getMimeType() { - return $this->mimeType; - } - public function setModifiedByMeDate($modifiedByMeDate) { - $this->modifiedByMeDate = $modifiedByMeDate; - } - public function getModifiedByMeDate() { - return $this->modifiedByMeDate; - } - public function setModifiedDate($modifiedDate) { - $this->modifiedDate = $modifiedDate; - } - public function getModifiedDate() { - return $this->modifiedDate; - } - public function setOriginalFilename($originalFilename) { - $this->originalFilename = $originalFilename; - } - public function getOriginalFilename() { - return $this->originalFilename; - } - public function setOwnerNames(/* array(Google_string) */ $ownerNames) { - $this->assertIsArray($ownerNames, 'Google_string', __METHOD__); - $this->ownerNames = $ownerNames; - } - public function getOwnerNames() { - return $this->ownerNames; - } - public function setOwners(/* array(Google_User) */ $owners) { - $this->assertIsArray($owners, 'Google_User', __METHOD__); - $this->owners = $owners; - } - public function getOwners() { - return $this->owners; - } - public function setParents(/* array(Google_ParentReference) */ $parents) { - $this->assertIsArray($parents, 'Google_ParentReference', __METHOD__); - $this->parents = $parents; - } - public function getParents() { - return $this->parents; - } - public function setQuotaBytesUsed($quotaBytesUsed) { - $this->quotaBytesUsed = $quotaBytesUsed; - } - public function getQuotaBytesUsed() { - return $this->quotaBytesUsed; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } - public function setShared($shared) { - $this->shared = $shared; - } - public function getShared() { - return $this->shared; - } - public function setSharedWithMeDate($sharedWithMeDate) { - $this->sharedWithMeDate = $sharedWithMeDate; - } - public function getSharedWithMeDate() { - return $this->sharedWithMeDate; - } - public function setThumbnail(Google_DriveFileThumbnail $thumbnail) { - $this->thumbnail = $thumbnail; - } - public function getThumbnail() { - return $this->thumbnail; - } - public function setThumbnailLink($thumbnailLink) { - $this->thumbnailLink = $thumbnailLink; - } - public function getThumbnailLink() { - return $this->thumbnailLink; - } - public function setTitle($title) { - $this->title = $title; - } - public function getTitle() { - return $this->title; - } - public function setUserPermission(Google_Permission $userPermission) { - $this->userPermission = $userPermission; - } - public function getUserPermission() { - return $this->userPermission; - } - public function setWebContentLink($webContentLink) { - $this->webContentLink = $webContentLink; - } - public function getWebContentLink() { - return $this->webContentLink; - } - public function setWebViewLink($webViewLink) { - $this->webViewLink = $webViewLink; - } - public function getWebViewLink() { - return $this->webViewLink; - } - public function setWritersCanShare($writersCanShare) { - $this->writersCanShare = $writersCanShare; - } - public function getWritersCanShare() { - return $this->writersCanShare; - } -} - -class Google_DriveFileImageMediaMetadata extends Google_Model { - public $aperture; - public $cameraMake; - public $cameraModel; - public $colorSpace; - public $date; - public $exposureBias; - public $exposureMode; - public $exposureTime; - public $flashUsed; - public $focalLength; - public $height; - public $isoSpeed; - public $lens; - protected $__locationType = 'Google_DriveFileImageMediaMetadataLocation'; - protected $__locationDataType = ''; - public $location; - public $maxApertureValue; - public $meteringMode; - public $rotation; - public $sensor; - public $subjectDistance; - public $whiteBalance; - public $width; - public function setAperture($aperture) { - $this->aperture = $aperture; - } - public function getAperture() { - return $this->aperture; - } - public function setCameraMake($cameraMake) { - $this->cameraMake = $cameraMake; - } - public function getCameraMake() { - return $this->cameraMake; - } - public function setCameraModel($cameraModel) { - $this->cameraModel = $cameraModel; - } - public function getCameraModel() { - return $this->cameraModel; - } - public function setColorSpace($colorSpace) { - $this->colorSpace = $colorSpace; - } - public function getColorSpace() { - return $this->colorSpace; - } - public function setDate($date) { - $this->date = $date; - } - public function getDate() { - return $this->date; - } - public function setExposureBias($exposureBias) { - $this->exposureBias = $exposureBias; - } - public function getExposureBias() { - return $this->exposureBias; - } - public function setExposureMode($exposureMode) { - $this->exposureMode = $exposureMode; - } - public function getExposureMode() { - return $this->exposureMode; - } - public function setExposureTime($exposureTime) { - $this->exposureTime = $exposureTime; - } - public function getExposureTime() { - return $this->exposureTime; - } - public function setFlashUsed($flashUsed) { - $this->flashUsed = $flashUsed; - } - public function getFlashUsed() { - return $this->flashUsed; - } - public function setFocalLength($focalLength) { - $this->focalLength = $focalLength; - } - public function getFocalLength() { - return $this->focalLength; - } - public function setHeight($height) { - $this->height = $height; - } - public function getHeight() { - return $this->height; - } - public function setIsoSpeed($isoSpeed) { - $this->isoSpeed = $isoSpeed; - } - public function getIsoSpeed() { - return $this->isoSpeed; - } - public function setLens($lens) { - $this->lens = $lens; - } - public function getLens() { - return $this->lens; - } - public function setLocation(Google_DriveFileImageMediaMetadataLocation $location) { - $this->location = $location; - } - public function getLocation() { - return $this->location; - } - public function setMaxApertureValue($maxApertureValue) { - $this->maxApertureValue = $maxApertureValue; - } - public function getMaxApertureValue() { - return $this->maxApertureValue; - } - public function setMeteringMode($meteringMode) { - $this->meteringMode = $meteringMode; - } - public function getMeteringMode() { - return $this->meteringMode; - } - public function setRotation($rotation) { - $this->rotation = $rotation; - } - public function getRotation() { - return $this->rotation; - } - public function setSensor($sensor) { - $this->sensor = $sensor; - } - public function getSensor() { - return $this->sensor; - } - public function setSubjectDistance($subjectDistance) { - $this->subjectDistance = $subjectDistance; - } - public function getSubjectDistance() { - return $this->subjectDistance; - } - public function setWhiteBalance($whiteBalance) { - $this->whiteBalance = $whiteBalance; - } - public function getWhiteBalance() { - return $this->whiteBalance; - } - public function setWidth($width) { - $this->width = $width; - } - public function getWidth() { - return $this->width; - } -} - -class Google_DriveFileImageMediaMetadataLocation extends Google_Model { - public $altitude; - public $latitude; - public $longitude; - public function setAltitude($altitude) { - $this->altitude = $altitude; - } - public function getAltitude() { - return $this->altitude; - } - public function setLatitude($latitude) { - $this->latitude = $latitude; - } - public function getLatitude() { - return $this->latitude; - } - public function setLongitude($longitude) { - $this->longitude = $longitude; - } - public function getLongitude() { - return $this->longitude; - } -} - -class Google_DriveFileIndexableText extends Google_Model { - public $text; - public function setText($text) { - $this->text = $text; - } - public function getText() { - return $this->text; - } -} - -class Google_DriveFileLabels extends Google_Model { - public $hidden; - public $restricted; - public $starred; - public $trashed; - public $viewed; - public function setHidden($hidden) { - $this->hidden = $hidden; - } - public function getHidden() { - return $this->hidden; - } - public function setRestricted($restricted) { - $this->restricted = $restricted; - } - public function getRestricted() { - return $this->restricted; - } - public function setStarred($starred) { - $this->starred = $starred; - } - public function getStarred() { - return $this->starred; - } - public function setTrashed($trashed) { - $this->trashed = $trashed; - } - public function getTrashed() { - return $this->trashed; - } - public function setViewed($viewed) { - $this->viewed = $viewed; - } - public function getViewed() { - return $this->viewed; - } -} - -class Google_DriveFileThumbnail extends Google_Model { - public $image; - public $mimeType; - public function setImage($image) { - $this->image = $image; - } - public function getImage() { - return $this->image; - } - public function setMimeType($mimeType) { - $this->mimeType = $mimeType; - } - public function getMimeType() { - return $this->mimeType; - } -} - -class Google_FileList extends Google_Model { - public $etag; - protected $__itemsType = 'Google_DriveFile'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $nextLink; - public $nextPageToken; - public $selfLink; - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setItems(/* array(Google_DriveFile) */ $items) { - $this->assertIsArray($items, 'Google_DriveFile', __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 setNextLink($nextLink) { - $this->nextLink = $nextLink; - } - public function getNextLink() { - return $this->nextLink; - } - public function setNextPageToken($nextPageToken) { - $this->nextPageToken = $nextPageToken; - } - public function getNextPageToken() { - return $this->nextPageToken; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_ParentList extends Google_Model { - public $etag; - protected $__itemsType = 'Google_ParentReference'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $selfLink; - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setItems(/* array(Google_ParentReference) */ $items) { - $this->assertIsArray($items, 'Google_ParentReference', __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 setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_ParentReference extends Google_Model { - public $id; - public $isRoot; - public $kind; - public $parentLink; - public $selfLink; - public function setId($id) { - $this->id = $id; - } - public function getId() { - return $this->id; - } - public function setIsRoot($isRoot) { - $this->isRoot = $isRoot; - } - public function getIsRoot() { - return $this->isRoot; - } - public function setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setParentLink($parentLink) { - $this->parentLink = $parentLink; - } - public function getParentLink() { - return $this->parentLink; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_Permission extends Google_Model { - public $additionalRoles; - public $authKey; - public $etag; - public $id; - public $kind; - public $name; - public $photoLink; - public $role; - public $selfLink; - public $type; - public $value; - public $withLink; - public function setAdditionalRoles(/* array(Google_string) */ $additionalRoles) { - $this->assertIsArray($additionalRoles, 'Google_string', __METHOD__); - $this->additionalRoles = $additionalRoles; - } - public function getAdditionalRoles() { - return $this->additionalRoles; - } - public function setAuthKey($authKey) { - $this->authKey = $authKey; - } - public function getAuthKey() { - return $this->authKey; - } - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setId($id) { - $this->id = $id; - } - public function getId() { - return $this->id; - } - 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 setPhotoLink($photoLink) { - $this->photoLink = $photoLink; - } - public function getPhotoLink() { - return $this->photoLink; - } - public function setRole($role) { - $this->role = $role; - } - public function getRole() { - return $this->role; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } - public function setType($type) { - $this->type = $type; - } - public function getType() { - return $this->type; - } - public function setValue($value) { - $this->value = $value; - } - public function getValue() { - return $this->value; - } - public function setWithLink($withLink) { - $this->withLink = $withLink; - } - public function getWithLink() { - return $this->withLink; - } -} - -class Google_PermissionList extends Google_Model { - public $etag; - protected $__itemsType = 'Google_Permission'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $selfLink; - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setItems(/* array(Google_Permission) */ $items) { - $this->assertIsArray($items, 'Google_Permission', __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 setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_Property extends Google_Model { - public $etag; - public $key; - public $kind; - public $selfLink; - public $value; - public $visibility; - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setKey($key) { - $this->key = $key; - } - public function getKey() { - return $this->key; - } - public function setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } - public function setValue($value) { - $this->value = $value; - } - public function getValue() { - return $this->value; - } - public function setVisibility($visibility) { - $this->visibility = $visibility; - } - public function getVisibility() { - return $this->visibility; - } -} - -class Google_PropertyList extends Google_Model { - public $etag; - protected $__itemsType = 'Google_Property'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $selfLink; - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setItems(/* array(Google_Property) */ $items) { - $this->assertIsArray($items, 'Google_Property', __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 setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_Revision extends Google_Model { - public $downloadUrl; - public $etag; - public $exportLinks; - public $fileSize; - public $id; - public $kind; - protected $__lastModifyingUserType = 'Google_User'; - protected $__lastModifyingUserDataType = ''; - public $lastModifyingUser; - public $lastModifyingUserName; - public $md5Checksum; - public $mimeType; - public $modifiedDate; - public $originalFilename; - public $pinned; - public $publishAuto; - public $published; - public $publishedLink; - public $publishedOutsideDomain; - public $selfLink; - public function setDownloadUrl($downloadUrl) { - $this->downloadUrl = $downloadUrl; - } - public function getDownloadUrl() { - return $this->downloadUrl; - } - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setExportLinks($exportLinks) { - $this->exportLinks = $exportLinks; - } - public function getExportLinks() { - return $this->exportLinks; - } - public function setFileSize($fileSize) { - $this->fileSize = $fileSize; - } - public function getFileSize() { - return $this->fileSize; - } - public function setId($id) { - $this->id = $id; - } - public function getId() { - return $this->id; - } - public function setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setLastModifyingUser(Google_User $lastModifyingUser) { - $this->lastModifyingUser = $lastModifyingUser; - } - public function getLastModifyingUser() { - return $this->lastModifyingUser; - } - public function setLastModifyingUserName($lastModifyingUserName) { - $this->lastModifyingUserName = $lastModifyingUserName; - } - public function getLastModifyingUserName() { - return $this->lastModifyingUserName; - } - public function setMd5Checksum($md5Checksum) { - $this->md5Checksum = $md5Checksum; - } - public function getMd5Checksum() { - return $this->md5Checksum; - } - public function setMimeType($mimeType) { - $this->mimeType = $mimeType; - } - public function getMimeType() { - return $this->mimeType; - } - public function setModifiedDate($modifiedDate) { - $this->modifiedDate = $modifiedDate; - } - public function getModifiedDate() { - return $this->modifiedDate; - } - public function setOriginalFilename($originalFilename) { - $this->originalFilename = $originalFilename; - } - public function getOriginalFilename() { - return $this->originalFilename; - } - public function setPinned($pinned) { - $this->pinned = $pinned; - } - public function getPinned() { - return $this->pinned; - } - public function setPublishAuto($publishAuto) { - $this->publishAuto = $publishAuto; - } - public function getPublishAuto() { - return $this->publishAuto; - } - public function setPublished($published) { - $this->published = $published; - } - public function getPublished() { - return $this->published; - } - public function setPublishedLink($publishedLink) { - $this->publishedLink = $publishedLink; - } - public function getPublishedLink() { - return $this->publishedLink; - } - public function setPublishedOutsideDomain($publishedOutsideDomain) { - $this->publishedOutsideDomain = $publishedOutsideDomain; - } - public function getPublishedOutsideDomain() { - return $this->publishedOutsideDomain; - } - public function setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_RevisionList extends Google_Model { - public $etag; - protected $__itemsType = 'Google_Revision'; - protected $__itemsDataType = 'array'; - public $items; - public $kind; - public $selfLink; - public function setEtag($etag) { - $this->etag = $etag; - } - public function getEtag() { - return $this->etag; - } - public function setItems(/* array(Google_Revision) */ $items) { - $this->assertIsArray($items, 'Google_Revision', __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 setSelfLink($selfLink) { - $this->selfLink = $selfLink; - } - public function getSelfLink() { - return $this->selfLink; - } -} - -class Google_User extends Google_Model { - public $displayName; - public $isAuthenticatedUser; - public $kind; - public $permissionId; - protected $__pictureType = 'Google_UserPicture'; - protected $__pictureDataType = ''; - public $picture; - public function setDisplayName($displayName) { - $this->displayName = $displayName; - } - public function getDisplayName() { - return $this->displayName; - } - public function setIsAuthenticatedUser($isAuthenticatedUser) { - $this->isAuthenticatedUser = $isAuthenticatedUser; - } - public function getIsAuthenticatedUser() { - return $this->isAuthenticatedUser; - } - public function setKind($kind) { - $this->kind = $kind; - } - public function getKind() { - return $this->kind; - } - public function setPermissionId($permissionId) { - $this->permissionId = $permissionId; - } - public function getPermissionId() { - return $this->permissionId; - } - public function setPicture(Google_UserPicture $picture) { - $this->picture = $picture; - } - public function getPicture() { - return $this->picture; - } -} - -class Google_UserPicture extends Google_Model { - public $url; - public function setUrl($url) { - $this->url = $url; - } - public function getUrl() { - return $this->url; - } -} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/external/URITemplateParser.php b/apps/files_external/3rdparty/google-api-php-client/src/external/URITemplateParser.php deleted file mode 100644 index 594adbb15e..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/external/URITemplateParser.php +++ /dev/null @@ -1,209 +0,0 @@ -template = $template; - } - - public function expand($data) { - // Modification to make this a bit more performant (since gettype is very slow) - if (! is_array($data)) { - $data = (array)$data; - } - /* - // Original code, which uses a slow gettype() statement, kept in place for if the assumption that is_array always works here is incorrect - switch (gettype($data)) { - case "boolean": - case "integer": - case "double": - case "string": - case "object": - $data = (array)$data; - break; - } -*/ - - // Resolve template vars - preg_match_all('/\{([^\}]*)\}/', $this->template, $em); - - foreach ($em[1] as $i => $bare_expression) { - preg_match('/^([\+\;\?\/\.]{1})?(.*)$/', $bare_expression, $lm); - $exp = new StdClass(); - $exp->expression = $em[0][$i]; - $exp->operator = $lm[1]; - $exp->variable_list = $lm[2]; - $exp->varspecs = explode(',', $exp->variable_list); - $exp->vars = array(); - foreach ($exp->varspecs as $varspec) { - preg_match('/^([a-zA-Z0-9_]+)([\*\+]{1})?([\:\^][0-9-]+)?(\=[^,]+)?$/', $varspec, $vm); - $var = new StdClass(); - $var->name = $vm[1]; - $var->modifier = isset($vm[2]) && $vm[2] ? $vm[2] : null; - $var->modifier = isset($vm[3]) && $vm[3] ? $vm[3] : $var->modifier; - $var->default = isset($vm[4]) ? substr($vm[4], 1) : null; - $exp->vars[] = $var; - } - - // Add processing flags - $exp->reserved = false; - $exp->prefix = ''; - $exp->delimiter = ','; - switch ($exp->operator) { - case '+': - $exp->reserved = 'true'; - break; - case ';': - $exp->prefix = ';'; - $exp->delimiter = ';'; - break; - case '?': - $exp->prefix = '?'; - $exp->delimiter = '&'; - break; - case '/': - $exp->prefix = '/'; - $exp->delimiter = '/'; - break; - case '.': - $exp->prefix = '.'; - $exp->delimiter = '.'; - break; - } - $expressions[] = $exp; - } - - // Expansion - $this->expansion = $this->template; - - foreach ($expressions as $exp) { - $part = $exp->prefix; - $exp->one_var_defined = false; - foreach ($exp->vars as $var) { - $val = ''; - if ($exp->one_var_defined && isset($data[$var->name])) { - $part .= $exp->delimiter; - } - // Variable present - if (isset($data[$var->name])) { - $exp->one_var_defined = true; - $var->data = $data[$var->name]; - - $val = self::val_from_var($var, $exp); - - // Variable missing - } else { - if ($var->default) { - $exp->one_var_defined = true; - $val = $var->default; - } - } - $part .= $val; - } - if (! $exp->one_var_defined) $part = ''; - $this->expansion = str_replace($exp->expression, $part, $this->expansion); - } - - return $this->expansion; - } - - private function val_from_var($var, $exp) { - $val = ''; - if (is_array($var->data)) { - $i = 0; - if ($exp->operator == '?' && ! $var->modifier) { - $val .= $var->name . '='; - } - foreach ($var->data as $k => $v) { - $del = $var->modifier ? $exp->delimiter : ','; - $ek = rawurlencode($k); - $ev = rawurlencode($v); - - // Array - if ($k !== $i) { - if ($var->modifier == '+') { - $val .= $var->name . '.'; - } - if ($exp->operator == '?' && $var->modifier || $exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+') { - $val .= $ek . '='; - } else { - $val .= $ek . $del; - } - - // List - } else { - if ($var->modifier == '+') { - if ($exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+' || $exp->operator == '?' && $var->modifier == '+') { - $val .= $var->name . '='; - } else { - $val .= $var->name . '.'; - } - } - } - $val .= $ev . $del; - $i ++; - } - $val = trim($val, $del); - - // Strings, numbers, etc. - } else { - if ($exp->operator == '?') { - $val = $var->name . (isset($var->data) ? '=' : ''); - } else if ($exp->operator == ';') { - $val = $var->name . ($var->data ? '=' : ''); - } - $val .= rawurlencode($var->data); - if ($exp->operator == '+') { - $val = str_replace(self::$reserved_pct, self::$reserved, $val); - } - } - return $val; - } - - public function match($uri) {} - - public function __toString() { - return $this->template; - } -} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CurlIO.php b/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CurlIO.php deleted file mode 100644 index 65352f2988..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CurlIO.php +++ /dev/null @@ -1,278 +0,0 @@ - - * @author Chirag Shah - */ - -require_once 'Google_CacheParser.php'; - -class Google_CurlIO implements Google_IO { - const CONNECTION_ESTABLISHED = "HTTP/1.0 200 Connection established\r\n\r\n"; - const FORM_URLENCODED = 'application/x-www-form-urlencoded'; - - private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null); - private static $HOP_BY_HOP = array( - 'connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', - 'te', 'trailers', 'transfer-encoding', 'upgrade'); - - private $curlParams = array ( - CURLOPT_RETURNTRANSFER => true, - CURLOPT_FOLLOWLOCATION => 0, - CURLOPT_FAILONERROR => false, - CURLOPT_SSL_VERIFYPEER => true, - CURLOPT_HEADER => true, - CURLOPT_VERBOSE => false, - ); - - /** - * Perform an authenticated / signed apiHttpRequest. - * This function takes the apiHttpRequest, calls apiAuth->sign on it - * (which can modify the request in what ever way fits the auth mechanism) - * and then calls apiCurlIO::makeRequest on the signed request - * - * @param Google_HttpRequest $request - * @return Google_HttpRequest The resulting HTTP response including the - * responseHttpCode, responseHeaders and responseBody. - */ - public function authenticatedRequest(Google_HttpRequest $request) { - $request = Google_Client::$auth->sign($request); - return $this->makeRequest($request); - } - - /** - * Execute a apiHttpRequest - * - * @param Google_HttpRequest $request the http request to be executed - * @return Google_HttpRequest http request with the response http code, response - * headers and response body filled in - * @throws Google_IOException on curl or IO error - */ - public function makeRequest(Google_HttpRequest $request) { - // First, check to see if we have a valid cached version. - $cached = $this->getCachedRequest($request); - if ($cached !== false) { - if (Google_CacheParser::mustRevalidate($cached)) { - $addHeaders = array(); - if ($cached->getResponseHeader('etag')) { - // [13.3.4] If an entity tag has been provided by the origin server, - // we must use that entity tag in any cache-conditional request. - $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag'); - } elseif ($cached->getResponseHeader('date')) { - $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date'); - } - - $request->setRequestHeaders($addHeaders); - } else { - // No need to revalidate the request, return it directly - return $cached; - } - } - - if (array_key_exists($request->getRequestMethod(), - self::$ENTITY_HTTP_METHODS)) { - $request = $this->processEntityRequest($request); - } - - $ch = curl_init(); - curl_setopt_array($ch, $this->curlParams); - curl_setopt($ch, CURLOPT_URL, $request->getUrl()); - if ($request->getPostBody()) { - curl_setopt($ch, CURLOPT_POSTFIELDS, $request->getPostBody()); - } - - $requestHeaders = $request->getRequestHeaders(); - if ($requestHeaders && is_array($requestHeaders)) { - $parsed = array(); - foreach ($requestHeaders as $k => $v) { - $parsed[] = "$k: $v"; - } - curl_setopt($ch, CURLOPT_HTTPHEADER, $parsed); - } - - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod()); - curl_setopt($ch, CURLOPT_USERAGENT, $request->getUserAgent()); - $respData = curl_exec($ch); - - // Retry if certificates are missing. - if (curl_errno($ch) == CURLE_SSL_CACERT) { - error_log('SSL certificate problem, verify that the CA cert is OK.' - . ' Retrying with the CA cert bundle from google-api-php-client.'); - curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem'); - $respData = curl_exec($ch); - } - - $respHeaderSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); - $respHttpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); - $curlErrorNum = curl_errno($ch); - $curlError = curl_error($ch); - curl_close($ch); - if ($curlErrorNum != CURLE_OK) { - throw new Google_IOException("HTTP Error: ($respHttpCode) $curlError"); - } - - // Parse out the raw response into usable bits - list($responseHeaders, $responseBody) = - self::parseHttpResponse($respData, $respHeaderSize); - - if ($respHttpCode == 304 && $cached) { - // If the server responded NOT_MODIFIED, return the cached request. - if (isset($responseHeaders['connection'])) { - $hopByHop = array_merge( - self::$HOP_BY_HOP, - explode(',', $responseHeaders['connection']) - ); - - $endToEnd = array(); - foreach($hopByHop as $key) { - if (isset($responseHeaders[$key])) { - $endToEnd[$key] = $responseHeaders[$key]; - } - } - $cached->setResponseHeaders($endToEnd); - } - return $cached; - } - - // Fill in the apiHttpRequest with the response values - $request->setResponseHttpCode($respHttpCode); - $request->setResponseHeaders($responseHeaders); - $request->setResponseBody($responseBody); - // Store the request in cache (the function checks to see if the request - // can actually be cached) - $this->setCachedRequest($request); - // And finally return it - return $request; - } - - /** - * @visible for testing. - * Cache the response to an HTTP request if it is cacheable. - * @param Google_HttpRequest $request - * @return bool Returns true if the insertion was successful. - * Otherwise, return false. - */ - public function setCachedRequest(Google_HttpRequest $request) { - // Determine if the request is cacheable. - if (Google_CacheParser::isResponseCacheable($request)) { - Google_Client::$cache->set($request->getCacheKey(), $request); - return true; - } - - return false; - } - - /** - * @visible for testing. - * @param Google_HttpRequest $request - * @return Google_HttpRequest|bool Returns the cached object or - * false if the operation was unsuccessful. - */ - public function getCachedRequest(Google_HttpRequest $request) { - if (false == Google_CacheParser::isRequestCacheable($request)) { - false; - } - - return Google_Client::$cache->get($request->getCacheKey()); - } - - /** - * @param $respData - * @param $headerSize - * @return array - */ - public static function parseHttpResponse($respData, $headerSize) { - if (stripos($respData, self::CONNECTION_ESTABLISHED) !== false) { - $respData = str_ireplace(self::CONNECTION_ESTABLISHED, '', $respData); - } - - if ($headerSize) { - $responseBody = substr($respData, $headerSize); - $responseHeaders = substr($respData, 0, $headerSize); - } else { - list($responseHeaders, $responseBody) = explode("\r\n\r\n", $respData, 2); - } - - $responseHeaders = self::parseResponseHeaders($responseHeaders); - return array($responseHeaders, $responseBody); - } - - public static function parseResponseHeaders($rawHeaders) { - $responseHeaders = array(); - - $responseHeaderLines = explode("\r\n", $rawHeaders); - foreach ($responseHeaderLines as $headerLine) { - if ($headerLine && strpos($headerLine, ':') !== false) { - list($header, $value) = explode(': ', $headerLine, 2); - $header = strtolower($header); - if (isset($responseHeaders[$header])) { - $responseHeaders[$header] .= "\n" . $value; - } else { - $responseHeaders[$header] = $value; - } - } - } - return $responseHeaders; - } - - /** - * @visible for testing - * Process an http request that contains an enclosed entity. - * @param Google_HttpRequest $request - * @return Google_HttpRequest Processed request with the enclosed entity. - */ - public function processEntityRequest(Google_HttpRequest $request) { - $postBody = $request->getPostBody(); - $contentType = $request->getRequestHeader("content-type"); - - // Set the default content-type as application/x-www-form-urlencoded. - if (false == $contentType) { - $contentType = self::FORM_URLENCODED; - $request->setRequestHeaders(array('content-type' => $contentType)); - } - - // Force the payload to match the content-type asserted in the header. - if ($contentType == self::FORM_URLENCODED && is_array($postBody)) { - $postBody = http_build_query($postBody, '', '&'); - $request->setPostBody($postBody); - } - - // Make sure the content-length header is set. - if (!$postBody || is_string($postBody)) { - $postsLength = strlen($postBody); - $request->setRequestHeaders(array('content-length' => $postsLength)); - } - - return $request; - } - - /** - * Set options that update cURL's default behavior. - * The list of accepted options are: - * {@link http://php.net/manual/en/function.curl-setopt.php] - * - * @param array $optCurlParams Multiple options used by a cURL session. - */ - public function setOptions($optCurlParams) { - foreach ($optCurlParams as $key => $val) { - $this->curlParams[$key] = $val; - } - } -} \ No newline at end of file diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_HttpRequest.php b/apps/files_external/3rdparty/google-api-php-client/src/io/Google_HttpRequest.php deleted file mode 100644 index b98eae5400..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_HttpRequest.php +++ /dev/null @@ -1,304 +0,0 @@ - - * @author Chirag Shah - * - */ -class Google_HttpRequest { - const USER_AGENT_SUFFIX = "google-api-php-client/0.6.0"; - private $batchHeaders = array( - 'Content-Type' => 'application/http', - 'Content-Transfer-Encoding' => 'binary', - 'MIME-Version' => '1.0', - 'Content-Length' => '' - ); - - protected $url; - protected $requestMethod; - protected $requestHeaders; - protected $postBody; - protected $userAgent; - - protected $responseHttpCode; - protected $responseHeaders; - protected $responseBody; - - public $accessKey; - - public function __construct($url, $method = 'GET', $headers = array(), $postBody = null) { - $this->setUrl($url); - $this->setRequestMethod($method); - $this->setRequestHeaders($headers); - $this->setPostBody($postBody); - - global $apiConfig; - if (empty($apiConfig['application_name'])) { - $this->userAgent = self::USER_AGENT_SUFFIX; - } else { - $this->userAgent = $apiConfig['application_name'] . " " . self::USER_AGENT_SUFFIX; - } - } - - /** - * Misc function that returns the base url component of the $url - * used by the OAuth signing class to calculate the base string - * @return string The base url component of the $url. - * @see http://oauth.net/core/1.0a/#anchor13 - */ - public function getBaseUrl() { - if ($pos = strpos($this->url, '?')) { - return substr($this->url, 0, $pos); - } - return $this->url; - } - - /** - * Misc function that returns an array of the query parameters of the current - * url used by the OAuth signing class to calculate the signature - * @return array Query parameters in the query string. - */ - public function getQueryParams() { - if ($pos = strpos($this->url, '?')) { - $queryStr = substr($this->url, $pos + 1); - $params = array(); - parse_str($queryStr, $params); - return $params; - } - return array(); - } - - /** - * @return string HTTP Response Code. - */ - public function getResponseHttpCode() { - return (int) $this->responseHttpCode; - } - - /** - * @param int $responseHttpCode HTTP Response Code. - */ - public function setResponseHttpCode($responseHttpCode) { - $this->responseHttpCode = $responseHttpCode; - } - - /** - * @return $responseHeaders (array) HTTP Response Headers. - */ - public function getResponseHeaders() { - return $this->responseHeaders; - } - - /** - * @return string HTTP Response Body - */ - public function getResponseBody() { - return $this->responseBody; - } - - /** - * @param array $headers The HTTP response headers - * to be normalized. - */ - public function setResponseHeaders($headers) { - $headers = Google_Utils::normalize($headers); - if ($this->responseHeaders) { - $headers = array_merge($this->responseHeaders, $headers); - } - - $this->responseHeaders = $headers; - } - - /** - * @param string $key - * @return array|boolean Returns the requested HTTP header or - * false if unavailable. - */ - public function getResponseHeader($key) { - return isset($this->responseHeaders[$key]) - ? $this->responseHeaders[$key] - : false; - } - - /** - * @param string $responseBody The HTTP response body. - */ - public function setResponseBody($responseBody) { - $this->responseBody = $responseBody; - } - - /** - * @return string $url The request URL. - */ - - public function getUrl() { - return $this->url; - } - - /** - * @return string $method HTTP Request Method. - */ - public function getRequestMethod() { - return $this->requestMethod; - } - - /** - * @return array $headers HTTP Request Headers. - */ - public function getRequestHeaders() { - return $this->requestHeaders; - } - - /** - * @param string $key - * @return array|boolean Returns the requested HTTP header or - * false if unavailable. - */ - public function getRequestHeader($key) { - return isset($this->requestHeaders[$key]) - ? $this->requestHeaders[$key] - : false; - } - - /** - * @return string $postBody HTTP Request Body. - */ - public function getPostBody() { - return $this->postBody; - } - - /** - * @param string $url the url to set - */ - public function setUrl($url) { - if (substr($url, 0, 4) == 'http') { - $this->url = $url; - } else { - // Force the path become relative. - if (substr($url, 0, 1) !== '/') { - $url = '/' . $url; - } - global $apiConfig; - $this->url = $apiConfig['basePath'] . $url; - } - } - - /** - * @param string $method Set he HTTP Method and normalize - * it to upper-case, as required by HTTP. - * - */ - public function setRequestMethod($method) { - $this->requestMethod = strtoupper($method); - } - - /** - * @param array $headers The HTTP request headers - * to be set and normalized. - */ - public function setRequestHeaders($headers) { - $headers = Google_Utils::normalize($headers); - if ($this->requestHeaders) { - $headers = array_merge($this->requestHeaders, $headers); - } - $this->requestHeaders = $headers; - } - - /** - * @param string $postBody the postBody to set - */ - public function setPostBody($postBody) { - $this->postBody = $postBody; - } - - /** - * Set the User-Agent Header. - * @param string $userAgent The User-Agent. - */ - public function setUserAgent($userAgent) { - $this->userAgent = $userAgent; - } - - /** - * @return string The User-Agent. - */ - public function getUserAgent() { - return $this->userAgent; - } - - /** - * Returns a cache key depending on if this was an OAuth signed request - * in which case it will use the non-signed url and access key to make this - * cache key unique per authenticated user, else use the plain request url - * @return string The md5 hash of the request cache key. - */ - public function getCacheKey() { - $key = $this->getUrl(); - - if (isset($this->accessKey)) { - $key .= $this->accessKey; - } - - if (isset($this->requestHeaders['authorization'])) { - $key .= $this->requestHeaders['authorization']; - } - - return md5($key); - } - - public function getParsedCacheControl() { - $parsed = array(); - $rawCacheControl = $this->getResponseHeader('cache-control'); - if ($rawCacheControl) { - $rawCacheControl = str_replace(', ', '&', $rawCacheControl); - parse_str($rawCacheControl, $parsed); - } - - return $parsed; - } - - /** - * @param string $id - * @return string A string representation of the HTTP Request. - */ - public function toBatchString($id) { - $str = ''; - foreach($this->batchHeaders as $key => $val) { - $str .= $key . ': ' . $val . "\n"; - } - - $str .= "Content-ID: $id\n"; - $str .= "\n"; - - $path = parse_url($this->getUrl(), PHP_URL_PATH); - $str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n"; - foreach($this->getRequestHeaders() as $key => $val) { - $str .= $key . ': ' . $val . "\n"; - } - - if ($this->getPostBody()) { - $str .= "\n"; - $str .= $this->getPostBody(); - } - - return $str; - } -} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_IO.php b/apps/files_external/3rdparty/google-api-php-client/src/io/Google_IO.php deleted file mode 100644 index 5445e69903..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_IO.php +++ /dev/null @@ -1,49 +0,0 @@ - - */ -interface Google_IO { - /** - * An utility function that first calls $this->auth->sign($request) and then executes makeRequest() - * on that signed request. Used for when a request should be authenticated - * @param Google_HttpRequest $request - * @return Google_HttpRequest $request - */ - public function authenticatedRequest(Google_HttpRequest $request); - - /** - * Executes a apIHttpRequest and returns the resulting populated httpRequest - * @param Google_HttpRequest $request - * @return Google_HttpRequest $request - */ - public function makeRequest(Google_HttpRequest $request); - - /** - * Set options that update the transport implementation's behavior. - * @param $options - */ - public function setOptions($options); - -} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_MediaFileUpload.php b/apps/files_external/3rdparty/google-api-php-client/src/service/Google_MediaFileUpload.php deleted file mode 100644 index c64e18851d..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_MediaFileUpload.php +++ /dev/null @@ -1,262 +0,0 @@ - - * - */ -class Google_MediaFileUpload { - const UPLOAD_MEDIA_TYPE = 'media'; - const UPLOAD_MULTIPART_TYPE = 'multipart'; - const UPLOAD_RESUMABLE_TYPE = 'resumable'; - - /** @var string $mimeType */ - public $mimeType; - - /** @var string $data */ - public $data; - - /** @var bool $resumable */ - public $resumable; - - /** @var int $chunkSize */ - public $chunkSize; - - /** @var int $size */ - public $size; - - /** @var string $resumeUri */ - public $resumeUri; - - /** @var int $progress */ - public $progress; - - /** - * @param $mimeType string - * @param $data string The bytes you want to upload. - * @param $resumable bool - * @param bool $chunkSize File will be uploaded in chunks of this many bytes. - * only used if resumable=True - */ - public function __construct($mimeType, $data, $resumable=false, $chunkSize=false) { - $this->mimeType = $mimeType; - $this->data = $data; - $this->size = strlen($this->data); - $this->resumable = $resumable; - if(!$chunkSize) { - $chunkSize = 256 * 1024; - } - $this->chunkSize = $chunkSize; - $this->progress = 0; - } - - public function setFileSize($size) { - $this->size = $size; - } - - /** - * @static - * @param $meta - * @param $params - * @return array|bool - */ - public static function process($meta, &$params) { - $payload = array(); - $meta = is_string($meta) ? json_decode($meta, true) : $meta; - $uploadType = self::getUploadType($meta, $payload, $params); - if (!$uploadType) { - // Process as a normal API request. - return false; - } - - // Process as a media upload request. - $params['uploadType'] = array( - 'type' => 'string', - 'location' => 'query', - 'value' => $uploadType, - ); - - $mimeType = isset($params['mimeType']) - ? $params['mimeType']['value'] - : false; - unset($params['mimeType']); - - if (!$mimeType) { - $mimeType = $payload['content-type']; - } - - if (isset($params['file'])) { - // This is a standard file upload with curl. - $file = $params['file']['value']; - unset($params['file']); - return self::processFileUpload($file, $mimeType); - } - - $data = isset($params['data']) - ? $params['data']['value'] - : false; - unset($params['data']); - - if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) { - $payload['content-type'] = $mimeType; - $payload['postBody'] = is_string($meta) ? $meta : json_encode($meta); - - } elseif (self::UPLOAD_MEDIA_TYPE == $uploadType) { - // This is a simple media upload. - $payload['content-type'] = $mimeType; - $payload['postBody'] = $data; - } - - elseif (self::UPLOAD_MULTIPART_TYPE == $uploadType) { - // This is a multipart/related upload. - $boundary = isset($params['boundary']['value']) ? $params['boundary']['value'] : mt_rand(); - $boundary = str_replace('"', '', $boundary); - $payload['content-type'] = 'multipart/related; boundary=' . $boundary; - $related = "--$boundary\r\n"; - $related .= "Content-Type: application/json; charset=UTF-8\r\n"; - $related .= "\r\n" . json_encode($meta) . "\r\n"; - $related .= "--$boundary\r\n"; - $related .= "Content-Type: $mimeType\r\n"; - $related .= "Content-Transfer-Encoding: base64\r\n"; - $related .= "\r\n" . base64_encode($data) . "\r\n"; - $related .= "--$boundary--"; - $payload['postBody'] = $related; - } - - return $payload; - } - - /** - * Prepares a standard file upload via cURL. - * @param $file - * @param $mime - * @return array Includes the processed file name. - * @visible For testing. - */ - public static function processFileUpload($file, $mime) { - if (!$file) return array(); - if (substr($file, 0, 1) != '@') { - $file = '@' . $file; - } - - // This is a standard file upload with curl. - $params = array('postBody' => array('file' => $file)); - if ($mime) { - $params['content-type'] = $mime; - } - - return $params; - } - - /** - * Valid upload types: - * - resumable (UPLOAD_RESUMABLE_TYPE) - * - media (UPLOAD_MEDIA_TYPE) - * - multipart (UPLOAD_MULTIPART_TYPE) - * - none (false) - * @param $meta - * @param $payload - * @param $params - * @return bool|string - */ - public static function getUploadType($meta, &$payload, &$params) { - if (isset($params['mediaUpload']) - && get_class($params['mediaUpload']['value']) == 'Google_MediaFileUpload') { - $upload = $params['mediaUpload']['value']; - unset($params['mediaUpload']); - $payload['content-type'] = $upload->mimeType; - if (isset($upload->resumable) && $upload->resumable) { - return self::UPLOAD_RESUMABLE_TYPE; - } - } - - // Allow the developer to override the upload type. - if (isset($params['uploadType'])) { - return $params['uploadType']['value']; - } - - $data = isset($params['data']['value']) - ? $params['data']['value'] : false; - - if (false == $data && false == isset($params['file'])) { - // No upload data available. - return false; - } - - if (isset($params['file'])) { - return self::UPLOAD_MEDIA_TYPE; - } - - if (false == $meta) { - return self::UPLOAD_MEDIA_TYPE; - } - - return self::UPLOAD_MULTIPART_TYPE; - } - - - public function nextChunk(Google_HttpRequest $req, $chunk=false) { - if (false == $this->resumeUri) { - $this->resumeUri = $this->getResumeUri($req); - } - - if (false == $chunk) { - $chunk = substr($this->data, $this->progress, $this->chunkSize); - } - - $lastBytePos = $this->progress + strlen($chunk) - 1; - $headers = array( - 'content-range' => "bytes $this->progress-$lastBytePos/$this->size", - 'content-type' => $req->getRequestHeader('content-type'), - 'content-length' => $this->chunkSize, - 'expect' => '', - ); - - $httpRequest = new Google_HttpRequest($this->resumeUri, 'PUT', $headers, $chunk); - $response = Google_Client::$io->authenticatedRequest($httpRequest); - $code = $response->getResponseHttpCode(); - if (308 == $code) { - $range = explode('-', $response->getResponseHeader('range')); - $this->progress = $range[1] + 1; - return false; - } else { - return Google_REST::decodeHttpResponse($response); - } - } - - private function getResumeUri(Google_HttpRequest $httpRequest) { - $result = null; - $body = $httpRequest->getPostBody(); - if ($body) { - $httpRequest->setRequestHeaders(array( - 'content-type' => 'application/json; charset=UTF-8', - 'content-length' => Google_Utils::getStrLen($body), - 'x-upload-content-type' => $this->mimeType, - 'x-upload-content-length' => $this->size, - 'expect' => '', - )); - } - - $response = Google_Client::$io->makeRequest($httpRequest); - $location = $response->getResponseHeader('location'); - $code = $response->getResponseHttpCode(); - if (200 == $code && true == $location) { - return $location; - } - throw new Google_Exception("Failed to start the resumable upload"); - } -} \ No newline at end of file diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Model.php b/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Model.php deleted file mode 100644 index cb44cb2574..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Model.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - */ -class Google_Model { - public function __construct( /* polymorphic */ ) { - if (func_num_args() == 1 && is_array(func_get_arg(0))) { - // Initialize the model with the array's contents. - $array = func_get_arg(0); - $this->mapTypes($array); - } - } - - /** - * Initialize this object's properties from an array. - * - * @param array $array Used to seed this object's properties. - * @return void - */ - protected function mapTypes($array) { - foreach ($array as $key => $val) { - $this->$key = $val; - - $keyTypeName = "__$key" . 'Type'; - $keyDataType = "__$key" . 'DataType'; - if ($this->useObjects() && property_exists($this, $keyTypeName)) { - if ($this->isAssociativeArray($val)) { - if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) { - foreach($val as $arrayKey => $arrayItem) { - $val[$arrayKey] = $this->createObjectFromName($keyTypeName, $arrayItem); - } - $this->$key = $val; - } else { - $this->$key = $this->createObjectFromName($keyTypeName, $val); - } - } else if (is_array($val)) { - $arrayObject = array(); - foreach ($val as $arrayIndex => $arrayItem) { - $arrayObject[$arrayIndex] = $this->createObjectFromName($keyTypeName, $arrayItem); - } - $this->$key = $arrayObject; - } - } - } - } - - /** - * Returns true only if the array is associative. - * @param array $array - * @return bool True if the array is associative. - */ - protected function isAssociativeArray($array) { - if (!is_array($array)) { - return false; - } - $keys = array_keys($array); - foreach($keys as $key) { - if (is_string($key)) { - return true; - } - } - return false; - } - - /** - * Given a variable name, discover its type. - * - * @param $name - * @param $item - * @return object The object from the item. - */ - private function createObjectFromName($name, $item) { - $type = $this->$name; - return new $type($item); - } - - protected function useObjects() { - global $apiConfig; - return (isset($apiConfig['use_objects']) && $apiConfig['use_objects']); - } - - /** - * Verify if $obj is an array. - * @throws Google_Exception Thrown if $obj isn't an array. - * @param array $obj Items that should be validated. - * @param string $type Array items should be of this type. - * @param string $method Method expecting an array as an argument. - */ - public function assertIsArray($obj, $type, $method) { - if ($obj && !is_array($obj)) { - throw new Google_Exception("Incorrect parameter type passed to $method(), expected an" - . " array containing items of type $type."); - } - } -} diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_ServiceResource.php b/apps/files_external/3rdparty/google-api-php-client/src/service/Google_ServiceResource.php deleted file mode 100644 index bb3af4db80..0000000000 --- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_ServiceResource.php +++ /dev/null @@ -1,205 +0,0 @@ - - * @author Chirag Shah - * - */ -class Google_ServiceResource { - // Valid query parameters that work, but don't appear in discovery. - private $stackParameters = array( - 'alt' => array('type' => 'string', 'location' => 'query'), - 'boundary' => array('type' => 'string', 'location' => 'query'), - 'fields' => array('type' => 'string', 'location' => 'query'), - 'trace' => array('type' => 'string', 'location' => 'query'), - 'userIp' => array('type' => 'string', 'location' => 'query'), - 'userip' => array('type' => 'string', 'location' => 'query'), - 'quotaUser' => array('type' => 'string', 'location' => 'query'), - 'file' => array('type' => 'complex', 'location' => 'body'), - 'data' => array('type' => 'string', 'location' => 'body'), - 'mimeType' => array('type' => 'string', 'location' => 'header'), - 'uploadType' => array('type' => 'string', 'location' => 'query'), - 'mediaUpload' => array('type' => 'complex', 'location' => 'query'), - ); - - /** @var Google_Service $service */ - private $service; - - /** @var string $serviceName */ - private $serviceName; - - /** @var string $resourceName */ - private $resourceName; - - /** @var array $methods */ - private $methods; - - public function __construct($service, $serviceName, $resourceName, $resource) { - $this->service = $service; - $this->serviceName = $serviceName; - $this->resourceName = $resourceName; - $this->methods = isset($resource['methods']) ? $resource['methods'] : array($resourceName => $resource); - } - - /** - * @param $name - * @param $arguments - * @return Google_HttpRequest|array - * @throws Google_Exception - */ - public function __call($name, $arguments) { - if (! isset($this->methods[$name])) { - throw new Google_Exception("Unknown function: {$this->serviceName}->{$this->resourceName}->{$name}()"); - } - $method = $this->methods[$name]; - $parameters = $arguments[0]; - - // postBody is a special case since it's not defined in the discovery document as parameter, but we abuse the param entry for storing it - $postBody = null; - if (isset($parameters['postBody'])) { - if (is_object($parameters['postBody'])) { - $this->stripNull($parameters['postBody']); - } - - // Some APIs require the postBody to be set under the data key. - if (is_array($parameters['postBody']) && 'latitude' == $this->serviceName) { - if (!isset($parameters['postBody']['data'])) { - $rawBody = $parameters['postBody']; - unset($parameters['postBody']); - $parameters['postBody']['data'] = $rawBody; - } - } - - $postBody = is_array($parameters['postBody']) || is_object($parameters['postBody']) - ? json_encode($parameters['postBody']) - : $parameters['postBody']; - unset($parameters['postBody']); - - if (isset($parameters['optParams'])) { - $optParams = $parameters['optParams']; - unset($parameters['optParams']); - $parameters = array_merge($parameters, $optParams); - } - } - - if (!isset($method['parameters'])) { - $method['parameters'] = array(); - } - - $method['parameters'] = array_merge($method['parameters'], $this->stackParameters); - foreach ($parameters as $key => $val) { - if ($key != 'postBody' && ! isset($method['parameters'][$key])) { - throw new Google_Exception("($name) unknown parameter: '$key'"); - } - } - if (isset($method['parameters'])) { - foreach ($method['parameters'] as $paramName => $paramSpec) { - if (isset($paramSpec['required']) && $paramSpec['required'] && ! isset($parameters[$paramName])) { - throw new Google_Exception("($name) missing required param: '$paramName'"); - } - if (isset($parameters[$paramName])) { - $value = $parameters[$paramName]; - $parameters[$paramName] = $paramSpec; - $parameters[$paramName]['value'] = $value; - unset($parameters[$paramName]['required']); - } else { - unset($parameters[$paramName]); - } - } - } - - // Discovery v1.0 puts the canonical method id under the 'id' field. - if (! isset($method['id'])) { - $method['id'] = $method['rpcMethod']; - } - - // Discovery v1.0 puts the canonical path under the 'path' field. - if (! isset($method['path'])) { - $method['path'] = $method['restPath']; - } - - $servicePath = $this->service->servicePath; - - // Process Media Request - $contentType = false; - if (isset($method['mediaUpload'])) { - $media = Google_MediaFileUpload::process($postBody, $parameters); - if ($media) { - $contentType = isset($media['content-type']) ? $media['content-type']: null; - $postBody = isset($media['postBody']) ? $media['postBody'] : null; - $servicePath = $method['mediaUpload']['protocols']['simple']['path']; - $method['path'] = ''; - } - } - - $url = Google_REST::createRequestUri($servicePath, $method['path'], $parameters); - $httpRequest = new Google_HttpRequest($url, $method['httpMethod'], null, $postBody); - if ($postBody) { - $contentTypeHeader = array(); - if (isset($contentType) && $contentType) { - $contentTypeHeader['content-type'] = $contentType; - } else { - $contentTypeHeader['content-type'] = 'application/json; charset=UTF-8'; - $contentTypeHeader['content-length'] = Google_Utils::getStrLen($postBody); - } - $httpRequest->setRequestHeaders($contentTypeHeader); - } - - $httpRequest = Google_Client::$auth->sign($httpRequest); - if (Google_Client::$useBatch) { - return $httpRequest; - } - - // Terminate immediately if this is a resumable request. - if (isset($parameters['uploadType']['value']) - && Google_MediaFileUpload::UPLOAD_RESUMABLE_TYPE == $parameters['uploadType']['value']) { - $contentTypeHeader = array(); - if (isset($contentType) && $contentType) { - $contentTypeHeader['content-type'] = $contentType; - } - $httpRequest->setRequestHeaders($contentTypeHeader); - if ($postBody) { - $httpRequest->setPostBody($postBody); - } - return $httpRequest; - } - - return Google_REST::execute($httpRequest); - } - - public function useObjects() { - global $apiConfig; - return (isset($apiConfig['use_objects']) && $apiConfig['use_objects']); - } - - protected function stripNull(&$o) { - $o = (array) $o; - foreach ($o as $k => $v) { - if ($v === null || strstr($k, "\0*\0__")) { - unset($o[$k]); - } - elseif (is_object($v) || is_array($v)) { - $this->stripNull($o[$k]); - } - } - } -}