Added Google API lib
This commit is contained in:
41
htdocs/lib/Google/Auth/Abstract.php
Normal file
41
htdocs/lib/Google/Auth/Abstract.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once "Google/Http/Request.php";
|
||||
|
||||
/**
|
||||
* Abstract class for the Authentication in the API client
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
*
|
||||
*/
|
||||
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 refreshToken($refreshToken);
|
||||
abstract public function revokeToken();
|
||||
}
|
||||
133
htdocs/lib/Google/Auth/AssertionCredentials.php
Normal file
133
htdocs/lib/Google/Auth/AssertionCredentials.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
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 <chirags@google.com>
|
||||
*/
|
||||
class Google_Auth_AssertionCredentials
|
||||
{
|
||||
const MAX_TOKEN_LIFETIME_SECS = 3600;
|
||||
|
||||
public $serviceAccountName;
|
||||
public $scopes;
|
||||
public $privateKey;
|
||||
public $privateKeyPassword;
|
||||
public $assertionType;
|
||||
public $sub;
|
||||
/**
|
||||
* @deprecated
|
||||
* @link http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06
|
||||
*/
|
||||
public $prn;
|
||||
private $useCache;
|
||||
|
||||
/**
|
||||
* @param $serviceAccountName
|
||||
* @param $scopes array List of scopes
|
||||
* @param $privateKey
|
||||
* @param string $privateKeyPassword
|
||||
* @param string $assertionType
|
||||
* @param bool|string $sub The email address of the user for which the
|
||||
* 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,
|
||||
$scopes,
|
||||
$privateKey,
|
||||
$privateKeyPassword = 'notasecret',
|
||||
$assertionType = 'http://oauth.net/grant_type/jwt/1.0/bearer',
|
||||
$sub = false,
|
||||
$useCache = true
|
||||
) {
|
||||
$this->serviceAccountName = $serviceAccountName;
|
||||
$this->scopes = is_string($scopes) ? $scopes : implode(' ', $scopes);
|
||||
$this->privateKey = $privateKey;
|
||||
$this->privateKeyPassword = $privateKeyPassword;
|
||||
$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()
|
||||
{
|
||||
$now = time();
|
||||
|
||||
$jwtParams = array(
|
||||
'aud' => Google_Auth_OAuth2::OAUTH2_TOKEN_URI,
|
||||
'scope' => $this->scopes,
|
||||
'iat' => $now,
|
||||
'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS,
|
||||
'iss' => $this->serviceAccountName,
|
||||
);
|
||||
|
||||
if ($this->sub !== false) {
|
||||
$jwtParams['sub'] = $this->sub;
|
||||
} else if ($this->prn !== false) {
|
||||
$jwtParams['prn'] = $this->prn;
|
||||
}
|
||||
|
||||
return $this->makeSignedJwt($jwtParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a signed JWT.
|
||||
* @param array $payload
|
||||
* @return string The signed JWT.
|
||||
*/
|
||||
private function makeSignedJwt($payload)
|
||||
{
|
||||
$header = array('typ' => 'JWT', 'alg' => 'RS256');
|
||||
|
||||
$segments = array(
|
||||
Google_Utils::urlSafeB64Encode(json_encode($header)),
|
||||
Google_Utils::urlSafeB64Encode(json_encode($payload))
|
||||
);
|
||||
|
||||
$signingInput = implode('.', $segments);
|
||||
$signer = new Google_Signer_P12($this->privateKey, $this->privateKeyPassword);
|
||||
$signature = $signer->sign($signingInput);
|
||||
$segments[] = Google_Utils::urlSafeB64Encode($signature);
|
||||
|
||||
return implode(".", $segments);
|
||||
}
|
||||
}
|
||||
22
htdocs/lib/Google/Auth/Exception.php
Normal file
22
htdocs/lib/Google/Auth/Exception.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once "Google/Exception.php";
|
||||
|
||||
class Google_Auth_Exception extends Google_Exception
|
||||
{
|
||||
}
|
||||
69
htdocs/lib/Google/Auth/LoginTicket.php
Normal file
69
htdocs/lib/Google/Auth/LoginTicket.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once "Google/Auth/Exception.php";
|
||||
|
||||
/**
|
||||
* Class to hold information about an authenticated login.
|
||||
*
|
||||
* @author Brian Eaton <beaton@google.com>
|
||||
*/
|
||||
class Google_Auth_LoginTicket
|
||||
{
|
||||
const USER_ATTR = "sub";
|
||||
|
||||
// Information from id token envelope.
|
||||
private $envelope;
|
||||
|
||||
// Information from id token payload.
|
||||
private $payload;
|
||||
|
||||
/**
|
||||
* Creates a user based on the supplied token.
|
||||
*
|
||||
* @param string $envelope Header from a verified authentication token.
|
||||
* @param string $payload Information from a verified authentication token.
|
||||
*/
|
||||
public function __construct($envelope, $payload)
|
||||
{
|
||||
$this->envelope = $envelope;
|
||||
$this->payload = $payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the numeric identifier for the user.
|
||||
* @throws Google_Auth_Exception
|
||||
* @return
|
||||
*/
|
||||
public function getUserId()
|
||||
{
|
||||
if (array_key_exists(self::USER_ATTR, $this->payload)) {
|
||||
return $this->payload[self::USER_ATTR];
|
||||
}
|
||||
throw new Google_Auth_Exception("No user_id in token");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns attributes from the login ticket. This can contain
|
||||
* various information about the user session.
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes()
|
||||
{
|
||||
return array("envelope" => $this->envelope, "payload" => $this->payload);
|
||||
}
|
||||
}
|
||||
580
htdocs/lib/Google/Auth/OAuth2.php
Normal file
580
htdocs/lib/Google/Auth/OAuth2.php
Normal file
@@ -0,0 +1,580 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once "Google/Auth/Abstract.php";
|
||||
require_once "Google/Auth/AssertionCredentials.php";
|
||||
require_once "Google/Auth/Exception.php";
|
||||
require_once "Google/Auth/LoginTicket.php";
|
||||
require_once "Google/Client.php";
|
||||
require_once "Google/Http/Request.php";
|
||||
require_once "Google/Utils.php";
|
||||
require_once "Google/Verifier/Pem.php";
|
||||
|
||||
/**
|
||||
* Authentication class that deals with the OAuth 2 web-server authentication flow
|
||||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*
|
||||
*/
|
||||
class Google_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 = 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')
|
||||
)
|
||||
);
|
||||
$request->disableGzip();
|
||||
$response = $this->client->getIo()->makeRequest($request);
|
||||
|
||||
if ($response->getResponseHttpCode() == 200) {
|
||||
$this->setAccessToken($response->getResponseBody());
|
||||
$this->token['created'] = time();
|
||||
return $this->getAccessToken();
|
||||
} else {
|
||||
$decodedResponse = json_decode($response->getResponseBody(), true);
|
||||
if ($decodedResponse != null && $decodedResponse['error']) {
|
||||
$decodedResponse = $decodedResponse['error'];
|
||||
}
|
||||
throw new Google_Auth_Exception(
|
||||
sprintf(
|
||||
"Error fetching OAuth2 access token, message: '%s'",
|
||||
$decodedResponse
|
||||
),
|
||||
$response->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
|
||||
);
|
||||
$http->disableGzip();
|
||||
$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"
|
||||
);
|
||||
$request->disableGzip();
|
||||
$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);
|
||||
}
|
||||
}
|
||||
92
htdocs/lib/Google/Auth/Simple.php
Normal file
92
htdocs/lib/Google/Auth/Simple.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once "Google/Auth/Abstract.php";
|
||||
require_once "Google/Http/Request.php";
|
||||
|
||||
/**
|
||||
* Simple API access implementation. Can either be used to make requests
|
||||
* completely unauthenticated, or by using a Simple API Access developer
|
||||
* key.
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
53
htdocs/lib/Google/Cache/Abstract.php
Normal file
53
htdocs/lib/Google/Cache/Abstract.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract storage class
|
||||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
*/
|
||||
abstract class Google_Cache_Abstract
|
||||
{
|
||||
|
||||
abstract public function __construct(Google_Client $client);
|
||||
|
||||
/**
|
||||
* Retrieves the data for the given key, or false if they
|
||||
* key is unknown or expired
|
||||
*
|
||||
* @param String $key The key who's data to retrieve
|
||||
* @param boolean|int $expiration Expiration time in seconds
|
||||
*
|
||||
*/
|
||||
abstract public function get($key, $expiration = false);
|
||||
|
||||
/**
|
||||
* Store the key => $value set. The $value is serialized
|
||||
* by this function so can be of any type
|
||||
*
|
||||
* @param string $key Key of the data
|
||||
* @param string $value data
|
||||
*/
|
||||
abstract public function set($key, $value);
|
||||
|
||||
/**
|
||||
* Removes the key/data pair for the given $key
|
||||
*
|
||||
* @param String $key
|
||||
*/
|
||||
abstract public function delete($key);
|
||||
}
|
||||
73
htdocs/lib/Google/Cache/Apc.php
Normal file
73
htdocs/lib/Google/Cache/Apc.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once "Google/Cache/Abstract.php";
|
||||
require_once "Google/Cache/Exception.php";
|
||||
|
||||
/**
|
||||
* A persistent storage class based on the APC cache, which is not
|
||||
* really very persistent, as soon as you restart your web server
|
||||
* the storage will be wiped, however for debugging and/or speed
|
||||
* it can be useful, and cache is a lot cheaper then storage.
|
||||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
21
htdocs/lib/Google/Cache/Exception.php
Normal file
21
htdocs/lib/Google/Cache/Exception.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once "Google/Exception.php";
|
||||
|
||||
class Google_Cache_Exception extends Google_Exception
|
||||
{
|
||||
}
|
||||
145
htdocs/lib/Google/Cache/File.php
Normal file
145
htdocs/lib/Google/Cache/File.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once "Google/Cache/Abstract.php";
|
||||
require_once "Google/Cache/Exception.php";
|
||||
|
||||
/*
|
||||
* This class implements a basic on disk storage. While that does
|
||||
* work quite well it's not the most elegant and scalable solution.
|
||||
* It will also get you into a heap of trouble when you try to run
|
||||
* this in a clustered environment.
|
||||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
*/
|
||||
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 = fread($this->fh, filesize($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);
|
||||
}
|
||||
}
|
||||
}
|
||||
137
htdocs/lib/Google/Cache/Memcache.php
Normal file
137
htdocs/lib/Google/Cache/Memcache.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once "Google/Cache/Abstract.php";
|
||||
require_once "Google/Cache/Exception.php";
|
||||
|
||||
/**
|
||||
* A persistent storage class based on the memcache, which is not
|
||||
* really very persistent, as soon as you restart your memcache daemon
|
||||
* the storage will be wiped.
|
||||
*
|
||||
* Will use either the memcache or memcached extensions, preferring
|
||||
* memcached.
|
||||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
*/
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
56
htdocs/lib/Google/Cache/Null.php
Normal file
56
htdocs/lib/Google/Cache/Null.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once "Google/Cache/Abstract.php";
|
||||
require_once "Google/Cache/Exception.php";
|
||||
|
||||
/**
|
||||
* A blank storage class, for cases where caching is not
|
||||
* required.
|
||||
*/
|
||||
class Google_Cache_Null extends Google_Cache_Abstract
|
||||
{
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get($key, $expiration = false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
// Nop.
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param String $key
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
// Nop.
|
||||
}
|
||||
}
|
||||
608
htdocs/lib/Google/Client.php
Normal file
608
htdocs/lib/Google/Client.php
Normal file
@@ -0,0 +1,608 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once 'Google/Auth/AssertionCredentials.php';
|
||||
require_once 'Google/Cache/File.php';
|
||||
require_once 'Google/Cache/Memcache.php';
|
||||
require_once 'Google/Config.php';
|
||||
require_once 'Google/Collection.php';
|
||||
require_once 'Google/Exception.php';
|
||||
require_once 'Google/IO/Curl.php';
|
||||
require_once 'Google/IO/Stream.php';
|
||||
require_once 'Google/Model.php';
|
||||
require_once 'Google/Service.php';
|
||||
require_once 'Google/Service/Resource.php';
|
||||
|
||||
/**
|
||||
* The Google API Client
|
||||
* http://code.google.com/p/google-api-php-client/
|
||||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Client
|
||||
{
|
||||
const LIBVER = "1.0.4-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');
|
||||
}
|
||||
|
||||
if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
|
||||
// Automatically disable compress.zlib, as currently unsupported.
|
||||
$config->setClassConfig('Google_Http_Request', 'disable_gzip', true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
|
||||
if (function_exists('curl_version')) {
|
||||
$config->setIoClass("Google_Io_Curl");
|
||||
} else {
|
||||
$config->setIoClass("Google_Io_Stream");
|
||||
}
|
||||
}
|
||||
|
||||
$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') {
|
||||
$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);
|
||||
}
|
||||
}
|
||||
94
htdocs/lib/Google/Collection.php
Normal file
94
htdocs/lib/Google/Collection.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
require_once "Google/Model.php";
|
||||
|
||||
/**
|
||||
* Extension to the regular Google_Model that automatically
|
||||
* exposes the items array for iteration, so you can just
|
||||
* iterate over the object rather than a reference inside.
|
||||
*/
|
||||
class Google_Collection extends Google_Model implements Iterator, Countable
|
||||
{
|
||||
protected $collection_key = 'items';
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
if (is_array($this->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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
315
htdocs/lib/Google/Config.php
Normal file
315
htdocs/lib/Google/Config.php
Normal file
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A class to contain the library configuration for the Google API client.
|
||||
*/
|
||||
class Google_Config
|
||||
{
|
||||
const GZIP_DISABLED = true;
|
||||
const GZIP_ENABLED = false;
|
||||
const GZIP_UPLOADS_ENABLED = true;
|
||||
const GZIP_UPLOADS_DISABLED = false;
|
||||
const USE_AUTO_IO_SELECTION = "auto";
|
||||
private $configuration;
|
||||
|
||||
/**
|
||||
* Create a new Google_Config. Can accept an ini file location with the
|
||||
* local configuration. For example:
|
||||
* application_name: "My App";
|
||||
*
|
||||
* @param [$ini_file_location] - optional - The location of the ini file to load
|
||||
*/
|
||||
public function __construct($ini_file_location = null)
|
||||
{
|
||||
$this->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' => self::USE_AUTO_IO_SELECTION,
|
||||
'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(
|
||||
'Google_IO_Abstract' => array(
|
||||
'request_timeout_seconds' => 100,
|
||||
),
|
||||
'Google_Http_Request' => array(
|
||||
// Disable the use of gzip on calls if set to true. Defaults to false.
|
||||
'disable_gzip' => self::GZIP_ENABLED,
|
||||
|
||||
// We default gzip to disabled on uploads even if gzip is otherwise
|
||||
// enabled, due to some issues seen with small packet sizes for uploads.
|
||||
// Please test with this option before enabling gzip for uploads in
|
||||
// a production environment.
|
||||
'enable_gzip_for_uploads' => self::GZIP_UPLOADS_DISABLED,
|
||||
),
|
||||
// If you want to pass in OAuth 2.0 settings, they will need to be
|
||||
// structured like this.
|
||||
'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;
|
||||
}
|
||||
}
|
||||
20
htdocs/lib/Google/Exception.php
Normal file
20
htdocs/lib/Google/Exception.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class Google_Exception extends Exception
|
||||
{
|
||||
}
|
||||
143
htdocs/lib/Google/Http/Batch.php
Normal file
143
htdocs/lib/Google/Http/Batch.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once 'Google/Client.php';
|
||||
require_once 'Google/Http/Request.php';
|
||||
require_once 'Google/Http/REST.php';
|
||||
|
||||
/**
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Http_Batch
|
||||
{
|
||||
/** @var string Multipart Boundary. */
|
||||
private $boundary;
|
||||
|
||||
/** @var array service requests to be executed. */
|
||||
private $requests = array();
|
||||
|
||||
/** @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_Http_Request $request, $key = false)
|
||||
{
|
||||
if (false == $key) {
|
||||
$key = mt_rand();
|
||||
}
|
||||
|
||||
$this->requests[$key] = $request;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$body = '';
|
||||
|
||||
/** @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}--";
|
||||
|
||||
$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 = $this->client->getIo()->makeRequest($httpRequest);
|
||||
|
||||
return $this->parseResponse($response);
|
||||
}
|
||||
|
||||
public function parseResponse(Google_Http_Request $response)
|
||||
{
|
||||
$contentType = $response->getResponseHeader('content-type');
|
||||
$contentType = explode(';', $contentType);
|
||||
$boundary = false;
|
||||
foreach ($contentType as $part) {
|
||||
$part = (explode('=', $part, 2));
|
||||
if (isset($part[0]) && 'boundary' == trim($part[0])) {
|
||||
$boundary = $part[1];
|
||||
}
|
||||
}
|
||||
|
||||
$body = $response->getResponseBody();
|
||||
if ($body) {
|
||||
$body = str_replace("--$boundary--", "--$boundary", $body);
|
||||
$parts = explode("--$boundary", $body);
|
||||
$responses = array();
|
||||
|
||||
foreach ($parts as $part) {
|
||||
$part = trim($part);
|
||||
if (!empty($part)) {
|
||||
list($metaHeaders, $part) = explode("\r\n\r\n", $part, 2);
|
||||
$metaHeaders = $this->client->getIo()->getHttpResponseHeaders($metaHeaders);
|
||||
|
||||
$status = substr($part, 0, strpos($part, "\n"));
|
||||
$status = explode(" ", $status);
|
||||
$status = $status[1];
|
||||
|
||||
list($partHeaders, $partBody) = $this->client->getIo()->ParseHttpResponse($part, false);
|
||||
$response = new Google_Http_Request("");
|
||||
$response->setResponseHttpCode($status);
|
||||
$response->setResponseHeaders($partHeaders);
|
||||
$response->setResponseBody($partBody);
|
||||
|
||||
// Need content id.
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $responses;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
184
htdocs/lib/Google/Http/CacheParser.php
Normal file
184
htdocs/lib/Google/Http/CacheParser.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
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 <chirags@google.com>
|
||||
*/
|
||||
class Google_Http_CacheParser
|
||||
{
|
||||
public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD');
|
||||
public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301');
|
||||
|
||||
/**
|
||||
* Check if an HTTP request can be cached by a private local cache.
|
||||
*
|
||||
* @static
|
||||
* @param Google_Http_Request $resp
|
||||
* @return bool True if the request is cacheable.
|
||||
* False if the request is uncacheable.
|
||||
*/
|
||||
public static function isRequestCacheable(Google_Http_Request $resp)
|
||||
{
|
||||
$method = $resp->getRequestMethod();
|
||||
if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't cache authorized requests/responses.
|
||||
// [rfc2616-14.8] When a shared cache receives a request containing an
|
||||
// Authorization field, it MUST NOT return the corresponding response
|
||||
// as a reply to any other request...
|
||||
if ($resp->getRequestHeader("authorization")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an HTTP response can be cached by a private local cache.
|
||||
*
|
||||
* @static
|
||||
* @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_Http_Request $resp)
|
||||
{
|
||||
// First, check if the HTTP request was cacheable before inspecting the
|
||||
// HTTP response.
|
||||
if (false == self::isRequestCacheable($resp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$code = $resp->getResponseHttpCode();
|
||||
if (! in_array($code, self::$CACHEABLE_STATUS_CODES)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The resource is uncacheable if the resource is already expired and
|
||||
// the resource doesn't have an ETag for revalidation.
|
||||
$etag = $resp->getResponseHeader("etag");
|
||||
if (self::isExpired($resp) && $etag == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// [rfc2616-14.9.2] If [no-store is] sent in a response, a cache MUST NOT
|
||||
// store any part of either this response or the request that elicited it.
|
||||
$cacheControl = $resp->getParsedCacheControl();
|
||||
if (isset($cacheControl['no-store'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Pragma: no-cache is an http request directive, but is occasionally
|
||||
// used as a response header incorrectly.
|
||||
$pragma = $resp->getResponseHeader('pragma');
|
||||
if ($pragma == 'no-cache' || strpos($pragma, 'no-cache') !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// [rfc2616-14.44] Vary: * is extremely difficult to cache. "It implies that
|
||||
// a cache cannot determine from the request headers of a subsequent request
|
||||
// whether this response is the appropriate representation."
|
||||
// Given this, we deem responses with the Vary header as uncacheable.
|
||||
$vary = $resp->getResponseHeader('vary');
|
||||
if ($vary) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @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_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.
|
||||
if (empty($rawExpires) || (is_numeric($rawExpires) && $rawExpires <= 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// See if we can parse the expires header.
|
||||
$parsedExpires = strtotime($rawExpires);
|
||||
if (false == $parsedExpires || $parsedExpires <= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the freshness of an http response.
|
||||
$freshnessLifetime = false;
|
||||
$cacheControl = $resp->getParsedCacheControl();
|
||||
if (isset($cacheControl['max-age'])) {
|
||||
$freshnessLifetime = $cacheControl['max-age'];
|
||||
}
|
||||
|
||||
$rawDate = $resp->getResponseHeader('date');
|
||||
$parsedDate = strtotime($rawDate);
|
||||
|
||||
if (empty($rawDate) || false == $parsedDate) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (false == $freshnessLifetime) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Calculate the age of an http response.
|
||||
$age = max(0, time() - $parsedDate);
|
||||
if (isset($responseHeaders['age'])) {
|
||||
$age = max($age, strtotime($responseHeaders['age']));
|
||||
}
|
||||
|
||||
return $freshnessLifetime <= $age;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a cache entry should be revalidated with by the origin.
|
||||
*
|
||||
* @param Google_Http_Request $response
|
||||
* @return bool True if the entry is expired, else return false.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
276
htdocs/lib/Google/Http/MediaFileUpload.php
Normal file
276
htdocs/lib/Google/Http/MediaFileUpload.php
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once 'Google/Client.php';
|
||||
require_once 'Google/Exception.php';
|
||||
require_once 'Google/Http/Request.php';
|
||||
require_once 'Google/Http/REST.php';
|
||||
require_once 'Google/Utils.php';
|
||||
|
||||
/**
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*
|
||||
*/
|
||||
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
|
||||
);
|
||||
|
||||
if ($client->getClassConfig("Google_Http_Request", "enable_gzip_for_uploads")) {
|
||||
$httpRequest->enableGzip();
|
||||
} else {
|
||||
$httpRequest->disableGzip();
|
||||
}
|
||||
|
||||
$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");
|
||||
}
|
||||
}
|
||||
142
htdocs/lib/Google/Http/REST.php
Normal file
142
htdocs/lib/Google/Http/REST.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once 'Google/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 <chabotc@google.com>
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Http_REST
|
||||
{
|
||||
/**
|
||||
* Executes a Google_Http_Request
|
||||
*
|
||||
* @param Google_Client $client
|
||||
* @param Google_Http_Request $req
|
||||
* @return array decoded result
|
||||
* @throws Google_Service_Exception on server side error (ie: not authenticated,
|
||||
* invalid or malformed post body, invalid url)
|
||||
*/
|
||||
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_Service_Exception
|
||||
* @param Google_Http_Request $response The http response to be decoded.
|
||||
* @return mixed|null
|
||||
*/
|
||||
public static function decodeHttpResponse($response)
|
||||
{
|
||||
$code = $response->getResponseHttpCode();
|
||||
$body = $response->getResponseBody();
|
||||
$decoded = null;
|
||||
|
||||
if ((intVal($code)) >= 300) {
|
||||
$decoded = json_decode($body, true);
|
||||
$err = 'Error calling ' . $response->getRequestMethod() . ' ' . $response->getUrl();
|
||||
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']}";
|
||||
} else {
|
||||
$err .= ": ($code) $body";
|
||||
}
|
||||
|
||||
$errors = null;
|
||||
// Specific check for APIs which don't return error details, such as Blogger.
|
||||
if (isset($decoded['error']) && isset($decoded['error']['errors'])) {
|
||||
$errors = $decoded['error']['errors'];
|
||||
}
|
||||
|
||||
throw new Google_Service_Exception($err, $code, null, $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_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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse/expand request parameters and create a fully qualified
|
||||
* request uri.
|
||||
* @static
|
||||
* @param string $servicePath
|
||||
* @param string $restPath
|
||||
* @param array $params
|
||||
* @return string $requestUrl
|
||||
*/
|
||||
public static function createRequestUri($servicePath, $restPath, $params)
|
||||
{
|
||||
$requestUrl = $servicePath . $restPath;
|
||||
$uriTemplateVars = array();
|
||||
$queryVars = array();
|
||||
foreach ($params as $paramName => $paramSpec) {
|
||||
if ($paramSpec['type'] == 'boolean') {
|
||||
$paramSpec['value'] = ($paramSpec['value']) ? 'true' : 'false';
|
||||
}
|
||||
if ($paramSpec['location'] == 'path') {
|
||||
$uriTemplateVars[$paramName] = $paramSpec['value'];
|
||||
} else if ($paramSpec['location'] == 'query') {
|
||||
if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
|
||||
foreach ($paramSpec['value'] as $value) {
|
||||
$queryVars[] = $paramName . '=' . rawurlencode($value);
|
||||
}
|
||||
} else {
|
||||
$queryVars[] = $paramName . '=' . rawurlencode($paramSpec['value']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($uriTemplateVars)) {
|
||||
$uriTemplateParser = new Google_Utils_URITemplate();
|
||||
$requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
|
||||
}
|
||||
|
||||
if (count($queryVars)) {
|
||||
$requestUrl .= '?' . implode($queryVars, '&');
|
||||
}
|
||||
|
||||
return $requestUrl;
|
||||
}
|
||||
}
|
||||
476
htdocs/lib/Google/Http/Request.php
Normal file
476
htdocs/lib/Google/Http/Request.php
Normal file
@@ -0,0 +1,476 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once 'Google/Utils.php';
|
||||
|
||||
/**
|
||||
* HTTP Request to be executed by IO classes. Upon execution, the
|
||||
* responseHttpCode, responseHeaders and responseBody will be filled in.
|
||||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*
|
||||
*/
|
||||
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])) {
|
||||
if (!is_array($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();
|
||||
}
|
||||
}
|
||||
}
|
||||
312
htdocs/lib/Google/IO/Abstract.php
Normal file
312
htdocs/lib/Google/IO/Abstract.php
Normal file
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract IO base class
|
||||
*/
|
||||
|
||||
require_once 'Google/Client.php';
|
||||
require_once 'Google/IO/Exception.php';
|
||||
require_once 'Google/Http/CacheParser.php';
|
||||
require_once 'Google/Http/Request.php';
|
||||
|
||||
abstract class Google_IO_Abstract
|
||||
{
|
||||
const UNKNOWN_CODE = 0;
|
||||
const FORM_URLENCODED = 'application/x-www-form-urlencoded';
|
||||
const CONNECTION_ESTABLISHED = "HTTP/1.0 200 Connection established\r\n\r\n";
|
||||
private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
|
||||
|
||||
/** @var Google_Client */
|
||||
protected $client;
|
||||
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
$timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
|
||||
if ($timeout > 0) {
|
||||
$this->setTimeout($timeout);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 executeRequest(Google_Http_Request $request);
|
||||
|
||||
/**
|
||||
* Set options that update the transport implementation's behavior.
|
||||
* @param $options
|
||||
*/
|
||||
abstract public function setOptions($options);
|
||||
|
||||
/**
|
||||
* Set the maximum request time in seconds.
|
||||
* @param $timeout in seconds
|
||||
*/
|
||||
abstract public function setTimeout($timeout);
|
||||
|
||||
/**
|
||||
* Get the maximum request time in seconds.
|
||||
* @return timeout in seconds
|
||||
*/
|
||||
abstract public function getTimeout();
|
||||
|
||||
/**
|
||||
* Determine whether "Connection Established" quirk is needed
|
||||
* @return boolean
|
||||
*/
|
||||
abstract protected function _needsQuirk();
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 && $cached instanceof Google_Http_Request) {
|
||||
if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
|
||||
return $cached;
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
|
||||
$request = $this->processEntityRequest($request);
|
||||
}
|
||||
|
||||
list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
|
||||
|
||||
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($responseData);
|
||||
// Store the request in cache (the function checks to see if the request
|
||||
// can actually be cached)
|
||||
$this->setCachedRequest($request);
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
// only strip this header if the sub-class needs this quirk
|
||||
if ($this->_needsQuirk() && 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;
|
||||
}
|
||||
}
|
||||
135
htdocs/lib/Google/IO/Curl.php
Normal file
135
htdocs/lib/Google/IO/Curl.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Curl based implementation of Google_IO.
|
||||
*
|
||||
* @author Stuart Langley <slangley@google.com>
|
||||
*/
|
||||
|
||||
require_once 'Google/IO/Abstract.php';
|
||||
|
||||
class Google_IO_Curl extends Google_IO_Abstract
|
||||
{
|
||||
// hex for version 7.31.0
|
||||
const NO_QUIRK_VERSION = 0x071F00;
|
||||
|
||||
private $options = array();
|
||||
/**
|
||||
* 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 executeRequest(Google_Http_Request $request)
|
||||
{
|
||||
$curl = curl_init();
|
||||
|
||||
if ($request->getPostBody()) {
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getPostBody());
|
||||
}
|
||||
|
||||
$requestHeaders = $request->getRequestHeaders();
|
||||
if ($requestHeaders && is_array($requestHeaders)) {
|
||||
$curlHeaders = array();
|
||||
foreach ($requestHeaders as $k => $v) {
|
||||
$curlHeaders[] = "$k: $v";
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders);
|
||||
}
|
||||
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, $request->getUserAgent());
|
||||
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_HEADER, true);
|
||||
|
||||
curl_setopt($curl, CURLOPT_URL, $request->getUrl());
|
||||
|
||||
if ($request->canGzip()) {
|
||||
curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
|
||||
}
|
||||
|
||||
foreach ($this->options as $key => $var) {
|
||||
curl_setopt($curl, $key, $var);
|
||||
}
|
||||
|
||||
if (!isset($this->options[CURLOPT_CAINFO])) {
|
||||
curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem');
|
||||
}
|
||||
|
||||
$response = curl_exec($curl);
|
||||
if ($response === false) {
|
||||
throw new Google_IO_Exception(curl_error($curl));
|
||||
}
|
||||
$headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
|
||||
|
||||
$responseBody = substr($response, $headerSize);
|
||||
$responseHeaderString = substr($response, 0, $headerSize);
|
||||
$responseHeaders = $this->getHttpResponseHeaders($responseHeaderString);
|
||||
$responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
|
||||
return array($responseBody, $responseHeaders, $responseCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set options that update the transport implementation's behavior.
|
||||
* @param $options
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->options = array_merge($this->options, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum request time in seconds.
|
||||
* @param $timeout in seconds
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
// Since this timeout is really for putting a bound on the time
|
||||
// we'll set them both to the same. If you need to specify a longer
|
||||
// CURLOPT_TIMEOUT, or a tigher CONNECTTIMEOUT, the best thing to
|
||||
// do is use the setOptions method for the values individually.
|
||||
$this->options[CURLOPT_CONNECTTIMEOUT] = $timeout;
|
||||
$this->options[CURLOPT_TIMEOUT] = $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum request time in seconds.
|
||||
* @return timeout in seconds
|
||||
*/
|
||||
public function getTimeout()
|
||||
{
|
||||
return $this->options[CURLOPT_TIMEOUT];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether "Connection Established" quirk is needed
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _needsQuirk()
|
||||
{
|
||||
$ver = curl_version();
|
||||
$versionNum = $ver['version_number'];
|
||||
return $versionNum < static::NO_QUIRK_VERSION;
|
||||
}
|
||||
}
|
||||
22
htdocs/lib/Google/IO/Exception.php
Normal file
22
htdocs/lib/Google/IO/Exception.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once 'Google/Exception.php';
|
||||
|
||||
class Google_IO_Exception extends Google_Exception
|
||||
{
|
||||
}
|
||||
182
htdocs/lib/Google/IO/Stream.php
Normal file
182
htdocs/lib/Google/IO/Stream.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Http Streams based implementation of Google_IO.
|
||||
*
|
||||
* @author Stuart Langley <slangley@google.com>
|
||||
*/
|
||||
|
||||
require_once 'Google/IO/Abstract.php';
|
||||
|
||||
class Google_IO_Stream extends Google_IO_Abstract
|
||||
{
|
||||
const TIMEOUT = "timeout";
|
||||
const ZLIB = "compress.zlib://";
|
||||
private $options = array();
|
||||
|
||||
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 executeRequest(Google_Http_Request $request)
|
||||
{
|
||||
$default_options = stream_context_get_options(stream_context_get_default());
|
||||
|
||||
$requestHttpContext = array_key_exists('http', $default_options) ?
|
||||
$default_options['http'] : array();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Not entirely happy about this, but supressing the warning from the
|
||||
// fopen seems like the best situation here - we can't do anything
|
||||
// useful with it, and failure to connect is a legitimate run
|
||||
// time situation.
|
||||
@$fh = fopen($url, 'r', false, $context);
|
||||
|
||||
$response_data = false;
|
||||
$respHttpCode = self::UNKNOWN_CODE;
|
||||
if ($fh) {
|
||||
if (isset($this->options[self::TIMEOUT])) {
|
||||
stream_set_timeout($fh, $this->options[self::TIMEOUT]);
|
||||
}
|
||||
|
||||
$response_data = stream_get_contents($fh);
|
||||
fclose($fh);
|
||||
|
||||
$respHttpCode = $this->getHttpResponseCode($http_response_header);
|
||||
}
|
||||
|
||||
if (false === $response_data) {
|
||||
throw new Google_IO_Exception(
|
||||
sprintf(
|
||||
"HTTP Error: Unable to connect: '%s'",
|
||||
$respHttpCode
|
||||
),
|
||||
$respHttpCode
|
||||
);
|
||||
}
|
||||
|
||||
$responseHeaders = $this->getHttpResponseHeaders($http_response_header);
|
||||
|
||||
return array($response_data, $responseHeaders, $respHttpCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set options that update the transport implementation's behavior.
|
||||
* @param $options
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->options = array_merge($this->options, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum request time in seconds.
|
||||
* @param $timeout in seconds
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
$this->options[self::TIMEOUT] = $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum request time in seconds.
|
||||
* @return timeout in seconds
|
||||
*/
|
||||
public function getTimeout()
|
||||
{
|
||||
return $this->options[self::TIMEOUT];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether "Connection Established" quirk is needed
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _needsQuirk()
|
||||
{
|
||||
// Stream needs the special quirk
|
||||
return true;
|
||||
}
|
||||
|
||||
protected 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 self::UNKNOWN_CODE;
|
||||
}
|
||||
}
|
||||
2183
htdocs/lib/Google/IO/cacerts.pem
Normal file
2183
htdocs/lib/Google/IO/cacerts.pem
Normal file
File diff suppressed because it is too large
Load Diff
247
htdocs/lib/Google/Model.php
Normal file
247
htdocs/lib/Google/Model.php
Normal file
@@ -0,0 +1,247 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class defines attributes, valid values, and usage which is generated
|
||||
* from a given json schema.
|
||||
* http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5
|
||||
*
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*
|
||||
*/
|
||||
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 other data.
|
||||
foreach ($this->data as $key => $val) {
|
||||
$result = $this->getSimpleValue($val);
|
||||
if ($result != null) {
|
||||
$object->$key = $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Process all public properties.
|
||||
$reflect = new ReflectionObject($this);
|
||||
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
|
||||
foreach ($props as $member) {
|
||||
$name = $member->getName();
|
||||
$result = $this->getSimpleValue($this->$name);
|
||||
if ($result != null) {
|
||||
$object->$name = $result;
|
||||
}
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle different types of values, primarily
|
||||
* other objects and map and array data types.
|
||||
*/
|
||||
private function getSimpleValue($value)
|
||||
{
|
||||
if ($value instanceof Google_Model) {
|
||||
return $value->toSimpleObject();
|
||||
} else if (is_array($value)) {
|
||||
$return = array();
|
||||
foreach ($value as $key => $a_value) {
|
||||
$a_value = $this->getSimpleValue($a_value);
|
||||
if ($a_value != null) {
|
||||
$return[$key] = $a_value;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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";
|
||||
}
|
||||
|
||||
public function __isset($key)
|
||||
{
|
||||
return isset($this->data[$key]);
|
||||
}
|
||||
|
||||
public function __unset($key)
|
||||
{
|
||||
unset($this->data[$key]);
|
||||
}
|
||||
}
|
||||
39
htdocs/lib/Google/Service.php
Normal file
39
htdocs/lib/Google/Service.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class Google_Service
|
||||
{
|
||||
public $version;
|
||||
public $servicePath;
|
||||
public $availableScopes;
|
||||
public $resource;
|
||||
private $client;
|
||||
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the associated Google_Client class.
|
||||
* @return Google_Client
|
||||
*/
|
||||
public function getClient()
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
}
|
||||
1996
htdocs/lib/Google/Service/AdExchangeSeller.php
Normal file
1996
htdocs/lib/Google/Service/AdExchangeSeller.php
Normal file
File diff suppressed because it is too large
Load Diff
3770
htdocs/lib/Google/Service/AdSense.php
Normal file
3770
htdocs/lib/Google/Service/AdSense.php
Normal file
File diff suppressed because it is too large
Load Diff
2281
htdocs/lib/Google/Service/AdSenseHost.php
Normal file
2281
htdocs/lib/Google/Service/AdSenseHost.php
Normal file
File diff suppressed because it is too large
Load Diff
1276
htdocs/lib/Google/Service/Adexchangebuyer.php
Normal file
1276
htdocs/lib/Google/Service/Adexchangebuyer.php
Normal file
File diff suppressed because it is too large
Load Diff
207
htdocs/lib/Google/Service/Admin.php
Normal file
207
htdocs/lib/Google/Service/Admin.php
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Admin (email_migration_v2).
|
||||
*
|
||||
* <p>
|
||||
* Email Migration API lets you migrate emails of users to Google backends.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/admin-sdk/email-migration/v2/" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Admin extends Google_Service
|
||||
{
|
||||
/** Manage email messages of users on your domain. */
|
||||
const EMAIL_MIGRATION = "https://www.googleapis.com/auth/email.migration";
|
||||
|
||||
public $mail;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Admin service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'email/v2/users/';
|
||||
$this->version = 'email_migration_v2';
|
||||
$this->serviceName = 'admin';
|
||||
|
||||
$this->mail = new Google_Service_Admin_Mail_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'mail',
|
||||
array(
|
||||
'methods' => array(
|
||||
'insert' => array(
|
||||
'path' => '{userKey}/mail',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userKey' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "mail" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $adminService = new Google_Service_Admin(...);
|
||||
* $mail = $adminService->mail;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Admin_Mail_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Insert Mail into Google's Gmail backends (mail.insert)
|
||||
*
|
||||
* @param string $userKey
|
||||
* The email or immutable id of the user
|
||||
* @param Google_MailItem $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function insert($userKey, Google_Service_Admin_MailItem $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('userKey' => $userKey, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Admin_MailItem extends Google_Collection
|
||||
{
|
||||
public $isDeleted;
|
||||
public $isDraft;
|
||||
public $isInbox;
|
||||
public $isSent;
|
||||
public $isStarred;
|
||||
public $isTrash;
|
||||
public $isUnread;
|
||||
public $kind;
|
||||
public $labels;
|
||||
|
||||
public function setIsDeleted($isDeleted)
|
||||
{
|
||||
$this->isDeleted = $isDeleted;
|
||||
}
|
||||
|
||||
public function getIsDeleted()
|
||||
{
|
||||
return $this->isDeleted;
|
||||
}
|
||||
|
||||
public function setIsDraft($isDraft)
|
||||
{
|
||||
$this->isDraft = $isDraft;
|
||||
}
|
||||
|
||||
public function getIsDraft()
|
||||
{
|
||||
return $this->isDraft;
|
||||
}
|
||||
|
||||
public function setIsInbox($isInbox)
|
||||
{
|
||||
$this->isInbox = $isInbox;
|
||||
}
|
||||
|
||||
public function getIsInbox()
|
||||
{
|
||||
return $this->isInbox;
|
||||
}
|
||||
|
||||
public function setIsSent($isSent)
|
||||
{
|
||||
$this->isSent = $isSent;
|
||||
}
|
||||
|
||||
public function getIsSent()
|
||||
{
|
||||
return $this->isSent;
|
||||
}
|
||||
|
||||
public function setIsStarred($isStarred)
|
||||
{
|
||||
$this->isStarred = $isStarred;
|
||||
}
|
||||
|
||||
public function getIsStarred()
|
||||
{
|
||||
return $this->isStarred;
|
||||
}
|
||||
|
||||
public function setIsTrash($isTrash)
|
||||
{
|
||||
$this->isTrash = $isTrash;
|
||||
}
|
||||
|
||||
public function getIsTrash()
|
||||
{
|
||||
return $this->isTrash;
|
||||
}
|
||||
|
||||
public function setIsUnread($isUnread)
|
||||
{
|
||||
$this->isUnread = $isUnread;
|
||||
}
|
||||
|
||||
public function getIsUnread()
|
||||
{
|
||||
return $this->isUnread;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setLabels($labels)
|
||||
{
|
||||
$this->labels = $labels;
|
||||
}
|
||||
|
||||
public function getLabels()
|
||||
{
|
||||
return $this->labels;
|
||||
}
|
||||
}
|
||||
7430
htdocs/lib/Google/Service/Analytics.php
Normal file
7430
htdocs/lib/Google/Service/Analytics.php
Normal file
File diff suppressed because it is too large
Load Diff
329
htdocs/lib/Google/Service/AndroidPublisher.php
Normal file
329
htdocs/lib/Google/Service/AndroidPublisher.php
Normal file
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for AndroidPublisher (v1.1).
|
||||
*
|
||||
* <p>
|
||||
* Lets Android application developers access their Google Play accounts.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/android-publisher" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_AndroidPublisher extends Google_Service
|
||||
{
|
||||
|
||||
|
||||
public $inapppurchases;
|
||||
public $purchases;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the AndroidPublisher service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'androidpublisher/v1.1/applications/';
|
||||
$this->version = 'v1.1';
|
||||
$this->serviceName = 'androidpublisher';
|
||||
|
||||
$this->inapppurchases = new Google_Service_AndroidPublisher_Inapppurchases_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'inapppurchases',
|
||||
array(
|
||||
'methods' => array(
|
||||
'get' => array(
|
||||
'path' => '{packageName}/inapp/{productId}/purchases/{token}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'packageName' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'productId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'token' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->purchases = new Google_Service_AndroidPublisher_Purchases_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'purchases',
|
||||
array(
|
||||
'methods' => array(
|
||||
'cancel' => array(
|
||||
'path' => '{packageName}/subscriptions/{subscriptionId}/purchases/{token}/cancel',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'packageName' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'subscriptionId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'token' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => '{packageName}/subscriptions/{subscriptionId}/purchases/{token}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'packageName' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'subscriptionId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'token' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "inapppurchases" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $androidpublisherService = new Google_Service_AndroidPublisher(...);
|
||||
* $inapppurchases = $androidpublisherService->inapppurchases;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_AndroidPublisher_Inapppurchases_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Checks the purchase and consumption status of an inapp item.
|
||||
* (inapppurchases.get)
|
||||
*
|
||||
* @param string $packageName
|
||||
* The package name of the application the inapp product was sold in (for example,
|
||||
* 'com.some.thing').
|
||||
* @param string $productId
|
||||
* The inapp product SKU (for example, 'com.some.thing.inapp1').
|
||||
* @param string $token
|
||||
* The token provided to the user's device when the inapp product was purchased.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_AndroidPublisher_InappPurchase
|
||||
*/
|
||||
public function get($packageName, $productId, $token, $optParams = array())
|
||||
{
|
||||
$params = array('packageName' => $packageName, 'productId' => $productId, 'token' => $token);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_AndroidPublisher_InappPurchase");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "purchases" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $androidpublisherService = new Google_Service_AndroidPublisher(...);
|
||||
* $purchases = $androidpublisherService->purchases;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_AndroidPublisher_Purchases_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Cancels a user's subscription purchase. The subscription remains valid until
|
||||
* its expiration time. (purchases.cancel)
|
||||
*
|
||||
* @param string $packageName
|
||||
* The package name of the application for which this subscription was purchased (for example,
|
||||
* 'com.some.thing').
|
||||
* @param string $subscriptionId
|
||||
* The purchased subscription ID (for example, 'monthly001').
|
||||
* @param string $token
|
||||
* The token provided to the user's device when the subscription was purchased.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function cancel($packageName, $subscriptionId, $token, $optParams = array())
|
||||
{
|
||||
$params = array('packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('cancel', array($params));
|
||||
}
|
||||
/**
|
||||
* Checks whether a user's subscription purchase is valid and returns its expiry
|
||||
* time. (purchases.get)
|
||||
*
|
||||
* @param string $packageName
|
||||
* The package name of the application for which this subscription was purchased (for example,
|
||||
* 'com.some.thing').
|
||||
* @param string $subscriptionId
|
||||
* The purchased subscription ID (for example, 'monthly001').
|
||||
* @param string $token
|
||||
* The token provided to the user's device when the subscription was purchased.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_AndroidPublisher_SubscriptionPurchase
|
||||
*/
|
||||
public function get($packageName, $subscriptionId, $token, $optParams = array())
|
||||
{
|
||||
$params = array('packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_AndroidPublisher_SubscriptionPurchase");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_AndroidPublisher_InappPurchase extends Google_Model
|
||||
{
|
||||
public $consumptionState;
|
||||
public $developerPayload;
|
||||
public $kind;
|
||||
public $purchaseState;
|
||||
public $purchaseTime;
|
||||
|
||||
public function setConsumptionState($consumptionState)
|
||||
{
|
||||
$this->consumptionState = $consumptionState;
|
||||
}
|
||||
|
||||
public function getConsumptionState()
|
||||
{
|
||||
return $this->consumptionState;
|
||||
}
|
||||
|
||||
public function setDeveloperPayload($developerPayload)
|
||||
{
|
||||
$this->developerPayload = $developerPayload;
|
||||
}
|
||||
|
||||
public function getDeveloperPayload()
|
||||
{
|
||||
return $this->developerPayload;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setPurchaseState($purchaseState)
|
||||
{
|
||||
$this->purchaseState = $purchaseState;
|
||||
}
|
||||
|
||||
public function getPurchaseState()
|
||||
{
|
||||
return $this->purchaseState;
|
||||
}
|
||||
|
||||
public function setPurchaseTime($purchaseTime)
|
||||
{
|
||||
$this->purchaseTime = $purchaseTime;
|
||||
}
|
||||
|
||||
public function getPurchaseTime()
|
||||
{
|
||||
return $this->purchaseTime;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_AndroidPublisher_SubscriptionPurchase extends Google_Model
|
||||
{
|
||||
public $autoRenewing;
|
||||
public $initiationTimestampMsec;
|
||||
public $kind;
|
||||
public $validUntilTimestampMsec;
|
||||
|
||||
public function setAutoRenewing($autoRenewing)
|
||||
{
|
||||
$this->autoRenewing = $autoRenewing;
|
||||
}
|
||||
|
||||
public function getAutoRenewing()
|
||||
{
|
||||
return $this->autoRenewing;
|
||||
}
|
||||
|
||||
public function setInitiationTimestampMsec($initiationTimestampMsec)
|
||||
{
|
||||
$this->initiationTimestampMsec = $initiationTimestampMsec;
|
||||
}
|
||||
|
||||
public function getInitiationTimestampMsec()
|
||||
{
|
||||
return $this->initiationTimestampMsec;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setValidUntilTimestampMsec($validUntilTimestampMsec)
|
||||
{
|
||||
$this->validUntilTimestampMsec = $validUntilTimestampMsec;
|
||||
}
|
||||
|
||||
public function getValidUntilTimestampMsec()
|
||||
{
|
||||
return $this->validUntilTimestampMsec;
|
||||
}
|
||||
}
|
||||
373
htdocs/lib/Google/Service/AppState.php
Normal file
373
htdocs/lib/Google/Service/AppState.php
Normal file
@@ -0,0 +1,373 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for AppState (v1).
|
||||
*
|
||||
* <p>
|
||||
* The Google App State API.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/games/services/web/api/states" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_AppState extends Google_Service
|
||||
{
|
||||
/** View and manage your data for this application. */
|
||||
const APPSTATE = "https://www.googleapis.com/auth/appstate";
|
||||
|
||||
public $states;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the AppState service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'appstate/v1/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'appstate';
|
||||
|
||||
$this->states = new Google_Service_AppState_States_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'states',
|
||||
array(
|
||||
'methods' => array(
|
||||
'clear' => array(
|
||||
'path' => 'states/{stateKey}/clear',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'stateKey' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'currentDataVersion' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
'path' => 'states/{stateKey}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'stateKey' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'states/{stateKey}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'stateKey' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'states',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'includeData' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => 'states/{stateKey}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'stateKey' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'currentStateVersion' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "states" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $appstateService = new Google_Service_AppState(...);
|
||||
* $states = $appstateService->states;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_AppState_States_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Clears (sets to empty) the data for the passed key if and only if the passed
|
||||
* version matches the currently stored version. This method results in a
|
||||
* conflict error on version mismatch. (states.clear)
|
||||
*
|
||||
* @param int $stateKey
|
||||
* The key for the data to be retrieved.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string currentDataVersion
|
||||
* The version of the data to be cleared. Version strings are returned by the server.
|
||||
* @return Google_Service_AppState_WriteResult
|
||||
*/
|
||||
public function clear($stateKey, $optParams = array())
|
||||
{
|
||||
$params = array('stateKey' => $stateKey);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('clear', array($params), "Google_Service_AppState_WriteResult");
|
||||
}
|
||||
/**
|
||||
* Deletes a key and the data associated with it. The key is removed and no
|
||||
* longer counts against the key quota. Note that since this method is not safe
|
||||
* in the face of concurrent modifications, it should only be used for
|
||||
* development and testing purposes. Invoking this method in shipping code can
|
||||
* result in data loss and data corruption. (states.delete)
|
||||
*
|
||||
* @param int $stateKey
|
||||
* The key for the data to be retrieved.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function delete($stateKey, $optParams = array())
|
||||
{
|
||||
$params = array('stateKey' => $stateKey);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('delete', array($params));
|
||||
}
|
||||
/**
|
||||
* Retrieves the data corresponding to the passed key. (states.get)
|
||||
*
|
||||
* @param int $stateKey
|
||||
* The key for the data to be retrieved.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_AppState_GetResponse
|
||||
*/
|
||||
public function get($stateKey, $optParams = array())
|
||||
{
|
||||
$params = array('stateKey' => $stateKey);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_AppState_GetResponse");
|
||||
}
|
||||
/**
|
||||
* Lists all the states keys, and optionally the state data. (states.listStates)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param bool includeData
|
||||
* Whether to include the full data in addition to the version number
|
||||
* @return Google_Service_AppState_ListResponse
|
||||
*/
|
||||
public function listStates($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_AppState_ListResponse");
|
||||
}
|
||||
/**
|
||||
* Update the data associated with the input key if and only if the passed
|
||||
* version matches the currently stored version. This method is safe in the face
|
||||
* of concurrent writes. Maximum per-key size is 128KB. (states.update)
|
||||
*
|
||||
* @param int $stateKey
|
||||
* The key for the data to be retrieved.
|
||||
* @param Google_UpdateRequest $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string currentStateVersion
|
||||
* The version of the app state your application is attempting to update. If this does not match
|
||||
* the current version, this method will return a conflict error. If there is no data stored on the
|
||||
* server for this key, the update will succeed irrespective of the value of this parameter.
|
||||
* @return Google_Service_AppState_WriteResult
|
||||
*/
|
||||
public function update($stateKey, Google_Service_AppState_UpdateRequest $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('stateKey' => $stateKey, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('update', array($params), "Google_Service_AppState_WriteResult");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_AppState_GetResponse extends Google_Model
|
||||
{
|
||||
public $currentStateVersion;
|
||||
public $data;
|
||||
public $kind;
|
||||
public $stateKey;
|
||||
|
||||
public function setCurrentStateVersion($currentStateVersion)
|
||||
{
|
||||
$this->currentStateVersion = $currentStateVersion;
|
||||
}
|
||||
|
||||
public function getCurrentStateVersion()
|
||||
{
|
||||
return $this->currentStateVersion;
|
||||
}
|
||||
|
||||
public function setData($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setStateKey($stateKey)
|
||||
{
|
||||
$this->stateKey = $stateKey;
|
||||
}
|
||||
|
||||
public function getStateKey()
|
||||
{
|
||||
return $this->stateKey;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_AppState_ListResponse extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_AppState_GetResponse';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
public $maximumKeyCount;
|
||||
|
||||
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 setMaximumKeyCount($maximumKeyCount)
|
||||
{
|
||||
$this->maximumKeyCount = $maximumKeyCount;
|
||||
}
|
||||
|
||||
public function getMaximumKeyCount()
|
||||
{
|
||||
return $this->maximumKeyCount;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_AppState_UpdateRequest extends Google_Model
|
||||
{
|
||||
public $data;
|
||||
public $kind;
|
||||
|
||||
public function setData($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_AppState_WriteResult extends Google_Model
|
||||
{
|
||||
public $currentStateVersion;
|
||||
public $kind;
|
||||
public $stateKey;
|
||||
|
||||
public function setCurrentStateVersion($currentStateVersion)
|
||||
{
|
||||
$this->currentStateVersion = $currentStateVersion;
|
||||
}
|
||||
|
||||
public function getCurrentStateVersion()
|
||||
{
|
||||
return $this->currentStateVersion;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setStateKey($stateKey)
|
||||
{
|
||||
$this->stateKey = $stateKey;
|
||||
}
|
||||
|
||||
public function getStateKey()
|
||||
{
|
||||
return $this->stateKey;
|
||||
}
|
||||
}
|
||||
438
htdocs/lib/Google/Service/Audit.php
Normal file
438
htdocs/lib/Google/Service/Audit.php
Normal file
@@ -0,0 +1,438 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Audit (v1).
|
||||
*
|
||||
* <p>
|
||||
* Lets you access user activities in your enterprise made through various applications.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/google-apps/admin-audit/get_started" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Audit extends Google_Service
|
||||
{
|
||||
|
||||
|
||||
public $activities;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Audit service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'apps/reporting/audit/v1/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'audit';
|
||||
|
||||
$this->activities = new Google_Service_Audit_Activities_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'activities',
|
||||
array(
|
||||
'methods' => array(
|
||||
'list' => array(
|
||||
'path' => '{customerId}/{applicationId}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'customerId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'applicationId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'actorEmail' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'actorApplicationId' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'actorIpAddress' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'caller' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'eventName' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'startTime' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'endTime' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'continuationToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "activities" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $auditService = new Google_Service_Audit(...);
|
||||
* $activities = $auditService->activities;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Audit_Activities_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Retrieves a list of activities for a specific customer and application.
|
||||
* (activities.listActivities)
|
||||
*
|
||||
* @param string $customerId
|
||||
* Represents the customer who is the owner of target object on which action was performed.
|
||||
* @param string $applicationId
|
||||
* Application ID of the application on which the event was performed.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string actorEmail
|
||||
* Email address of the user who performed the action.
|
||||
* @opt_param string actorApplicationId
|
||||
* Application ID of the application which interacted on behalf of the user while performing the
|
||||
* event.
|
||||
* @opt_param string actorIpAddress
|
||||
* IP Address of host where the event was performed. Supports both IPv4 and IPv6 addresses.
|
||||
* @opt_param string caller
|
||||
* Type of the caller.
|
||||
* @opt_param int maxResults
|
||||
* Number of activity records to be shown in each page.
|
||||
* @opt_param string eventName
|
||||
* Name of the event being queried.
|
||||
* @opt_param string startTime
|
||||
* Return events which occured at or after this time.
|
||||
* @opt_param string endTime
|
||||
* Return events which occured at or before this time.
|
||||
* @opt_param string continuationToken
|
||||
* Next page URL.
|
||||
* @return Google_Service_Audit_Activities
|
||||
*/
|
||||
public function listActivities($customerId, $applicationId, $optParams = array())
|
||||
{
|
||||
$params = array('customerId' => $customerId, 'applicationId' => $applicationId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Audit_Activities");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Audit_Activities extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_Audit_Activity';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
public $next;
|
||||
|
||||
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 setNext($next)
|
||||
{
|
||||
$this->next = $next;
|
||||
}
|
||||
|
||||
public function getNext()
|
||||
{
|
||||
return $this->next;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_Activity extends Google_Collection
|
||||
{
|
||||
protected $actorType = 'Google_Service_Audit_ActivityActor';
|
||||
protected $actorDataType = '';
|
||||
protected $eventsType = 'Google_Service_Audit_ActivityEvents';
|
||||
protected $eventsDataType = 'array';
|
||||
protected $idType = 'Google_Service_Audit_ActivityId';
|
||||
protected $idDataType = '';
|
||||
public $ipAddress;
|
||||
public $kind;
|
||||
public $ownerDomain;
|
||||
|
||||
public function setActor(Google_Service_Audit_ActivityActor $actor)
|
||||
{
|
||||
$this->actor = $actor;
|
||||
}
|
||||
|
||||
public function getActor()
|
||||
{
|
||||
return $this->actor;
|
||||
}
|
||||
|
||||
public function setEvents($events)
|
||||
{
|
||||
$this->events = $events;
|
||||
}
|
||||
|
||||
public function getEvents()
|
||||
{
|
||||
return $this->events;
|
||||
}
|
||||
|
||||
public function setId(Google_Service_Audit_ActivityId $id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setIpAddress($ipAddress)
|
||||
{
|
||||
$this->ipAddress = $ipAddress;
|
||||
}
|
||||
|
||||
public function getIpAddress()
|
||||
{
|
||||
return $this->ipAddress;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setOwnerDomain($ownerDomain)
|
||||
{
|
||||
$this->ownerDomain = $ownerDomain;
|
||||
}
|
||||
|
||||
public function getOwnerDomain()
|
||||
{
|
||||
return $this->ownerDomain;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_ActivityActor extends Google_Model
|
||||
{
|
||||
public $applicationId;
|
||||
public $callerType;
|
||||
public $email;
|
||||
public $key;
|
||||
|
||||
public function setApplicationId($applicationId)
|
||||
{
|
||||
$this->applicationId = $applicationId;
|
||||
}
|
||||
|
||||
public function getApplicationId()
|
||||
{
|
||||
return $this->applicationId;
|
||||
}
|
||||
|
||||
public function setCallerType($callerType)
|
||||
{
|
||||
$this->callerType = $callerType;
|
||||
}
|
||||
|
||||
public function getCallerType()
|
||||
{
|
||||
return $this->callerType;
|
||||
}
|
||||
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setKey($key)
|
||||
{
|
||||
$this->key = $key;
|
||||
}
|
||||
|
||||
public function getKey()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_ActivityEvents extends Google_Collection
|
||||
{
|
||||
public $eventType;
|
||||
public $name;
|
||||
protected $parametersType = 'Google_Service_Audit_ActivityEventsParameters';
|
||||
protected $parametersDataType = 'array';
|
||||
|
||||
public function setEventType($eventType)
|
||||
{
|
||||
$this->eventType = $eventType;
|
||||
}
|
||||
|
||||
public function getEventType()
|
||||
{
|
||||
return $this->eventType;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setParameters($parameters)
|
||||
{
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
public function getParameters()
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_ActivityEventsParameters extends Google_Model
|
||||
{
|
||||
public $name;
|
||||
public $value;
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Audit_ActivityId extends Google_Model
|
||||
{
|
||||
public $applicationId;
|
||||
public $customerId;
|
||||
public $time;
|
||||
public $uniqQualifier;
|
||||
|
||||
public function setApplicationId($applicationId)
|
||||
{
|
||||
$this->applicationId = $applicationId;
|
||||
}
|
||||
|
||||
public function getApplicationId()
|
||||
{
|
||||
return $this->applicationId;
|
||||
}
|
||||
|
||||
public function setCustomerId($customerId)
|
||||
{
|
||||
$this->customerId = $customerId;
|
||||
}
|
||||
|
||||
public function getCustomerId()
|
||||
{
|
||||
return $this->customerId;
|
||||
}
|
||||
|
||||
public function setTime($time)
|
||||
{
|
||||
$this->time = $time;
|
||||
}
|
||||
|
||||
public function getTime()
|
||||
{
|
||||
return $this->time;
|
||||
}
|
||||
|
||||
public function setUniqQualifier($uniqQualifier)
|
||||
{
|
||||
$this->uniqQualifier = $uniqQualifier;
|
||||
}
|
||||
|
||||
public function getUniqQualifier()
|
||||
{
|
||||
return $this->uniqQualifier;
|
||||
}
|
||||
}
|
||||
3368
htdocs/lib/Google/Service/Bigquery.php
Normal file
3368
htdocs/lib/Google/Service/Bigquery.php
Normal file
File diff suppressed because it is too large
Load Diff
3315
htdocs/lib/Google/Service/Blogger.php
Normal file
3315
htdocs/lib/Google/Service/Blogger.php
Normal file
File diff suppressed because it is too large
Load Diff
6403
htdocs/lib/Google/Service/Books.php
Normal file
6403
htdocs/lib/Google/Service/Books.php
Normal file
File diff suppressed because it is too large
Load Diff
3518
htdocs/lib/Google/Service/Calendar.php
Normal file
3518
htdocs/lib/Google/Service/Calendar.php
Normal file
File diff suppressed because it is too large
Load Diff
1571
htdocs/lib/Google/Service/CivicInfo.php
Normal file
1571
htdocs/lib/Google/Service/CivicInfo.php
Normal file
File diff suppressed because it is too large
Load Diff
9757
htdocs/lib/Google/Service/Compute.php
Normal file
9757
htdocs/lib/Google/Service/Compute.php
Normal file
File diff suppressed because it is too large
Load Diff
1474
htdocs/lib/Google/Service/Coordinate.php
Normal file
1474
htdocs/lib/Google/Service/Coordinate.php
Normal file
File diff suppressed because it is too large
Load Diff
1417
htdocs/lib/Google/Service/Customsearch.php
Normal file
1417
htdocs/lib/Google/Service/Customsearch.php
Normal file
File diff suppressed because it is too large
Load Diff
1567
htdocs/lib/Google/Service/Datastore.php
Normal file
1567
htdocs/lib/Google/Service/Datastore.php
Normal file
File diff suppressed because it is too large
Load Diff
2928
htdocs/lib/Google/Service/Dfareporting.php
Normal file
2928
htdocs/lib/Google/Service/Dfareporting.php
Normal file
File diff suppressed because it is too large
Load Diff
5127
htdocs/lib/Google/Service/Directory.php
Normal file
5127
htdocs/lib/Google/Service/Directory.php
Normal file
File diff suppressed because it is too large
Load Diff
1117
htdocs/lib/Google/Service/DoubleClickBidManager.php
Normal file
1117
htdocs/lib/Google/Service/DoubleClickBidManager.php
Normal file
File diff suppressed because it is too large
Load Diff
1444
htdocs/lib/Google/Service/Doubleclicksearch.php
Normal file
1444
htdocs/lib/Google/Service/Doubleclicksearch.php
Normal file
File diff suppressed because it is too large
Load Diff
5732
htdocs/lib/Google/Service/Drive.php
Normal file
5732
htdocs/lib/Google/Service/Drive.php
Normal file
File diff suppressed because it is too large
Load Diff
53
htdocs/lib/Google/Service/Exception.php
Normal file
53
htdocs/lib/Google/Service/Exception.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
require_once 'Google/Exception.php';
|
||||
|
||||
class Google_Service_Exception 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;
|
||||
}
|
||||
}
|
||||
487
htdocs/lib/Google/Service/Freebase.php
Normal file
487
htdocs/lib/Google/Service/Freebase.php
Normal file
@@ -0,0 +1,487 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Freebase (v1).
|
||||
*
|
||||
* <p>
|
||||
* Find Freebase entities using textual queries and other constraints.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/freebase/" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Freebase extends Google_Service
|
||||
{
|
||||
|
||||
|
||||
|
||||
private $base_methods;
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Freebase service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'freebase/v1/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'freebase';
|
||||
|
||||
$this->base_methods = new Google_Service_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'',
|
||||
array(
|
||||
'methods' => array(
|
||||
'reconcile' => array(
|
||||
'path' => 'reconcile',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'lang' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'confidence' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'number',
|
||||
),
|
||||
'name' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'kind' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'prop' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'limit' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
),'search' => array(
|
||||
'path' => 'search',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'domain' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'help' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'query' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'scoring' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'cursor' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'prefixed' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'exact' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'mid' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'encode' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'type' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'as_of_time' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'stemmed' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'format' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'spell' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'with' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'lang' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'indent' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'filter' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'callback' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'without' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'limit' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'output' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'mql_output' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Reconcile entities to Freebase open data. (reconcile)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string lang
|
||||
* Languages for names and values. First language is used for display. Default is 'en'.
|
||||
* @opt_param float confidence
|
||||
* Required confidence for a candidate to match. Must be between .5 and 1.0
|
||||
* @opt_param string name
|
||||
* Name of entity.
|
||||
* @opt_param string kind
|
||||
* Classifications of entity e.g. type, category, title.
|
||||
* @opt_param string prop
|
||||
* Property values for entity formatted as
|
||||
:
|
||||
* @opt_param int limit
|
||||
* Maximum number of candidates to return.
|
||||
* @return Google_Service_Freebase_ReconcileGet
|
||||
*/
|
||||
public function reconcile($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->base_methods->call('reconcile', array($params), "Google_Service_Freebase_ReconcileGet");
|
||||
}
|
||||
/**
|
||||
* Search Freebase open data. (search)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string domain
|
||||
* Restrict to topics with this Freebase domain id.
|
||||
* @opt_param string help
|
||||
* The keyword to request help on.
|
||||
* @opt_param string query
|
||||
* Query term to search for.
|
||||
* @opt_param string scoring
|
||||
* Relevance scoring algorithm to use.
|
||||
* @opt_param int cursor
|
||||
* The cursor value to use for the next page of results.
|
||||
* @opt_param bool prefixed
|
||||
* Prefix match against names and aliases.
|
||||
* @opt_param bool exact
|
||||
* Query on exact name and keys only.
|
||||
* @opt_param string mid
|
||||
* A mid to use instead of a query.
|
||||
* @opt_param string encode
|
||||
* The encoding of the response. You can use this parameter to enable html encoding.
|
||||
* @opt_param string type
|
||||
* Restrict to topics with this Freebase type id.
|
||||
* @opt_param string asOfTime
|
||||
* A mql as_of_time value to use with mql_output queries.
|
||||
* @opt_param bool stemmed
|
||||
* Query on stemmed names and aliases. May not be used with prefixed.
|
||||
* @opt_param string format
|
||||
* Structural format of the json response.
|
||||
* @opt_param string spell
|
||||
* Request 'did you mean' suggestions
|
||||
* @opt_param string with
|
||||
* A rule to match against.
|
||||
* @opt_param string lang
|
||||
* The code of the language to run the query with. Default is 'en'.
|
||||
* @opt_param bool indent
|
||||
* Whether to indent the json results or not.
|
||||
* @opt_param string filter
|
||||
* A filter to apply to the query.
|
||||
* @opt_param string callback
|
||||
* JS method name for JSONP callbacks.
|
||||
* @opt_param string without
|
||||
* A rule to not match against.
|
||||
* @opt_param int limit
|
||||
* Maximum number of results to return.
|
||||
* @opt_param string output
|
||||
* An output expression to request data from matches.
|
||||
* @opt_param string mqlOutput
|
||||
* The MQL query to run againist the results to extract more data.
|
||||
*/
|
||||
public function search($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('search', array($params));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Freebase_ReconcileCandidate extends Google_Model
|
||||
{
|
||||
public $confidence;
|
||||
public $lang;
|
||||
public $mid;
|
||||
public $name;
|
||||
protected $notableType = 'Google_Service_Freebase_ReconcileCandidateNotable';
|
||||
protected $notableDataType = '';
|
||||
|
||||
public function setConfidence($confidence)
|
||||
{
|
||||
$this->confidence = $confidence;
|
||||
}
|
||||
|
||||
public function getConfidence()
|
||||
{
|
||||
return $this->confidence;
|
||||
}
|
||||
|
||||
public function setLang($lang)
|
||||
{
|
||||
$this->lang = $lang;
|
||||
}
|
||||
|
||||
public function getLang()
|
||||
{
|
||||
return $this->lang;
|
||||
}
|
||||
|
||||
public function setMid($mid)
|
||||
{
|
||||
$this->mid = $mid;
|
||||
}
|
||||
|
||||
public function getMid()
|
||||
{
|
||||
return $this->mid;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setNotable(Google_Service_Freebase_ReconcileCandidateNotable $notable)
|
||||
{
|
||||
$this->notable = $notable;
|
||||
}
|
||||
|
||||
public function getNotable()
|
||||
{
|
||||
return $this->notable;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Freebase_ReconcileCandidateNotable extends Google_Model
|
||||
{
|
||||
public $id;
|
||||
public $name;
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Freebase_ReconcileGet extends Google_Collection
|
||||
{
|
||||
protected $candidateType = 'Google_Service_Freebase_ReconcileCandidate';
|
||||
protected $candidateDataType = 'array';
|
||||
protected $costsType = 'Google_Service_Freebase_ReconcileGetCosts';
|
||||
protected $costsDataType = '';
|
||||
protected $matchType = 'Google_Service_Freebase_ReconcileCandidate';
|
||||
protected $matchDataType = '';
|
||||
protected $warningType = 'Google_Service_Freebase_ReconcileGetWarning';
|
||||
protected $warningDataType = 'array';
|
||||
|
||||
public function setCandidate($candidate)
|
||||
{
|
||||
$this->candidate = $candidate;
|
||||
}
|
||||
|
||||
public function getCandidate()
|
||||
{
|
||||
return $this->candidate;
|
||||
}
|
||||
|
||||
public function setCosts(Google_Service_Freebase_ReconcileGetCosts $costs)
|
||||
{
|
||||
$this->costs = $costs;
|
||||
}
|
||||
|
||||
public function getCosts()
|
||||
{
|
||||
return $this->costs;
|
||||
}
|
||||
|
||||
public function setMatch(Google_Service_Freebase_ReconcileCandidate $match)
|
||||
{
|
||||
$this->match = $match;
|
||||
}
|
||||
|
||||
public function getMatch()
|
||||
{
|
||||
return $this->match;
|
||||
}
|
||||
|
||||
public function setWarning($warning)
|
||||
{
|
||||
$this->warning = $warning;
|
||||
}
|
||||
|
||||
public function getWarning()
|
||||
{
|
||||
return $this->warning;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Freebase_ReconcileGetCosts extends Google_Model
|
||||
{
|
||||
public $hits;
|
||||
public $ms;
|
||||
|
||||
public function setHits($hits)
|
||||
{
|
||||
$this->hits = $hits;
|
||||
}
|
||||
|
||||
public function getHits()
|
||||
{
|
||||
return $this->hits;
|
||||
}
|
||||
|
||||
public function setMs($ms)
|
||||
{
|
||||
$this->ms = $ms;
|
||||
}
|
||||
|
||||
public function getMs()
|
||||
{
|
||||
return $this->ms;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Freebase_ReconcileGetWarning extends Google_Model
|
||||
{
|
||||
public $location;
|
||||
public $message;
|
||||
public $reason;
|
||||
|
||||
public function setLocation($location)
|
||||
{
|
||||
$this->location = $location;
|
||||
}
|
||||
|
||||
public function getLocation()
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
public function setMessage($message)
|
||||
{
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
public function getMessage()
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
public function setReason($reason)
|
||||
{
|
||||
$this->reason = $reason;
|
||||
}
|
||||
|
||||
public function getReason()
|
||||
{
|
||||
return $this->reason;
|
||||
}
|
||||
}
|
||||
2200
htdocs/lib/Google/Service/Fusiontables.php
Normal file
2200
htdocs/lib/Google/Service/Fusiontables.php
Normal file
File diff suppressed because it is too large
Load Diff
5930
htdocs/lib/Google/Service/Games.php
Normal file
5930
htdocs/lib/Google/Service/Games.php
Normal file
File diff suppressed because it is too large
Load Diff
761
htdocs/lib/Google/Service/GamesManagement.php
Normal file
761
htdocs/lib/Google/Service/GamesManagement.php
Normal file
@@ -0,0 +1,761 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for GamesManagement (v1management).
|
||||
*
|
||||
* <p>
|
||||
* The Management API for Google Play Game Services.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/games/services" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_GamesManagement extends Google_Service
|
||||
{
|
||||
/** Share your Google+ profile information and view and manage your game activity. */
|
||||
const GAMES = "https://www.googleapis.com/auth/games";
|
||||
/** Know your basic profile info and list of people in your circles.. */
|
||||
const PLUS_LOGIN = "https://www.googleapis.com/auth/plus.login";
|
||||
|
||||
public $achievements;
|
||||
public $applications;
|
||||
public $players;
|
||||
public $rooms;
|
||||
public $scores;
|
||||
public $turnBasedMatches;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the GamesManagement service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'games/v1management/';
|
||||
$this->version = 'v1management';
|
||||
$this->serviceName = 'gamesManagement';
|
||||
|
||||
$this->achievements = new Google_Service_GamesManagement_Achievements_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'achievements',
|
||||
array(
|
||||
'methods' => array(
|
||||
'reset' => array(
|
||||
'path' => 'achievements/{achievementId}/reset',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'achievementId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'resetAll' => array(
|
||||
'path' => 'achievements/reset',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(),
|
||||
),'resetForAllPlayers' => array(
|
||||
'path' => 'achievements/{achievementId}/resetForAllPlayers',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'achievementId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->applications = new Google_Service_GamesManagement_Applications_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'applications',
|
||||
array(
|
||||
'methods' => array(
|
||||
'listHidden' => array(
|
||||
'path' => 'applications/{applicationId}/players/hidden',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'applicationId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->players = new Google_Service_GamesManagement_Players_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'players',
|
||||
array(
|
||||
'methods' => array(
|
||||
'hide' => array(
|
||||
'path' => 'applications/{applicationId}/players/hidden/{playerId}',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'applicationId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'playerId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'unhide' => array(
|
||||
'path' => 'applications/{applicationId}/players/hidden/{playerId}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'applicationId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'playerId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->rooms = new Google_Service_GamesManagement_Rooms_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'rooms',
|
||||
array(
|
||||
'methods' => array(
|
||||
'reset' => array(
|
||||
'path' => 'rooms/reset',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->scores = new Google_Service_GamesManagement_Scores_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'scores',
|
||||
array(
|
||||
'methods' => array(
|
||||
'reset' => array(
|
||||
'path' => 'leaderboards/{leaderboardId}/scores/reset',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'leaderboardId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'resetForAllPlayers' => array(
|
||||
'path' => 'leaderboards/{leaderboardId}/scores/resetForAllPlayers',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'leaderboardId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->turnBasedMatches = new Google_Service_GamesManagement_TurnBasedMatches_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'turnBasedMatches',
|
||||
array(
|
||||
'methods' => array(
|
||||
'reset' => array(
|
||||
'path' => 'turnbasedmatches/reset',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "achievements" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $gamesManagementService = new Google_Service_GamesManagement(...);
|
||||
* $achievements = $gamesManagementService->achievements;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_GamesManagement_Achievements_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Resets the achievement with the given ID for the currently authenticated
|
||||
* player. This method is only accessible to whitelisted tester accounts for
|
||||
* your application. (achievements.reset)
|
||||
*
|
||||
* @param string $achievementId
|
||||
* The ID of the achievement used by this method.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_GamesManagement_AchievementResetResponse
|
||||
*/
|
||||
public function reset($achievementId, $optParams = array())
|
||||
{
|
||||
$params = array('achievementId' => $achievementId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('reset', array($params), "Google_Service_GamesManagement_AchievementResetResponse");
|
||||
}
|
||||
/**
|
||||
* Resets all achievements for the currently authenticated player for your
|
||||
* application. This method is only accessible to whitelisted tester accounts
|
||||
* for your application. (achievements.resetAll)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_GamesManagement_AchievementResetAllResponse
|
||||
*/
|
||||
public function resetAll($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('resetAll', array($params), "Google_Service_GamesManagement_AchievementResetAllResponse");
|
||||
}
|
||||
/**
|
||||
* Resets the achievement with the given ID for the all players. This method is
|
||||
* only accessible to whitelisted tester accounts for your application.
|
||||
* (achievements.resetForAllPlayers)
|
||||
*
|
||||
* @param string $achievementId
|
||||
* The ID of the achievement used by this method.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function resetForAllPlayers($achievementId, $optParams = array())
|
||||
{
|
||||
$params = array('achievementId' => $achievementId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('resetForAllPlayers', array($params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "applications" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $gamesManagementService = new Google_Service_GamesManagement(...);
|
||||
* $applications = $gamesManagementService->applications;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_GamesManagement_Applications_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the list of players hidden from the given application. This method is
|
||||
* only available to user accounts for your developer console.
|
||||
* (applications.listHidden)
|
||||
*
|
||||
* @param string $applicationId
|
||||
* The application being requested.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string pageToken
|
||||
* The token returned by the previous request.
|
||||
* @opt_param int maxResults
|
||||
* The maximum number of player resources to return in the response, used for paging. For any
|
||||
* response, the actual number of player resources returned may be less than the specified
|
||||
* maxResults.
|
||||
* @return Google_Service_GamesManagement_HiddenPlayerList
|
||||
*/
|
||||
public function listHidden($applicationId, $optParams = array())
|
||||
{
|
||||
$params = array('applicationId' => $applicationId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('listHidden', array($params), "Google_Service_GamesManagement_HiddenPlayerList");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "players" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $gamesManagementService = new Google_Service_GamesManagement(...);
|
||||
* $players = $gamesManagementService->players;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_GamesManagement_Players_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Hide the given player's leaderboard scores from the given application. This
|
||||
* method is only available to user accounts for your developer console.
|
||||
* (players.hide)
|
||||
*
|
||||
* @param string $applicationId
|
||||
* The application being requested.
|
||||
* @param string $playerId
|
||||
* A player ID. A value of me may be used in place of the authenticated player's ID.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function hide($applicationId, $playerId, $optParams = array())
|
||||
{
|
||||
$params = array('applicationId' => $applicationId, 'playerId' => $playerId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('hide', array($params));
|
||||
}
|
||||
/**
|
||||
* Unhide the given player's leaderboard scores from the given application. This
|
||||
* method is only available to user accounts for your developer console.
|
||||
* (players.unhide)
|
||||
*
|
||||
* @param string $applicationId
|
||||
* The application being requested.
|
||||
* @param string $playerId
|
||||
* A player ID. A value of me may be used in place of the authenticated player's ID.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function unhide($applicationId, $playerId, $optParams = array())
|
||||
{
|
||||
$params = array('applicationId' => $applicationId, 'playerId' => $playerId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('unhide', array($params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "rooms" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $gamesManagementService = new Google_Service_GamesManagement(...);
|
||||
* $rooms = $gamesManagementService->rooms;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_GamesManagement_Rooms_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Reset all rooms for the currently authenticated player for your application.
|
||||
* This method is only accessible to whitelisted tester accounts for your
|
||||
* application. (rooms.reset)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function reset($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('reset', array($params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "scores" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $gamesManagementService = new Google_Service_GamesManagement(...);
|
||||
* $scores = $gamesManagementService->scores;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_GamesManagement_Scores_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Reset scores for the specified leaderboard for the currently authenticated
|
||||
* player. This method is only accessible to whitelisted tester accounts for
|
||||
* your application. (scores.reset)
|
||||
*
|
||||
* @param string $leaderboardId
|
||||
* The ID of the leaderboard.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_GamesManagement_PlayerScoreResetResponse
|
||||
*/
|
||||
public function reset($leaderboardId, $optParams = array())
|
||||
{
|
||||
$params = array('leaderboardId' => $leaderboardId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('reset', array($params), "Google_Service_GamesManagement_PlayerScoreResetResponse");
|
||||
}
|
||||
/**
|
||||
* Reset scores for the specified leaderboard for all players. This method is
|
||||
* only accessible to whitelisted tester accounts for your application. Only
|
||||
* draft leaderboards can be reset. (scores.resetForAllPlayers)
|
||||
*
|
||||
* @param string $leaderboardId
|
||||
* The ID of the leaderboard.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function resetForAllPlayers($leaderboardId, $optParams = array())
|
||||
{
|
||||
$params = array('leaderboardId' => $leaderboardId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('resetForAllPlayers', array($params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "turnBasedMatches" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $gamesManagementService = new Google_Service_GamesManagement(...);
|
||||
* $turnBasedMatches = $gamesManagementService->turnBasedMatches;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_GamesManagement_TurnBasedMatches_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Reset all turn-based match data for a user. This method is only accessible to
|
||||
* whitelisted tester accounts for your application. (turnBasedMatches.reset)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function reset($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('reset', array($params));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_GamesManagement_AchievementResetAllResponse extends Google_Collection
|
||||
{
|
||||
public $kind;
|
||||
protected $resultsType = 'Google_Service_GamesManagement_AchievementResetResponse';
|
||||
protected $resultsDataType = 'array';
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setResults($results)
|
||||
{
|
||||
$this->results = $results;
|
||||
}
|
||||
|
||||
public function getResults()
|
||||
{
|
||||
return $this->results;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_GamesManagement_AchievementResetResponse extends Google_Model
|
||||
{
|
||||
public $currentState;
|
||||
public $definitionId;
|
||||
public $kind;
|
||||
public $updateOccurred;
|
||||
|
||||
public function setCurrentState($currentState)
|
||||
{
|
||||
$this->currentState = $currentState;
|
||||
}
|
||||
|
||||
public function getCurrentState()
|
||||
{
|
||||
return $this->currentState;
|
||||
}
|
||||
|
||||
public function setDefinitionId($definitionId)
|
||||
{
|
||||
$this->definitionId = $definitionId;
|
||||
}
|
||||
|
||||
public function getDefinitionId()
|
||||
{
|
||||
return $this->definitionId;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setUpdateOccurred($updateOccurred)
|
||||
{
|
||||
$this->updateOccurred = $updateOccurred;
|
||||
}
|
||||
|
||||
public function getUpdateOccurred()
|
||||
{
|
||||
return $this->updateOccurred;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_GamesManagement_GamesPlayedResource extends Google_Model
|
||||
{
|
||||
public $autoMatched;
|
||||
public $timeMillis;
|
||||
|
||||
public function setAutoMatched($autoMatched)
|
||||
{
|
||||
$this->autoMatched = $autoMatched;
|
||||
}
|
||||
|
||||
public function getAutoMatched()
|
||||
{
|
||||
return $this->autoMatched;
|
||||
}
|
||||
|
||||
public function setTimeMillis($timeMillis)
|
||||
{
|
||||
$this->timeMillis = $timeMillis;
|
||||
}
|
||||
|
||||
public function getTimeMillis()
|
||||
{
|
||||
return $this->timeMillis;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_GamesManagement_HiddenPlayer extends Google_Model
|
||||
{
|
||||
public $hiddenTimeMillis;
|
||||
public $kind;
|
||||
protected $playerType = 'Google_Service_GamesManagement_Player';
|
||||
protected $playerDataType = '';
|
||||
|
||||
public function setHiddenTimeMillis($hiddenTimeMillis)
|
||||
{
|
||||
$this->hiddenTimeMillis = $hiddenTimeMillis;
|
||||
}
|
||||
|
||||
public function getHiddenTimeMillis()
|
||||
{
|
||||
return $this->hiddenTimeMillis;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setPlayer(Google_Service_GamesManagement_Player $player)
|
||||
{
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
public function getPlayer()
|
||||
{
|
||||
return $this->player;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_GamesManagement_HiddenPlayerList extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_GamesManagement_HiddenPlayer';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
public $nextPageToken;
|
||||
|
||||
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 setNextPageToken($nextPageToken)
|
||||
{
|
||||
$this->nextPageToken = $nextPageToken;
|
||||
}
|
||||
|
||||
public function getNextPageToken()
|
||||
{
|
||||
return $this->nextPageToken;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_GamesManagement_Player extends Google_Model
|
||||
{
|
||||
public $avatarImageUrl;
|
||||
public $displayName;
|
||||
public $kind;
|
||||
protected $lastPlayedWithType = 'Google_Service_GamesManagement_GamesPlayedResource';
|
||||
protected $lastPlayedWithDataType = '';
|
||||
protected $nameType = 'Google_Service_GamesManagement_PlayerName';
|
||||
protected $nameDataType = '';
|
||||
public $playerId;
|
||||
|
||||
public function setAvatarImageUrl($avatarImageUrl)
|
||||
{
|
||||
$this->avatarImageUrl = $avatarImageUrl;
|
||||
}
|
||||
|
||||
public function getAvatarImageUrl()
|
||||
{
|
||||
return $this->avatarImageUrl;
|
||||
}
|
||||
|
||||
public function setDisplayName($displayName)
|
||||
{
|
||||
$this->displayName = $displayName;
|
||||
}
|
||||
|
||||
public function getDisplayName()
|
||||
{
|
||||
return $this->displayName;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setLastPlayedWith(Google_Service_GamesManagement_GamesPlayedResource $lastPlayedWith)
|
||||
{
|
||||
$this->lastPlayedWith = $lastPlayedWith;
|
||||
}
|
||||
|
||||
public function getLastPlayedWith()
|
||||
{
|
||||
return $this->lastPlayedWith;
|
||||
}
|
||||
|
||||
public function setName(Google_Service_GamesManagement_PlayerName $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setPlayerId($playerId)
|
||||
{
|
||||
$this->playerId = $playerId;
|
||||
}
|
||||
|
||||
public function getPlayerId()
|
||||
{
|
||||
return $this->playerId;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_GamesManagement_PlayerName extends Google_Model
|
||||
{
|
||||
public $familyName;
|
||||
public $givenName;
|
||||
|
||||
public function setFamilyName($familyName)
|
||||
{
|
||||
$this->familyName = $familyName;
|
||||
}
|
||||
|
||||
public function getFamilyName()
|
||||
{
|
||||
return $this->familyName;
|
||||
}
|
||||
|
||||
public function setGivenName($givenName)
|
||||
{
|
||||
$this->givenName = $givenName;
|
||||
}
|
||||
|
||||
public function getGivenName()
|
||||
{
|
||||
return $this->givenName;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_GamesManagement_PlayerScoreResetResponse extends Google_Collection
|
||||
{
|
||||
public $kind;
|
||||
public $resetScoreTimeSpans;
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setResetScoreTimeSpans($resetScoreTimeSpans)
|
||||
{
|
||||
$this->resetScoreTimeSpans = $resetScoreTimeSpans;
|
||||
}
|
||||
|
||||
public function getResetScoreTimeSpans()
|
||||
{
|
||||
return $this->resetScoreTimeSpans;
|
||||
}
|
||||
}
|
||||
129
htdocs/lib/Google/Service/GroupsMigration.php
Normal file
129
htdocs/lib/Google/Service/GroupsMigration.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for GroupsMigration (v1).
|
||||
*
|
||||
* <p>
|
||||
* Groups Migration Api.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/google-apps/groups-migration/" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_GroupsMigration extends Google_Service
|
||||
{
|
||||
|
||||
|
||||
public $archive;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the GroupsMigration service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'groups/v1/groups/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'groupsmigration';
|
||||
|
||||
$this->archive = new Google_Service_GroupsMigration_Archive_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'archive',
|
||||
array(
|
||||
'methods' => array(
|
||||
'insert' => array(
|
||||
'path' => '{groupId}/archive',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'groupId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "archive" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $groupsmigrationService = new Google_Service_GroupsMigration(...);
|
||||
* $archive = $groupsmigrationService->archive;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_GroupsMigration_Archive_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Inserts a new mail into the archive of the Google group. (archive.insert)
|
||||
*
|
||||
* @param string $groupId
|
||||
* The group ID
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_GroupsMigration_Groups
|
||||
*/
|
||||
public function insert($groupId, $optParams = array())
|
||||
{
|
||||
$params = array('groupId' => $groupId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params), "Google_Service_GroupsMigration_Groups");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_GroupsMigration_Groups extends Google_Model
|
||||
{
|
||||
public $kind;
|
||||
public $responseCode;
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setResponseCode($responseCode)
|
||||
{
|
||||
$this->responseCode = $responseCode;
|
||||
}
|
||||
|
||||
public function getResponseCode()
|
||||
{
|
||||
return $this->responseCode;
|
||||
}
|
||||
}
|
||||
467
htdocs/lib/Google/Service/Groupssettings.php
Normal file
467
htdocs/lib/Google/Service/Groupssettings.php
Normal file
@@ -0,0 +1,467 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Groupssettings (v1).
|
||||
*
|
||||
* <p>
|
||||
* Lets you manage permission levels and related settings of a group.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/google-apps/groups-settings/get_started" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Groupssettings extends Google_Service
|
||||
{
|
||||
/** View and manage the settings of a Google Apps Group. */
|
||||
const APPS_GROUPS_SETTINGS = "https://www.googleapis.com/auth/apps.groups.settings";
|
||||
|
||||
public $groups;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Groupssettings service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'groups/v1/groups/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'groupssettings';
|
||||
|
||||
$this->groups = new Google_Service_Groupssettings_Groups_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'groups',
|
||||
array(
|
||||
'methods' => array(
|
||||
'get' => array(
|
||||
'path' => '{groupUniqueId}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'groupUniqueId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'patch' => array(
|
||||
'path' => '{groupUniqueId}',
|
||||
'httpMethod' => 'PATCH',
|
||||
'parameters' => array(
|
||||
'groupUniqueId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => '{groupUniqueId}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'groupUniqueId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "groups" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $groupssettingsService = new Google_Service_Groupssettings(...);
|
||||
* $groups = $groupssettingsService->groups;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Groupssettings_Groups_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Gets one resource by id. (groups.get)
|
||||
*
|
||||
* @param string $groupUniqueId
|
||||
* The resource ID
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Groupssettings_Groups
|
||||
*/
|
||||
public function get($groupUniqueId, $optParams = array())
|
||||
{
|
||||
$params = array('groupUniqueId' => $groupUniqueId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Groupssettings_Groups");
|
||||
}
|
||||
/**
|
||||
* Updates an existing resource. This method supports patch semantics.
|
||||
* (groups.patch)
|
||||
*
|
||||
* @param string $groupUniqueId
|
||||
* The resource ID
|
||||
* @param Google_Groups $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Groupssettings_Groups
|
||||
*/
|
||||
public function patch($groupUniqueId, Google_Service_Groupssettings_Groups $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('groupUniqueId' => $groupUniqueId, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('patch', array($params), "Google_Service_Groupssettings_Groups");
|
||||
}
|
||||
/**
|
||||
* Updates an existing resource. (groups.update)
|
||||
*
|
||||
* @param string $groupUniqueId
|
||||
* The resource ID
|
||||
* @param Google_Groups $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Groupssettings_Groups
|
||||
*/
|
||||
public function update($groupUniqueId, Google_Service_Groupssettings_Groups $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('groupUniqueId' => $groupUniqueId, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('update', array($params), "Google_Service_Groupssettings_Groups");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Groupssettings_Groups extends Google_Model
|
||||
{
|
||||
public $allowExternalMembers;
|
||||
public $allowGoogleCommunication;
|
||||
public $allowWebPosting;
|
||||
public $archiveOnly;
|
||||
public $customReplyTo;
|
||||
public $defaultMessageDenyNotificationText;
|
||||
public $description;
|
||||
public $email;
|
||||
public $includeInGlobalAddressList;
|
||||
public $isArchived;
|
||||
public $kind;
|
||||
public $maxMessageBytes;
|
||||
public $membersCanPostAsTheGroup;
|
||||
public $messageDisplayFont;
|
||||
public $messageModerationLevel;
|
||||
public $name;
|
||||
public $primaryLanguage;
|
||||
public $replyTo;
|
||||
public $sendMessageDenyNotification;
|
||||
public $showInGroupDirectory;
|
||||
public $spamModerationLevel;
|
||||
public $whoCanContactOwner;
|
||||
public $whoCanInvite;
|
||||
public $whoCanJoin;
|
||||
public $whoCanLeaveGroup;
|
||||
public $whoCanPostMessage;
|
||||
public $whoCanViewGroup;
|
||||
public $whoCanViewMembership;
|
||||
|
||||
public function setAllowExternalMembers($allowExternalMembers)
|
||||
{
|
||||
$this->allowExternalMembers = $allowExternalMembers;
|
||||
}
|
||||
|
||||
public function getAllowExternalMembers()
|
||||
{
|
||||
return $this->allowExternalMembers;
|
||||
}
|
||||
|
||||
public function setAllowGoogleCommunication($allowGoogleCommunication)
|
||||
{
|
||||
$this->allowGoogleCommunication = $allowGoogleCommunication;
|
||||
}
|
||||
|
||||
public function getAllowGoogleCommunication()
|
||||
{
|
||||
return $this->allowGoogleCommunication;
|
||||
}
|
||||
|
||||
public function setAllowWebPosting($allowWebPosting)
|
||||
{
|
||||
$this->allowWebPosting = $allowWebPosting;
|
||||
}
|
||||
|
||||
public function getAllowWebPosting()
|
||||
{
|
||||
return $this->allowWebPosting;
|
||||
}
|
||||
|
||||
public function setArchiveOnly($archiveOnly)
|
||||
{
|
||||
$this->archiveOnly = $archiveOnly;
|
||||
}
|
||||
|
||||
public function getArchiveOnly()
|
||||
{
|
||||
return $this->archiveOnly;
|
||||
}
|
||||
|
||||
public function setCustomReplyTo($customReplyTo)
|
||||
{
|
||||
$this->customReplyTo = $customReplyTo;
|
||||
}
|
||||
|
||||
public function getCustomReplyTo()
|
||||
{
|
||||
return $this->customReplyTo;
|
||||
}
|
||||
|
||||
public function setDefaultMessageDenyNotificationText($defaultMessageDenyNotificationText)
|
||||
{
|
||||
$this->defaultMessageDenyNotificationText = $defaultMessageDenyNotificationText;
|
||||
}
|
||||
|
||||
public function getDefaultMessageDenyNotificationText()
|
||||
{
|
||||
return $this->defaultMessageDenyNotificationText;
|
||||
}
|
||||
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setIncludeInGlobalAddressList($includeInGlobalAddressList)
|
||||
{
|
||||
$this->includeInGlobalAddressList = $includeInGlobalAddressList;
|
||||
}
|
||||
|
||||
public function getIncludeInGlobalAddressList()
|
||||
{
|
||||
return $this->includeInGlobalAddressList;
|
||||
}
|
||||
|
||||
public function setIsArchived($isArchived)
|
||||
{
|
||||
$this->isArchived = $isArchived;
|
||||
}
|
||||
|
||||
public function getIsArchived()
|
||||
{
|
||||
return $this->isArchived;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setMaxMessageBytes($maxMessageBytes)
|
||||
{
|
||||
$this->maxMessageBytes = $maxMessageBytes;
|
||||
}
|
||||
|
||||
public function getMaxMessageBytes()
|
||||
{
|
||||
return $this->maxMessageBytes;
|
||||
}
|
||||
|
||||
public function setMembersCanPostAsTheGroup($membersCanPostAsTheGroup)
|
||||
{
|
||||
$this->membersCanPostAsTheGroup = $membersCanPostAsTheGroup;
|
||||
}
|
||||
|
||||
public function getMembersCanPostAsTheGroup()
|
||||
{
|
||||
return $this->membersCanPostAsTheGroup;
|
||||
}
|
||||
|
||||
public function setMessageDisplayFont($messageDisplayFont)
|
||||
{
|
||||
$this->messageDisplayFont = $messageDisplayFont;
|
||||
}
|
||||
|
||||
public function getMessageDisplayFont()
|
||||
{
|
||||
return $this->messageDisplayFont;
|
||||
}
|
||||
|
||||
public function setMessageModerationLevel($messageModerationLevel)
|
||||
{
|
||||
$this->messageModerationLevel = $messageModerationLevel;
|
||||
}
|
||||
|
||||
public function getMessageModerationLevel()
|
||||
{
|
||||
return $this->messageModerationLevel;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setPrimaryLanguage($primaryLanguage)
|
||||
{
|
||||
$this->primaryLanguage = $primaryLanguage;
|
||||
}
|
||||
|
||||
public function getPrimaryLanguage()
|
||||
{
|
||||
return $this->primaryLanguage;
|
||||
}
|
||||
|
||||
public function setReplyTo($replyTo)
|
||||
{
|
||||
$this->replyTo = $replyTo;
|
||||
}
|
||||
|
||||
public function getReplyTo()
|
||||
{
|
||||
return $this->replyTo;
|
||||
}
|
||||
|
||||
public function setSendMessageDenyNotification($sendMessageDenyNotification)
|
||||
{
|
||||
$this->sendMessageDenyNotification = $sendMessageDenyNotification;
|
||||
}
|
||||
|
||||
public function getSendMessageDenyNotification()
|
||||
{
|
||||
return $this->sendMessageDenyNotification;
|
||||
}
|
||||
|
||||
public function setShowInGroupDirectory($showInGroupDirectory)
|
||||
{
|
||||
$this->showInGroupDirectory = $showInGroupDirectory;
|
||||
}
|
||||
|
||||
public function getShowInGroupDirectory()
|
||||
{
|
||||
return $this->showInGroupDirectory;
|
||||
}
|
||||
|
||||
public function setSpamModerationLevel($spamModerationLevel)
|
||||
{
|
||||
$this->spamModerationLevel = $spamModerationLevel;
|
||||
}
|
||||
|
||||
public function getSpamModerationLevel()
|
||||
{
|
||||
return $this->spamModerationLevel;
|
||||
}
|
||||
|
||||
public function setWhoCanContactOwner($whoCanContactOwner)
|
||||
{
|
||||
$this->whoCanContactOwner = $whoCanContactOwner;
|
||||
}
|
||||
|
||||
public function getWhoCanContactOwner()
|
||||
{
|
||||
return $this->whoCanContactOwner;
|
||||
}
|
||||
|
||||
public function setWhoCanInvite($whoCanInvite)
|
||||
{
|
||||
$this->whoCanInvite = $whoCanInvite;
|
||||
}
|
||||
|
||||
public function getWhoCanInvite()
|
||||
{
|
||||
return $this->whoCanInvite;
|
||||
}
|
||||
|
||||
public function setWhoCanJoin($whoCanJoin)
|
||||
{
|
||||
$this->whoCanJoin = $whoCanJoin;
|
||||
}
|
||||
|
||||
public function getWhoCanJoin()
|
||||
{
|
||||
return $this->whoCanJoin;
|
||||
}
|
||||
|
||||
public function setWhoCanLeaveGroup($whoCanLeaveGroup)
|
||||
{
|
||||
$this->whoCanLeaveGroup = $whoCanLeaveGroup;
|
||||
}
|
||||
|
||||
public function getWhoCanLeaveGroup()
|
||||
{
|
||||
return $this->whoCanLeaveGroup;
|
||||
}
|
||||
|
||||
public function setWhoCanPostMessage($whoCanPostMessage)
|
||||
{
|
||||
$this->whoCanPostMessage = $whoCanPostMessage;
|
||||
}
|
||||
|
||||
public function getWhoCanPostMessage()
|
||||
{
|
||||
return $this->whoCanPostMessage;
|
||||
}
|
||||
|
||||
public function setWhoCanViewGroup($whoCanViewGroup)
|
||||
{
|
||||
$this->whoCanViewGroup = $whoCanViewGroup;
|
||||
}
|
||||
|
||||
public function getWhoCanViewGroup()
|
||||
{
|
||||
return $this->whoCanViewGroup;
|
||||
}
|
||||
|
||||
public function setWhoCanViewMembership($whoCanViewMembership)
|
||||
{
|
||||
$this->whoCanViewMembership = $whoCanViewMembership;
|
||||
}
|
||||
|
||||
public function getWhoCanViewMembership()
|
||||
{
|
||||
return $this->whoCanViewMembership;
|
||||
}
|
||||
}
|
||||
1739
htdocs/lib/Google/Service/IdentityToolkit.php
Normal file
1739
htdocs/lib/Google/Service/IdentityToolkit.php
Normal file
File diff suppressed because it is too large
Load Diff
499
htdocs/lib/Google/Service/Licensing.php
Normal file
499
htdocs/lib/Google/Service/Licensing.php
Normal file
@@ -0,0 +1,499 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Licensing (v1).
|
||||
*
|
||||
* <p>
|
||||
* Licensing API to view and manage license for your domain.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/google-apps/licensing/" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Licensing extends Google_Service
|
||||
{
|
||||
|
||||
|
||||
public $licenseAssignments;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Licensing service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'apps/licensing/v1/product/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'licensing';
|
||||
|
||||
$this->licenseAssignments = new Google_Service_Licensing_LicenseAssignments_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'licenseAssignments',
|
||||
array(
|
||||
'methods' => array(
|
||||
'delete' => array(
|
||||
'path' => '{productId}/sku/{skuId}/user/{userId}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'productId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'skuId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'userId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => '{productId}/sku/{skuId}/user/{userId}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'productId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'skuId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'userId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'insert' => array(
|
||||
'path' => '{productId}/sku/{skuId}/user',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'productId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'skuId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'listForProduct' => array(
|
||||
'path' => '{productId}/users',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'productId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'customerId' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
),'listForProductAndSku' => array(
|
||||
'path' => '{productId}/sku/{skuId}/users',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'productId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'skuId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'customerId' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
),'patch' => array(
|
||||
'path' => '{productId}/sku/{skuId}/user/{userId}',
|
||||
'httpMethod' => 'PATCH',
|
||||
'parameters' => array(
|
||||
'productId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'skuId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'userId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => '{productId}/sku/{skuId}/user/{userId}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'productId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'skuId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'userId' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "licenseAssignments" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $licensingService = new Google_Service_Licensing(...);
|
||||
* $licenseAssignments = $licensingService->licenseAssignments;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Licensing_LicenseAssignments_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Revoke License. (licenseAssignments.delete)
|
||||
*
|
||||
* @param string $productId
|
||||
* Name for product
|
||||
* @param string $skuId
|
||||
* Name for sku
|
||||
* @param string $userId
|
||||
* email id or unique Id of the user
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function delete($productId, $skuId, $userId, $optParams = array())
|
||||
{
|
||||
$params = array('productId' => $productId, 'skuId' => $skuId, 'userId' => $userId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('delete', array($params));
|
||||
}
|
||||
/**
|
||||
* Get license assignment of a particular product and sku for a user
|
||||
* (licenseAssignments.get)
|
||||
*
|
||||
* @param string $productId
|
||||
* Name for product
|
||||
* @param string $skuId
|
||||
* Name for sku
|
||||
* @param string $userId
|
||||
* email id or unique Id of the user
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Licensing_LicenseAssignment
|
||||
*/
|
||||
public function get($productId, $skuId, $userId, $optParams = array())
|
||||
{
|
||||
$params = array('productId' => $productId, 'skuId' => $skuId, 'userId' => $userId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Licensing_LicenseAssignment");
|
||||
}
|
||||
/**
|
||||
* Assign License. (licenseAssignments.insert)
|
||||
*
|
||||
* @param string $productId
|
||||
* Name for product
|
||||
* @param string $skuId
|
||||
* Name for sku
|
||||
* @param Google_LicenseAssignmentInsert $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Licensing_LicenseAssignment
|
||||
*/
|
||||
public function insert($productId, $skuId, Google_Service_Licensing_LicenseAssignmentInsert $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('productId' => $productId, 'skuId' => $skuId, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params), "Google_Service_Licensing_LicenseAssignment");
|
||||
}
|
||||
/**
|
||||
* List license assignments for given product of the customer.
|
||||
* (licenseAssignments.listForProduct)
|
||||
*
|
||||
* @param string $productId
|
||||
* Name for product
|
||||
* @param string $customerId
|
||||
* CustomerId represents the customer for whom licenseassignments are queried
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string pageToken
|
||||
* Token to fetch the next page.Optional. By default server will return first page
|
||||
* @opt_param string maxResults
|
||||
* Maximum number of campaigns to return at one time. Must be positive. Optional. Default value is
|
||||
* 100.
|
||||
* @return Google_Service_Licensing_LicenseAssignmentList
|
||||
*/
|
||||
public function listForProduct($productId, $customerId, $optParams = array())
|
||||
{
|
||||
$params = array('productId' => $productId, 'customerId' => $customerId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('listForProduct', array($params), "Google_Service_Licensing_LicenseAssignmentList");
|
||||
}
|
||||
/**
|
||||
* List license assignments for given product and sku of the customer.
|
||||
* (licenseAssignments.listForProductAndSku)
|
||||
*
|
||||
* @param string $productId
|
||||
* Name for product
|
||||
* @param string $skuId
|
||||
* Name for sku
|
||||
* @param string $customerId
|
||||
* CustomerId represents the customer for whom licenseassignments are queried
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string pageToken
|
||||
* Token to fetch the next page.Optional. By default server will return first page
|
||||
* @opt_param string maxResults
|
||||
* Maximum number of campaigns to return at one time. Must be positive. Optional. Default value is
|
||||
* 100.
|
||||
* @return Google_Service_Licensing_LicenseAssignmentList
|
||||
*/
|
||||
public function listForProductAndSku($productId, $skuId, $customerId, $optParams = array())
|
||||
{
|
||||
$params = array('productId' => $productId, 'skuId' => $skuId, 'customerId' => $customerId);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('listForProductAndSku', array($params), "Google_Service_Licensing_LicenseAssignmentList");
|
||||
}
|
||||
/**
|
||||
* Assign License. This method supports patch semantics.
|
||||
* (licenseAssignments.patch)
|
||||
*
|
||||
* @param string $productId
|
||||
* Name for product
|
||||
* @param string $skuId
|
||||
* Name for sku for which license would be revoked
|
||||
* @param string $userId
|
||||
* email id or unique Id of the user
|
||||
* @param Google_LicenseAssignment $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Licensing_LicenseAssignment
|
||||
*/
|
||||
public function patch($productId, $skuId, $userId, Google_Service_Licensing_LicenseAssignment $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('productId' => $productId, 'skuId' => $skuId, 'userId' => $userId, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('patch', array($params), "Google_Service_Licensing_LicenseAssignment");
|
||||
}
|
||||
/**
|
||||
* Assign License. (licenseAssignments.update)
|
||||
*
|
||||
* @param string $productId
|
||||
* Name for product
|
||||
* @param string $skuId
|
||||
* Name for sku for which license would be revoked
|
||||
* @param string $userId
|
||||
* email id or unique Id of the user
|
||||
* @param Google_LicenseAssignment $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Licensing_LicenseAssignment
|
||||
*/
|
||||
public function update($productId, $skuId, $userId, Google_Service_Licensing_LicenseAssignment $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('productId' => $productId, 'skuId' => $skuId, 'userId' => $userId, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('update', array($params), "Google_Service_Licensing_LicenseAssignment");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Licensing_LicenseAssignment extends Google_Model
|
||||
{
|
||||
public $etags;
|
||||
public $kind;
|
||||
public $productId;
|
||||
public $selfLink;
|
||||
public $skuId;
|
||||
public $userId;
|
||||
|
||||
public function setEtags($etags)
|
||||
{
|
||||
$this->etags = $etags;
|
||||
}
|
||||
|
||||
public function getEtags()
|
||||
{
|
||||
return $this->etags;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setProductId($productId)
|
||||
{
|
||||
$this->productId = $productId;
|
||||
}
|
||||
|
||||
public function getProductId()
|
||||
{
|
||||
return $this->productId;
|
||||
}
|
||||
|
||||
public function setSelfLink($selfLink)
|
||||
{
|
||||
$this->selfLink = $selfLink;
|
||||
}
|
||||
|
||||
public function getSelfLink()
|
||||
{
|
||||
return $this->selfLink;
|
||||
}
|
||||
|
||||
public function setSkuId($skuId)
|
||||
{
|
||||
$this->skuId = $skuId;
|
||||
}
|
||||
|
||||
public function getSkuId()
|
||||
{
|
||||
return $this->skuId;
|
||||
}
|
||||
|
||||
public function setUserId($userId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function getUserId()
|
||||
{
|
||||
return $this->userId;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Licensing_LicenseAssignmentInsert extends Google_Model
|
||||
{
|
||||
public $userId;
|
||||
|
||||
public function setUserId($userId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function getUserId()
|
||||
{
|
||||
return $this->userId;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Licensing_LicenseAssignmentList extends Google_Collection
|
||||
{
|
||||
public $etag;
|
||||
protected $itemsType = 'Google_Service_Licensing_LicenseAssignment';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
public $nextPageToken;
|
||||
|
||||
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 setNextPageToken($nextPageToken)
|
||||
{
|
||||
$this->nextPageToken = $nextPageToken;
|
||||
}
|
||||
|
||||
public function getNextPageToken()
|
||||
{
|
||||
return $this->nextPageToken;
|
||||
}
|
||||
}
|
||||
1777
htdocs/lib/Google/Service/Mirror.php
Normal file
1777
htdocs/lib/Google/Service/Mirror.php
Normal file
File diff suppressed because it is too large
Load Diff
412
htdocs/lib/Google/Service/Oauth2.php
Normal file
412
htdocs/lib/Google/Service/Oauth2.php
Normal file
@@ -0,0 +1,412 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Oauth2 (v2).
|
||||
*
|
||||
* <p>
|
||||
* Lets you access OAuth2 protocol related APIs.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/accounts/docs/OAuth2" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Oauth2 extends Google_Service
|
||||
{
|
||||
/** Know your basic profile info and list of people in your circles.. */
|
||||
const PLUS_LOGIN = "https://www.googleapis.com/auth/plus.login";
|
||||
/** Know who you are on Google. */
|
||||
const PLUS_ME = "https://www.googleapis.com/auth/plus.me";
|
||||
/** View your email address. */
|
||||
const USERINFO_EMAIL = "https://www.googleapis.com/auth/userinfo.email";
|
||||
/** View basic information about your account. */
|
||||
const USERINFO_PROFILE = "https://www.googleapis.com/auth/userinfo.profile";
|
||||
|
||||
public $userinfo;
|
||||
public $userinfo_v2_me;
|
||||
private $base_methods;
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Oauth2 service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = '';
|
||||
$this->version = 'v2';
|
||||
$this->serviceName = 'oauth2';
|
||||
|
||||
$this->userinfo = new Google_Service_Oauth2_Userinfo_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'userinfo',
|
||||
array(
|
||||
'methods' => array(
|
||||
'get' => array(
|
||||
'path' => 'oauth2/v2/userinfo',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->userinfo_v2_me = new Google_Service_Oauth2_UserinfoV2Me_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'me',
|
||||
array(
|
||||
'methods' => array(
|
||||
'get' => array(
|
||||
'path' => 'userinfo/v2/me',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->base_methods = new Google_Service_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'',
|
||||
array(
|
||||
'methods' => array(
|
||||
'tokeninfo' => array(
|
||||
'path' => 'oauth2/v2/tokeninfo',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'access_token' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'id_token' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* (tokeninfo)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string accessToken
|
||||
*
|
||||
* @opt_param string idToken
|
||||
*
|
||||
* @return Google_Service_Oauth2_Tokeninfo
|
||||
*/
|
||||
public function tokeninfo($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->base_methods->call('tokeninfo', array($params), "Google_Service_Oauth2_Tokeninfo");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "userinfo" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $oauth2Service = new Google_Service_Oauth2(...);
|
||||
* $userinfo = $oauth2Service->userinfo;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Oauth2_Userinfo_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* (userinfo.get)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Oauth2_Userinfoplus
|
||||
*/
|
||||
public function get($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Oauth2_Userinfoplus");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "v2" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $oauth2Service = new Google_Service_Oauth2(...);
|
||||
* $v2 = $oauth2Service->v2;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Oauth2_UserinfoV2_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The "me" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $oauth2Service = new Google_Service_Oauth2(...);
|
||||
* $me = $oauth2Service->me;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Oauth2_UserinfoV2Me_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* (me.get)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Oauth2_Userinfoplus
|
||||
*/
|
||||
public function get($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Oauth2_Userinfoplus");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Oauth2_Tokeninfo extends Google_Model
|
||||
{
|
||||
public $accessType;
|
||||
public $audience;
|
||||
public $email;
|
||||
public $expiresIn;
|
||||
public $issuedTo;
|
||||
public $scope;
|
||||
public $userId;
|
||||
public $verifiedEmail;
|
||||
|
||||
public function setAccessType($accessType)
|
||||
{
|
||||
$this->accessType = $accessType;
|
||||
}
|
||||
|
||||
public function getAccessType()
|
||||
{
|
||||
return $this->accessType;
|
||||
}
|
||||
|
||||
public function setAudience($audience)
|
||||
{
|
||||
$this->audience = $audience;
|
||||
}
|
||||
|
||||
public function getAudience()
|
||||
{
|
||||
return $this->audience;
|
||||
}
|
||||
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setExpiresIn($expiresIn)
|
||||
{
|
||||
$this->expiresIn = $expiresIn;
|
||||
}
|
||||
|
||||
public function getExpiresIn()
|
||||
{
|
||||
return $this->expiresIn;
|
||||
}
|
||||
|
||||
public function setIssuedTo($issuedTo)
|
||||
{
|
||||
$this->issuedTo = $issuedTo;
|
||||
}
|
||||
|
||||
public function getIssuedTo()
|
||||
{
|
||||
return $this->issuedTo;
|
||||
}
|
||||
|
||||
public function setScope($scope)
|
||||
{
|
||||
$this->scope = $scope;
|
||||
}
|
||||
|
||||
public function getScope()
|
||||
{
|
||||
return $this->scope;
|
||||
}
|
||||
|
||||
public function setUserId($userId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function getUserId()
|
||||
{
|
||||
return $this->userId;
|
||||
}
|
||||
|
||||
public function setVerifiedEmail($verifiedEmail)
|
||||
{
|
||||
$this->verifiedEmail = $verifiedEmail;
|
||||
}
|
||||
|
||||
public function getVerifiedEmail()
|
||||
{
|
||||
return $this->verifiedEmail;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Oauth2_Userinfoplus extends Google_Model
|
||||
{
|
||||
public $email;
|
||||
public $familyName;
|
||||
public $gender;
|
||||
public $givenName;
|
||||
public $hd;
|
||||
public $id;
|
||||
public $link;
|
||||
public $locale;
|
||||
public $name;
|
||||
public $picture;
|
||||
public $verifiedEmail;
|
||||
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setFamilyName($familyName)
|
||||
{
|
||||
$this->familyName = $familyName;
|
||||
}
|
||||
|
||||
public function getFamilyName()
|
||||
{
|
||||
return $this->familyName;
|
||||
}
|
||||
|
||||
public function setGender($gender)
|
||||
{
|
||||
$this->gender = $gender;
|
||||
}
|
||||
|
||||
public function getGender()
|
||||
{
|
||||
return $this->gender;
|
||||
}
|
||||
|
||||
public function setGivenName($givenName)
|
||||
{
|
||||
$this->givenName = $givenName;
|
||||
}
|
||||
|
||||
public function getGivenName()
|
||||
{
|
||||
return $this->givenName;
|
||||
}
|
||||
|
||||
public function setHd($hd)
|
||||
{
|
||||
$this->hd = $hd;
|
||||
}
|
||||
|
||||
public function getHd()
|
||||
{
|
||||
return $this->hd;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setLink($link)
|
||||
{
|
||||
$this->link = $link;
|
||||
}
|
||||
|
||||
public function getLink()
|
||||
{
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setPicture($picture)
|
||||
{
|
||||
$this->picture = $picture;
|
||||
}
|
||||
|
||||
public function getPicture()
|
||||
{
|
||||
return $this->picture;
|
||||
}
|
||||
|
||||
public function setVerifiedEmail($verifiedEmail)
|
||||
{
|
||||
$this->verifiedEmail = $verifiedEmail;
|
||||
}
|
||||
|
||||
public function getVerifiedEmail()
|
||||
{
|
||||
return $this->verifiedEmail;
|
||||
}
|
||||
}
|
||||
4025
htdocs/lib/Google/Service/Orkut.php
Normal file
4025
htdocs/lib/Google/Service/Orkut.php
Normal file
File diff suppressed because it is too large
Load Diff
811
htdocs/lib/Google/Service/Pagespeedonline.php
Normal file
811
htdocs/lib/Google/Service/Pagespeedonline.php
Normal file
@@ -0,0 +1,811 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Pagespeedonline (v1).
|
||||
*
|
||||
* <p>
|
||||
* Lets you analyze the performance of a web page and get tailored suggestions to make that page faster.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/speed/docs/insights/v1/getting_started" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Pagespeedonline extends Google_Service
|
||||
{
|
||||
|
||||
|
||||
public $pagespeedapi;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Pagespeedonline service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'pagespeedonline/v1/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'pagespeedonline';
|
||||
|
||||
$this->pagespeedapi = new Google_Service_Pagespeedonline_Pagespeedapi_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'pagespeedapi',
|
||||
array(
|
||||
'methods' => array(
|
||||
'runpagespeed' => array(
|
||||
'path' => 'runPagespeed',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'url' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'screenshot' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'locale' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'snapshots' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'strategy' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'rule' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'filter_third_party_resources' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "pagespeedapi" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $pagespeedonlineService = new Google_Service_Pagespeedonline(...);
|
||||
* $pagespeedapi = $pagespeedonlineService->pagespeedapi;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Pagespeedonline_Pagespeedapi_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Runs Page Speed analysis on the page at the specified URL, and returns a Page
|
||||
* Speed score, a list of suggestions to make that page faster, and other
|
||||
* information. (pagespeedapi.runpagespeed)
|
||||
*
|
||||
* @param string $url
|
||||
* The URL to fetch and analyze
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param bool screenshot
|
||||
* Indicates if binary data containing a screenshot should be included
|
||||
* @opt_param string locale
|
||||
* The locale used to localize formatted results
|
||||
* @opt_param bool snapshots
|
||||
* Indicates if binary data containing snapshot images should be included
|
||||
* @opt_param string strategy
|
||||
* The analysis strategy to use
|
||||
* @opt_param string rule
|
||||
* A Page Speed rule to run; if none are given, all rules are run
|
||||
* @opt_param bool filterThirdPartyResources
|
||||
* Indicates if third party resources should be filtered out before PageSpeed analysis.
|
||||
* @return Google_Service_Pagespeedonline_Result
|
||||
*/
|
||||
public function runpagespeed($url, $optParams = array())
|
||||
{
|
||||
$params = array('url' => $url);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('runpagespeed', array($params), "Google_Service_Pagespeedonline_Result");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Pagespeedonline_Result extends Google_Collection
|
||||
{
|
||||
protected $formattedResultsType = 'Google_Service_Pagespeedonline_ResultFormattedResults';
|
||||
protected $formattedResultsDataType = '';
|
||||
public $id;
|
||||
public $invalidRules;
|
||||
public $kind;
|
||||
protected $pageStatsType = 'Google_Service_Pagespeedonline_ResultPageStats';
|
||||
protected $pageStatsDataType = '';
|
||||
protected $requestType = 'Google_Service_Pagespeedonline_ResultRequest';
|
||||
protected $requestDataType = '';
|
||||
public $responseCode;
|
||||
public $score;
|
||||
protected $screenshotType = 'Google_Service_Pagespeedonline_ResultScreenshot';
|
||||
protected $screenshotDataType = '';
|
||||
public $title;
|
||||
protected $versionType = 'Google_Service_Pagespeedonline_ResultVersion';
|
||||
protected $versionDataType = '';
|
||||
|
||||
public function setFormattedResults(Google_Service_Pagespeedonline_ResultFormattedResults $formattedResults)
|
||||
{
|
||||
$this->formattedResults = $formattedResults;
|
||||
}
|
||||
|
||||
public function getFormattedResults()
|
||||
{
|
||||
return $this->formattedResults;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setInvalidRules($invalidRules)
|
||||
{
|
||||
$this->invalidRules = $invalidRules;
|
||||
}
|
||||
|
||||
public function getInvalidRules()
|
||||
{
|
||||
return $this->invalidRules;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setPageStats(Google_Service_Pagespeedonline_ResultPageStats $pageStats)
|
||||
{
|
||||
$this->pageStats = $pageStats;
|
||||
}
|
||||
|
||||
public function getPageStats()
|
||||
{
|
||||
return $this->pageStats;
|
||||
}
|
||||
|
||||
public function setRequest(Google_Service_Pagespeedonline_ResultRequest $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function setResponseCode($responseCode)
|
||||
{
|
||||
$this->responseCode = $responseCode;
|
||||
}
|
||||
|
||||
public function getResponseCode()
|
||||
{
|
||||
return $this->responseCode;
|
||||
}
|
||||
|
||||
public function setScore($score)
|
||||
{
|
||||
$this->score = $score;
|
||||
}
|
||||
|
||||
public function getScore()
|
||||
{
|
||||
return $this->score;
|
||||
}
|
||||
|
||||
public function setScreenshot(Google_Service_Pagespeedonline_ResultScreenshot $screenshot)
|
||||
{
|
||||
$this->screenshot = $screenshot;
|
||||
}
|
||||
|
||||
public function getScreenshot()
|
||||
{
|
||||
return $this->screenshot;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setVersion(Google_Service_Pagespeedonline_ResultVersion $version)
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultFormattedResults extends Google_Model
|
||||
{
|
||||
public $locale;
|
||||
protected $ruleResultsType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElement';
|
||||
protected $ruleResultsDataType = 'map';
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
public function setRuleResults($ruleResults)
|
||||
{
|
||||
$this->ruleResults = $ruleResults;
|
||||
}
|
||||
|
||||
public function getRuleResults()
|
||||
{
|
||||
return $this->ruleResults;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElement extends Google_Collection
|
||||
{
|
||||
public $localizedRuleName;
|
||||
public $ruleImpact;
|
||||
protected $urlBlocksType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocks';
|
||||
protected $urlBlocksDataType = 'array';
|
||||
|
||||
public function setLocalizedRuleName($localizedRuleName)
|
||||
{
|
||||
$this->localizedRuleName = $localizedRuleName;
|
||||
}
|
||||
|
||||
public function getLocalizedRuleName()
|
||||
{
|
||||
return $this->localizedRuleName;
|
||||
}
|
||||
|
||||
public function setRuleImpact($ruleImpact)
|
||||
{
|
||||
$this->ruleImpact = $ruleImpact;
|
||||
}
|
||||
|
||||
public function getRuleImpact()
|
||||
{
|
||||
return $this->ruleImpact;
|
||||
}
|
||||
|
||||
public function setUrlBlocks($urlBlocks)
|
||||
{
|
||||
$this->urlBlocks = $urlBlocks;
|
||||
}
|
||||
|
||||
public function getUrlBlocks()
|
||||
{
|
||||
return $this->urlBlocks;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocks extends Google_Collection
|
||||
{
|
||||
protected $headerType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksHeader';
|
||||
protected $headerDataType = '';
|
||||
protected $urlsType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrls';
|
||||
protected $urlsDataType = 'array';
|
||||
|
||||
public function setHeader(Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksHeader $header)
|
||||
{
|
||||
$this->header = $header;
|
||||
}
|
||||
|
||||
public function getHeader()
|
||||
{
|
||||
return $this->header;
|
||||
}
|
||||
|
||||
public function setUrls($urls)
|
||||
{
|
||||
$this->urls = $urls;
|
||||
}
|
||||
|
||||
public function getUrls()
|
||||
{
|
||||
return $this->urls;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksHeader extends Google_Collection
|
||||
{
|
||||
protected $argsType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksHeaderArgs';
|
||||
protected $argsDataType = 'array';
|
||||
public $format;
|
||||
|
||||
public function setArgs($args)
|
||||
{
|
||||
$this->args = $args;
|
||||
}
|
||||
|
||||
public function getArgs()
|
||||
{
|
||||
return $this->args;
|
||||
}
|
||||
|
||||
public function setFormat($format)
|
||||
{
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
public function getFormat()
|
||||
{
|
||||
return $this->format;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksHeaderArgs 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_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrls extends Google_Collection
|
||||
{
|
||||
protected $detailsType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetails';
|
||||
protected $detailsDataType = 'array';
|
||||
protected $resultType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResult';
|
||||
protected $resultDataType = '';
|
||||
|
||||
public function setDetails($details)
|
||||
{
|
||||
$this->details = $details;
|
||||
}
|
||||
|
||||
public function getDetails()
|
||||
{
|
||||
return $this->details;
|
||||
}
|
||||
|
||||
public function setResult(Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResult $result)
|
||||
{
|
||||
$this->result = $result;
|
||||
}
|
||||
|
||||
public function getResult()
|
||||
{
|
||||
return $this->result;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetails extends Google_Collection
|
||||
{
|
||||
protected $argsType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetailsArgs';
|
||||
protected $argsDataType = 'array';
|
||||
public $format;
|
||||
|
||||
public function setArgs($args)
|
||||
{
|
||||
$this->args = $args;
|
||||
}
|
||||
|
||||
public function getArgs()
|
||||
{
|
||||
return $this->args;
|
||||
}
|
||||
|
||||
public function setFormat($format)
|
||||
{
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
public function getFormat()
|
||||
{
|
||||
return $this->format;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetailsArgs 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_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResult extends Google_Collection
|
||||
{
|
||||
protected $argsType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResultArgs';
|
||||
protected $argsDataType = 'array';
|
||||
public $format;
|
||||
|
||||
public function setArgs($args)
|
||||
{
|
||||
$this->args = $args;
|
||||
}
|
||||
|
||||
public function getArgs()
|
||||
{
|
||||
return $this->args;
|
||||
}
|
||||
|
||||
public function setFormat($format)
|
||||
{
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
public function getFormat()
|
||||
{
|
||||
return $this->format;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResultArgs 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_Pagespeedonline_ResultPageStats extends Google_Model
|
||||
{
|
||||
public $cssResponseBytes;
|
||||
public $flashResponseBytes;
|
||||
public $htmlResponseBytes;
|
||||
public $imageResponseBytes;
|
||||
public $javascriptResponseBytes;
|
||||
public $numberCssResources;
|
||||
public $numberHosts;
|
||||
public $numberJsResources;
|
||||
public $numberResources;
|
||||
public $numberStaticResources;
|
||||
public $otherResponseBytes;
|
||||
public $textResponseBytes;
|
||||
public $totalRequestBytes;
|
||||
|
||||
public function setCssResponseBytes($cssResponseBytes)
|
||||
{
|
||||
$this->cssResponseBytes = $cssResponseBytes;
|
||||
}
|
||||
|
||||
public function getCssResponseBytes()
|
||||
{
|
||||
return $this->cssResponseBytes;
|
||||
}
|
||||
|
||||
public function setFlashResponseBytes($flashResponseBytes)
|
||||
{
|
||||
$this->flashResponseBytes = $flashResponseBytes;
|
||||
}
|
||||
|
||||
public function getFlashResponseBytes()
|
||||
{
|
||||
return $this->flashResponseBytes;
|
||||
}
|
||||
|
||||
public function setHtmlResponseBytes($htmlResponseBytes)
|
||||
{
|
||||
$this->htmlResponseBytes = $htmlResponseBytes;
|
||||
}
|
||||
|
||||
public function getHtmlResponseBytes()
|
||||
{
|
||||
return $this->htmlResponseBytes;
|
||||
}
|
||||
|
||||
public function setImageResponseBytes($imageResponseBytes)
|
||||
{
|
||||
$this->imageResponseBytes = $imageResponseBytes;
|
||||
}
|
||||
|
||||
public function getImageResponseBytes()
|
||||
{
|
||||
return $this->imageResponseBytes;
|
||||
}
|
||||
|
||||
public function setJavascriptResponseBytes($javascriptResponseBytes)
|
||||
{
|
||||
$this->javascriptResponseBytes = $javascriptResponseBytes;
|
||||
}
|
||||
|
||||
public function getJavascriptResponseBytes()
|
||||
{
|
||||
return $this->javascriptResponseBytes;
|
||||
}
|
||||
|
||||
public function setNumberCssResources($numberCssResources)
|
||||
{
|
||||
$this->numberCssResources = $numberCssResources;
|
||||
}
|
||||
|
||||
public function getNumberCssResources()
|
||||
{
|
||||
return $this->numberCssResources;
|
||||
}
|
||||
|
||||
public function setNumberHosts($numberHosts)
|
||||
{
|
||||
$this->numberHosts = $numberHosts;
|
||||
}
|
||||
|
||||
public function getNumberHosts()
|
||||
{
|
||||
return $this->numberHosts;
|
||||
}
|
||||
|
||||
public function setNumberJsResources($numberJsResources)
|
||||
{
|
||||
$this->numberJsResources = $numberJsResources;
|
||||
}
|
||||
|
||||
public function getNumberJsResources()
|
||||
{
|
||||
return $this->numberJsResources;
|
||||
}
|
||||
|
||||
public function setNumberResources($numberResources)
|
||||
{
|
||||
$this->numberResources = $numberResources;
|
||||
}
|
||||
|
||||
public function getNumberResources()
|
||||
{
|
||||
return $this->numberResources;
|
||||
}
|
||||
|
||||
public function setNumberStaticResources($numberStaticResources)
|
||||
{
|
||||
$this->numberStaticResources = $numberStaticResources;
|
||||
}
|
||||
|
||||
public function getNumberStaticResources()
|
||||
{
|
||||
return $this->numberStaticResources;
|
||||
}
|
||||
|
||||
public function setOtherResponseBytes($otherResponseBytes)
|
||||
{
|
||||
$this->otherResponseBytes = $otherResponseBytes;
|
||||
}
|
||||
|
||||
public function getOtherResponseBytes()
|
||||
{
|
||||
return $this->otherResponseBytes;
|
||||
}
|
||||
|
||||
public function setTextResponseBytes($textResponseBytes)
|
||||
{
|
||||
$this->textResponseBytes = $textResponseBytes;
|
||||
}
|
||||
|
||||
public function getTextResponseBytes()
|
||||
{
|
||||
return $this->textResponseBytes;
|
||||
}
|
||||
|
||||
public function setTotalRequestBytes($totalRequestBytes)
|
||||
{
|
||||
$this->totalRequestBytes = $totalRequestBytes;
|
||||
}
|
||||
|
||||
public function getTotalRequestBytes()
|
||||
{
|
||||
return $this->totalRequestBytes;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultRequest extends Google_Model
|
||||
{
|
||||
public $filterThirdPartyResources;
|
||||
public $strategy;
|
||||
public $url;
|
||||
|
||||
public function setFilterThirdPartyResources($filterThirdPartyResources)
|
||||
{
|
||||
$this->filterThirdPartyResources = $filterThirdPartyResources;
|
||||
}
|
||||
|
||||
public function getFilterThirdPartyResources()
|
||||
{
|
||||
return $this->filterThirdPartyResources;
|
||||
}
|
||||
|
||||
public function setStrategy($strategy)
|
||||
{
|
||||
$this->strategy = $strategy;
|
||||
}
|
||||
|
||||
public function getStrategy()
|
||||
{
|
||||
return $this->strategy;
|
||||
}
|
||||
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultScreenshot extends Google_Model
|
||||
{
|
||||
public $data;
|
||||
public $height;
|
||||
public $mimeType;
|
||||
public $width;
|
||||
|
||||
public function setData($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setHeight($height)
|
||||
{
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
public function setMimeType($mimeType)
|
||||
{
|
||||
$this->mimeType = $mimeType;
|
||||
}
|
||||
|
||||
public function getMimeType()
|
||||
{
|
||||
return $this->mimeType;
|
||||
}
|
||||
|
||||
public function setWidth($width)
|
||||
{
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Pagespeedonline_ResultVersion extends Google_Model
|
||||
{
|
||||
public $major;
|
||||
public $minor;
|
||||
|
||||
public function setMajor($major)
|
||||
{
|
||||
$this->major = $major;
|
||||
}
|
||||
|
||||
public function getMajor()
|
||||
{
|
||||
return $this->major;
|
||||
}
|
||||
|
||||
public function setMinor($minor)
|
||||
{
|
||||
$this->minor = $minor;
|
||||
}
|
||||
|
||||
public function getMinor()
|
||||
{
|
||||
return $this->minor;
|
||||
}
|
||||
}
|
||||
3821
htdocs/lib/Google/Service/Plus.php
Normal file
3821
htdocs/lib/Google/Service/Plus.php
Normal file
File diff suppressed because it is too large
Load Diff
3977
htdocs/lib/Google/Service/PlusDomains.php
Normal file
3977
htdocs/lib/Google/Service/PlusDomains.php
Normal file
File diff suppressed because it is too large
Load Diff
1265
htdocs/lib/Google/Service/Prediction.php
Normal file
1265
htdocs/lib/Google/Service/Prediction.php
Normal file
File diff suppressed because it is too large
Load Diff
1700
htdocs/lib/Google/Service/QpxExpress.php
Normal file
1700
htdocs/lib/Google/Service/QpxExpress.php
Normal file
File diff suppressed because it is too large
Load Diff
1178
htdocs/lib/Google/Service/Reports.php
Normal file
1178
htdocs/lib/Google/Service/Reports.php
Normal file
File diff suppressed because it is too large
Load Diff
1102
htdocs/lib/Google/Service/Reseller.php
Normal file
1102
htdocs/lib/Google/Service/Reseller.php
Normal file
File diff suppressed because it is too large
Load Diff
210
htdocs/lib/Google/Service/Resource.php
Normal file
210
htdocs/lib/Google/Service/Resource.php
Normal file
@@ -0,0 +1,210 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once 'Google/Client.php';
|
||||
require_once 'Google/Exception.php';
|
||||
require_once 'Google/Utils.php';
|
||||
require_once 'Google/Http/Request.php';
|
||||
require_once 'Google/Http/MediaFileUpload.php';
|
||||
require_once 'Google/Http/REST.php';
|
||||
|
||||
/**
|
||||
* Implements the actual methods/resources of the discovered Google API using magic function
|
||||
* calling overloading (__call()), which on call will see if the method name (plus.activities.list)
|
||||
* is available in this service, and if so construct an apiHttpRequest representing it.
|
||||
*
|
||||
* @author Chris Chabot <chabotc@google.com>
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
2441
htdocs/lib/Google/Service/SQLAdmin.php
Normal file
2441
htdocs/lib/Google/Service/SQLAdmin.php
Normal file
File diff suppressed because it is too large
Load Diff
2122
htdocs/lib/Google/Service/Shopping.php
Normal file
2122
htdocs/lib/Google/Service/Shopping.php
Normal file
File diff suppressed because it is too large
Load Diff
399
htdocs/lib/Google/Service/SiteVerification.php
Normal file
399
htdocs/lib/Google/Service/SiteVerification.php
Normal file
@@ -0,0 +1,399 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for SiteVerification (v1).
|
||||
*
|
||||
* <p>
|
||||
* Lets you programatically verify ownership of websites or domains with Google.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/site-verification/" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_SiteVerification extends Google_Service
|
||||
{
|
||||
/** Manage the list of sites and domains you control. */
|
||||
const SITEVERIFICATION = "https://www.googleapis.com/auth/siteverification";
|
||||
/** Manage your new site verifications with Google. */
|
||||
const SITEVERIFICATION_VERIFY_ONLY = "https://www.googleapis.com/auth/siteverification.verify_only";
|
||||
|
||||
public $webResource;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the SiteVerification service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'siteVerification/v1/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'siteVerification';
|
||||
|
||||
$this->webResource = new Google_Service_SiteVerification_WebResource_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'webResource',
|
||||
array(
|
||||
'methods' => array(
|
||||
'delete' => array(
|
||||
'path' => 'webResource/{id}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'id' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'webResource/{id}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'id' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'getToken' => array(
|
||||
'path' => 'token',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(),
|
||||
),'insert' => array(
|
||||
'path' => 'webResource',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'verificationMethod' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'webResource',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(),
|
||||
),'patch' => array(
|
||||
'path' => 'webResource/{id}',
|
||||
'httpMethod' => 'PATCH',
|
||||
'parameters' => array(
|
||||
'id' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => 'webResource/{id}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'id' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "webResource" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $siteVerificationService = new Google_Service_SiteVerification(...);
|
||||
* $webResource = $siteVerificationService->webResource;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_SiteVerification_WebResource_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Relinquish ownership of a website or domain. (webResource.delete)
|
||||
*
|
||||
* @param string $id
|
||||
* The id of a verified site or domain.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function delete($id, $optParams = array())
|
||||
{
|
||||
$params = array('id' => $id);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('delete', array($params));
|
||||
}
|
||||
/**
|
||||
* Get the most current data for a website or domain. (webResource.get)
|
||||
*
|
||||
* @param string $id
|
||||
* The id of a verified site or domain.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_SiteVerification_SiteVerificationWebResourceResource
|
||||
*/
|
||||
public function get($id, $optParams = array())
|
||||
{
|
||||
$params = array('id' => $id);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_SiteVerification_SiteVerificationWebResourceResource");
|
||||
}
|
||||
/**
|
||||
* Get a verification token for placing on a website or domain.
|
||||
* (webResource.getToken)
|
||||
*
|
||||
* @param Google_SiteVerificationWebResourceGettokenRequest $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_SiteVerification_SiteVerificationWebResourceGettokenResponse
|
||||
*/
|
||||
public function getToken(Google_Service_SiteVerification_SiteVerificationWebResourceGettokenRequest $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('getToken', array($params), "Google_Service_SiteVerification_SiteVerificationWebResourceGettokenResponse");
|
||||
}
|
||||
/**
|
||||
* Attempt verification of a website or domain. (webResource.insert)
|
||||
*
|
||||
* @param string $verificationMethod
|
||||
* The method to use for verifying a site or domain.
|
||||
* @param Google_SiteVerificationWebResourceResource $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_SiteVerification_SiteVerificationWebResourceResource
|
||||
*/
|
||||
public function insert($verificationMethod, Google_Service_SiteVerification_SiteVerificationWebResourceResource $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('verificationMethod' => $verificationMethod, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params), "Google_Service_SiteVerification_SiteVerificationWebResourceResource");
|
||||
}
|
||||
/**
|
||||
* Get the list of your verified websites and domains.
|
||||
* (webResource.listWebResource)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_SiteVerification_SiteVerificationWebResourceListResponse
|
||||
*/
|
||||
public function listWebResource($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_SiteVerification_SiteVerificationWebResourceListResponse");
|
||||
}
|
||||
/**
|
||||
* Modify the list of owners for your website or domain. This method supports
|
||||
* patch semantics. (webResource.patch)
|
||||
*
|
||||
* @param string $id
|
||||
* The id of a verified site or domain.
|
||||
* @param Google_SiteVerificationWebResourceResource $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_SiteVerification_SiteVerificationWebResourceResource
|
||||
*/
|
||||
public function patch($id, Google_Service_SiteVerification_SiteVerificationWebResourceResource $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('id' => $id, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('patch', array($params), "Google_Service_SiteVerification_SiteVerificationWebResourceResource");
|
||||
}
|
||||
/**
|
||||
* Modify the list of owners for your website or domain. (webResource.update)
|
||||
*
|
||||
* @param string $id
|
||||
* The id of a verified site or domain.
|
||||
* @param Google_SiteVerificationWebResourceResource $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_SiteVerification_SiteVerificationWebResourceResource
|
||||
*/
|
||||
public function update($id, Google_Service_SiteVerification_SiteVerificationWebResourceResource $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('id' => $id, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('update', array($params), "Google_Service_SiteVerification_SiteVerificationWebResourceResource");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_SiteVerification_SiteVerificationWebResourceGettokenRequest extends Google_Model
|
||||
{
|
||||
protected $siteType = 'Google_Service_SiteVerification_SiteVerificationWebResourceGettokenRequestSite';
|
||||
protected $siteDataType = '';
|
||||
public $verificationMethod;
|
||||
|
||||
public function setSite(Google_Service_SiteVerification_SiteVerificationWebResourceGettokenRequestSite $site)
|
||||
{
|
||||
$this->site = $site;
|
||||
}
|
||||
|
||||
public function getSite()
|
||||
{
|
||||
return $this->site;
|
||||
}
|
||||
|
||||
public function setVerificationMethod($verificationMethod)
|
||||
{
|
||||
$this->verificationMethod = $verificationMethod;
|
||||
}
|
||||
|
||||
public function getVerificationMethod()
|
||||
{
|
||||
return $this->verificationMethod;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_SiteVerification_SiteVerificationWebResourceGettokenRequestSite extends Google_Model
|
||||
{
|
||||
public $identifier;
|
||||
public $type;
|
||||
|
||||
public function setIdentifier($identifier)
|
||||
{
|
||||
$this->identifier = $identifier;
|
||||
}
|
||||
|
||||
public function getIdentifier()
|
||||
{
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_SiteVerification_SiteVerificationWebResourceGettokenResponse extends Google_Model
|
||||
{
|
||||
public $method;
|
||||
public $token;
|
||||
|
||||
public function setMethod($method)
|
||||
{
|
||||
$this->method = $method;
|
||||
}
|
||||
|
||||
public function getMethod()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
public function setToken($token)
|
||||
{
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
public function getToken()
|
||||
{
|
||||
return $this->token;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_SiteVerification_SiteVerificationWebResourceListResponse extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_SiteVerification_SiteVerificationWebResourceResource';
|
||||
protected $itemsDataType = 'array';
|
||||
|
||||
public function setItems($items)
|
||||
{
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
public function getItems()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_SiteVerification_SiteVerificationWebResourceResource extends Google_Collection
|
||||
{
|
||||
public $id;
|
||||
public $owners;
|
||||
protected $siteType = 'Google_Service_SiteVerification_SiteVerificationWebResourceResourceSite';
|
||||
protected $siteDataType = '';
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setOwners($owners)
|
||||
{
|
||||
$this->owners = $owners;
|
||||
}
|
||||
|
||||
public function getOwners()
|
||||
{
|
||||
return $this->owners;
|
||||
}
|
||||
|
||||
public function setSite(Google_Service_SiteVerification_SiteVerificationWebResourceResourceSite $site)
|
||||
{
|
||||
$this->site = $site;
|
||||
}
|
||||
|
||||
public function getSite()
|
||||
{
|
||||
return $this->site;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_SiteVerification_SiteVerificationWebResourceResourceSite extends Google_Model
|
||||
{
|
||||
public $identifier;
|
||||
public $type;
|
||||
|
||||
public function setIdentifier($identifier)
|
||||
{
|
||||
$this->identifier = $identifier;
|
||||
}
|
||||
|
||||
public function getIdentifier()
|
||||
{
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
1873
htdocs/lib/Google/Service/Spectrum.php
Normal file
1873
htdocs/lib/Google/Service/Spectrum.php
Normal file
File diff suppressed because it is too large
Load Diff
3111
htdocs/lib/Google/Service/Storage.php
Normal file
3111
htdocs/lib/Google/Service/Storage.php
Normal file
File diff suppressed because it is too large
Load Diff
727
htdocs/lib/Google/Service/Taskqueue.php
Normal file
727
htdocs/lib/Google/Service/Taskqueue.php
Normal file
@@ -0,0 +1,727 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Taskqueue (v1beta2).
|
||||
*
|
||||
* <p>
|
||||
* Lets you access a Google App Engine Pull Task Queue over REST.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/appengine/docs/python/taskqueue/rest" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Taskqueue extends Google_Service
|
||||
{
|
||||
/** Manage your Tasks and Taskqueues. */
|
||||
const TASKQUEUE = "https://www.googleapis.com/auth/taskqueue";
|
||||
/** Consume Tasks from your Taskqueues. */
|
||||
const TASKQUEUE_CONSUMER = "https://www.googleapis.com/auth/taskqueue.consumer";
|
||||
|
||||
public $taskqueues;
|
||||
public $tasks;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Taskqueue service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'taskqueue/v1beta2/projects/';
|
||||
$this->version = 'v1beta2';
|
||||
$this->serviceName = 'taskqueue';
|
||||
|
||||
$this->taskqueues = new Google_Service_Taskqueue_Taskqueues_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'taskqueues',
|
||||
array(
|
||||
'methods' => array(
|
||||
'get' => array(
|
||||
'path' => '{project}/taskqueues/{taskqueue}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'project' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'taskqueue' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'getStats' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->tasks = new Google_Service_Taskqueue_Tasks_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'tasks',
|
||||
array(
|
||||
'methods' => array(
|
||||
'delete' => array(
|
||||
'path' => '{project}/taskqueues/{taskqueue}/tasks/{task}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'project' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'taskqueue' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'task' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => '{project}/taskqueues/{taskqueue}/tasks/{task}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'project' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'taskqueue' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'task' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'insert' => array(
|
||||
'path' => '{project}/taskqueues/{taskqueue}/tasks',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'project' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'taskqueue' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'lease' => array(
|
||||
'path' => '{project}/taskqueues/{taskqueue}/tasks/lease',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'project' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'taskqueue' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'numTasks' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'leaseSecs' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'groupByTag' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'tag' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => '{project}/taskqueues/{taskqueue}/tasks',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'project' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'taskqueue' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'patch' => array(
|
||||
'path' => '{project}/taskqueues/{taskqueue}/tasks/{task}',
|
||||
'httpMethod' => 'PATCH',
|
||||
'parameters' => array(
|
||||
'project' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'taskqueue' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'task' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'newLeaseSeconds' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => '{project}/taskqueues/{taskqueue}/tasks/{task}',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'project' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'taskqueue' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'task' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'newLeaseSeconds' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "taskqueues" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $taskqueueService = new Google_Service_Taskqueue(...);
|
||||
* $taskqueues = $taskqueueService->taskqueues;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Taskqueue_Taskqueues_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Get detailed information about a TaskQueue. (taskqueues.get)
|
||||
*
|
||||
* @param string $project
|
||||
* The project under which the queue lies.
|
||||
* @param string $taskqueue
|
||||
* The id of the taskqueue to get the properties of.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param bool getStats
|
||||
* Whether to get stats. Optional.
|
||||
* @return Google_Service_Taskqueue_TaskQueue
|
||||
*/
|
||||
public function get($project, $taskqueue, $optParams = array())
|
||||
{
|
||||
$params = array('project' => $project, 'taskqueue' => $taskqueue);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Taskqueue_TaskQueue");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "tasks" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $taskqueueService = new Google_Service_Taskqueue(...);
|
||||
* $tasks = $taskqueueService->tasks;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Taskqueue_Tasks_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Delete a task from a TaskQueue. (tasks.delete)
|
||||
*
|
||||
* @param string $project
|
||||
* The project under which the queue lies.
|
||||
* @param string $taskqueue
|
||||
* The taskqueue to delete a task from.
|
||||
* @param string $task
|
||||
* The id of the task to delete.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function delete($project, $taskqueue, $task, $optParams = array())
|
||||
{
|
||||
$params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('delete', array($params));
|
||||
}
|
||||
/**
|
||||
* Get a particular task from a TaskQueue. (tasks.get)
|
||||
*
|
||||
* @param string $project
|
||||
* The project under which the queue lies.
|
||||
* @param string $taskqueue
|
||||
* The taskqueue in which the task belongs.
|
||||
* @param string $task
|
||||
* The task to get properties of.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Taskqueue_Task
|
||||
*/
|
||||
public function get($project, $taskqueue, $task, $optParams = array())
|
||||
{
|
||||
$params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Taskqueue_Task");
|
||||
}
|
||||
/**
|
||||
* Insert a new task in a TaskQueue (tasks.insert)
|
||||
*
|
||||
* @param string $project
|
||||
* The project under which the queue lies
|
||||
* @param string $taskqueue
|
||||
* The taskqueue to insert the task into
|
||||
* @param Google_Task $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Taskqueue_Task
|
||||
*/
|
||||
public function insert($project, $taskqueue, Google_Service_Taskqueue_Task $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('project' => $project, 'taskqueue' => $taskqueue, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params), "Google_Service_Taskqueue_Task");
|
||||
}
|
||||
/**
|
||||
* Lease 1 or more tasks from a TaskQueue. (tasks.lease)
|
||||
*
|
||||
* @param string $project
|
||||
* The project under which the queue lies.
|
||||
* @param string $taskqueue
|
||||
* The taskqueue to lease a task from.
|
||||
* @param int $numTasks
|
||||
* The number of tasks to lease.
|
||||
* @param int $leaseSecs
|
||||
* The lease in seconds.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param bool groupByTag
|
||||
* When true, all returned tasks will have the same tag
|
||||
* @opt_param string tag
|
||||
* The tag allowed for tasks in the response. Must only be specified if group_by_tag is true. If
|
||||
* group_by_tag is true and tag is not specified the tag will be that of the oldest task by eta,
|
||||
* i.e. the first available tag
|
||||
* @return Google_Service_Taskqueue_Tasks
|
||||
*/
|
||||
public function lease($project, $taskqueue, $numTasks, $leaseSecs, $optParams = array())
|
||||
{
|
||||
$params = array('project' => $project, 'taskqueue' => $taskqueue, 'numTasks' => $numTasks, 'leaseSecs' => $leaseSecs);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('lease', array($params), "Google_Service_Taskqueue_Tasks");
|
||||
}
|
||||
/**
|
||||
* List Tasks in a TaskQueue (tasks.listTasks)
|
||||
*
|
||||
* @param string $project
|
||||
* The project under which the queue lies.
|
||||
* @param string $taskqueue
|
||||
* The id of the taskqueue to list tasks from.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Taskqueue_Tasks2
|
||||
*/
|
||||
public function listTasks($project, $taskqueue, $optParams = array())
|
||||
{
|
||||
$params = array('project' => $project, 'taskqueue' => $taskqueue);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Taskqueue_Tasks2");
|
||||
}
|
||||
/**
|
||||
* Update tasks that are leased out of a TaskQueue. This method supports patch
|
||||
* semantics. (tasks.patch)
|
||||
*
|
||||
* @param string $project
|
||||
* The project under which the queue lies.
|
||||
* @param string $taskqueue
|
||||
*
|
||||
* @param string $task
|
||||
*
|
||||
* @param int $newLeaseSeconds
|
||||
* The new lease in seconds.
|
||||
* @param Google_Task $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Taskqueue_Task
|
||||
*/
|
||||
public function patch($project, $taskqueue, $task, $newLeaseSeconds, Google_Service_Taskqueue_Task $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task, 'newLeaseSeconds' => $newLeaseSeconds, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('patch', array($params), "Google_Service_Taskqueue_Task");
|
||||
}
|
||||
/**
|
||||
* Update tasks that are leased out of a TaskQueue. (tasks.update)
|
||||
*
|
||||
* @param string $project
|
||||
* The project under which the queue lies.
|
||||
* @param string $taskqueue
|
||||
*
|
||||
* @param string $task
|
||||
*
|
||||
* @param int $newLeaseSeconds
|
||||
* The new lease in seconds.
|
||||
* @param Google_Task $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Taskqueue_Task
|
||||
*/
|
||||
public function update($project, $taskqueue, $task, $newLeaseSeconds, Google_Service_Taskqueue_Task $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('project' => $project, 'taskqueue' => $taskqueue, 'task' => $task, 'newLeaseSeconds' => $newLeaseSeconds, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('update', array($params), "Google_Service_Taskqueue_Task");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Taskqueue_Task extends Google_Model
|
||||
{
|
||||
public $enqueueTimestamp;
|
||||
public $id;
|
||||
public $kind;
|
||||
public $leaseTimestamp;
|
||||
public $payloadBase64;
|
||||
public $queueName;
|
||||
public $retryCount;
|
||||
public $tag;
|
||||
|
||||
public function setEnqueueTimestamp($enqueueTimestamp)
|
||||
{
|
||||
$this->enqueueTimestamp = $enqueueTimestamp;
|
||||
}
|
||||
|
||||
public function getEnqueueTimestamp()
|
||||
{
|
||||
return $this->enqueueTimestamp;
|
||||
}
|
||||
|
||||
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 setLeaseTimestamp($leaseTimestamp)
|
||||
{
|
||||
$this->leaseTimestamp = $leaseTimestamp;
|
||||
}
|
||||
|
||||
public function getLeaseTimestamp()
|
||||
{
|
||||
return $this->leaseTimestamp;
|
||||
}
|
||||
|
||||
public function setPayloadBase64($payloadBase64)
|
||||
{
|
||||
$this->payloadBase64 = $payloadBase64;
|
||||
}
|
||||
|
||||
public function getPayloadBase64()
|
||||
{
|
||||
return $this->payloadBase64;
|
||||
}
|
||||
|
||||
public function setQueueName($queueName)
|
||||
{
|
||||
$this->queueName = $queueName;
|
||||
}
|
||||
|
||||
public function getQueueName()
|
||||
{
|
||||
return $this->queueName;
|
||||
}
|
||||
|
||||
public function setRetryCount($retryCount)
|
||||
{
|
||||
$this->retryCount = $retryCount;
|
||||
}
|
||||
|
||||
public function getRetryCount()
|
||||
{
|
||||
return $this->retryCount;
|
||||
}
|
||||
|
||||
public function setTag($tag)
|
||||
{
|
||||
$this->tag = $tag;
|
||||
}
|
||||
|
||||
public function getTag()
|
||||
{
|
||||
return $this->tag;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Taskqueue_TaskQueue extends Google_Model
|
||||
{
|
||||
protected $aclType = 'Google_Service_Taskqueue_TaskQueueAcl';
|
||||
protected $aclDataType = '';
|
||||
public $id;
|
||||
public $kind;
|
||||
public $maxLeases;
|
||||
protected $statsType = 'Google_Service_Taskqueue_TaskQueueStats';
|
||||
protected $statsDataType = '';
|
||||
|
||||
public function setAcl(Google_Service_Taskqueue_TaskQueueAcl $acl)
|
||||
{
|
||||
$this->acl = $acl;
|
||||
}
|
||||
|
||||
public function getAcl()
|
||||
{
|
||||
return $this->acl;
|
||||
}
|
||||
|
||||
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 setMaxLeases($maxLeases)
|
||||
{
|
||||
$this->maxLeases = $maxLeases;
|
||||
}
|
||||
|
||||
public function getMaxLeases()
|
||||
{
|
||||
return $this->maxLeases;
|
||||
}
|
||||
|
||||
public function setStats(Google_Service_Taskqueue_TaskQueueStats $stats)
|
||||
{
|
||||
$this->stats = $stats;
|
||||
}
|
||||
|
||||
public function getStats()
|
||||
{
|
||||
return $this->stats;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Taskqueue_TaskQueueAcl extends Google_Collection
|
||||
{
|
||||
public $adminEmails;
|
||||
public $consumerEmails;
|
||||
public $producerEmails;
|
||||
|
||||
public function setAdminEmails($adminEmails)
|
||||
{
|
||||
$this->adminEmails = $adminEmails;
|
||||
}
|
||||
|
||||
public function getAdminEmails()
|
||||
{
|
||||
return $this->adminEmails;
|
||||
}
|
||||
|
||||
public function setConsumerEmails($consumerEmails)
|
||||
{
|
||||
$this->consumerEmails = $consumerEmails;
|
||||
}
|
||||
|
||||
public function getConsumerEmails()
|
||||
{
|
||||
return $this->consumerEmails;
|
||||
}
|
||||
|
||||
public function setProducerEmails($producerEmails)
|
||||
{
|
||||
$this->producerEmails = $producerEmails;
|
||||
}
|
||||
|
||||
public function getProducerEmails()
|
||||
{
|
||||
return $this->producerEmails;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Taskqueue_TaskQueueStats extends Google_Model
|
||||
{
|
||||
public $leasedLastHour;
|
||||
public $leasedLastMinute;
|
||||
public $oldestTask;
|
||||
public $totalTasks;
|
||||
|
||||
public function setLeasedLastHour($leasedLastHour)
|
||||
{
|
||||
$this->leasedLastHour = $leasedLastHour;
|
||||
}
|
||||
|
||||
public function getLeasedLastHour()
|
||||
{
|
||||
return $this->leasedLastHour;
|
||||
}
|
||||
|
||||
public function setLeasedLastMinute($leasedLastMinute)
|
||||
{
|
||||
$this->leasedLastMinute = $leasedLastMinute;
|
||||
}
|
||||
|
||||
public function getLeasedLastMinute()
|
||||
{
|
||||
return $this->leasedLastMinute;
|
||||
}
|
||||
|
||||
public function setOldestTask($oldestTask)
|
||||
{
|
||||
$this->oldestTask = $oldestTask;
|
||||
}
|
||||
|
||||
public function getOldestTask()
|
||||
{
|
||||
return $this->oldestTask;
|
||||
}
|
||||
|
||||
public function setTotalTasks($totalTasks)
|
||||
{
|
||||
$this->totalTasks = $totalTasks;
|
||||
}
|
||||
|
||||
public function getTotalTasks()
|
||||
{
|
||||
return $this->totalTasks;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Taskqueue_Tasks extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_Taskqueue_Task';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Taskqueue_Tasks2 extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_Taskqueue_Task';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
958
htdocs/lib/Google/Service/Tasks.php
Normal file
958
htdocs/lib/Google/Service/Tasks.php
Normal file
@@ -0,0 +1,958 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Tasks (v1).
|
||||
*
|
||||
* <p>
|
||||
* Lets you manage your tasks and task lists.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/google-apps/tasks/firstapp" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Tasks extends Google_Service
|
||||
{
|
||||
/** Manage your tasks. */
|
||||
const TASKS = "https://www.googleapis.com/auth/tasks";
|
||||
/** View your tasks. */
|
||||
const TASKS_READONLY = "https://www.googleapis.com/auth/tasks.readonly";
|
||||
|
||||
public $tasklists;
|
||||
public $tasks;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Tasks service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'tasks/v1/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'tasks';
|
||||
|
||||
$this->tasklists = new Google_Service_Tasks_Tasklists_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'tasklists',
|
||||
array(
|
||||
'methods' => array(
|
||||
'delete' => array(
|
||||
'path' => 'users/@me/lists/{tasklist}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'users/@me/lists/{tasklist}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'insert' => array(
|
||||
'path' => 'users/@me/lists',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(),
|
||||
),'list' => array(
|
||||
'path' => 'users/@me/lists',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'patch' => array(
|
||||
'path' => 'users/@me/lists/{tasklist}',
|
||||
'httpMethod' => 'PATCH',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => 'users/@me/lists/{tasklist}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->tasks = new Google_Service_Tasks_Tasks_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'tasks',
|
||||
array(
|
||||
'methods' => array(
|
||||
'clear' => array(
|
||||
'path' => 'lists/{tasklist}/clear',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
'path' => 'lists/{tasklist}/tasks/{task}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'task' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'lists/{tasklist}/tasks/{task}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'task' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'insert' => array(
|
||||
'path' => 'lists/{tasklist}/tasks',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'parent' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'previous' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'lists/{tasklist}/tasks',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'dueMax' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'showDeleted' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'updatedMin' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'completedMin' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'showCompleted' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'completedMax' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'showHidden' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'dueMin' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'move' => array(
|
||||
'path' => 'lists/{tasklist}/tasks/{task}/move',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'task' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'parent' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'previous' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'patch' => array(
|
||||
'path' => 'lists/{tasklist}/tasks/{task}',
|
||||
'httpMethod' => 'PATCH',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'task' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => 'lists/{tasklist}/tasks/{task}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'tasklist' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'task' => array(
|
||||
'location' => 'path',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "tasklists" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $tasksService = new Google_Service_Tasks(...);
|
||||
* $tasklists = $tasksService->tasklists;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Tasks_Tasklists_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Deletes the authenticated user's specified task list. (tasklists.delete)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function delete($tasklist, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('delete', array($params));
|
||||
}
|
||||
/**
|
||||
* Returns the authenticated user's specified task list. (tasklists.get)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Tasks_TaskList
|
||||
*/
|
||||
public function get($tasklist, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Tasks_TaskList");
|
||||
}
|
||||
/**
|
||||
* Creates a new task list and adds it to the authenticated user's task lists.
|
||||
* (tasklists.insert)
|
||||
*
|
||||
* @param Google_TaskList $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Tasks_TaskList
|
||||
*/
|
||||
public function insert(Google_Service_Tasks_TaskList $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params), "Google_Service_Tasks_TaskList");
|
||||
}
|
||||
/**
|
||||
* Returns all the authenticated user's task lists. (tasklists.listTasklists)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string pageToken
|
||||
* Token specifying the result page to return. Optional.
|
||||
* @opt_param string maxResults
|
||||
* Maximum number of task lists returned on one page. Optional. The default is 100.
|
||||
* @return Google_Service_Tasks_TaskLists
|
||||
*/
|
||||
public function listTasklists($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Tasks_TaskLists");
|
||||
}
|
||||
/**
|
||||
* Updates the authenticated user's specified task list. This method supports
|
||||
* patch semantics. (tasklists.patch)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param Google_TaskList $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Tasks_TaskList
|
||||
*/
|
||||
public function patch($tasklist, Google_Service_Tasks_TaskList $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('patch', array($params), "Google_Service_Tasks_TaskList");
|
||||
}
|
||||
/**
|
||||
* Updates the authenticated user's specified task list. (tasklists.update)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param Google_TaskList $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Tasks_TaskList
|
||||
*/
|
||||
public function update($tasklist, Google_Service_Tasks_TaskList $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('update', array($params), "Google_Service_Tasks_TaskList");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "tasks" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $tasksService = new Google_Service_Tasks(...);
|
||||
* $tasks = $tasksService->tasks;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Tasks_Tasks_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Clears all completed tasks from the specified task list. The affected tasks
|
||||
* will be marked as 'hidden' and no longer be returned by default when
|
||||
* retrieving all tasks for a task list. (tasks.clear)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function clear($tasklist, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('clear', array($params));
|
||||
}
|
||||
/**
|
||||
* Deletes the specified task from the task list. (tasks.delete)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param string $task
|
||||
* Task identifier.
|
||||
* @param array $optParams Optional parameters.
|
||||
*/
|
||||
public function delete($tasklist, $task, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist, 'task' => $task);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('delete', array($params));
|
||||
}
|
||||
/**
|
||||
* Returns the specified task. (tasks.get)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param string $task
|
||||
* Task identifier.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Tasks_Task
|
||||
*/
|
||||
public function get($tasklist, $task, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist, 'task' => $task);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Tasks_Task");
|
||||
}
|
||||
/**
|
||||
* Creates a new task on the specified task list. (tasks.insert)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param Google_Task $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string parent
|
||||
* Parent task identifier. If the task is created at the top level, this parameter is omitted.
|
||||
* Optional.
|
||||
* @opt_param string previous
|
||||
* Previous sibling task identifier. If the task is created at the first position among its
|
||||
* siblings, this parameter is omitted. Optional.
|
||||
* @return Google_Service_Tasks_Task
|
||||
*/
|
||||
public function insert($tasklist, Google_Service_Tasks_Task $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params), "Google_Service_Tasks_Task");
|
||||
}
|
||||
/**
|
||||
* Returns all tasks in the specified task list. (tasks.listTasks)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string dueMax
|
||||
* Upper bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default
|
||||
* is not to filter by due date.
|
||||
* @opt_param bool showDeleted
|
||||
* Flag indicating whether deleted tasks are returned in the result. Optional. The default is
|
||||
* False.
|
||||
* @opt_param string updatedMin
|
||||
* Lower bound for a task's last modification time (as a RFC 3339 timestamp) to filter by.
|
||||
* Optional. The default is not to filter by last modification time.
|
||||
* @opt_param string completedMin
|
||||
* Lower bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The
|
||||
* default is not to filter by completion date.
|
||||
* @opt_param string maxResults
|
||||
* Maximum number of task lists returned on one page. Optional. The default is 100.
|
||||
* @opt_param bool showCompleted
|
||||
* Flag indicating whether completed tasks are returned in the result. Optional. The default is
|
||||
* True.
|
||||
* @opt_param string pageToken
|
||||
* Token specifying the result page to return. Optional.
|
||||
* @opt_param string completedMax
|
||||
* Upper bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The
|
||||
* default is not to filter by completion date.
|
||||
* @opt_param bool showHidden
|
||||
* Flag indicating whether hidden tasks are returned in the result. Optional. The default is False.
|
||||
* @opt_param string dueMin
|
||||
* Lower bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default
|
||||
* is not to filter by due date.
|
||||
* @return Google_Service_Tasks_Tasks
|
||||
*/
|
||||
public function listTasks($tasklist, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Tasks_Tasks");
|
||||
}
|
||||
/**
|
||||
* Moves the specified task to another position in the task list. This can
|
||||
* include putting it as a child task under a new parent and/or move it to a
|
||||
* different position among its sibling tasks. (tasks.move)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param string $task
|
||||
* Task identifier.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string parent
|
||||
* New parent task identifier. If the task is moved to the top level, this parameter is omitted.
|
||||
* Optional.
|
||||
* @opt_param string previous
|
||||
* New previous sibling task identifier. If the task is moved to the first position among its
|
||||
* siblings, this parameter is omitted. Optional.
|
||||
* @return Google_Service_Tasks_Task
|
||||
*/
|
||||
public function move($tasklist, $task, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist, 'task' => $task);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('move', array($params), "Google_Service_Tasks_Task");
|
||||
}
|
||||
/**
|
||||
* Updates the specified task. This method supports patch semantics.
|
||||
* (tasks.patch)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param string $task
|
||||
* Task identifier.
|
||||
* @param Google_Task $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Tasks_Task
|
||||
*/
|
||||
public function patch($tasklist, $task, Google_Service_Tasks_Task $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('patch', array($params), "Google_Service_Tasks_Task");
|
||||
}
|
||||
/**
|
||||
* Updates the specified task. (tasks.update)
|
||||
*
|
||||
* @param string $tasklist
|
||||
* Task list identifier.
|
||||
* @param string $task
|
||||
* Task identifier.
|
||||
* @param Google_Task $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Tasks_Task
|
||||
*/
|
||||
public function update($tasklist, $task, Google_Service_Tasks_Task $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('tasklist' => $tasklist, 'task' => $task, 'postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('update', array($params), "Google_Service_Tasks_Task");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Tasks_Task extends Google_Collection
|
||||
{
|
||||
public $completed;
|
||||
public $deleted;
|
||||
public $due;
|
||||
public $etag;
|
||||
public $hidden;
|
||||
public $id;
|
||||
public $kind;
|
||||
protected $linksType = 'Google_Service_Tasks_TaskLinks';
|
||||
protected $linksDataType = 'array';
|
||||
public $notes;
|
||||
public $parent;
|
||||
public $position;
|
||||
public $selfLink;
|
||||
public $status;
|
||||
public $title;
|
||||
public $updated;
|
||||
|
||||
public function setCompleted($completed)
|
||||
{
|
||||
$this->completed = $completed;
|
||||
}
|
||||
|
||||
public function getCompleted()
|
||||
{
|
||||
return $this->completed;
|
||||
}
|
||||
|
||||
public function setDeleted($deleted)
|
||||
{
|
||||
$this->deleted = $deleted;
|
||||
}
|
||||
|
||||
public function getDeleted()
|
||||
{
|
||||
return $this->deleted;
|
||||
}
|
||||
|
||||
public function setDue($due)
|
||||
{
|
||||
$this->due = $due;
|
||||
}
|
||||
|
||||
public function getDue()
|
||||
{
|
||||
return $this->due;
|
||||
}
|
||||
|
||||
public function setEtag($etag)
|
||||
{
|
||||
$this->etag = $etag;
|
||||
}
|
||||
|
||||
public function getEtag()
|
||||
{
|
||||
return $this->etag;
|
||||
}
|
||||
|
||||
public function setHidden($hidden)
|
||||
{
|
||||
$this->hidden = $hidden;
|
||||
}
|
||||
|
||||
public function getHidden()
|
||||
{
|
||||
return $this->hidden;
|
||||
}
|
||||
|
||||
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 setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
}
|
||||
|
||||
public function getLinks()
|
||||
{
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
public function setNotes($notes)
|
||||
{
|
||||
$this->notes = $notes;
|
||||
}
|
||||
|
||||
public function getNotes()
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
public function setParent($parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
public function setPosition($position)
|
||||
{
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
public function getPosition()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setUpdated($updated)
|
||||
{
|
||||
$this->updated = $updated;
|
||||
}
|
||||
|
||||
public function getUpdated()
|
||||
{
|
||||
return $this->updated;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Tasks_TaskLinks extends Google_Model
|
||||
{
|
||||
public $description;
|
||||
public $link;
|
||||
public $type;
|
||||
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setLink($link)
|
||||
{
|
||||
$this->link = $link;
|
||||
}
|
||||
|
||||
public function getLink()
|
||||
{
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Tasks_TaskList extends Google_Model
|
||||
{
|
||||
public $etag;
|
||||
public $id;
|
||||
public $kind;
|
||||
public $selfLink;
|
||||
public $title;
|
||||
public $updated;
|
||||
|
||||
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 setSelfLink($selfLink)
|
||||
{
|
||||
$this->selfLink = $selfLink;
|
||||
}
|
||||
|
||||
public function getSelfLink()
|
||||
{
|
||||
return $this->selfLink;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setUpdated($updated)
|
||||
{
|
||||
$this->updated = $updated;
|
||||
}
|
||||
|
||||
public function getUpdated()
|
||||
{
|
||||
return $this->updated;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Tasks_TaskLists extends Google_Collection
|
||||
{
|
||||
public $etag;
|
||||
protected $itemsType = 'Google_Service_Tasks_TaskList';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
public $nextPageToken;
|
||||
|
||||
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 setNextPageToken($nextPageToken)
|
||||
{
|
||||
$this->nextPageToken = $nextPageToken;
|
||||
}
|
||||
|
||||
public function getNextPageToken()
|
||||
{
|
||||
return $this->nextPageToken;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Tasks_Tasks extends Google_Collection
|
||||
{
|
||||
public $etag;
|
||||
protected $itemsType = 'Google_Service_Tasks_Task';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
public $nextPageToken;
|
||||
|
||||
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 setNextPageToken($nextPageToken)
|
||||
{
|
||||
$this->nextPageToken = $nextPageToken;
|
||||
}
|
||||
|
||||
public function getNextPageToken()
|
||||
{
|
||||
return $this->nextPageToken;
|
||||
}
|
||||
}
|
||||
367
htdocs/lib/Google/Service/Translate.php
Normal file
367
htdocs/lib/Google/Service/Translate.php
Normal file
@@ -0,0 +1,367 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Translate (v2).
|
||||
*
|
||||
* <p>
|
||||
* Lets you translate text from one language to another
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/translate/v2/using_rest" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Translate extends Google_Service
|
||||
{
|
||||
|
||||
|
||||
public $detections;
|
||||
public $languages;
|
||||
public $translations;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Translate service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'language/translate/';
|
||||
$this->version = 'v2';
|
||||
$this->serviceName = 'translate';
|
||||
|
||||
$this->detections = new Google_Service_Translate_Detections_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'detections',
|
||||
array(
|
||||
'methods' => array(
|
||||
'list' => array(
|
||||
'path' => 'v2/detect',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'q' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->languages = new Google_Service_Translate_Languages_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'languages',
|
||||
array(
|
||||
'methods' => array(
|
||||
'list' => array(
|
||||
'path' => 'v2/languages',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'target' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->translations = new Google_Service_Translate_Translations_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'translations',
|
||||
array(
|
||||
'methods' => array(
|
||||
'list' => array(
|
||||
'path' => 'v2',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'q' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
'required' => true,
|
||||
),
|
||||
'target' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'source' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'format' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'cid' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "detections" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $translateService = new Google_Service_Translate(...);
|
||||
* $detections = $translateService->detections;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Translate_Detections_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Detect the language of text. (detections.listDetections)
|
||||
*
|
||||
* @param string $q
|
||||
* The text to detect
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Translate_DetectionsListResponse
|
||||
*/
|
||||
public function listDetections($q, $optParams = array())
|
||||
{
|
||||
$params = array('q' => $q);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Translate_DetectionsListResponse");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "languages" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $translateService = new Google_Service_Translate(...);
|
||||
* $languages = $translateService->languages;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Translate_Languages_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* List the source/target languages supported by the API
|
||||
* (languages.listLanguages)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string target
|
||||
* the language and collation in which the localized results should be returned
|
||||
* @return Google_Service_Translate_LanguagesListResponse
|
||||
*/
|
||||
public function listLanguages($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Translate_LanguagesListResponse");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "translations" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $translateService = new Google_Service_Translate(...);
|
||||
* $translations = $translateService->translations;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Translate_Translations_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns text translations from one language to another.
|
||||
* (translations.listTranslations)
|
||||
*
|
||||
* @param string $q
|
||||
* The text to translate
|
||||
* @param string $target
|
||||
* The target language into which the text should be translated
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string source
|
||||
* The source language of the text
|
||||
* @opt_param string format
|
||||
* The format of the text
|
||||
* @opt_param string cid
|
||||
* The customization id for translate
|
||||
* @return Google_Service_Translate_TranslationsListResponse
|
||||
*/
|
||||
public function listTranslations($q, $target, $optParams = array())
|
||||
{
|
||||
$params = array('q' => $q, 'target' => $target);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Translate_TranslationsListResponse");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Translate_DetectionsListResponse extends Google_Collection
|
||||
{
|
||||
protected $detectionsType = 'Google_Service_Translate_DetectionsResourceItems';
|
||||
protected $detectionsDataType = 'array';
|
||||
|
||||
public function setDetections($detections)
|
||||
{
|
||||
$this->detections = $detections;
|
||||
}
|
||||
|
||||
public function getDetections()
|
||||
{
|
||||
return $this->detections;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Translate_DetectionsResourceItems extends Google_Model
|
||||
{
|
||||
public $confidence;
|
||||
public $isReliable;
|
||||
public $language;
|
||||
|
||||
public function setConfidence($confidence)
|
||||
{
|
||||
$this->confidence = $confidence;
|
||||
}
|
||||
|
||||
public function getConfidence()
|
||||
{
|
||||
return $this->confidence;
|
||||
}
|
||||
|
||||
public function setIsReliable($isReliable)
|
||||
{
|
||||
$this->isReliable = $isReliable;
|
||||
}
|
||||
|
||||
public function getIsReliable()
|
||||
{
|
||||
return $this->isReliable;
|
||||
}
|
||||
|
||||
public function setLanguage($language)
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
public function getLanguage()
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Translate_LanguagesListResponse extends Google_Collection
|
||||
{
|
||||
protected $languagesType = 'Google_Service_Translate_LanguagesResource';
|
||||
protected $languagesDataType = 'array';
|
||||
|
||||
public function setLanguages($languages)
|
||||
{
|
||||
$this->languages = $languages;
|
||||
}
|
||||
|
||||
public function getLanguages()
|
||||
{
|
||||
return $this->languages;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Translate_LanguagesResource extends Google_Model
|
||||
{
|
||||
public $language;
|
||||
public $name;
|
||||
|
||||
public function setLanguage($language)
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
public function getLanguage()
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Translate_TranslationsListResponse extends Google_Collection
|
||||
{
|
||||
protected $translationsType = 'Google_Service_Translate_TranslationsResource';
|
||||
protected $translationsDataType = 'array';
|
||||
|
||||
public function setTranslations($translations)
|
||||
{
|
||||
$this->translations = $translations;
|
||||
}
|
||||
|
||||
public function getTranslations()
|
||||
{
|
||||
return $this->translations;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Translate_TranslationsResource extends Google_Model
|
||||
{
|
||||
public $detectedSourceLanguage;
|
||||
public $translatedText;
|
||||
|
||||
public function setDetectedSourceLanguage($detectedSourceLanguage)
|
||||
{
|
||||
$this->detectedSourceLanguage = $detectedSourceLanguage;
|
||||
}
|
||||
|
||||
public function getDetectedSourceLanguage()
|
||||
{
|
||||
return $this->detectedSourceLanguage;
|
||||
}
|
||||
|
||||
public function setTranslatedText($translatedText)
|
||||
{
|
||||
$this->translatedText = $translatedText;
|
||||
}
|
||||
|
||||
public function getTranslatedText()
|
||||
{
|
||||
return $this->translatedText;
|
||||
}
|
||||
}
|
||||
453
htdocs/lib/Google/Service/Urlshortener.php
Normal file
453
htdocs/lib/Google/Service/Urlshortener.php
Normal file
@@ -0,0 +1,453 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Urlshortener (v1).
|
||||
*
|
||||
* <p>
|
||||
* Lets you create, inspect, and manage goo.gl short URLs
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="http://code.google.com/apis/urlshortener/v1/getting_started.html" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Urlshortener extends Google_Service
|
||||
{
|
||||
/** Manage your goo.gl short URLs. */
|
||||
const URLSHORTENER = "https://www.googleapis.com/auth/urlshortener";
|
||||
|
||||
public $url;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Urlshortener service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'urlshortener/v1/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'urlshortener';
|
||||
|
||||
$this->url = new Google_Service_Urlshortener_Url_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'url',
|
||||
array(
|
||||
'methods' => array(
|
||||
'get' => array(
|
||||
'path' => 'url',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'shortUrl' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'projection' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'insert' => array(
|
||||
'path' => 'url',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(),
|
||||
),'list' => array(
|
||||
'path' => 'url/history',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'start-token' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'projection' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "url" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $urlshortenerService = new Google_Service_Urlshortener(...);
|
||||
* $url = $urlshortenerService->url;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Urlshortener_Url_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Expands a short URL or gets creation time and analytics. (url.get)
|
||||
*
|
||||
* @param string $shortUrl
|
||||
* The short URL, including the protocol.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string projection
|
||||
* Additional information to return.
|
||||
* @return Google_Service_Urlshortener_Url
|
||||
*/
|
||||
public function get($shortUrl, $optParams = array())
|
||||
{
|
||||
$params = array('shortUrl' => $shortUrl);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('get', array($params), "Google_Service_Urlshortener_Url");
|
||||
}
|
||||
/**
|
||||
* Creates a new short URL. (url.insert)
|
||||
*
|
||||
* @param Google_Url $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Urlshortener_Url
|
||||
*/
|
||||
public function insert(Google_Service_Urlshortener_Url $postBody, $optParams = array())
|
||||
{
|
||||
$params = array('postBody' => $postBody);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('insert', array($params), "Google_Service_Urlshortener_Url");
|
||||
}
|
||||
/**
|
||||
* Retrieves a list of URLs shortened by a user. (url.listUrl)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string startToken
|
||||
* Token for requesting successive pages of results.
|
||||
* @opt_param string projection
|
||||
* Additional information to return.
|
||||
* @return Google_Service_Urlshortener_UrlHistory
|
||||
*/
|
||||
public function listUrl($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Urlshortener_UrlHistory");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Urlshortener_AnalyticsSnapshot extends Google_Collection
|
||||
{
|
||||
protected $browsersType = 'Google_Service_Urlshortener_StringCount';
|
||||
protected $browsersDataType = 'array';
|
||||
protected $countriesType = 'Google_Service_Urlshortener_StringCount';
|
||||
protected $countriesDataType = 'array';
|
||||
public $longUrlClicks;
|
||||
protected $platformsType = 'Google_Service_Urlshortener_StringCount';
|
||||
protected $platformsDataType = 'array';
|
||||
protected $referrersType = 'Google_Service_Urlshortener_StringCount';
|
||||
protected $referrersDataType = 'array';
|
||||
public $shortUrlClicks;
|
||||
|
||||
public function setBrowsers($browsers)
|
||||
{
|
||||
$this->browsers = $browsers;
|
||||
}
|
||||
|
||||
public function getBrowsers()
|
||||
{
|
||||
return $this->browsers;
|
||||
}
|
||||
|
||||
public function setCountries($countries)
|
||||
{
|
||||
$this->countries = $countries;
|
||||
}
|
||||
|
||||
public function getCountries()
|
||||
{
|
||||
return $this->countries;
|
||||
}
|
||||
|
||||
public function setLongUrlClicks($longUrlClicks)
|
||||
{
|
||||
$this->longUrlClicks = $longUrlClicks;
|
||||
}
|
||||
|
||||
public function getLongUrlClicks()
|
||||
{
|
||||
return $this->longUrlClicks;
|
||||
}
|
||||
|
||||
public function setPlatforms($platforms)
|
||||
{
|
||||
$this->platforms = $platforms;
|
||||
}
|
||||
|
||||
public function getPlatforms()
|
||||
{
|
||||
return $this->platforms;
|
||||
}
|
||||
|
||||
public function setReferrers($referrers)
|
||||
{
|
||||
$this->referrers = $referrers;
|
||||
}
|
||||
|
||||
public function getReferrers()
|
||||
{
|
||||
return $this->referrers;
|
||||
}
|
||||
|
||||
public function setShortUrlClicks($shortUrlClicks)
|
||||
{
|
||||
$this->shortUrlClicks = $shortUrlClicks;
|
||||
}
|
||||
|
||||
public function getShortUrlClicks()
|
||||
{
|
||||
return $this->shortUrlClicks;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Urlshortener_AnalyticsSummary extends Google_Model
|
||||
{
|
||||
protected $allTimeType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
|
||||
protected $allTimeDataType = '';
|
||||
protected $dayType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
|
||||
protected $dayDataType = '';
|
||||
protected $monthType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
|
||||
protected $monthDataType = '';
|
||||
protected $twoHoursType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
|
||||
protected $twoHoursDataType = '';
|
||||
protected $weekType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
|
||||
protected $weekDataType = '';
|
||||
|
||||
public function setAllTime(Google_Service_Urlshortener_AnalyticsSnapshot $allTime)
|
||||
{
|
||||
$this->allTime = $allTime;
|
||||
}
|
||||
|
||||
public function getAllTime()
|
||||
{
|
||||
return $this->allTime;
|
||||
}
|
||||
|
||||
public function setDay(Google_Service_Urlshortener_AnalyticsSnapshot $day)
|
||||
{
|
||||
$this->day = $day;
|
||||
}
|
||||
|
||||
public function getDay()
|
||||
{
|
||||
return $this->day;
|
||||
}
|
||||
|
||||
public function setMonth(Google_Service_Urlshortener_AnalyticsSnapshot $month)
|
||||
{
|
||||
$this->month = $month;
|
||||
}
|
||||
|
||||
public function getMonth()
|
||||
{
|
||||
return $this->month;
|
||||
}
|
||||
|
||||
public function setTwoHours(Google_Service_Urlshortener_AnalyticsSnapshot $twoHours)
|
||||
{
|
||||
$this->twoHours = $twoHours;
|
||||
}
|
||||
|
||||
public function getTwoHours()
|
||||
{
|
||||
return $this->twoHours;
|
||||
}
|
||||
|
||||
public function setWeek(Google_Service_Urlshortener_AnalyticsSnapshot $week)
|
||||
{
|
||||
$this->week = $week;
|
||||
}
|
||||
|
||||
public function getWeek()
|
||||
{
|
||||
return $this->week;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Urlshortener_StringCount extends Google_Model
|
||||
{
|
||||
public $count;
|
||||
public $id;
|
||||
|
||||
public function setCount($count)
|
||||
{
|
||||
$this->count = $count;
|
||||
}
|
||||
|
||||
public function getCount()
|
||||
{
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Urlshortener_Url extends Google_Model
|
||||
{
|
||||
protected $analyticsType = 'Google_Service_Urlshortener_AnalyticsSummary';
|
||||
protected $analyticsDataType = '';
|
||||
public $created;
|
||||
public $id;
|
||||
public $kind;
|
||||
public $longUrl;
|
||||
public $status;
|
||||
|
||||
public function setAnalytics(Google_Service_Urlshortener_AnalyticsSummary $analytics)
|
||||
{
|
||||
$this->analytics = $analytics;
|
||||
}
|
||||
|
||||
public function getAnalytics()
|
||||
{
|
||||
return $this->analytics;
|
||||
}
|
||||
|
||||
public function setCreated($created)
|
||||
{
|
||||
$this->created = $created;
|
||||
}
|
||||
|
||||
public function getCreated()
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
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 setLongUrl($longUrl)
|
||||
{
|
||||
$this->longUrl = $longUrl;
|
||||
}
|
||||
|
||||
public function getLongUrl()
|
||||
{
|
||||
return $this->longUrl;
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Urlshortener_UrlHistory extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_Urlshortener_Url';
|
||||
protected $itemsDataType = 'array';
|
||||
public $itemsPerPage;
|
||||
public $kind;
|
||||
public $nextPageToken;
|
||||
public $totalItems;
|
||||
|
||||
public function setItems($items)
|
||||
{
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
public function getItems()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
public function setItemsPerPage($itemsPerPage)
|
||||
{
|
||||
$this->itemsPerPage = $itemsPerPage;
|
||||
}
|
||||
|
||||
public function getItemsPerPage()
|
||||
{
|
||||
return $this->itemsPerPage;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public function setTotalItems($totalItems)
|
||||
{
|
||||
$this->totalItems = $totalItems;
|
||||
}
|
||||
|
||||
public function getTotalItems()
|
||||
{
|
||||
return $this->totalItems;
|
||||
}
|
||||
}
|
||||
223
htdocs/lib/Google/Service/Webfonts.php
Normal file
223
htdocs/lib/Google/Service/Webfonts.php
Normal file
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for Webfonts (v1).
|
||||
*
|
||||
* <p>
|
||||
* The Google Fonts Developer API.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="https://developers.google.com/fonts/docs/developer_api" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_Webfonts extends Google_Service
|
||||
{
|
||||
|
||||
|
||||
public $webfonts;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the Webfonts service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'webfonts/v1/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'webfonts';
|
||||
|
||||
$this->webfonts = new Google_Service_Webfonts_Webfonts_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'webfonts',
|
||||
array(
|
||||
'methods' => array(
|
||||
'list' => array(
|
||||
'path' => 'webfonts',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'sort' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "webfonts" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $webfontsService = new Google_Service_Webfonts(...);
|
||||
* $webfonts = $webfontsService->webfonts;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_Webfonts_Webfonts_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Retrieves the list of fonts currently served by the Google Fonts Developer
|
||||
* API (webfonts.listWebfonts)
|
||||
*
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string sort
|
||||
* Enables sorting of the list
|
||||
* @return Google_Service_Webfonts_WebfontList
|
||||
*/
|
||||
public function listWebfonts($optParams = array())
|
||||
{
|
||||
$params = array();
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_Webfonts_WebfontList");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_Webfonts_Webfont extends Google_Collection
|
||||
{
|
||||
public $category;
|
||||
public $family;
|
||||
public $files;
|
||||
public $kind;
|
||||
public $lastModified;
|
||||
public $subsets;
|
||||
public $variants;
|
||||
public $version;
|
||||
|
||||
public function setCategory($category)
|
||||
{
|
||||
$this->category = $category;
|
||||
}
|
||||
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
public function setFamily($family)
|
||||
{
|
||||
$this->family = $family;
|
||||
}
|
||||
|
||||
public function getFamily()
|
||||
{
|
||||
return $this->family;
|
||||
}
|
||||
|
||||
public function setFiles($files)
|
||||
{
|
||||
$this->files = $files;
|
||||
}
|
||||
|
||||
public function getFiles()
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setLastModified($lastModified)
|
||||
{
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
public function setSubsets($subsets)
|
||||
{
|
||||
$this->subsets = $subsets;
|
||||
}
|
||||
|
||||
public function getSubsets()
|
||||
{
|
||||
return $this->subsets;
|
||||
}
|
||||
|
||||
public function setVariants($variants)
|
||||
{
|
||||
$this->variants = $variants;
|
||||
}
|
||||
|
||||
public function getVariants()
|
||||
{
|
||||
return $this->variants;
|
||||
}
|
||||
|
||||
public function setVersion($version)
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_Webfonts_WebfontList extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_Webfonts_Webfont';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
9624
htdocs/lib/Google/Service/YouTube.php
Normal file
9624
htdocs/lib/Google/Service/YouTube.php
Normal file
File diff suppressed because it is too large
Load Diff
623
htdocs/lib/Google/Service/YouTubeAnalytics.php
Normal file
623
htdocs/lib/Google/Service/YouTubeAnalytics.php
Normal file
@@ -0,0 +1,623 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service definition for YouTubeAnalytics (v1).
|
||||
*
|
||||
* <p>
|
||||
* Retrieve your YouTube Analytics reports.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
* <a href="http://developers.google.com/youtube/analytics/" target="_blank">Documentation</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Google, Inc.
|
||||
*/
|
||||
class Google_Service_YouTubeAnalytics extends Google_Service
|
||||
{
|
||||
/** View YouTube Analytics monetary reports for your YouTube content. */
|
||||
const YT_ANALYTICS_MONETARY_READONLY = "https://www.googleapis.com/auth/yt-analytics-monetary.readonly";
|
||||
/** View YouTube Analytics reports for your YouTube content. */
|
||||
const YT_ANALYTICS_READONLY = "https://www.googleapis.com/auth/yt-analytics.readonly";
|
||||
|
||||
public $batchReportDefinitions;
|
||||
public $batchReports;
|
||||
public $reports;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the internal representation of the YouTubeAnalytics service.
|
||||
*
|
||||
* @param Google_Client $client
|
||||
*/
|
||||
public function __construct(Google_Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->servicePath = 'youtube/analytics/v1/';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'youtubeAnalytics';
|
||||
|
||||
$this->batchReportDefinitions = new Google_Service_YouTubeAnalytics_BatchReportDefinitions_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'batchReportDefinitions',
|
||||
array(
|
||||
'methods' => array(
|
||||
'list' => array(
|
||||
'path' => 'batchReportDefinitions',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'onBehalfOfContentOwner' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->batchReports = new Google_Service_YouTubeAnalytics_BatchReports_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'batchReports',
|
||||
array(
|
||||
'methods' => array(
|
||||
'list' => array(
|
||||
'path' => 'batchReports',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'batchReportDefinitionId' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'onBehalfOfContentOwner' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->reports = new Google_Service_YouTubeAnalytics_Reports_Resource(
|
||||
$this,
|
||||
$this->serviceName,
|
||||
'reports',
|
||||
array(
|
||||
'methods' => array(
|
||||
'query' => array(
|
||||
'path' => 'reports',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'ids' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'start-date' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'end-date' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'metrics' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'max-results' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'sort' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'dimensions' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'start-index' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'filters' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The "batchReportDefinitions" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $youtubeAnalyticsService = new Google_Service_YouTubeAnalytics(...);
|
||||
* $batchReportDefinitions = $youtubeAnalyticsService->batchReportDefinitions;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_YouTubeAnalytics_BatchReportDefinitions_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Retrieves a list of available batch report definitions.
|
||||
* (batchReportDefinitions.listBatchReportDefinitions)
|
||||
*
|
||||
* @param string $onBehalfOfContentOwner
|
||||
* The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on
|
||||
* behalf of.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_YouTubeAnalytics_BatchReportDefinitionList
|
||||
*/
|
||||
public function listBatchReportDefinitions($onBehalfOfContentOwner, $optParams = array())
|
||||
{
|
||||
$params = array('onBehalfOfContentOwner' => $onBehalfOfContentOwner);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_YouTubeAnalytics_BatchReportDefinitionList");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "batchReports" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $youtubeAnalyticsService = new Google_Service_YouTubeAnalytics(...);
|
||||
* $batchReports = $youtubeAnalyticsService->batchReports;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_YouTubeAnalytics_BatchReports_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Retrieves a list of processed batch reports. (batchReports.listBatchReports)
|
||||
*
|
||||
* @param string $batchReportDefinitionId
|
||||
* The batchReportDefinitionId parameter specifies the ID of the batch reportort definition for
|
||||
* which you are retrieving reports.
|
||||
* @param string $onBehalfOfContentOwner
|
||||
* The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on
|
||||
* behalf of.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_YouTubeAnalytics_BatchReportList
|
||||
*/
|
||||
public function listBatchReports($batchReportDefinitionId, $onBehalfOfContentOwner, $optParams = array())
|
||||
{
|
||||
$params = array('batchReportDefinitionId' => $batchReportDefinitionId, 'onBehalfOfContentOwner' => $onBehalfOfContentOwner);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('list', array($params), "Google_Service_YouTubeAnalytics_BatchReportList");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The "reports" collection of methods.
|
||||
* Typical usage is:
|
||||
* <code>
|
||||
* $youtubeAnalyticsService = new Google_Service_YouTubeAnalytics(...);
|
||||
* $reports = $youtubeAnalyticsService->reports;
|
||||
* </code>
|
||||
*/
|
||||
class Google_Service_YouTubeAnalytics_Reports_Resource extends Google_Service_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* Retrieve your YouTube Analytics reports. (reports.query)
|
||||
*
|
||||
* @param string $ids
|
||||
* Identifies the YouTube channel or content owner for which you are retrieving YouTube Analytics
|
||||
* data.
|
||||
- To request data for a YouTube user, set the ids parameter value to channel==CHANNEL_ID,
|
||||
* where CHANNEL_ID specifies the unique YouTube channel ID.
|
||||
- To request data for a YouTube CMS
|
||||
* content owner, set the ids parameter value to contentOwner==OWNER_NAME, where OWNER_NAME is the
|
||||
* CMS name of the content owner.
|
||||
* @param string $startDate
|
||||
* The start date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format.
|
||||
* @param string $endDate
|
||||
* The end date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format.
|
||||
* @param string $metrics
|
||||
* A comma-separated list of YouTube Analytics metrics, such as views or likes,dislikes. See the
|
||||
* Available Reports document for a list of the reports that you can retrieve and the metrics
|
||||
* available in each report, and see the Metrics document for definitions of those metrics.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param int maxResults
|
||||
* The maximum number of rows to include in the response.
|
||||
* @opt_param string sort
|
||||
* A comma-separated list of dimensions or metrics that determine the sort order for YouTube
|
||||
* Analytics data. By default the sort order is ascending. The '-' prefix causes descending sort
|
||||
* order.
|
||||
* @opt_param string dimensions
|
||||
* A comma-separated list of YouTube Analytics dimensions, such as views or ageGroup,gender. See
|
||||
* the Available Reports document for a list of the reports that you can retrieve and the
|
||||
* dimensions used for those reports. Also see the Dimensions document for definitions of those
|
||||
* dimensions.
|
||||
* @opt_param int startIndex
|
||||
* An index of the first entity to retrieve. Use this parameter as a pagination mechanism along
|
||||
* with the max-results parameter (one-based, inclusive).
|
||||
* @opt_param string filters
|
||||
* A list of filters that should be applied when retrieving YouTube Analytics data. The Available
|
||||
* Reports document identifies the dimensions that can be used to filter each report, and the
|
||||
* Dimensions document defines those dimensions. If a request uses multiple filters, join them
|
||||
* together with a semicolon (;), and the returned result table will satisfy both filters. For
|
||||
* example, a filters parameter value of video==dMH0bHeiRNg;country==IT restricts the result set to
|
||||
* include data for the given video in Italy.
|
||||
* @return Google_Service_YouTubeAnalytics_ResultTable
|
||||
*/
|
||||
public function query($ids, $startDate, $endDate, $metrics, $optParams = array())
|
||||
{
|
||||
$params = array('ids' => $ids, 'start-date' => $startDate, 'end-date' => $endDate, 'metrics' => $metrics);
|
||||
$params = array_merge($params, $optParams);
|
||||
return $this->call('query', array($params), "Google_Service_YouTubeAnalytics_ResultTable");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Google_Service_YouTubeAnalytics_BatchReportDefinitionList extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_YouTubeAnalytics_BatchReportDefinitionTemplate';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_YouTubeAnalytics_BatchReportDefinitionTemplate extends Google_Collection
|
||||
{
|
||||
protected $defaultOutputType = 'Google_Service_YouTubeAnalytics_BatchReportDefinitionTemplateDefaultOutput';
|
||||
protected $defaultOutputDataType = 'array';
|
||||
public $id;
|
||||
public $name;
|
||||
public $status;
|
||||
public $type;
|
||||
|
||||
public function setDefaultOutput($defaultOutput)
|
||||
{
|
||||
$this->defaultOutput = $defaultOutput;
|
||||
}
|
||||
|
||||
public function getDefaultOutput()
|
||||
{
|
||||
return $this->defaultOutput;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_YouTubeAnalytics_BatchReportDefinitionTemplateDefaultOutput extends Google_Model
|
||||
{
|
||||
public $format;
|
||||
public $type;
|
||||
|
||||
public function setFormat($format)
|
||||
{
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
public function getFormat()
|
||||
{
|
||||
return $this->format;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_YouTubeAnalytics_BatchReportList extends Google_Collection
|
||||
{
|
||||
protected $itemsType = 'Google_Service_YouTubeAnalytics_BatchReportTemplate';
|
||||
protected $itemsDataType = 'array';
|
||||
public $kind;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_YouTubeAnalytics_BatchReportTemplate extends Google_Collection
|
||||
{
|
||||
public $id;
|
||||
protected $outputsType = 'Google_Service_YouTubeAnalytics_BatchReportTemplateOutputs';
|
||||
protected $outputsDataType = 'array';
|
||||
public $reportId;
|
||||
protected $timeSpanType = 'Google_Service_YouTubeAnalytics_BatchReportTemplateTimeSpan';
|
||||
protected $timeSpanDataType = '';
|
||||
public $timeUpdated;
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setOutputs($outputs)
|
||||
{
|
||||
$this->outputs = $outputs;
|
||||
}
|
||||
|
||||
public function getOutputs()
|
||||
{
|
||||
return $this->outputs;
|
||||
}
|
||||
|
||||
public function setReportId($reportId)
|
||||
{
|
||||
$this->reportId = $reportId;
|
||||
}
|
||||
|
||||
public function getReportId()
|
||||
{
|
||||
return $this->reportId;
|
||||
}
|
||||
|
||||
public function setTimeSpan(Google_Service_YouTubeAnalytics_BatchReportTemplateTimeSpan $timeSpan)
|
||||
{
|
||||
$this->timeSpan = $timeSpan;
|
||||
}
|
||||
|
||||
public function getTimeSpan()
|
||||
{
|
||||
return $this->timeSpan;
|
||||
}
|
||||
|
||||
public function setTimeUpdated($timeUpdated)
|
||||
{
|
||||
$this->timeUpdated = $timeUpdated;
|
||||
}
|
||||
|
||||
public function getTimeUpdated()
|
||||
{
|
||||
return $this->timeUpdated;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_YouTubeAnalytics_BatchReportTemplateOutputs extends Google_Model
|
||||
{
|
||||
public $downloadUrl;
|
||||
public $format;
|
||||
public $type;
|
||||
|
||||
public function setDownloadUrl($downloadUrl)
|
||||
{
|
||||
$this->downloadUrl = $downloadUrl;
|
||||
}
|
||||
|
||||
public function getDownloadUrl()
|
||||
{
|
||||
return $this->downloadUrl;
|
||||
}
|
||||
|
||||
public function setFormat($format)
|
||||
{
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
public function getFormat()
|
||||
{
|
||||
return $this->format;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_YouTubeAnalytics_BatchReportTemplateTimeSpan extends Google_Model
|
||||
{
|
||||
public $endTime;
|
||||
public $startTime;
|
||||
|
||||
public function setEndTime($endTime)
|
||||
{
|
||||
$this->endTime = $endTime;
|
||||
}
|
||||
|
||||
public function getEndTime()
|
||||
{
|
||||
return $this->endTime;
|
||||
}
|
||||
|
||||
public function setStartTime($startTime)
|
||||
{
|
||||
$this->startTime = $startTime;
|
||||
}
|
||||
|
||||
public function getStartTime()
|
||||
{
|
||||
return $this->startTime;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_YouTubeAnalytics_ResultTable extends Google_Collection
|
||||
{
|
||||
protected $columnHeadersType = 'Google_Service_YouTubeAnalytics_ResultTableColumnHeaders';
|
||||
protected $columnHeadersDataType = 'array';
|
||||
public $kind;
|
||||
public $rows;
|
||||
|
||||
public function setColumnHeaders($columnHeaders)
|
||||
{
|
||||
$this->columnHeaders = $columnHeaders;
|
||||
}
|
||||
|
||||
public function getColumnHeaders()
|
||||
{
|
||||
return $this->columnHeaders;
|
||||
}
|
||||
|
||||
public function setKind($kind)
|
||||
{
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
public function getKind()
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function setRows($rows)
|
||||
{
|
||||
$this->rows = $rows;
|
||||
}
|
||||
|
||||
public function getRows()
|
||||
{
|
||||
return $this->rows;
|
||||
}
|
||||
}
|
||||
|
||||
class Google_Service_YouTubeAnalytics_ResultTableColumnHeaders extends Google_Model
|
||||
{
|
||||
public $columnType;
|
||||
public $dataType;
|
||||
public $name;
|
||||
|
||||
public function setColumnType($columnType)
|
||||
{
|
||||
$this->columnType = $columnType;
|
||||
}
|
||||
|
||||
public function getColumnType()
|
||||
{
|
||||
return $this->columnType;
|
||||
}
|
||||
|
||||
public function setDataType($dataType)
|
||||
{
|
||||
$this->dataType = $dataType;
|
||||
}
|
||||
|
||||
public function getDataType()
|
||||
{
|
||||
return $this->dataType;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
29
htdocs/lib/Google/Signer/Abstract.php
Normal file
29
htdocs/lib/Google/Signer/Abstract.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Signs data.
|
||||
*
|
||||
* @author Brian Eaton <beaton@google.com>
|
||||
*/
|
||||
abstract class Google_Signer_Abstract
|
||||
{
|
||||
/**
|
||||
* Signs data, returns the signature as binary data.
|
||||
*/
|
||||
abstract public function sign($data);
|
||||
}
|
||||
90
htdocs/lib/Google/Signer/P12.php
Normal file
90
htdocs/lib/Google/Signer/P12.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once 'Google/Auth/Exception.php';
|
||||
require_once 'Google/Signer/Abstract.php';
|
||||
|
||||
/**
|
||||
* Signs data.
|
||||
*
|
||||
* Only used for testing.
|
||||
*
|
||||
* @author Brian Eaton <beaton@google.com>
|
||||
*/
|
||||
class Google_Signer_P12 extends Google_Signer_Abstract
|
||||
{
|
||||
// OpenSSL private key resource
|
||||
private $privateKey;
|
||||
|
||||
// Creates a new signer from a .p12 file.
|
||||
public function __construct($p12, $password)
|
||||
{
|
||||
if (!function_exists('openssl_x509_read')) {
|
||||
throw new Google_Exception(
|
||||
'The Google PHP API library needs the openssl PHP extension'
|
||||
);
|
||||
}
|
||||
|
||||
// If the private key is provided directly, then this isn't in the p12
|
||||
// format. Different versions of openssl support different p12 formats
|
||||
// and the key from google wasn't being accepted by the version available
|
||||
// at the time.
|
||||
if (!$password && strpos($p12, "-----BEGIN RSA PRIVATE KEY-----") !== false) {
|
||||
$this->privateKey = openssl_pkey_get_private($p12);
|
||||
} else {
|
||||
// This throws on error
|
||||
$certs = array();
|
||||
if (!openssl_pkcs12_read($p12, $certs, $password)) {
|
||||
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()
|
||||
);
|
||||
}
|
||||
// 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_Auth_Exception("No private key found in p12 file.");
|
||||
}
|
||||
$this->privateKey = openssl_pkey_get_private($certs['pkey']);
|
||||
}
|
||||
|
||||
if (!$this->privateKey) {
|
||||
throw new Google_Auth_Exception("Unable to load private key");
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->privateKey) {
|
||||
openssl_pkey_free($this->privateKey);
|
||||
}
|
||||
}
|
||||
|
||||
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_Auth_Exception("Unable to sign data");
|
||||
}
|
||||
return $signature;
|
||||
}
|
||||
}
|
||||
135
htdocs/lib/Google/Utils.php
Normal file
135
htdocs/lib/Google/Utils.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Collection of static utility methods used for convenience across
|
||||
* the client library.
|
||||
*
|
||||
* @author Chirag Shah <chirags@google.com>
|
||||
*/
|
||||
class Google_Utils
|
||||
{
|
||||
public static function urlSafeB64Encode($data)
|
||||
{
|
||||
$b64 = base64_encode($data);
|
||||
$b64 = str_replace(
|
||||
array('+', '/', '\r', '\n', '='),
|
||||
array('-', '_'),
|
||||
$b64
|
||||
);
|
||||
return $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
|
||||
* manner at the moment.
|
||||
*
|
||||
* This algorithm was originally developed for the
|
||||
* Solar Framework by Paul M. Jones
|
||||
*
|
||||
* @link http://solarphp.com/
|
||||
* @link http://svn.solarphp.com/core/trunk/Solar/Json.php
|
||||
* @link http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Json/Decoder.php
|
||||
* @param string $str
|
||||
* @return int The number of bytes in a string.
|
||||
*/
|
||||
public static function getStrLen($str)
|
||||
{
|
||||
$strlenVar = strlen($str);
|
||||
$d = $ret = 0;
|
||||
for ($count = 0; $count < $strlenVar; ++ $count) {
|
||||
$ordinalValue = ord($str{$ret});
|
||||
switch (true) {
|
||||
case (($ordinalValue >= 0x20) && ($ordinalValue <= 0x7F)):
|
||||
// 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
|
||||
$ret += 6;
|
||||
break;
|
||||
default:
|
||||
$ret ++;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize all keys in an array to lower-case.
|
||||
* @param array $arr
|
||||
* @return array Normalized array.
|
||||
*/
|
||||
public static function normalize($arr)
|
||||
{
|
||||
if (!is_array($arr)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$normalized = array();
|
||||
foreach ($arr as $key => $val) {
|
||||
$normalized[strtolower($key)] = $val;
|
||||
}
|
||||
return $normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string to camelCase
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function camelCase($value)
|
||||
{
|
||||
$value = ucwords(str_replace(array('-', '_'), ' ', $value));
|
||||
$value = str_replace(' ', '', $value);
|
||||
$value[0] = strtolower($value[0]);
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
333
htdocs/lib/Google/Utils/URITemplate.php
Normal file
333
htdocs/lib/Google/Utils/URITemplate.php
Normal file
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of levels 1-3 of the URI Template spec.
|
||||
* @see http://tools.ietf.org/html/rfc6570
|
||||
*/
|
||||
class Google_Utils_URITemplate
|
||||
{
|
||||
const TYPE_MAP = "1";
|
||||
const TYPE_LIST = "2";
|
||||
const TYPE_SCALAR = "4";
|
||||
|
||||
/**
|
||||
* @var $operators array
|
||||
* These are valid at the start of a template block to
|
||||
* modify the way in which the variables inside are
|
||||
* processed.
|
||||
*/
|
||||
private $operators = array(
|
||||
"+" => "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;
|
||||
}
|
||||
}
|
||||
30
htdocs/lib/Google/Verifier/Abstract.php
Normal file
30
htdocs/lib/Google/Verifier/Abstract.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Verifies signatures.
|
||||
*
|
||||
* @author Brian Eaton <beaton@google.com>
|
||||
*/
|
||||
abstract class Google_Verifier_Abstract
|
||||
{
|
||||
/**
|
||||
* Checks a signature, returns true if the signature is correct,
|
||||
* false otherwise.
|
||||
*/
|
||||
abstract public function verify($data, $signature);
|
||||
}
|
||||
73
htdocs/lib/Google/Verifier/Pem.php
Normal file
73
htdocs/lib/Google/Verifier/Pem.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once 'Google/Auth/Exception.php';
|
||||
require_once 'Google/Verifier/Abstract.php';
|
||||
|
||||
/**
|
||||
* Verifies signatures using PEM encoded certificates.
|
||||
*
|
||||
* @author Brian Eaton <beaton@google.com>
|
||||
*/
|
||||
class Google_Verifier_Pem extends Google_Verifier_Abstract
|
||||
{
|
||||
private $publicKey;
|
||||
|
||||
/**
|
||||
* Constructs a verifier from the supplied PEM-encoded certificate.
|
||||
*
|
||||
* $pem: a PEM encoded certificate (not a file).
|
||||
* @param $pem
|
||||
* @throws Google_Auth_Exception
|
||||
* @throws Google_Exception
|
||||
*/
|
||||
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_Auth_Exception("Unable to parse PEM: $pem");
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->publicKey) {
|
||||
openssl_x509_free($this->publicKey);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies the signature on data.
|
||||
*
|
||||
* Returns true if the signature is valid, false otherwise.
|
||||
* @param $data
|
||||
* @param $signature
|
||||
* @throws Google_Auth_Exception
|
||||
* @return bool
|
||||
*/
|
||||
public function verify($data, $signature)
|
||||
{
|
||||
$status = openssl_verify($data, $signature, $this->publicKey, "sha256");
|
||||
if ($status === -1) {
|
||||
throw new Google_Auth_Exception('Signature verification error: ' . openssl_error_string());
|
||||
}
|
||||
return $status === 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user