Version Description
- Fix: Google library conflict issues are fixed.
Download this release
Release Info
Developer | infinitewp |
Plugin | InfiniteWP Client |
Version | 1.2.13 |
Comparing to | |
See all releases |
Code changes from version 1.2.12 to 1.2.13
- backup.class.php +13 -13
- init.php +2 -2
- lib/Google/Auth/Abstract.php +5 -5
- lib/Google/Auth/AssertionCredentials.php +6 -6
- lib/Google/Auth/Exception.php +1 -1
- lib/Google/Auth/LoginTicket.php +3 -3
- lib/Google/Auth/OAuth2.php +47 -47
- lib/Google/Auth/Simple.php +7 -7
- lib/Google/Cache/Abstract.php +2 -2
- lib/Google/Cache/Apc.php +4 -4
- lib/Google/Cache/Exception.php +1 -1
- lib/Google/Cache/File.php +4 -4
- lib/Google/Cache/Memcache.php +7 -7
- lib/Google/Cache/Null.php +2 -2
- lib/Google/Client.php +38 -38
- lib/Google/Collection.php +2 -2
- lib/Google/Config.php +10 -10
- lib/Google/Exception.php +1 -1
- lib/Google/Http/Batch.php +10 -10
- lib/Google/Http/CacheParser.php +10 -10
- lib/Google/Http/MediaFileUpload.php +13 -11
- lib/Google/Http/REST.php +11 -11
- lib/Google/Http/Request.php +3 -3
- lib/Google/IO/Abstract.php +27 -27
- lib/Google/IO/Curl.php +8 -8
- lib/Google/IO/Exception.php +1 -1
- lib/Google/IO/Stream.php +7 -7
- lib/Google/Model.php +5 -5
- lib/Google/Service.php +4 -4
- lib/Google/Service/Drive.php +269 -269
- lib/Google/Service/Exception.php +1 -1
- lib/Google/Service/Oauth2.php +20 -20
- lib/Google/Service/Resource.php +12 -12
- lib/Google/Signer/Abstract.php +1 -1
- lib/Google/Signer/P12.php +7 -7
- lib/Google/Utils.php +1 -1
- lib/Google/Utils/URITemplate.php +1 -1
- lib/Google/Verifier/Abstract.php +1 -1
- lib/Google/Verifier/Pem.php +7 -7
- readme.txt +4 -1
backup.class.php
CHANGED
@@ -2307,7 +2307,7 @@ function ftp_backup($args)
|
|
2307 |
$fileSizeUploaded = 0;
|
2308 |
$resumeURI = false;
|
2309 |
|
2310 |
-
$client = new
|
2311 |
$client->setClientId($args['clientID']);
|
2312 |
$client->setClientSecret($args['clientSecretKey']);
|
2313 |
$client->setRedirectUri($args['redirectURL']);
|
@@ -2331,7 +2331,7 @@ function ftp_backup($args)
|
|
2331 |
return array("error" => $e->getMessage());
|
2332 |
}
|
2333 |
|
2334 |
-
$service = new
|
2335 |
|
2336 |
//create folder if not present
|
2337 |
try
|
@@ -2345,7 +2345,7 @@ function ftp_backup($args)
|
|
2345 |
|
2346 |
if(empty($list_result))
|
2347 |
{
|
2348 |
-
$file = new
|
2349 |
$file->setTitle('infinitewp');
|
2350 |
$file->setMimeType('application/vnd.google-apps.folder');
|
2351 |
|
@@ -2380,12 +2380,12 @@ function ftp_backup($args)
|
|
2380 |
|
2381 |
if(empty($list_result))
|
2382 |
{
|
2383 |
-
$file = new
|
2384 |
$file->setTitle($sub_folder_name);
|
2385 |
$file->setMimeType('application/vnd.google-apps.folder');
|
2386 |
|
2387 |
//setting parent as infinitewpFolder
|
2388 |
-
$parent = new
|
2389 |
$parent->setId($iwp_folder_id);
|
2390 |
$file->setParents(array($parent));
|
2391 |
|
@@ -2407,12 +2407,12 @@ function ftp_backup($args)
|
|
2407 |
|
2408 |
|
2409 |
//Insert a file
|
2410 |
-
$file = new
|
2411 |
$file->setTitle(basename($backup_file));
|
2412 |
$file->setMimeType('binary/octet-stream');
|
2413 |
|
2414 |
// Set the Parent Folder on Google Drive
|
2415 |
-
$parent = new
|
2416 |
if(empty($sub_folder_id))
|
2417 |
{
|
2418 |
$parent->setId($iwp_folder_id);
|
@@ -2446,7 +2446,7 @@ function ftp_backup($args)
|
|
2446 |
$request = $service->files->insert($file);
|
2447 |
|
2448 |
// Create a media file upload to represent our upload process.
|
2449 |
-
$media = new
|
2450 |
$media->setFileSize(filesize($backup_file));
|
2451 |
|
2452 |
$status = false;
|
@@ -2546,7 +2546,7 @@ function ftp_backup($args)
|
|
2546 |
require_once($GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Service/Drive.php');
|
2547 |
|
2548 |
//refresh token
|
2549 |
-
$client = new
|
2550 |
$client->setClientId($args['clientID']);
|
2551 |
$client->setClientSecret($args['clientSecretKey']);
|
2552 |
$client->setRedirectUri($args['redirectURL']);
|
@@ -2571,7 +2571,7 @@ function ftp_backup($args)
|
|
2571 |
}
|
2572 |
|
2573 |
//downloading the file
|
2574 |
-
$service = new
|
2575 |
|
2576 |
$file = $service->files->get($args['backup_file']);
|
2577 |
|
@@ -2583,7 +2583,7 @@ function ftp_backup($args)
|
|
2583 |
{
|
2584 |
if ($downloadUrl)
|
2585 |
{
|
2586 |
-
$request = new
|
2587 |
|
2588 |
$signHttpRequest = $client->getAuth()->sign($request);
|
2589 |
$httpRequest = $client->getIo()->makeRequest($signHttpRequest);
|
@@ -2617,7 +2617,7 @@ function ftp_backup($args)
|
|
2617 |
require_once($GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Client.php');
|
2618 |
require_once($GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Service/Drive.php');
|
2619 |
|
2620 |
-
$client = new
|
2621 |
$client->setClientId($args['clientID']);
|
2622 |
$client->setClientSecret($args['clientSecretKey']);
|
2623 |
$client->setRedirectUri($args['redirectURL']);
|
@@ -2641,7 +2641,7 @@ function ftp_backup($args)
|
|
2641 |
return array("error" => $e->getMessage());
|
2642 |
}
|
2643 |
|
2644 |
-
$service = new
|
2645 |
|
2646 |
try
|
2647 |
{
|
2307 |
$fileSizeUploaded = 0;
|
2308 |
$resumeURI = false;
|
2309 |
|
2310 |
+
$client = new IWP_google_Client();
|
2311 |
$client->setClientId($args['clientID']);
|
2312 |
$client->setClientSecret($args['clientSecretKey']);
|
2313 |
$client->setRedirectUri($args['redirectURL']);
|
2331 |
return array("error" => $e->getMessage());
|
2332 |
}
|
2333 |
|
2334 |
+
$service = new IWP_google_Service_Drive($client);
|
2335 |
|
2336 |
//create folder if not present
|
2337 |
try
|
2345 |
|
2346 |
if(empty($list_result))
|
2347 |
{
|
2348 |
+
$file = new IWP_google_Service_Drive_DriveFile();
|
2349 |
$file->setTitle('infinitewp');
|
2350 |
$file->setMimeType('application/vnd.google-apps.folder');
|
2351 |
|
2380 |
|
2381 |
if(empty($list_result))
|
2382 |
{
|
2383 |
+
$file = new IWP_google_Service_Drive_DriveFile();
|
2384 |
$file->setTitle($sub_folder_name);
|
2385 |
$file->setMimeType('application/vnd.google-apps.folder');
|
2386 |
|
2387 |
//setting parent as infinitewpFolder
|
2388 |
+
$parent = new IWP_google_Service_Drive_ParentReference();
|
2389 |
$parent->setId($iwp_folder_id);
|
2390 |
$file->setParents(array($parent));
|
2391 |
|
2407 |
|
2408 |
|
2409 |
//Insert a file
|
2410 |
+
$file = new IWP_google_Service_Drive_DriveFile();
|
2411 |
$file->setTitle(basename($backup_file));
|
2412 |
$file->setMimeType('binary/octet-stream');
|
2413 |
|
2414 |
// Set the Parent Folder on Google Drive
|
2415 |
+
$parent = new IWP_google_Service_Drive_ParentReference();
|
2416 |
if(empty($sub_folder_id))
|
2417 |
{
|
2418 |
$parent->setId($iwp_folder_id);
|
2446 |
$request = $service->files->insert($file);
|
2447 |
|
2448 |
// Create a media file upload to represent our upload process.
|
2449 |
+
$media = new IWP_google_Http_MediaFileUpload($client, $request, 'application/zip', null, true, $upload_file_block_size);
|
2450 |
$media->setFileSize(filesize($backup_file));
|
2451 |
|
2452 |
$status = false;
|
2546 |
require_once($GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Service/Drive.php');
|
2547 |
|
2548 |
//refresh token
|
2549 |
+
$client = new IWP_google_Client();
|
2550 |
$client->setClientId($args['clientID']);
|
2551 |
$client->setClientSecret($args['clientSecretKey']);
|
2552 |
$client->setRedirectUri($args['redirectURL']);
|
2571 |
}
|
2572 |
|
2573 |
//downloading the file
|
2574 |
+
$service = new IWP_google_Service_Drive($client);
|
2575 |
|
2576 |
$file = $service->files->get($args['backup_file']);
|
2577 |
|
2583 |
{
|
2584 |
if ($downloadUrl)
|
2585 |
{
|
2586 |
+
$request = new IWP_google_Http_Request($downloadUrl, 'GET', null, null);
|
2587 |
|
2588 |
$signHttpRequest = $client->getAuth()->sign($request);
|
2589 |
$httpRequest = $client->getIo()->makeRequest($signHttpRequest);
|
2617 |
require_once($GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Client.php');
|
2618 |
require_once($GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Service/Drive.php');
|
2619 |
|
2620 |
+
$client = new IWP_google_Client();
|
2621 |
$client->setClientId($args['clientID']);
|
2622 |
$client->setClientSecret($args['clientSecretKey']);
|
2623 |
$client->setRedirectUri($args['redirectURL']);
|
2641 |
return array("error" => $e->getMessage());
|
2642 |
}
|
2643 |
|
2644 |
+
$service = new IWP_google_Service_Drive($client);
|
2645 |
|
2646 |
try
|
2647 |
{
|
init.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: InfiniteWP - Client
|
|
4 |
Plugin URI: http://infinitewp.com/
|
5 |
Description: This is the client plugin of InfiniteWP that communicates with the InfiniteWP Admin panel.
|
6 |
Author: Revmakx
|
7 |
-
Version: 1.2.
|
8 |
Author URI: http://www.revmakx.com
|
9 |
*/
|
10 |
/************************************************************
|
@@ -26,7 +26,7 @@ Author URI: http://www.revmakx.com
|
|
26 |
**************************************************************/
|
27 |
|
28 |
if(!defined('IWP_MMB_CLIENT_VERSION'))
|
29 |
-
define('IWP_MMB_CLIENT_VERSION', '1.2.
|
30 |
|
31 |
|
32 |
if ( !defined('IWP_MMB_XFRAME_COOKIE')){
|
4 |
Plugin URI: http://infinitewp.com/
|
5 |
Description: This is the client plugin of InfiniteWP that communicates with the InfiniteWP Admin panel.
|
6 |
Author: Revmakx
|
7 |
+
Version: 1.2.13
|
8 |
Author URI: http://www.revmakx.com
|
9 |
*/
|
10 |
/************************************************************
|
26 |
**************************************************************/
|
27 |
|
28 |
if(!defined('IWP_MMB_CLIENT_VERSION'))
|
29 |
+
define('IWP_MMB_CLIENT_VERSION', '1.2.13');
|
30 |
|
31 |
|
32 |
if ( !defined('IWP_MMB_XFRAME_COOKIE')){
|
lib/Google/Auth/Abstract.php
CHANGED
@@ -21,19 +21,19 @@ require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Http/Request.php";
|
|
21 |
* @author Chris Chabot <chabotc@google.com>
|
22 |
*
|
23 |
*/
|
24 |
-
abstract class
|
25 |
{
|
26 |
/**
|
27 |
* An utility function that first calls $this->auth->sign($request) and then
|
28 |
* executes makeRequest() on that signed request. Used for when a request
|
29 |
* should be authenticated
|
30 |
-
* @param
|
31 |
-
* @return
|
32 |
*/
|
33 |
-
abstract public function authenticatedRequest(
|
34 |
|
35 |
abstract public function authenticate($code);
|
36 |
-
abstract public function sign(
|
37 |
abstract public function createAuthUrl($scope);
|
38 |
|
39 |
abstract public function refreshToken($refreshToken);
|
21 |
* @author Chris Chabot <chabotc@google.com>
|
22 |
*
|
23 |
*/
|
24 |
+
abstract class IWP_google_Auth_Abstract
|
25 |
{
|
26 |
/**
|
27 |
* An utility function that first calls $this->auth->sign($request) and then
|
28 |
* executes makeRequest() on that signed request. Used for when a request
|
29 |
* should be authenticated
|
30 |
+
* @param IWP_google_Http_Request $request
|
31 |
+
* @return IWP_google_Http_Request $request
|
32 |
*/
|
33 |
+
abstract public function authenticatedRequest(IWP_google_Http_Request $request);
|
34 |
|
35 |
abstract public function authenticate($code);
|
36 |
+
abstract public function sign(IWP_google_Http_Request $request);
|
37 |
abstract public function createAuthUrl($scope);
|
38 |
|
39 |
abstract public function refreshToken($refreshToken);
|
lib/Google/Auth/AssertionCredentials.php
CHANGED
@@ -24,7 +24,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Utils.php";
|
|
24 |
*
|
25 |
* @author Chirag Shah <chirags@google.com>
|
26 |
*/
|
27 |
-
class
|
28 |
{
|
29 |
const MAX_TOKEN_LIFETIME_SECS = 3600;
|
30 |
|
@@ -93,7 +93,7 @@ class Google_Auth_AssertionCredentials
|
|
93 |
$now = time();
|
94 |
|
95 |
$jwtParams = array(
|
96 |
-
'aud' =>
|
97 |
'scope' => $this->scopes,
|
98 |
'iat' => $now,
|
99 |
'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS,
|
@@ -119,14 +119,14 @@ class Google_Auth_AssertionCredentials
|
|
119 |
$header = array('typ' => 'JWT', 'alg' => 'RS256');
|
120 |
|
121 |
$segments = array(
|
122 |
-
|
123 |
-
|
124 |
);
|
125 |
|
126 |
$signingInput = implode('.', $segments);
|
127 |
-
$signer = new
|
128 |
$signature = $signer->sign($signingInput);
|
129 |
-
$segments[] =
|
130 |
|
131 |
return implode(".", $segments);
|
132 |
}
|
24 |
*
|
25 |
* @author Chirag Shah <chirags@google.com>
|
26 |
*/
|
27 |
+
class IWP_google_Auth_AssertionCredentials
|
28 |
{
|
29 |
const MAX_TOKEN_LIFETIME_SECS = 3600;
|
30 |
|
93 |
$now = time();
|
94 |
|
95 |
$jwtParams = array(
|
96 |
+
'aud' => IWP_google_Auth_OAuth2::OAUTH2_TOKEN_URI,
|
97 |
'scope' => $this->scopes,
|
98 |
'iat' => $now,
|
99 |
'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS,
|
119 |
$header = array('typ' => 'JWT', 'alg' => 'RS256');
|
120 |
|
121 |
$segments = array(
|
122 |
+
IWP_google_Utils::urlSafeB64Encode(json_encode($header)),
|
123 |
+
IWP_google_Utils::urlSafeB64Encode(json_encode($payload))
|
124 |
);
|
125 |
|
126 |
$signingInput = implode('.', $segments);
|
127 |
+
$signer = new IWP_google_Signer_P12($this->privateKey, $this->privateKeyPassword);
|
128 |
$signature = $signer->sign($signingInput);
|
129 |
+
$segments[] = IWP_google_Utils::urlSafeB64Encode($signature);
|
130 |
|
131 |
return implode(".", $segments);
|
132 |
}
|
lib/Google/Auth/Exception.php
CHANGED
@@ -17,6 +17,6 @@
|
|
17 |
|
18 |
require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Exception.php";
|
19 |
|
20 |
-
class
|
21 |
{
|
22 |
}
|
17 |
|
18 |
require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Exception.php";
|
19 |
|
20 |
+
class IWP_google_Auth_Exception extends IWP_google_Exception
|
21 |
{
|
22 |
}
|
lib/Google/Auth/LoginTicket.php
CHANGED
@@ -22,7 +22,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Auth/Exception.php";
|
|
22 |
*
|
23 |
* @author Brian Eaton <beaton@google.com>
|
24 |
*/
|
25 |
-
class
|
26 |
{
|
27 |
const USER_ATTR = "sub";
|
28 |
|
@@ -46,7 +46,7 @@ class Google_Auth_LoginTicket
|
|
46 |
|
47 |
/**
|
48 |
* Returns the numeric identifier for the user.
|
49 |
-
* @throws
|
50 |
* @return
|
51 |
*/
|
52 |
public function getUserId()
|
@@ -54,7 +54,7 @@ class Google_Auth_LoginTicket
|
|
54 |
if (array_key_exists(self::USER_ATTR, $this->payload)) {
|
55 |
return $this->payload[self::USER_ATTR];
|
56 |
}
|
57 |
-
throw new
|
58 |
}
|
59 |
|
60 |
/**
|
22 |
*
|
23 |
* @author Brian Eaton <beaton@google.com>
|
24 |
*/
|
25 |
+
class IWP_google_Auth_LoginTicket
|
26 |
{
|
27 |
const USER_ATTR = "sub";
|
28 |
|
46 |
|
47 |
/**
|
48 |
* Returns the numeric identifier for the user.
|
49 |
+
* @throws IWP_google_Auth_Exception
|
50 |
* @return
|
51 |
*/
|
52 |
public function getUserId()
|
54 |
if (array_key_exists(self::USER_ATTR, $this->payload)) {
|
55 |
return $this->payload[self::USER_ATTR];
|
56 |
}
|
57 |
+
throw new IWP_google_Auth_Exception("No user_id in token");
|
58 |
}
|
59 |
|
60 |
/**
|
lib/Google/Auth/OAuth2.php
CHANGED
@@ -31,7 +31,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Verifier/Pem.php";
|
|
31 |
* @author Chirag Shah <chirags@google.com>
|
32 |
*
|
33 |
*/
|
34 |
-
class
|
35 |
{
|
36 |
const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
|
37 |
const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
|
@@ -41,7 +41,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
41 |
const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
|
42 |
const OAUTH2_ISSUER = 'accounts.google.com';
|
43 |
|
44 |
-
/** @var
|
45 |
private $assertionCredentials;
|
46 |
|
47 |
/**
|
@@ -55,7 +55,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
55 |
private $token = array();
|
56 |
|
57 |
/**
|
58 |
-
* @var
|
59 |
*/
|
60 |
private $client;
|
61 |
|
@@ -63,7 +63,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
63 |
* Instantiates the class, but does not initiate the login flow, leaving it
|
64 |
* to the discretion of the caller.
|
65 |
*/
|
66 |
-
public function __construct(
|
67 |
{
|
68 |
$this->client = $client;
|
69 |
}
|
@@ -74,11 +74,11 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
74 |
* (which can modify the request in what ever way fits the auth mechanism)
|
75 |
* and then calls apiCurlIO::makeRequest on the signed request
|
76 |
*
|
77 |
-
* @param
|
78 |
-
* @return
|
79 |
* responseHttpCode, responseHeaders and responseBody.
|
80 |
*/
|
81 |
-
public function authenticatedRequest(
|
82 |
{
|
83 |
$request = $this->sign($request);
|
84 |
return $this->client->getIo()->makeRequest($request);
|
@@ -86,18 +86,18 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
86 |
|
87 |
/**
|
88 |
* @param string $code
|
89 |
-
* @throws
|
90 |
* @return string
|
91 |
*/
|
92 |
public function authenticate($code)
|
93 |
{
|
94 |
if (strlen($code) == 0) {
|
95 |
-
throw new
|
96 |
}
|
97 |
|
98 |
// We got here from the redirect from a successful authorization grant,
|
99 |
// fetch the access token
|
100 |
-
$request = new
|
101 |
self::OAUTH2_TOKEN_URI,
|
102 |
'POST',
|
103 |
array(),
|
@@ -121,7 +121,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
121 |
if ($decodedResponse != null && $decodedResponse['error']) {
|
122 |
$decodedResponse = $decodedResponse['error'];
|
123 |
}
|
124 |
-
throw new
|
125 |
sprintf(
|
126 |
"Error fetching OAuth2 access token, message: '%s'",
|
127 |
$decodedResponse
|
@@ -165,16 +165,16 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
165 |
|
166 |
/**
|
167 |
* @param string $token
|
168 |
-
* @throws
|
169 |
*/
|
170 |
public function setAccessToken($token)
|
171 |
{
|
172 |
$token = json_decode($token, true);
|
173 |
if ($token == null) {
|
174 |
-
throw new
|
175 |
}
|
176 |
if (! isset($token['access_token'])) {
|
177 |
-
throw new
|
178 |
}
|
179 |
$this->token = $token;
|
180 |
}
|
@@ -189,18 +189,18 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
189 |
$this->state = $state;
|
190 |
}
|
191 |
|
192 |
-
public function setAssertionCredentials(
|
193 |
{
|
194 |
$this->assertionCredentials = $creds;
|
195 |
}
|
196 |
|
197 |
/**
|
198 |
* Include an accessToken in a given apiHttpRequest.
|
199 |
-
* @param
|
200 |
-
* @return
|
201 |
-
* @throws
|
202 |
*/
|
203 |
-
public function sign(
|
204 |
{
|
205 |
// add the developer key to the request before signing it
|
206 |
if ($this->client->getClassConfig($this, 'developer_key')) {
|
@@ -219,7 +219,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
219 |
$this->refreshTokenWithAssertion();
|
220 |
} else {
|
221 |
if (! array_key_exists('refresh_token', $this->token)) {
|
222 |
-
throw new
|
223 |
"The OAuth 2.0 access token has expired,"
|
224 |
." and a refresh token is not available. Refresh tokens"
|
225 |
." are not returned for responses that were auto-approved."
|
@@ -256,7 +256,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
256 |
|
257 |
/**
|
258 |
* Fetches a fresh access token with a given assertion token.
|
259 |
-
* @param
|
260 |
* @return void
|
261 |
*/
|
262 |
public function refreshTokenWithAssertion($assertionCredentials = null)
|
@@ -299,7 +299,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
299 |
|
300 |
private function refreshTokenRequest($params)
|
301 |
{
|
302 |
-
$http = new
|
303 |
self::OAUTH2_TOKEN_URI,
|
304 |
'POST',
|
305 |
array(),
|
@@ -313,25 +313,25 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
313 |
if (200 == $code) {
|
314 |
$token = json_decode($body, true);
|
315 |
if ($token == null) {
|
316 |
-
throw new
|
317 |
}
|
318 |
|
319 |
if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
|
320 |
-
throw new
|
321 |
}
|
322 |
|
323 |
$this->token['access_token'] = $token['access_token'];
|
324 |
$this->token['expires_in'] = $token['expires_in'];
|
325 |
$this->token['created'] = time();
|
326 |
} else {
|
327 |
-
throw new
|
328 |
}
|
329 |
}
|
330 |
|
331 |
/**
|
332 |
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
333 |
* token, if a token isn't provided.
|
334 |
-
* @throws
|
335 |
* @param string|null $token The token (access token or a refresh token) that should be revoked.
|
336 |
* @return boolean Returns True if the revocation was successful, otherwise False.
|
337 |
*/
|
@@ -347,7 +347,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
347 |
$token = $this->token['access_token'];
|
348 |
}
|
349 |
}
|
350 |
-
$request = new
|
351 |
self::OAUTH2_REVOKE_URI,
|
352 |
'POST',
|
353 |
array(),
|
@@ -404,7 +404,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
404 |
if ($file) {
|
405 |
return json_decode($file, true);
|
406 |
} else {
|
407 |
-
throw new
|
408 |
"Failed to retrieve verification certificates: '" .
|
409 |
$url . "'."
|
410 |
);
|
@@ -413,7 +413,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
413 |
|
414 |
// This relies on makeRequest caching certificate responses.
|
415 |
$request = $this->client->getIo()->makeRequest(
|
416 |
-
new
|
417 |
$url
|
418 |
)
|
419 |
);
|
@@ -423,7 +423,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
423 |
return $certs;
|
424 |
}
|
425 |
}
|
426 |
-
throw new
|
427 |
"Failed to retrieve verification certificates: '" .
|
428 |
$request->getResponseBody() . "'.",
|
429 |
$request->getResponseHttpCode()
|
@@ -438,7 +438,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
438 |
*
|
439 |
* @param $id_token
|
440 |
* @param $audience
|
441 |
-
* @return
|
442 |
*/
|
443 |
public function verifyIdToken($id_token = null, $audience = null)
|
444 |
{
|
@@ -477,28 +477,28 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
477 |
|
478 |
$segments = explode(".", $jwt);
|
479 |
if (count($segments) != 3) {
|
480 |
-
throw new
|
481 |
}
|
482 |
$signed = $segments[0] . "." . $segments[1];
|
483 |
-
$signature =
|
484 |
|
485 |
// Parse envelope.
|
486 |
-
$envelope = json_decode(
|
487 |
if (!$envelope) {
|
488 |
-
throw new
|
489 |
}
|
490 |
|
491 |
// Parse token
|
492 |
-
$json_body =
|
493 |
$payload = json_decode($json_body, true);
|
494 |
if (!$payload) {
|
495 |
-
throw new
|
496 |
}
|
497 |
|
498 |
// Check signature
|
499 |
$verified = false;
|
500 |
foreach ($certs as $keyName => $pem) {
|
501 |
-
$public_key = new
|
502 |
if ($public_key->verify($signed, $signature)) {
|
503 |
$verified = true;
|
504 |
break;
|
@@ -506,7 +506,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
506 |
}
|
507 |
|
508 |
if (!$verified) {
|
509 |
-
throw new
|
510 |
}
|
511 |
|
512 |
// Check issued-at timestamp
|
@@ -515,7 +515,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
515 |
$iat = $payload["iat"];
|
516 |
}
|
517 |
if (!$iat) {
|
518 |
-
throw new
|
519 |
}
|
520 |
$earliest = $iat - self::CLOCK_SKEW_SECS;
|
521 |
|
@@ -526,17 +526,17 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
526 |
$exp = $payload["exp"];
|
527 |
}
|
528 |
if (!$exp) {
|
529 |
-
throw new
|
530 |
}
|
531 |
if ($exp >= $now + $max_expiry) {
|
532 |
-
throw new
|
533 |
sprintf("Expiration time too far in future: %s", $json_body)
|
534 |
);
|
535 |
}
|
536 |
|
537 |
$latest = $exp + self::CLOCK_SKEW_SECS;
|
538 |
if ($now < $earliest) {
|
539 |
-
throw new
|
540 |
sprintf(
|
541 |
"Token used too early, %s < %s: %s",
|
542 |
$now,
|
@@ -546,7 +546,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
546 |
);
|
547 |
}
|
548 |
if ($now > $latest) {
|
549 |
-
throw new
|
550 |
sprintf(
|
551 |
"Token used too late, %s > %s: %s",
|
552 |
$now,
|
@@ -558,7 +558,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
558 |
|
559 |
$iss = $payload['iss'];
|
560 |
if ($issuer && $iss != $issuer) {
|
561 |
-
throw new
|
562 |
sprintf(
|
563 |
"Invalid issuer, %s != %s: %s",
|
564 |
$iss,
|
@@ -571,7 +571,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
571 |
// Check audience
|
572 |
$aud = $payload["aud"];
|
573 |
if ($aud != $required_audience) {
|
574 |
-
throw new
|
575 |
sprintf(
|
576 |
"Wrong recipient, %s != %s:",
|
577 |
$aud,
|
@@ -582,6 +582,6 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
|
|
582 |
}
|
583 |
|
584 |
// All good.
|
585 |
-
return new
|
586 |
}
|
587 |
}
|
31 |
* @author Chirag Shah <chirags@google.com>
|
32 |
*
|
33 |
*/
|
34 |
+
class IWP_google_Auth_OAuth2 extends IWP_google_Auth_Abstract
|
35 |
{
|
36 |
const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
|
37 |
const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
|
41 |
const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
|
42 |
const OAUTH2_ISSUER = 'accounts.google.com';
|
43 |
|
44 |
+
/** @var IWP_google_Auth_AssertionCredentials $assertionCredentials */
|
45 |
private $assertionCredentials;
|
46 |
|
47 |
/**
|
55 |
private $token = array();
|
56 |
|
57 |
/**
|
58 |
+
* @var IWP_google_Client the base client
|
59 |
*/
|
60 |
private $client;
|
61 |
|
63 |
* Instantiates the class, but does not initiate the login flow, leaving it
|
64 |
* to the discretion of the caller.
|
65 |
*/
|
66 |
+
public function __construct(IWP_google_Client $client)
|
67 |
{
|
68 |
$this->client = $client;
|
69 |
}
|
74 |
* (which can modify the request in what ever way fits the auth mechanism)
|
75 |
* and then calls apiCurlIO::makeRequest on the signed request
|
76 |
*
|
77 |
+
* @param IWP_google_Http_Request $request
|
78 |
+
* @return IWP_google_Http_Request The resulting HTTP response including the
|
79 |
* responseHttpCode, responseHeaders and responseBody.
|
80 |
*/
|
81 |
+
public function authenticatedRequest(IWP_google_Http_Request $request)
|
82 |
{
|
83 |
$request = $this->sign($request);
|
84 |
return $this->client->getIo()->makeRequest($request);
|
86 |
|
87 |
/**
|
88 |
* @param string $code
|
89 |
+
* @throws IWP_google_Auth_Exception
|
90 |
* @return string
|
91 |
*/
|
92 |
public function authenticate($code)
|
93 |
{
|
94 |
if (strlen($code) == 0) {
|
95 |
+
throw new IWP_google_Auth_Exception("Invalid code");
|
96 |
}
|
97 |
|
98 |
// We got here from the redirect from a successful authorization grant,
|
99 |
// fetch the access token
|
100 |
+
$request = new IWP_google_Http_Request(
|
101 |
self::OAUTH2_TOKEN_URI,
|
102 |
'POST',
|
103 |
array(),
|
121 |
if ($decodedResponse != null && $decodedResponse['error']) {
|
122 |
$decodedResponse = $decodedResponse['error'];
|
123 |
}
|
124 |
+
throw new IWP_google_Auth_Exception(
|
125 |
sprintf(
|
126 |
"Error fetching OAuth2 access token, message: '%s'",
|
127 |
$decodedResponse
|
165 |
|
166 |
/**
|
167 |
* @param string $token
|
168 |
+
* @throws IWP_google_Auth_Exception
|
169 |
*/
|
170 |
public function setAccessToken($token)
|
171 |
{
|
172 |
$token = json_decode($token, true);
|
173 |
if ($token == null) {
|
174 |
+
throw new IWP_google_Auth_Exception('Could not json decode the token');
|
175 |
}
|
176 |
if (! isset($token['access_token'])) {
|
177 |
+
throw new IWP_google_Auth_Exception("Invalid token format");
|
178 |
}
|
179 |
$this->token = $token;
|
180 |
}
|
189 |
$this->state = $state;
|
190 |
}
|
191 |
|
192 |
+
public function setAssertionCredentials(IWP_google_Auth_AssertionCredentials $creds)
|
193 |
{
|
194 |
$this->assertionCredentials = $creds;
|
195 |
}
|
196 |
|
197 |
/**
|
198 |
* Include an accessToken in a given apiHttpRequest.
|
199 |
+
* @param IWP_google_Http_Request $request
|
200 |
+
* @return IWP_google_Http_Request
|
201 |
+
* @throws IWP_google_Auth_Exception
|
202 |
*/
|
203 |
+
public function sign(IWP_google_Http_Request $request)
|
204 |
{
|
205 |
// add the developer key to the request before signing it
|
206 |
if ($this->client->getClassConfig($this, 'developer_key')) {
|
219 |
$this->refreshTokenWithAssertion();
|
220 |
} else {
|
221 |
if (! array_key_exists('refresh_token', $this->token)) {
|
222 |
+
throw new IWP_google_Auth_Exception(
|
223 |
"The OAuth 2.0 access token has expired,"
|
224 |
." and a refresh token is not available. Refresh tokens"
|
225 |
." are not returned for responses that were auto-approved."
|
256 |
|
257 |
/**
|
258 |
* Fetches a fresh access token with a given assertion token.
|
259 |
+
* @param IWP_google_Auth_AssertionCredentials $assertionCredentials optional.
|
260 |
* @return void
|
261 |
*/
|
262 |
public function refreshTokenWithAssertion($assertionCredentials = null)
|
299 |
|
300 |
private function refreshTokenRequest($params)
|
301 |
{
|
302 |
+
$http = new IWP_google_Http_Request(
|
303 |
self::OAUTH2_TOKEN_URI,
|
304 |
'POST',
|
305 |
array(),
|
313 |
if (200 == $code) {
|
314 |
$token = json_decode($body, true);
|
315 |
if ($token == null) {
|
316 |
+
throw new IWP_google_Auth_Exception("Could not json decode the access token");
|
317 |
}
|
318 |
|
319 |
if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
|
320 |
+
throw new IWP_google_Auth_Exception("Invalid token format");
|
321 |
}
|
322 |
|
323 |
$this->token['access_token'] = $token['access_token'];
|
324 |
$this->token['expires_in'] = $token['expires_in'];
|
325 |
$this->token['created'] = time();
|
326 |
} else {
|
327 |
+
throw new IWP_google_Auth_Exception("Error refreshing the OAuth2 token, message: '$body'", $code);
|
328 |
}
|
329 |
}
|
330 |
|
331 |
/**
|
332 |
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
333 |
* token, if a token isn't provided.
|
334 |
+
* @throws IWP_google_Auth_Exception
|
335 |
* @param string|null $token The token (access token or a refresh token) that should be revoked.
|
336 |
* @return boolean Returns True if the revocation was successful, otherwise False.
|
337 |
*/
|
347 |
$token = $this->token['access_token'];
|
348 |
}
|
349 |
}
|
350 |
+
$request = new IWP_google_Http_Request(
|
351 |
self::OAUTH2_REVOKE_URI,
|
352 |
'POST',
|
353 |
array(),
|
404 |
if ($file) {
|
405 |
return json_decode($file, true);
|
406 |
} else {
|
407 |
+
throw new IWP_google_Auth_Exception(
|
408 |
"Failed to retrieve verification certificates: '" .
|
409 |
$url . "'."
|
410 |
);
|
413 |
|
414 |
// This relies on makeRequest caching certificate responses.
|
415 |
$request = $this->client->getIo()->makeRequest(
|
416 |
+
new IWP_google_Http_Request(
|
417 |
$url
|
418 |
)
|
419 |
);
|
423 |
return $certs;
|
424 |
}
|
425 |
}
|
426 |
+
throw new IWP_google_Auth_Exception(
|
427 |
"Failed to retrieve verification certificates: '" .
|
428 |
$request->getResponseBody() . "'.",
|
429 |
$request->getResponseHttpCode()
|
438 |
*
|
439 |
* @param $id_token
|
440 |
* @param $audience
|
441 |
+
* @return IWP_google_Auth_LoginTicket
|
442 |
*/
|
443 |
public function verifyIdToken($id_token = null, $audience = null)
|
444 |
{
|
477 |
|
478 |
$segments = explode(".", $jwt);
|
479 |
if (count($segments) != 3) {
|
480 |
+
throw new IWP_google_Auth_Exception("Wrong number of segments in token: $jwt");
|
481 |
}
|
482 |
$signed = $segments[0] . "." . $segments[1];
|
483 |
+
$signature = IWP_google_Utils::urlSafeB64Decode($segments[2]);
|
484 |
|
485 |
// Parse envelope.
|
486 |
+
$envelope = json_decode(IWP_google_Utils::urlSafeB64Decode($segments[0]), true);
|
487 |
if (!$envelope) {
|
488 |
+
throw new IWP_google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
|
489 |
}
|
490 |
|
491 |
// Parse token
|
492 |
+
$json_body = IWP_google_Utils::urlSafeB64Decode($segments[1]);
|
493 |
$payload = json_decode($json_body, true);
|
494 |
if (!$payload) {
|
495 |
+
throw new IWP_google_Auth_Exception("Can't parse token payload: " . $segments[1]);
|
496 |
}
|
497 |
|
498 |
// Check signature
|
499 |
$verified = false;
|
500 |
foreach ($certs as $keyName => $pem) {
|
501 |
+
$public_key = new IWP_google_Verifier_Pem($pem);
|
502 |
if ($public_key->verify($signed, $signature)) {
|
503 |
$verified = true;
|
504 |
break;
|
506 |
}
|
507 |
|
508 |
if (!$verified) {
|
509 |
+
throw new IWP_google_Auth_Exception("Invalid token signature: $jwt");
|
510 |
}
|
511 |
|
512 |
// Check issued-at timestamp
|
515 |
$iat = $payload["iat"];
|
516 |
}
|
517 |
if (!$iat) {
|
518 |
+
throw new IWP_google_Auth_Exception("No issue time in token: $json_body");
|
519 |
}
|
520 |
$earliest = $iat - self::CLOCK_SKEW_SECS;
|
521 |
|
526 |
$exp = $payload["exp"];
|
527 |
}
|
528 |
if (!$exp) {
|
529 |
+
throw new IWP_google_Auth_Exception("No expiration time in token: $json_body");
|
530 |
}
|
531 |
if ($exp >= $now + $max_expiry) {
|
532 |
+
throw new IWP_google_Auth_Exception(
|
533 |
sprintf("Expiration time too far in future: %s", $json_body)
|
534 |
);
|
535 |
}
|
536 |
|
537 |
$latest = $exp + self::CLOCK_SKEW_SECS;
|
538 |
if ($now < $earliest) {
|
539 |
+
throw new IWP_google_Auth_Exception(
|
540 |
sprintf(
|
541 |
"Token used too early, %s < %s: %s",
|
542 |
$now,
|
546 |
);
|
547 |
}
|
548 |
if ($now > $latest) {
|
549 |
+
throw new IWP_google_Auth_Exception(
|
550 |
sprintf(
|
551 |
"Token used too late, %s > %s: %s",
|
552 |
$now,
|
558 |
|
559 |
$iss = $payload['iss'];
|
560 |
if ($issuer && $iss != $issuer) {
|
561 |
+
throw new IWP_google_Auth_Exception(
|
562 |
sprintf(
|
563 |
"Invalid issuer, %s != %s: %s",
|
564 |
$iss,
|
571 |
// Check audience
|
572 |
$aud = $payload["aud"];
|
573 |
if ($aud != $required_audience) {
|
574 |
+
throw new IWP_google_Auth_Exception(
|
575 |
sprintf(
|
576 |
"Wrong recipient, %s != %s:",
|
577 |
$aud,
|
582 |
}
|
583 |
|
584 |
// All good.
|
585 |
+
return new IWP_google_Auth_LoginTicket($envelope, $payload);
|
586 |
}
|
587 |
}
|
lib/Google/Auth/Simple.php
CHANGED
@@ -25,12 +25,12 @@ require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Http/Request.php";
|
|
25 |
* @author Chris Chabot <chabotc@google.com>
|
26 |
* @author Chirag Shah <chirags@google.com>
|
27 |
*/
|
28 |
-
class
|
29 |
{
|
30 |
private $key = null;
|
31 |
private $client;
|
32 |
|
33 |
-
public function __construct(
|
34 |
{
|
35 |
$this->client = $client;
|
36 |
}
|
@@ -41,11 +41,11 @@ class Google_Auth_Simple extends Google_Auth_Abstract
|
|
41 |
* (which can modify the request in what ever way fits the auth mechanism)
|
42 |
* and then calls apiCurlIO::makeRequest on the signed request
|
43 |
*
|
44 |
-
* @param
|
45 |
-
* @return
|
46 |
* responseHttpCode, responseHeaders and responseBody.
|
47 |
*/
|
48 |
-
public function authenticatedRequest(
|
49 |
{
|
50 |
$request = $this->sign($request);
|
51 |
return $this->io->makeRequest($request);
|
@@ -53,7 +53,7 @@ class Google_Auth_Simple extends Google_Auth_Abstract
|
|
53 |
|
54 |
public function authenticate($code)
|
55 |
{
|
56 |
-
throw new
|
57 |
}
|
58 |
|
59 |
public function setAccessToken($accessToken)
|
@@ -81,7 +81,7 @@ class Google_Auth_Simple extends Google_Auth_Abstract
|
|
81 |
/* noop*/
|
82 |
}
|
83 |
|
84 |
-
public function sign(
|
85 |
{
|
86 |
$key = $this->client->getClassConfig($this, 'developer_key');
|
87 |
if ($key) {
|
25 |
* @author Chris Chabot <chabotc@google.com>
|
26 |
* @author Chirag Shah <chirags@google.com>
|
27 |
*/
|
28 |
+
class IWP_google_Auth_Simple extends IWP_google_Auth_Abstract
|
29 |
{
|
30 |
private $key = null;
|
31 |
private $client;
|
32 |
|
33 |
+
public function __construct(IWP_google_Client $client, $config = null)
|
34 |
{
|
35 |
$this->client = $client;
|
36 |
}
|
41 |
* (which can modify the request in what ever way fits the auth mechanism)
|
42 |
* and then calls apiCurlIO::makeRequest on the signed request
|
43 |
*
|
44 |
+
* @param IWP_google_Http_Request $request
|
45 |
+
* @return IWP_google_Http_Request The resulting HTTP response including the
|
46 |
* responseHttpCode, responseHeaders and responseBody.
|
47 |
*/
|
48 |
+
public function authenticatedRequest(IWP_google_Http_Request $request)
|
49 |
{
|
50 |
$request = $this->sign($request);
|
51 |
return $this->io->makeRequest($request);
|
53 |
|
54 |
public function authenticate($code)
|
55 |
{
|
56 |
+
throw new IWP_google_Auth_Exception("Simple auth does not exchange tokens.");
|
57 |
}
|
58 |
|
59 |
public function setAccessToken($accessToken)
|
81 |
/* noop*/
|
82 |
}
|
83 |
|
84 |
+
public function sign(IWP_google_Http_Request $request)
|
85 |
{
|
86 |
$key = $this->client->getClassConfig($this, 'developer_key');
|
87 |
if ($key) {
|
lib/Google/Cache/Abstract.php
CHANGED
@@ -20,10 +20,10 @@
|
|
20 |
*
|
21 |
* @author Chris Chabot <chabotc@google.com>
|
22 |
*/
|
23 |
-
abstract class
|
24 |
{
|
25 |
|
26 |
-
abstract public function __construct(
|
27 |
|
28 |
/**
|
29 |
* Retrieves the data for the given key, or false if they
|
20 |
*
|
21 |
* @author Chris Chabot <chabotc@google.com>
|
22 |
*/
|
23 |
+
abstract class IWP_google_Cache_Abstract
|
24 |
{
|
25 |
|
26 |
+
abstract public function __construct(IWP_google_Client $client);
|
27 |
|
28 |
/**
|
29 |
* Retrieves the data for the given key, or false if they
|
lib/Google/Cache/Apc.php
CHANGED
@@ -26,12 +26,12 @@ require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Cache/Exception.php";
|
|
26 |
*
|
27 |
* @author Chris Chabot <chabotc@google.com>
|
28 |
*/
|
29 |
-
class
|
30 |
{
|
31 |
-
public function __construct(
|
32 |
{
|
33 |
if (! function_exists('apc_add') ) {
|
34 |
-
throw new
|
35 |
}
|
36 |
}
|
37 |
|
@@ -58,7 +58,7 @@ class Google_Cache_Apc extends Google_Cache_Abstract
|
|
58 |
{
|
59 |
$rc = apc_store($key, array('time' => time(), 'data' => $value));
|
60 |
if ($rc == false) {
|
61 |
-
throw new
|
62 |
}
|
63 |
}
|
64 |
|
26 |
*
|
27 |
* @author Chris Chabot <chabotc@google.com>
|
28 |
*/
|
29 |
+
class IWP_google_Cache_Apc extends IWP_google_Cache_Abstract
|
30 |
{
|
31 |
+
public function __construct(IWP_google_Client $client)
|
32 |
{
|
33 |
if (! function_exists('apc_add') ) {
|
34 |
+
throw new IWP_google_Cache_Exception("Apc functions not available");
|
35 |
}
|
36 |
}
|
37 |
|
58 |
{
|
59 |
$rc = apc_store($key, array('time' => time(), 'data' => $value));
|
60 |
if ($rc == false) {
|
61 |
+
throw new IWP_google_Cache_Exception("Couldn't store data");
|
62 |
}
|
63 |
}
|
64 |
|
lib/Google/Cache/Exception.php
CHANGED
@@ -16,6 +16,6 @@
|
|
16 |
*/
|
17 |
require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Exception.php";
|
18 |
|
19 |
-
class
|
20 |
{
|
21 |
}
|
16 |
*/
|
17 |
require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Exception.php";
|
18 |
|
19 |
+
class IWP_google_Cache_Exception extends IWP_google_Exception
|
20 |
{
|
21 |
}
|
lib/Google/Cache/File.php
CHANGED
@@ -26,13 +26,13 @@ require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Cache/Exception.php";
|
|
26 |
*
|
27 |
* @author Chris Chabot <chabotc@google.com>
|
28 |
*/
|
29 |
-
class
|
30 |
{
|
31 |
const MAX_LOCK_RETRIES = 10;
|
32 |
private $path;
|
33 |
private $fh;
|
34 |
|
35 |
-
public function __construct(
|
36 |
{
|
37 |
$this->path = $client->getClassConfig($this, 'directory');
|
38 |
}
|
@@ -79,7 +79,7 @@ class Google_Cache_File extends Google_Cache_Abstract
|
|
79 |
{
|
80 |
$file = $this->getCacheFile($key);
|
81 |
if (file_exists($file) && !unlink($file)) {
|
82 |
-
throw new
|
83 |
}
|
84 |
}
|
85 |
|
@@ -101,7 +101,7 @@ class Google_Cache_File extends Google_Cache_Abstract
|
|
101 |
$storageDir = $this->path . '/' . substr(md5($file), 0, 2);
|
102 |
if ($forWrite && ! is_dir($storageDir)) {
|
103 |
if (! mkdir($storageDir, 0755, true)) {
|
104 |
-
throw new
|
105 |
}
|
106 |
}
|
107 |
return $storageDir;
|
26 |
*
|
27 |
* @author Chris Chabot <chabotc@google.com>
|
28 |
*/
|
29 |
+
class IWP_google_Cache_File extends IWP_google_Cache_Abstract
|
30 |
{
|
31 |
const MAX_LOCK_RETRIES = 10;
|
32 |
private $path;
|
33 |
private $fh;
|
34 |
|
35 |
+
public function __construct(IWP_google_Client $client)
|
36 |
{
|
37 |
$this->path = $client->getClassConfig($this, 'directory');
|
38 |
}
|
79 |
{
|
80 |
$file = $this->getCacheFile($key);
|
81 |
if (file_exists($file) && !unlink($file)) {
|
82 |
+
throw new IWP_google_Cache_Exception("Cache file could not be deleted");
|
83 |
}
|
84 |
}
|
85 |
|
101 |
$storageDir = $this->path . '/' . substr(md5($file), 0, 2);
|
102 |
if ($forWrite && ! is_dir($storageDir)) {
|
103 |
if (! mkdir($storageDir, 0755, true)) {
|
104 |
+
throw new IWP_google_Cache_Exception("Could not create storage directory: $storageDir");
|
105 |
}
|
106 |
}
|
107 |
return $storageDir;
|
lib/Google/Cache/Memcache.php
CHANGED
@@ -28,17 +28,17 @@ require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Cache/Exception.php";
|
|
28 |
*
|
29 |
* @author Chris Chabot <chabotc@google.com>
|
30 |
*/
|
31 |
-
class
|
32 |
{
|
33 |
private $connection = false;
|
34 |
private $mc = false;
|
35 |
private $host;
|
36 |
private $port;
|
37 |
|
38 |
-
public function __construct(
|
39 |
{
|
40 |
if (!function_exists('memcache_connect') && !class_exists("Memcached")) {
|
41 |
-
throw new
|
42 |
}
|
43 |
if ($client->isAppEngine()) {
|
44 |
// No credentials needed for GAE.
|
@@ -48,7 +48,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
|
|
48 |
$this->host = $client->getClassConfig($this, 'host');
|
49 |
$this->port = $client->getClassConfig($this, 'port');
|
50 |
if (empty($this->host) || empty($this->port)) {
|
51 |
-
throw new
|
52 |
}
|
53 |
}
|
54 |
}
|
@@ -79,7 +79,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
|
|
79 |
* @inheritDoc
|
80 |
* @param string $key
|
81 |
* @param string $value
|
82 |
-
* @throws
|
83 |
*/
|
84 |
public function set($key, $value)
|
85 |
{
|
@@ -94,7 +94,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
|
|
94 |
$rc = memcache_set($this->connection, $key, $data, false);
|
95 |
}
|
96 |
if ($rc == false) {
|
97 |
-
throw new
|
98 |
}
|
99 |
}
|
100 |
|
@@ -131,7 +131,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
|
|
131 |
}
|
132 |
|
133 |
if (! $this->connection) {
|
134 |
-
throw new
|
135 |
}
|
136 |
}
|
137 |
}
|
28 |
*
|
29 |
* @author Chris Chabot <chabotc@google.com>
|
30 |
*/
|
31 |
+
class IWP_google_Cache_Memcache extends IWP_google_Cache_Abstract
|
32 |
{
|
33 |
private $connection = false;
|
34 |
private $mc = false;
|
35 |
private $host;
|
36 |
private $port;
|
37 |
|
38 |
+
public function __construct(IWP_google_Client $client)
|
39 |
{
|
40 |
if (!function_exists('memcache_connect') && !class_exists("Memcached")) {
|
41 |
+
throw new IWP_google_Cache_Exception("Memcache functions not available");
|
42 |
}
|
43 |
if ($client->isAppEngine()) {
|
44 |
// No credentials needed for GAE.
|
48 |
$this->host = $client->getClassConfig($this, 'host');
|
49 |
$this->port = $client->getClassConfig($this, 'port');
|
50 |
if (empty($this->host) || empty($this->port)) {
|
51 |
+
throw new IWP_google_Cache_Exception("You need to supply a valid memcache host and port");
|
52 |
}
|
53 |
}
|
54 |
}
|
79 |
* @inheritDoc
|
80 |
* @param string $key
|
81 |
* @param string $value
|
82 |
+
* @throws IWP_google_Cache_Exception
|
83 |
*/
|
84 |
public function set($key, $value)
|
85 |
{
|
94 |
$rc = memcache_set($this->connection, $key, $data, false);
|
95 |
}
|
96 |
if ($rc == false) {
|
97 |
+
throw new IWP_google_Cache_Exception("Couldn't store data in cache");
|
98 |
}
|
99 |
}
|
100 |
|
131 |
}
|
132 |
|
133 |
if (! $this->connection) {
|
134 |
+
throw new IWP_google_Cache_Exception("Couldn't connect to memcache server");
|
135 |
}
|
136 |
}
|
137 |
}
|
lib/Google/Cache/Null.php
CHANGED
@@ -22,9 +22,9 @@ require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Cache/Exception.php";
|
|
22 |
* A blank storage class, for cases where caching is not
|
23 |
* required.
|
24 |
*/
|
25 |
-
class
|
26 |
{
|
27 |
-
public function __construct(
|
28 |
{
|
29 |
|
30 |
}
|
22 |
* A blank storage class, for cases where caching is not
|
23 |
* required.
|
24 |
*/
|
25 |
+
class IWP_google_Cache_Null extends IWP_google_Cache_Abstract
|
26 |
{
|
27 |
+
public function __construct(IWP_google_Client $client)
|
28 |
{
|
29 |
|
30 |
}
|
lib/Google/Client.php
CHANGED
@@ -34,27 +34,27 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Service/Resource.php';
|
|
34 |
* @author Chris Chabot <chabotc@google.com>
|
35 |
* @author Chirag Shah <chirags@google.com>
|
36 |
*/
|
37 |
-
class
|
38 |
{
|
39 |
const LIBVER = "1.0.5-beta";
|
40 |
const USER_AGENT_SUFFIX = "google-api-php-client/";
|
41 |
/**
|
42 |
-
* @var
|
43 |
*/
|
44 |
private $auth;
|
45 |
|
46 |
/**
|
47 |
-
* @var
|
48 |
*/
|
49 |
private $io;
|
50 |
|
51 |
/**
|
52 |
-
* @var
|
53 |
*/
|
54 |
private $cache;
|
55 |
|
56 |
/**
|
57 |
-
* @var
|
58 |
*/
|
59 |
private $config;
|
60 |
|
@@ -76,7 +76,7 @@ class Google_Client
|
|
76 |
/**
|
77 |
* Construct the Google Client.
|
78 |
*
|
79 |
-
* @param $config
|
80 |
*/
|
81 |
public function __construct($config = null)
|
82 |
{
|
@@ -86,26 +86,26 @@ class Google_Client
|
|
86 |
}
|
87 |
|
88 |
if (is_string($config) && strlen($config)) {
|
89 |
-
$config = new
|
90 |
-
} else if ( !($config instanceof
|
91 |
-
$config = new
|
92 |
|
93 |
if ($this->isAppEngine()) {
|
94 |
// Automatically use Memcache if we're in AppEngine.
|
95 |
-
$config->setCacheClass('
|
96 |
}
|
97 |
|
98 |
if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
|
99 |
// Automatically disable compress.zlib, as currently unsupported.
|
100 |
-
$config->setClassConfig('
|
101 |
}
|
102 |
}
|
103 |
|
104 |
-
if ($config->getIoClass() ==
|
105 |
if (function_exists('curl_version') && function_exists('curl_exec')) {
|
106 |
-
$config->setIoClass("
|
107 |
} else {
|
108 |
-
$config->setIoClass("
|
109 |
}
|
110 |
}
|
111 |
|
@@ -147,7 +147,7 @@ class Google_Client
|
|
147 |
$data = json_decode($json);
|
148 |
$key = isset($data->installed) ? 'installed' : 'web';
|
149 |
if (!isset($data->$key)) {
|
150 |
-
throw new
|
151 |
}
|
152 |
$this->setClientId($data->$key->client_id);
|
153 |
$this->setClientSecret($data->$key->client_secret);
|
@@ -175,7 +175,7 @@ class Google_Client
|
|
175 |
public function prepareScopes()
|
176 |
{
|
177 |
if (empty($this->requestedScopes)) {
|
178 |
-
throw new
|
179 |
}
|
180 |
$scopes = implode(' ', $this->requestedScopes);
|
181 |
return $scopes;
|
@@ -183,7 +183,7 @@ class Google_Client
|
|
183 |
|
184 |
/**
|
185 |
* Set the OAuth 2.0 access token using the string that resulted from calling createAuthUrl()
|
186 |
-
* or
|
187 |
* @param string $accessToken JSON encoded string containing in the following format:
|
188 |
* {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
|
189 |
* "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
|
@@ -200,9 +200,9 @@ class Google_Client
|
|
200 |
|
201 |
/**
|
202 |
* Set the authenticator object
|
203 |
-
* @param
|
204 |
*/
|
205 |
-
public function setAuth(
|
206 |
{
|
207 |
$this->config->setAuthClass(get_class($auth));
|
208 |
$this->auth = $auth;
|
@@ -210,9 +210,9 @@ class Google_Client
|
|
210 |
|
211 |
/**
|
212 |
* Set the IO object
|
213 |
-
* @param
|
214 |
*/
|
215 |
-
public function setIo(
|
216 |
{
|
217 |
$this->config->setIoClass(get_class($io));
|
218 |
$this->io = $io;
|
@@ -220,9 +220,9 @@ class Google_Client
|
|
220 |
|
221 |
/**
|
222 |
* Set the Cache object
|
223 |
-
* @param
|
224 |
*/
|
225 |
-
public function setCache(
|
226 |
{
|
227 |
$this->config->setCacheClass(get_class($cache));
|
228 |
$this->cache = $cache;
|
@@ -367,7 +367,7 @@ class Google_Client
|
|
367 |
/**
|
368 |
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
369 |
* token, if a token isn't provided.
|
370 |
-
* @throws
|
371 |
* @param string|null $token The token (access token or a refresh token) that should be revoked.
|
372 |
* @return boolean Returns True if the revocation was successful, otherwise False.
|
373 |
*/
|
@@ -379,9 +379,9 @@ class Google_Client
|
|
379 |
/**
|
380 |
* Verify an id_token. This method will verify the current id_token, if one
|
381 |
* isn't provided.
|
382 |
-
* @throws
|
383 |
* @param string|null $token The token (id_token) that should be verified.
|
384 |
-
* @return
|
385 |
* successful.
|
386 |
*/
|
387 |
public function verifyIdToken($token = null)
|
@@ -401,16 +401,16 @@ class Google_Client
|
|
401 |
*/
|
402 |
public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
|
403 |
{
|
404 |
-
$auth = new
|
405 |
$certs = $auth->retrieveCertsFromLocation($cert_location);
|
406 |
return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
|
407 |
}
|
408 |
|
409 |
/**
|
410 |
-
* @param
|
411 |
* @return void
|
412 |
*/
|
413 |
-
public function setAssertionCredentials(
|
414 |
{
|
415 |
$this->getAuth()->setAssertionCredentials($creds);
|
416 |
}
|
@@ -486,21 +486,21 @@ class Google_Client
|
|
486 |
*/
|
487 |
public function execute($request)
|
488 |
{
|
489 |
-
if ($request instanceof
|
490 |
$request->setUserAgent(
|
491 |
$this->getApplicationName()
|
492 |
. " " . self::USER_AGENT_SUFFIX
|
493 |
. $this->getLibraryVersion()
|
494 |
);
|
495 |
-
if (!$this->getClassConfig("
|
496 |
$request->enableGzip();
|
497 |
}
|
498 |
$request->maybeMoveParametersToBody();
|
499 |
-
return
|
500 |
-
} else if ($request instanceof
|
501 |
return $request->execute();
|
502 |
} else {
|
503 |
-
throw new
|
504 |
}
|
505 |
}
|
506 |
|
@@ -514,7 +514,7 @@ class Google_Client
|
|
514 |
}
|
515 |
|
516 |
/**
|
517 |
-
* @return
|
518 |
*/
|
519 |
public function getAuth()
|
520 |
{
|
@@ -526,7 +526,7 @@ class Google_Client
|
|
526 |
}
|
527 |
|
528 |
/**
|
529 |
-
* @return
|
530 |
*/
|
531 |
public function getIo()
|
532 |
{
|
@@ -538,7 +538,7 @@ class Google_Client
|
|
538 |
}
|
539 |
|
540 |
/**
|
541 |
-
* @return
|
542 |
*/
|
543 |
public function getCache()
|
544 |
{
|
@@ -564,7 +564,7 @@ class Google_Client
|
|
564 |
|
565 |
/**
|
566 |
* Set configuration specific to a given class.
|
567 |
-
* $config->setClassConfig('
|
568 |
* array('directory' => '/tmp/cache'));
|
569 |
* @param $class The class name for the configuration
|
570 |
* @param $config string key or an array of configuration values
|
34 |
* @author Chris Chabot <chabotc@google.com>
|
35 |
* @author Chirag Shah <chirags@google.com>
|
36 |
*/
|
37 |
+
class IWP_google_Client
|
38 |
{
|
39 |
const LIBVER = "1.0.5-beta";
|
40 |
const USER_AGENT_SUFFIX = "google-api-php-client/";
|
41 |
/**
|
42 |
+
* @var IWP_google_Auth_Abstract $auth
|
43 |
*/
|
44 |
private $auth;
|
45 |
|
46 |
/**
|
47 |
+
* @var IWP_google_IO_Abstract $io
|
48 |
*/
|
49 |
private $io;
|
50 |
|
51 |
/**
|
52 |
+
* @var IWP_google_Cache_Abstract $cache
|
53 |
*/
|
54 |
private $cache;
|
55 |
|
56 |
/**
|
57 |
+
* @var IWP_google_Config $config
|
58 |
*/
|
59 |
private $config;
|
60 |
|
76 |
/**
|
77 |
* Construct the Google Client.
|
78 |
*
|
79 |
+
* @param $config IWP_google_Config or string for the ini file to load
|
80 |
*/
|
81 |
public function __construct($config = null)
|
82 |
{
|
86 |
}
|
87 |
|
88 |
if (is_string($config) && strlen($config)) {
|
89 |
+
$config = new IWP_google_Config($config);
|
90 |
+
} else if ( !($config instanceof IWP_google_Config)) {
|
91 |
+
$config = new IWP_google_Config();
|
92 |
|
93 |
if ($this->isAppEngine()) {
|
94 |
// Automatically use Memcache if we're in AppEngine.
|
95 |
+
$config->setCacheClass('IWP_google_Cache_Memcache');
|
96 |
}
|
97 |
|
98 |
if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
|
99 |
// Automatically disable compress.zlib, as currently unsupported.
|
100 |
+
$config->setClassConfig('IWP_google_Http_Request', 'disable_gzip', true);
|
101 |
}
|
102 |
}
|
103 |
|
104 |
+
if ($config->getIoClass() == IWP_google_Config::USE_AUTO_IO_SELECTION) {
|
105 |
if (function_exists('curl_version') && function_exists('curl_exec')) {
|
106 |
+
$config->setIoClass("IWP_google_Io_Curl");
|
107 |
} else {
|
108 |
+
$config->setIoClass("IWP_google_Io_Stream");
|
109 |
}
|
110 |
}
|
111 |
|
147 |
$data = json_decode($json);
|
148 |
$key = isset($data->installed) ? 'installed' : 'web';
|
149 |
if (!isset($data->$key)) {
|
150 |
+
throw new IWP_google_Exception("Invalid client secret JSON file.");
|
151 |
}
|
152 |
$this->setClientId($data->$key->client_id);
|
153 |
$this->setClientSecret($data->$key->client_secret);
|
175 |
public function prepareScopes()
|
176 |
{
|
177 |
if (empty($this->requestedScopes)) {
|
178 |
+
throw new IWP_google_Auth_Exception("No scopes specified");
|
179 |
}
|
180 |
$scopes = implode(' ', $this->requestedScopes);
|
181 |
return $scopes;
|
183 |
|
184 |
/**
|
185 |
* Set the OAuth 2.0 access token using the string that resulted from calling createAuthUrl()
|
186 |
+
* or IWP_google_Client#getAccessToken().
|
187 |
* @param string $accessToken JSON encoded string containing in the following format:
|
188 |
* {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
|
189 |
* "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
|
200 |
|
201 |
/**
|
202 |
* Set the authenticator object
|
203 |
+
* @param IWP_google_Auth_Abstract $auth
|
204 |
*/
|
205 |
+
public function setAuth(IWP_google_Auth_Abstract $auth)
|
206 |
{
|
207 |
$this->config->setAuthClass(get_class($auth));
|
208 |
$this->auth = $auth;
|
210 |
|
211 |
/**
|
212 |
* Set the IO object
|
213 |
+
* @param IWP_google_Io_Abstract $auth
|
214 |
*/
|
215 |
+
public function setIo(IWP_google_Io_Abstract $io)
|
216 |
{
|
217 |
$this->config->setIoClass(get_class($io));
|
218 |
$this->io = $io;
|
220 |
|
221 |
/**
|
222 |
* Set the Cache object
|
223 |
+
* @param IWP_google_Cache_Abstract $auth
|
224 |
*/
|
225 |
+
public function setCache(IWP_google_Cache_Abstract $cache)
|
226 |
{
|
227 |
$this->config->setCacheClass(get_class($cache));
|
228 |
$this->cache = $cache;
|
367 |
/**
|
368 |
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
369 |
* token, if a token isn't provided.
|
370 |
+
* @throws IWP_google_Auth_Exception
|
371 |
* @param string|null $token The token (access token or a refresh token) that should be revoked.
|
372 |
* @return boolean Returns True if the revocation was successful, otherwise False.
|
373 |
*/
|
379 |
/**
|
380 |
* Verify an id_token. This method will verify the current id_token, if one
|
381 |
* isn't provided.
|
382 |
+
* @throws IWP_google_Auth_Exception
|
383 |
* @param string|null $token The token (id_token) that should be verified.
|
384 |
+
* @return IWP_google_Auth_LoginTicket Returns an apiLoginTicket if the verification was
|
385 |
* successful.
|
386 |
*/
|
387 |
public function verifyIdToken($token = null)
|
401 |
*/
|
402 |
public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
|
403 |
{
|
404 |
+
$auth = new IWP_google_Auth_OAuth2($this);
|
405 |
$certs = $auth->retrieveCertsFromLocation($cert_location);
|
406 |
return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
|
407 |
}
|
408 |
|
409 |
/**
|
410 |
+
* @param IWP_google_Auth_AssertionCredentials $creds
|
411 |
* @return void
|
412 |
*/
|
413 |
+
public function setAssertionCredentials(IWP_google_Auth_AssertionCredentials $creds)
|
414 |
{
|
415 |
$this->getAuth()->setAssertionCredentials($creds);
|
416 |
}
|
486 |
*/
|
487 |
public function execute($request)
|
488 |
{
|
489 |
+
if ($request instanceof IWP_google_Http_Request) {
|
490 |
$request->setUserAgent(
|
491 |
$this->getApplicationName()
|
492 |
. " " . self::USER_AGENT_SUFFIX
|
493 |
. $this->getLibraryVersion()
|
494 |
);
|
495 |
+
if (!$this->getClassConfig("IWP_google_Http_Request", "disable_gzip")) {
|
496 |
$request->enableGzip();
|
497 |
}
|
498 |
$request->maybeMoveParametersToBody();
|
499 |
+
return IWP_google_Http_REST::execute($this, $request);
|
500 |
+
} else if ($request instanceof IWP_google_Http_Batch) {
|
501 |
return $request->execute();
|
502 |
} else {
|
503 |
+
throw new IWP_google_Exception("Do not know how to execute this type of object.");
|
504 |
}
|
505 |
}
|
506 |
|
514 |
}
|
515 |
|
516 |
/**
|
517 |
+
* @return IWP_google_Auth_Abstract Authentication implementation
|
518 |
*/
|
519 |
public function getAuth()
|
520 |
{
|
526 |
}
|
527 |
|
528 |
/**
|
529 |
+
* @return IWP_google_IO_Abstract IO implementation
|
530 |
*/
|
531 |
public function getIo()
|
532 |
{
|
538 |
}
|
539 |
|
540 |
/**
|
541 |
+
* @return IWP_google_Cache_Abstract Cache implementation
|
542 |
*/
|
543 |
public function getCache()
|
544 |
{
|
564 |
|
565 |
/**
|
566 |
* Set configuration specific to a given class.
|
567 |
+
* $config->setClassConfig('IWP_google_Cache_File',
|
568 |
* array('directory' => '/tmp/cache'));
|
569 |
* @param $class The class name for the configuration
|
570 |
* @param $config string key or an array of configuration values
|
lib/Google/Collection.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Model.php";
|
4 |
|
5 |
/**
|
6 |
-
* Extension to the regular
|
7 |
* exposes the items array for iteration, so you can just
|
8 |
* iterate over the object rather than a reference inside.
|
9 |
*/
|
10 |
-
class
|
11 |
{
|
12 |
protected $collection_key = 'items';
|
13 |
|
3 |
require_once $GLOBALS['iwp_mmb_plugin_dir']."/lib/Google/Model.php";
|
4 |
|
5 |
/**
|
6 |
+
* Extension to the regular IWP_google_Model that automatically
|
7 |
* exposes the items array for iteration, so you can just
|
8 |
* iterate over the object rather than a reference inside.
|
9 |
*/
|
10 |
+
class IWP_google_Collection extends IWP_google_Model implements Iterator, Countable
|
11 |
{
|
12 |
protected $collection_key = 'items';
|
13 |
|
lib/Google/Config.php
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
/**
|
19 |
* A class to contain the library configuration for the Google API client.
|
20 |
*/
|
21 |
-
class
|
22 |
{
|
23 |
const GZIP_DISABLED = true;
|
24 |
const GZIP_ENABLED = false;
|
@@ -28,7 +28,7 @@ class Google_Config
|
|
28 |
private $configuration;
|
29 |
|
30 |
/**
|
31 |
-
* Create a new
|
32 |
* local configuration. For example:
|
33 |
* application_name: "My App";
|
34 |
*
|
@@ -41,9 +41,9 @@ class Google_Config
|
|
41 |
'application_name' => '',
|
42 |
|
43 |
// Which Authentication, Storage and HTTP IO classes to use.
|
44 |
-
'auth_class' => '
|
45 |
'io_class' => self::USE_AUTO_IO_SELECTION,
|
46 |
-
'cache_class' => '
|
47 |
|
48 |
// Don't change these unless you're working against a special development
|
49 |
// or testing environment.
|
@@ -51,10 +51,10 @@ class Google_Config
|
|
51 |
|
52 |
// Definition of class specific values, like file paths and so on.
|
53 |
'classes' => array(
|
54 |
-
'
|
55 |
'request_timeout_seconds' => 100,
|
56 |
),
|
57 |
-
'
|
58 |
// Disable the use of gzip on calls if set to true. Defaults to false.
|
59 |
'disable_gzip' => self::GZIP_ENABLED,
|
60 |
|
@@ -66,7 +66,7 @@ class Google_Config
|
|
66 |
),
|
67 |
// If you want to pass in OAuth 2.0 settings, they will need to be
|
68 |
// structured like this.
|
69 |
-
'
|
70 |
// Keys for OAuth 2.0 access, see the API console at
|
71 |
// https://developers.google.com/console
|
72 |
'client_id' => '',
|
@@ -85,8 +85,8 @@ class Google_Config
|
|
85 |
'https://www.googleapis.com/oauth2/v1/certs',
|
86 |
),
|
87 |
// Set a default directory for the file cache.
|
88 |
-
'
|
89 |
-
'directory' => sys_get_temp_dir() . '/
|
90 |
)
|
91 |
),
|
92 |
|
@@ -105,7 +105,7 @@ class Google_Config
|
|
105 |
|
106 |
/**
|
107 |
* Set configuration specific to a given class.
|
108 |
-
* $config->setClassConfig('
|
109 |
* array('directory' => '/tmp/cache'));
|
110 |
* @param $class The class name for the configuration
|
111 |
* @param $config string key or an array of configuration values
|
18 |
/**
|
19 |
* A class to contain the library configuration for the Google API client.
|
20 |
*/
|
21 |
+
class IWP_google_Config
|
22 |
{
|
23 |
const GZIP_DISABLED = true;
|
24 |
const GZIP_ENABLED = false;
|
28 |
private $configuration;
|
29 |
|
30 |
/**
|
31 |
+
* Create a new IWP_google_Config. Can accept an ini file location with the
|
32 |
* local configuration. For example:
|
33 |
* application_name: "My App";
|
34 |
*
|
41 |
'application_name' => '',
|
42 |
|
43 |
// Which Authentication, Storage and HTTP IO classes to use.
|
44 |
+
'auth_class' => 'IWP_google_Auth_OAuth2',
|
45 |
'io_class' => self::USE_AUTO_IO_SELECTION,
|
46 |
+
'cache_class' => 'IWP_google_Cache_File',
|
47 |
|
48 |
// Don't change these unless you're working against a special development
|
49 |
// or testing environment.
|
51 |
|
52 |
// Definition of class specific values, like file paths and so on.
|
53 |
'classes' => array(
|
54 |
+
'IWP_google_IO_Abstract' => array(
|
55 |
'request_timeout_seconds' => 100,
|
56 |
),
|
57 |
+
'IWP_google_Http_Request' => array(
|
58 |
// Disable the use of gzip on calls if set to true. Defaults to false.
|
59 |
'disable_gzip' => self::GZIP_ENABLED,
|
60 |
|
66 |
),
|
67 |
// If you want to pass in OAuth 2.0 settings, they will need to be
|
68 |
// structured like this.
|
69 |
+
'IWP_google_Auth_OAuth2' => array(
|
70 |
// Keys for OAuth 2.0 access, see the API console at
|
71 |
// https://developers.google.com/console
|
72 |
'client_id' => '',
|
85 |
'https://www.googleapis.com/oauth2/v1/certs',
|
86 |
),
|
87 |
// Set a default directory for the file cache.
|
88 |
+
'IWP_google_Cache_File' => array(
|
89 |
+
'directory' => sys_get_temp_dir() . '/IWP_google_Client'
|
90 |
)
|
91 |
),
|
92 |
|
105 |
|
106 |
/**
|
107 |
* Set configuration specific to a given class.
|
108 |
+
* $config->setClassConfig('IWP_google_Cache_File',
|
109 |
* array('directory' => '/tmp/cache'));
|
110 |
* @param $class The class name for the configuration
|
111 |
* @param $config string key or an array of configuration values
|
lib/Google/Exception.php
CHANGED
@@ -15,6 +15,6 @@
|
|
15 |
* limitations under the License.
|
16 |
*/
|
17 |
|
18 |
-
class
|
19 |
{
|
20 |
}
|
15 |
* limitations under the License.
|
16 |
*/
|
17 |
|
18 |
+
class IWP_google_Exception extends Exception
|
19 |
{
|
20 |
}
|
lib/Google/Http/Batch.php
CHANGED
@@ -22,7 +22,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Http/REST.php';
|
|
22 |
/**
|
23 |
* @author Chirag Shah <chirags@google.com>
|
24 |
*/
|
25 |
-
class
|
26 |
{
|
27 |
/** @var string Multipart Boundary. */
|
28 |
private $boundary;
|
@@ -30,14 +30,14 @@ class Google_Http_Batch
|
|
30 |
/** @var array service requests to be executed. */
|
31 |
private $requests = array();
|
32 |
|
33 |
-
/** @var
|
34 |
private $client;
|
35 |
|
36 |
private $expected_classes = array();
|
37 |
|
38 |
private $base_path;
|
39 |
|
40 |
-
public function __construct(
|
41 |
{
|
42 |
$this->client = $client;
|
43 |
$this->base_path = $this->client->getBasePath();
|
@@ -46,7 +46,7 @@ class Google_Http_Batch
|
|
46 |
$this->boundary = str_replace('"', '', $boundary);
|
47 |
}
|
48 |
|
49 |
-
public function add(
|
50 |
{
|
51 |
if (false == $key) {
|
52 |
$key = mt_rand();
|
@@ -59,7 +59,7 @@ class Google_Http_Batch
|
|
59 |
{
|
60 |
$body = '';
|
61 |
|
62 |
-
/** @var
|
63 |
foreach ($this->requests as $key => $req) {
|
64 |
$body .= "--{$this->boundary}\n";
|
65 |
$body .= $req->toBatchString($key) . "\n";
|
@@ -70,7 +70,7 @@ class Google_Http_Batch
|
|
70 |
$body .= "\n--{$this->boundary}--";
|
71 |
|
72 |
$url = $this->base_path . '/batch';
|
73 |
-
$httpRequest = new
|
74 |
$httpRequest->setRequestHeaders(
|
75 |
array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary)
|
76 |
);
|
@@ -81,7 +81,7 @@ class Google_Http_Batch
|
|
81 |
return $this->parseResponse($response);
|
82 |
}
|
83 |
|
84 |
-
public function parseResponse(
|
85 |
{
|
86 |
$contentType = $response->getResponseHeader('content-type');
|
87 |
$contentType = explode(';', $contentType);
|
@@ -110,7 +110,7 @@ class Google_Http_Batch
|
|
110 |
$status = $status[1];
|
111 |
|
112 |
list($partHeaders, $partBody) = $this->client->getIo()->ParseHttpResponse($part, false);
|
113 |
-
$response = new
|
114 |
$response->setResponseHttpCode($status);
|
115 |
$response->setResponseHeaders($partHeaders);
|
116 |
$response->setResponseBody($partBody);
|
@@ -125,9 +125,9 @@ class Google_Http_Batch
|
|
125 |
}
|
126 |
|
127 |
try {
|
128 |
-
$response =
|
129 |
$responses[$key] = $response;
|
130 |
-
} catch (
|
131 |
// Store the exception as the response, so succesful responses
|
132 |
// can be processed.
|
133 |
$responses[$key] = $e;
|
22 |
/**
|
23 |
* @author Chirag Shah <chirags@google.com>
|
24 |
*/
|
25 |
+
class IWP_google_Http_Batch
|
26 |
{
|
27 |
/** @var string Multipart Boundary. */
|
28 |
private $boundary;
|
30 |
/** @var array service requests to be executed. */
|
31 |
private $requests = array();
|
32 |
|
33 |
+
/** @var IWP_google_Client */
|
34 |
private $client;
|
35 |
|
36 |
private $expected_classes = array();
|
37 |
|
38 |
private $base_path;
|
39 |
|
40 |
+
public function __construct(IWP_google_Client $client, $boundary = false)
|
41 |
{
|
42 |
$this->client = $client;
|
43 |
$this->base_path = $this->client->getBasePath();
|
46 |
$this->boundary = str_replace('"', '', $boundary);
|
47 |
}
|
48 |
|
49 |
+
public function add(IWP_google_Http_Request $request, $key = false)
|
50 |
{
|
51 |
if (false == $key) {
|
52 |
$key = mt_rand();
|
59 |
{
|
60 |
$body = '';
|
61 |
|
62 |
+
/** @var IWP_google_Http_Request $req */
|
63 |
foreach ($this->requests as $key => $req) {
|
64 |
$body .= "--{$this->boundary}\n";
|
65 |
$body .= $req->toBatchString($key) . "\n";
|
70 |
$body .= "\n--{$this->boundary}--";
|
71 |
|
72 |
$url = $this->base_path . '/batch';
|
73 |
+
$httpRequest = new IWP_google_Http_Request($url, 'POST');
|
74 |
$httpRequest->setRequestHeaders(
|
75 |
array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary)
|
76 |
);
|
81 |
return $this->parseResponse($response);
|
82 |
}
|
83 |
|
84 |
+
public function parseResponse(IWP_google_Http_Request $response)
|
85 |
{
|
86 |
$contentType = $response->getResponseHeader('content-type');
|
87 |
$contentType = explode(';', $contentType);
|
110 |
$status = $status[1];
|
111 |
|
112 |
list($partHeaders, $partBody) = $this->client->getIo()->ParseHttpResponse($part, false);
|
113 |
+
$response = new IWP_google_Http_Request("");
|
114 |
$response->setResponseHttpCode($status);
|
115 |
$response->setResponseHeaders($partHeaders);
|
116 |
$response->setResponseBody($partBody);
|
125 |
}
|
126 |
|
127 |
try {
|
128 |
+
$response = IWP_google_Http_REST::decodeHttpResponse($response);
|
129 |
$responses[$key] = $response;
|
130 |
+
} catch (IWP_google_Service_Exception $e) {
|
131 |
// Store the exception as the response, so succesful responses
|
132 |
// can be processed.
|
133 |
$responses[$key] = $e;
|
lib/Google/Http/CacheParser.php
CHANGED
@@ -22,7 +22,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Http/Request.php';
|
|
22 |
* implementation is guided by the guidance offered in rfc2616-sec13.
|
23 |
* @author Chirag Shah <chirags@google.com>
|
24 |
*/
|
25 |
-
class
|
26 |
{
|
27 |
public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD');
|
28 |
public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301');
|
@@ -31,11 +31,11 @@ class Google_Http_CacheParser
|
|
31 |
* Check if an HTTP request can be cached by a private local cache.
|
32 |
*
|
33 |
* @static
|
34 |
-
* @param
|
35 |
* @return bool True if the request is cacheable.
|
36 |
* False if the request is uncacheable.
|
37 |
*/
|
38 |
-
public static function isRequestCacheable(
|
39 |
{
|
40 |
$method = $resp->getRequestMethod();
|
41 |
if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
|
@@ -57,11 +57,11 @@ class Google_Http_CacheParser
|
|
57 |
* Check if an HTTP response can be cached by a private local cache.
|
58 |
*
|
59 |
* @static
|
60 |
-
* @param
|
61 |
* @return bool True if the response is cacheable.
|
62 |
* False if the response is un-cacheable.
|
63 |
*/
|
64 |
-
public static function isResponseCacheable(
|
65 |
{
|
66 |
// First, check if the HTTP request was cacheable before inspecting the
|
67 |
// HTTP response.
|
@@ -109,11 +109,11 @@ class Google_Http_CacheParser
|
|
109 |
|
110 |
/**
|
111 |
* @static
|
112 |
-
* @param
|
113 |
* @return bool True if the HTTP response is considered to be expired.
|
114 |
* False if it is considered to be fresh.
|
115 |
*/
|
116 |
-
public static function isExpired(
|
117 |
{
|
118 |
// HTTP/1.1 clients and caches MUST treat other invalid date formats,
|
119 |
// especially including the value “0”, as in the past.
|
@@ -148,7 +148,7 @@ class Google_Http_CacheParser
|
|
148 |
// We can't default this to now, as that means future cache reads
|
149 |
// will always pass with the logic below, so we will require a
|
150 |
// date be injected if not supplied.
|
151 |
-
throw new
|
152 |
}
|
153 |
|
154 |
if (false == $freshnessLifetime && isset($responseHeaders['expires'])) {
|
@@ -171,10 +171,10 @@ class Google_Http_CacheParser
|
|
171 |
/**
|
172 |
* Determine if a cache entry should be revalidated with by the origin.
|
173 |
*
|
174 |
-
* @param
|
175 |
* @return bool True if the entry is expired, else return false.
|
176 |
*/
|
177 |
-
public static function mustRevalidate(
|
178 |
{
|
179 |
// [13.3] When a cache has a stale entry that it would like to use as a
|
180 |
// response to a client's request, it first has to check with the origin
|
22 |
* implementation is guided by the guidance offered in rfc2616-sec13.
|
23 |
* @author Chirag Shah <chirags@google.com>
|
24 |
*/
|
25 |
+
class IWP_google_Http_CacheParser
|
26 |
{
|
27 |
public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD');
|
28 |
public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301');
|
31 |
* Check if an HTTP request can be cached by a private local cache.
|
32 |
*
|
33 |
* @static
|
34 |
+
* @param IWP_google_Http_Request $resp
|
35 |
* @return bool True if the request is cacheable.
|
36 |
* False if the request is uncacheable.
|
37 |
*/
|
38 |
+
public static function isRequestCacheable(IWP_google_Http_Request $resp)
|
39 |
{
|
40 |
$method = $resp->getRequestMethod();
|
41 |
if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
|
57 |
* Check if an HTTP response can be cached by a private local cache.
|
58 |
*
|
59 |
* @static
|
60 |
+
* @param IWP_google_Http_Request $resp
|
61 |
* @return bool True if the response is cacheable.
|
62 |
* False if the response is un-cacheable.
|
63 |
*/
|
64 |
+
public static function isResponseCacheable(IWP_google_Http_Request $resp)
|
65 |
{
|
66 |
// First, check if the HTTP request was cacheable before inspecting the
|
67 |
// HTTP response.
|
109 |
|
110 |
/**
|
111 |
* @static
|
112 |
+
* @param IWP_google_Http_Request $resp
|
113 |
* @return bool True if the HTTP response is considered to be expired.
|
114 |
* False if it is considered to be fresh.
|
115 |
*/
|
116 |
+
public static function isExpired(IWP_google_Http_Request $resp)
|
117 |
{
|
118 |
// HTTP/1.1 clients and caches MUST treat other invalid date formats,
|
119 |
// especially including the value “0”, as in the past.
|
148 |
// We can't default this to now, as that means future cache reads
|
149 |
// will always pass with the logic below, so we will require a
|
150 |
// date be injected if not supplied.
|
151 |
+
throw new IWP_google_Exception("All cacheable requests must have creation dates.");
|
152 |
}
|
153 |
|
154 |
if (false == $freshnessLifetime && isset($responseHeaders['expires'])) {
|
171 |
/**
|
172 |
* Determine if a cache entry should be revalidated with by the origin.
|
173 |
*
|
174 |
+
* @param IWP_google_Http_Request $response
|
175 |
* @return bool True if the entry is expired, else return false.
|
176 |
*/
|
177 |
+
public static function mustRevalidate(IWP_google_Http_Request $response)
|
178 |
{
|
179 |
// [13.3] When a cache has a stale entry that it would like to use as a
|
180 |
// response to a client's request, it first has to check with the origin
|
lib/Google/Http/MediaFileUpload.php
CHANGED
@@ -25,7 +25,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Utils.php';
|
|
25 |
* @author Chirag Shah <chirags@google.com>
|
26 |
*
|
27 |
*/
|
28 |
-
class
|
29 |
{
|
30 |
const UPLOAD_MEDIA_TYPE = 'media';
|
31 |
const UPLOAD_MULTIPART_TYPE = 'multipart';
|
@@ -52,10 +52,10 @@ class Google_Http_MediaFileUpload
|
|
52 |
/** @var int $progress */
|
53 |
private $progress;
|
54 |
|
55 |
-
/** @var
|
56 |
private $client;
|
57 |
|
58 |
-
/** @var
|
59 |
private $request;
|
60 |
|
61 |
/** @var string */
|
@@ -75,8 +75,8 @@ class Google_Http_MediaFileUpload
|
|
75 |
* only used if resumable=True
|
76 |
*/
|
77 |
public function __construct(
|
78 |
-
|
79 |
-
|
80 |
$mimeType,
|
81 |
$data,
|
82 |
$resumable = false,
|
@@ -141,6 +141,8 @@ class Google_Http_MediaFileUpload
|
|
141 |
$this->resumeUri = $this->getResumeUri();
|
142 |
}
|
143 |
|
|
|
|
|
144 |
if (false == $chunk) {
|
145 |
$chunk = substr($this->data, $this->progress, $this->chunkSize);
|
146 |
}
|
@@ -153,14 +155,14 @@ class Google_Http_MediaFileUpload
|
|
153 |
'expect' => '',
|
154 |
);
|
155 |
|
156 |
-
$httpRequest = new
|
157 |
$this->resumeUri,
|
158 |
'PUT',
|
159 |
$headers,
|
160 |
$chunk
|
161 |
);
|
162 |
|
163 |
-
if ($this->client->getClassConfig("
|
164 |
$httpRequest->enableGzip();
|
165 |
} else {
|
166 |
$httpRequest->disableGzip();
|
@@ -189,9 +191,9 @@ class Google_Http_MediaFileUpload
|
|
189 |
return $status;
|
190 |
} else {
|
191 |
$status['progress'] = $this->progress;
|
192 |
-
$status['status'] =
|
193 |
return $status;
|
194 |
-
//return
|
195 |
}
|
196 |
}
|
197 |
|
@@ -283,7 +285,7 @@ class Google_Http_MediaFileUpload
|
|
283 |
if ($body) {
|
284 |
$headers = array(
|
285 |
'content-type' => 'application/json; charset=UTF-8',
|
286 |
-
'content-length' =>
|
287 |
'x-upload-content-type' => $this->mimeType,
|
288 |
'x-upload-content-length' => $this->size,
|
289 |
'expect' => '',
|
@@ -298,6 +300,6 @@ class Google_Http_MediaFileUpload
|
|
298 |
if (200 == $code && true == $location) {
|
299 |
return $location;
|
300 |
}
|
301 |
-
throw new
|
302 |
}
|
303 |
}
|
25 |
* @author Chirag Shah <chirags@google.com>
|
26 |
*
|
27 |
*/
|
28 |
+
class IWP_google_Http_MediaFileUpload
|
29 |
{
|
30 |
const UPLOAD_MEDIA_TYPE = 'media';
|
31 |
const UPLOAD_MULTIPART_TYPE = 'multipart';
|
52 |
/** @var int $progress */
|
53 |
private $progress;
|
54 |
|
55 |
+
/** @var IWP_google_Client */
|
56 |
private $client;
|
57 |
|
58 |
+
/** @var IWP_google_Http_Request */
|
59 |
private $request;
|
60 |
|
61 |
/** @var string */
|
75 |
* only used if resumable=True
|
76 |
*/
|
77 |
public function __construct(
|
78 |
+
IWP_google_Client $client,
|
79 |
+
IWP_google_Http_Request $request,
|
80 |
$mimeType,
|
81 |
$data,
|
82 |
$resumable = false,
|
141 |
$this->resumeUri = $this->getResumeUri();
|
142 |
}
|
143 |
|
144 |
+
file_put_contents(WP_CONTENT_DIR .'/DE_clientPluginSIde.php',"\n ------ resumeURI-------- ".var_export($this->resumeUri,true)."\n",FILE_APPEND);
|
145 |
+
|
146 |
if (false == $chunk) {
|
147 |
$chunk = substr($this->data, $this->progress, $this->chunkSize);
|
148 |
}
|
155 |
'expect' => '',
|
156 |
);
|
157 |
|
158 |
+
$httpRequest = new IWP_google_Http_Request(
|
159 |
$this->resumeUri,
|
160 |
'PUT',
|
161 |
$headers,
|
162 |
$chunk
|
163 |
);
|
164 |
|
165 |
+
if ($this->client->getClassConfig("IWP_google_Http_Request", "enable_gzip_for_uploads")) {
|
166 |
$httpRequest->enableGzip();
|
167 |
} else {
|
168 |
$httpRequest->disableGzip();
|
191 |
return $status;
|
192 |
} else {
|
193 |
$status['progress'] = $this->progress;
|
194 |
+
$status['status'] = IWP_google_Http_REST::decodeHttpResponse($response);
|
195 |
return $status;
|
196 |
+
//return IWP_google_Http_REST::decodeHttpResponse($response);
|
197 |
}
|
198 |
}
|
199 |
|
285 |
if ($body) {
|
286 |
$headers = array(
|
287 |
'content-type' => 'application/json; charset=UTF-8',
|
288 |
+
'content-length' => IWP_google_Utils::getStrLen($body),
|
289 |
'x-upload-content-type' => $this->mimeType,
|
290 |
'x-upload-content-length' => $this->size,
|
291 |
'expect' => '',
|
300 |
if (200 == $code && true == $location) {
|
301 |
return $location;
|
302 |
}
|
303 |
+
throw new IWP_google_Exception("Failed to start the resumable upload");
|
304 |
}
|
305 |
}
|
lib/Google/Http/REST.php
CHANGED
@@ -26,18 +26,18 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Utils/URITemplate.php';
|
|
26 |
* @author Chris Chabot <chabotc@google.com>
|
27 |
* @author Chirag Shah <chirags@google.com>
|
28 |
*/
|
29 |
-
class
|
30 |
{
|
31 |
/**
|
32 |
-
* Executes a
|
33 |
*
|
34 |
-
* @param
|
35 |
-
* @param
|
36 |
* @return array decoded result
|
37 |
-
* @throws
|
38 |
* invalid or malformed post body, invalid url)
|
39 |
*/
|
40 |
-
public static function execute(
|
41 |
{
|
42 |
$httpRequest = $client->getIo()->makeRequest($req);
|
43 |
$httpRequest->setExpectedClass($req->getExpectedClass());
|
@@ -47,8 +47,8 @@ class Google_Http_REST
|
|
47 |
/**
|
48 |
* Decode an HTTP Response.
|
49 |
* @static
|
50 |
-
* @throws
|
51 |
-
* @param
|
52 |
* @return mixed|null
|
53 |
*/
|
54 |
public static function decodeHttpResponse($response)
|
@@ -76,14 +76,14 @@ class Google_Http_REST
|
|
76 |
$errors = $decoded['error']['errors'];
|
77 |
}
|
78 |
|
79 |
-
throw new
|
80 |
}
|
81 |
|
82 |
// Only attempt to decode the response, if the response code wasn't (204) 'no content'
|
83 |
if ($code != '204') {
|
84 |
$decoded = json_decode($body, true);
|
85 |
if ($decoded === null || $decoded === "") {
|
86 |
-
throw new
|
87 |
}
|
88 |
|
89 |
if ($response->getExpectedClass()) {
|
@@ -126,7 +126,7 @@ class Google_Http_REST
|
|
126 |
}
|
127 |
|
128 |
if (count($uriTemplateVars)) {
|
129 |
-
$uriTemplateParser = new
|
130 |
$requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
|
131 |
}
|
132 |
|
26 |
* @author Chris Chabot <chabotc@google.com>
|
27 |
* @author Chirag Shah <chirags@google.com>
|
28 |
*/
|
29 |
+
class IWP_google_Http_REST
|
30 |
{
|
31 |
/**
|
32 |
+
* Executes a IWP_google_Http_Request
|
33 |
*
|
34 |
+
* @param IWP_google_Client $client
|
35 |
+
* @param IWP_google_Http_Request $req
|
36 |
* @return array decoded result
|
37 |
+
* @throws IWP_google_Service_Exception on server side error (ie: not authenticated,
|
38 |
* invalid or malformed post body, invalid url)
|
39 |
*/
|
40 |
+
public static function execute(IWP_google_Client $client, IWP_google_Http_Request $req)
|
41 |
{
|
42 |
$httpRequest = $client->getIo()->makeRequest($req);
|
43 |
$httpRequest->setExpectedClass($req->getExpectedClass());
|
47 |
/**
|
48 |
* Decode an HTTP Response.
|
49 |
* @static
|
50 |
+
* @throws IWP_google_Service_Exception
|
51 |
+
* @param IWP_google_Http_Request $response The http response to be decoded.
|
52 |
* @return mixed|null
|
53 |
*/
|
54 |
public static function decodeHttpResponse($response)
|
76 |
$errors = $decoded['error']['errors'];
|
77 |
}
|
78 |
|
79 |
+
throw new IWP_google_Service_Exception($err, $code, null, $errors);
|
80 |
}
|
81 |
|
82 |
// Only attempt to decode the response, if the response code wasn't (204) 'no content'
|
83 |
if ($code != '204') {
|
84 |
$decoded = json_decode($body, true);
|
85 |
if ($decoded === null || $decoded === "") {
|
86 |
+
throw new IWP_google_Service_Exception("Invalid json in service response: $body");
|
87 |
}
|
88 |
|
89 |
if ($response->getExpectedClass()) {
|
126 |
}
|
127 |
|
128 |
if (count($uriTemplateVars)) {
|
129 |
+
$uriTemplateParser = new IWP_google_Utils_URITemplate();
|
130 |
$requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
|
131 |
}
|
132 |
|
lib/Google/Http/Request.php
CHANGED
@@ -25,7 +25,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Utils.php';
|
|
25 |
* @author Chirag Shah <chirags@google.com>
|
26 |
*
|
27 |
*/
|
28 |
-
class
|
29 |
{
|
30 |
const GZIP_UA = " (gzip)";
|
31 |
|
@@ -194,7 +194,7 @@ class Google_Http_Request
|
|
194 |
*/
|
195 |
public function setResponseHeaders($headers)
|
196 |
{
|
197 |
-
$headers =
|
198 |
if ($this->responseHeaders) {
|
199 |
$headers = array_merge($this->responseHeaders, $headers);
|
200 |
}
|
@@ -312,7 +312,7 @@ class Google_Http_Request
|
|
312 |
*/
|
313 |
public function setRequestHeaders($headers)
|
314 |
{
|
315 |
-
$headers =
|
316 |
if ($this->requestHeaders) {
|
317 |
$headers = array_merge($this->requestHeaders, $headers);
|
318 |
}
|
25 |
* @author Chirag Shah <chirags@google.com>
|
26 |
*
|
27 |
*/
|
28 |
+
class IWP_google_Http_Request
|
29 |
{
|
30 |
const GZIP_UA = " (gzip)";
|
31 |
|
194 |
*/
|
195 |
public function setResponseHeaders($headers)
|
196 |
{
|
197 |
+
$headers = IWP_google_Utils::normalize($headers);
|
198 |
if ($this->responseHeaders) {
|
199 |
$headers = array_merge($this->responseHeaders, $headers);
|
200 |
}
|
312 |
*/
|
313 |
public function setRequestHeaders($headers)
|
314 |
{
|
315 |
+
$headers = IWP_google_Utils::normalize($headers);
|
316 |
if ($this->requestHeaders) {
|
317 |
$headers = array_merge($this->requestHeaders, $headers);
|
318 |
}
|
lib/Google/IO/Abstract.php
CHANGED
@@ -24,31 +24,31 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/IO/Exception.php';
|
|
24 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Http/CacheParser.php';
|
25 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Http/Request.php';
|
26 |
|
27 |
-
abstract class
|
28 |
{
|
29 |
const UNKNOWN_CODE = 0;
|
30 |
const FORM_URLENCODED = 'application/x-www-form-urlencoded';
|
31 |
const CONNECTION_ESTABLISHED = "HTTP/1.0 200 Connection established\r\n\r\n";
|
32 |
private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
|
33 |
|
34 |
-
/** @var
|
35 |
protected $client;
|
36 |
|
37 |
-
public function __construct(
|
38 |
{
|
39 |
$this->client = $client;
|
40 |
-
$timeout = $client->getClassConfig('
|
41 |
if ($timeout > 0) {
|
42 |
$this->setTimeout($timeout);
|
43 |
}
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
-
* Executes a
|
48 |
-
* @param
|
49 |
-
* @return
|
50 |
*/
|
51 |
-
abstract public function executeRequest(
|
52 |
|
53 |
/**
|
54 |
* Set options that update the transport implementation's behavior.
|
@@ -77,14 +77,14 @@ abstract class Google_IO_Abstract
|
|
77 |
/**
|
78 |
* @visible for testing.
|
79 |
* Cache the response to an HTTP request if it is cacheable.
|
80 |
-
* @param
|
81 |
* @return bool Returns true if the insertion was successful.
|
82 |
* Otherwise, return false.
|
83 |
*/
|
84 |
-
public function setCachedRequest(
|
85 |
{
|
86 |
// Determine if the request is cacheable.
|
87 |
-
if (
|
88 |
$this->client->getCache()->set($request->getCacheKey(), $request);
|
89 |
return true;
|
90 |
}
|
@@ -95,16 +95,16 @@ abstract class Google_IO_Abstract
|
|
95 |
/**
|
96 |
* Execute an HTTP Request
|
97 |
*
|
98 |
-
* @param
|
99 |
-
* @return
|
100 |
* response headers and response body filled in
|
101 |
-
* @throws
|
102 |
*/
|
103 |
-
public function makeRequest(
|
104 |
{
|
105 |
// First, check to see if we have a valid cached version.
|
106 |
$cached = $this->getCachedRequest($request);
|
107 |
-
if ($cached !== false && $cached instanceof
|
108 |
if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
|
109 |
return $cached;
|
110 |
}
|
@@ -137,13 +137,13 @@ abstract class Google_IO_Abstract
|
|
137 |
|
138 |
/**
|
139 |
* @visible for testing.
|
140 |
-
* @param
|
141 |
-
* @return
|
142 |
* false if the operation was unsuccessful.
|
143 |
*/
|
144 |
-
public function getCachedRequest(
|
145 |
{
|
146 |
-
if (false ===
|
147 |
return false;
|
148 |
}
|
149 |
|
@@ -153,10 +153,10 @@ abstract class Google_IO_Abstract
|
|
153 |
/**
|
154 |
* @visible for testing
|
155 |
* Process an http request that contains an enclosed entity.
|
156 |
-
* @param
|
157 |
-
* @return
|
158 |
*/
|
159 |
-
public function processEntityRequest(
|
160 |
{
|
161 |
$postBody = $request->getPostBody();
|
162 |
$contentType = $request->getRequestHeader("content-type");
|
@@ -185,14 +185,14 @@ abstract class Google_IO_Abstract
|
|
185 |
/**
|
186 |
* Check if an already cached request must be revalidated, and if so update
|
187 |
* the request with the correct ETag headers.
|
188 |
-
* @param
|
189 |
-
* @param
|
190 |
* return bool If the cached object needs to be revalidated, false if it is
|
191 |
* still current and can be re-used.
|
192 |
*/
|
193 |
protected function checkMustRevalidateCachedRequest($cached, $request)
|
194 |
{
|
195 |
-
if (
|
196 |
$addHeaders = array();
|
197 |
if ($cached->getResponseHeader('etag')) {
|
198 |
// [13.3.4] If an entity tag has been provided by the origin server,
|
@@ -211,7 +211,7 @@ abstract class Google_IO_Abstract
|
|
211 |
|
212 |
/**
|
213 |
* Update a cached request, using the headers from the last response.
|
214 |
-
* @param
|
215 |
* @param mixed Associative array of response headers from the last request.
|
216 |
*/
|
217 |
protected function updateCachedRequest($cached, $responseHeaders)
|
24 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Http/CacheParser.php';
|
25 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Http/Request.php';
|
26 |
|
27 |
+
abstract class IWP_google_IO_Abstract
|
28 |
{
|
29 |
const UNKNOWN_CODE = 0;
|
30 |
const FORM_URLENCODED = 'application/x-www-form-urlencoded';
|
31 |
const CONNECTION_ESTABLISHED = "HTTP/1.0 200 Connection established\r\n\r\n";
|
32 |
private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
|
33 |
|
34 |
+
/** @var IWP_google_Client */
|
35 |
protected $client;
|
36 |
|
37 |
+
public function __construct(IWP_google_Client $client)
|
38 |
{
|
39 |
$this->client = $client;
|
40 |
+
$timeout = $client->getClassConfig('IWP_google_IO_Abstract', 'request_timeout_seconds');
|
41 |
if ($timeout > 0) {
|
42 |
$this->setTimeout($timeout);
|
43 |
}
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
+
* Executes a IWP_google_Http_Request and returns the resulting populated IWP_google_Http_Request
|
48 |
+
* @param IWP_google_Http_Request $request
|
49 |
+
* @return IWP_google_Http_Request $request
|
50 |
*/
|
51 |
+
abstract public function executeRequest(IWP_google_Http_Request $request);
|
52 |
|
53 |
/**
|
54 |
* Set options that update the transport implementation's behavior.
|
77 |
/**
|
78 |
* @visible for testing.
|
79 |
* Cache the response to an HTTP request if it is cacheable.
|
80 |
+
* @param IWP_google_Http_Request $request
|
81 |
* @return bool Returns true if the insertion was successful.
|
82 |
* Otherwise, return false.
|
83 |
*/
|
84 |
+
public function setCachedRequest(IWP_google_Http_Request $request)
|
85 |
{
|
86 |
// Determine if the request is cacheable.
|
87 |
+
if (IWP_google_Http_CacheParser::isResponseCacheable($request)) {
|
88 |
$this->client->getCache()->set($request->getCacheKey(), $request);
|
89 |
return true;
|
90 |
}
|
95 |
/**
|
96 |
* Execute an HTTP Request
|
97 |
*
|
98 |
+
* @param IWP_google_HttpRequest $request the http request to be executed
|
99 |
+
* @return IWP_google_HttpRequest http request with the response http code,
|
100 |
* response headers and response body filled in
|
101 |
+
* @throws IWP_google_IO_Exception on curl or IO error
|
102 |
*/
|
103 |
+
public function makeRequest(IWP_google_Http_Request $request)
|
104 |
{
|
105 |
// First, check to see if we have a valid cached version.
|
106 |
$cached = $this->getCachedRequest($request);
|
107 |
+
if ($cached !== false && $cached instanceof IWP_google_Http_Request) {
|
108 |
if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
|
109 |
return $cached;
|
110 |
}
|
137 |
|
138 |
/**
|
139 |
* @visible for testing.
|
140 |
+
* @param IWP_google_Http_Request $request
|
141 |
+
* @return IWP_google_Http_Request|bool Returns the cached object or
|
142 |
* false if the operation was unsuccessful.
|
143 |
*/
|
144 |
+
public function getCachedRequest(IWP_google_Http_Request $request)
|
145 |
{
|
146 |
+
if (false === IWP_google_Http_CacheParser::isRequestCacheable($request)) {
|
147 |
return false;
|
148 |
}
|
149 |
|
153 |
/**
|
154 |
* @visible for testing
|
155 |
* Process an http request that contains an enclosed entity.
|
156 |
+
* @param IWP_google_Http_Request $request
|
157 |
+
* @return IWP_google_Http_Request Processed request with the enclosed entity.
|
158 |
*/
|
159 |
+
public function processEntityRequest(IWP_google_Http_Request $request)
|
160 |
{
|
161 |
$postBody = $request->getPostBody();
|
162 |
$contentType = $request->getRequestHeader("content-type");
|
185 |
/**
|
186 |
* Check if an already cached request must be revalidated, and if so update
|
187 |
* the request with the correct ETag headers.
|
188 |
+
* @param IWP_google_Http_Request $cached A previously cached response.
|
189 |
+
* @param IWP_google_Http_Request $request The outbound request.
|
190 |
* return bool If the cached object needs to be revalidated, false if it is
|
191 |
* still current and can be re-used.
|
192 |
*/
|
193 |
protected function checkMustRevalidateCachedRequest($cached, $request)
|
194 |
{
|
195 |
+
if (IWP_google_Http_CacheParser::mustRevalidate($cached)) {
|
196 |
$addHeaders = array();
|
197 |
if ($cached->getResponseHeader('etag')) {
|
198 |
// [13.3.4] If an entity tag has been provided by the origin server,
|
211 |
|
212 |
/**
|
213 |
* Update a cached request, using the headers from the last response.
|
214 |
+
* @param IWP_google_HttpRequest $cached A previously cached response.
|
215 |
* @param mixed Associative array of response headers from the last request.
|
216 |
*/
|
217 |
protected function updateCachedRequest($cached, $responseHeaders)
|
lib/Google/IO/Curl.php
CHANGED
@@ -16,14 +16,14 @@
|
|
16 |
*/
|
17 |
|
18 |
/**
|
19 |
-
* Curl based implementation of
|
20 |
*
|
21 |
* @author Stuart Langley <slangley@google.com>
|
22 |
*/
|
23 |
|
24 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/IO/Abstract.php';
|
25 |
|
26 |
-
class
|
27 |
{
|
28 |
// hex for version 7.31.0
|
29 |
const NO_QUIRK_VERSION = 0x071F00;
|
@@ -32,12 +32,12 @@ class Google_IO_Curl extends Google_IO_Abstract
|
|
32 |
/**
|
33 |
* Execute an HTTP Request
|
34 |
*
|
35 |
-
* @param
|
36 |
-
* @return
|
37 |
* response headers and response body filled in
|
38 |
-
* @throws
|
39 |
*/
|
40 |
-
public function executeRequest(
|
41 |
{
|
42 |
$curl = curl_init();
|
43 |
|
@@ -78,7 +78,7 @@ class Google_IO_Curl extends Google_IO_Abstract
|
|
78 |
|
79 |
$response = curl_exec($curl);
|
80 |
if ($response === false) {
|
81 |
-
throw new
|
82 |
}
|
83 |
$headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
|
84 |
|
@@ -130,6 +130,6 @@ class Google_IO_Curl extends Google_IO_Abstract
|
|
130 |
{
|
131 |
$ver = curl_version();
|
132 |
$versionNum = $ver['version_number'];
|
133 |
-
return $versionNum <
|
134 |
}
|
135 |
}
|
16 |
*/
|
17 |
|
18 |
/**
|
19 |
+
* Curl based implementation of IWP_google_IO.
|
20 |
*
|
21 |
* @author Stuart Langley <slangley@google.com>
|
22 |
*/
|
23 |
|
24 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/IO/Abstract.php';
|
25 |
|
26 |
+
class IWP_google_IO_Curl extends IWP_google_IO_Abstract
|
27 |
{
|
28 |
// hex for version 7.31.0
|
29 |
const NO_QUIRK_VERSION = 0x071F00;
|
32 |
/**
|
33 |
* Execute an HTTP Request
|
34 |
*
|
35 |
+
* @param IWP_google_HttpRequest $request the http request to be executed
|
36 |
+
* @return IWP_google_HttpRequest http request with the response http code,
|
37 |
* response headers and response body filled in
|
38 |
+
* @throws IWP_google_IO_Exception on curl or IO error
|
39 |
*/
|
40 |
+
public function executeRequest(IWP_google_Http_Request $request)
|
41 |
{
|
42 |
$curl = curl_init();
|
43 |
|
78 |
|
79 |
$response = curl_exec($curl);
|
80 |
if ($response === false) {
|
81 |
+
throw new IWP_google_IO_Exception(curl_error($curl));
|
82 |
}
|
83 |
$headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
|
84 |
|
130 |
{
|
131 |
$ver = curl_version();
|
132 |
$versionNum = $ver['version_number'];
|
133 |
+
return $versionNum < IWP_google_IO_Curl::NO_QUIRK_VERSION;
|
134 |
}
|
135 |
}
|
lib/Google/IO/Exception.php
CHANGED
@@ -17,6 +17,6 @@
|
|
17 |
|
18 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Exception.php';
|
19 |
|
20 |
-
class
|
21 |
{
|
22 |
}
|
17 |
|
18 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Exception.php';
|
19 |
|
20 |
+
class IWP_google_IO_Exception extends IWP_google_Exception
|
21 |
{
|
22 |
}
|
lib/Google/IO/Stream.php
CHANGED
@@ -16,14 +16,14 @@
|
|
16 |
*/
|
17 |
|
18 |
/**
|
19 |
-
* Http Streams based implementation of
|
20 |
*
|
21 |
* @author Stuart Langley <slangley@google.com>
|
22 |
*/
|
23 |
|
24 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/IO/Abstract.php';
|
25 |
|
26 |
-
class
|
27 |
{
|
28 |
const TIMEOUT = "timeout";
|
29 |
const ZLIB = "compress.zlib://";
|
@@ -41,12 +41,12 @@ class Google_IO_Stream extends Google_IO_Abstract
|
|
41 |
/**
|
42 |
* Execute an HTTP Request
|
43 |
*
|
44 |
-
* @param
|
45 |
-
* @return
|
46 |
* response headers and response body filled in
|
47 |
-
* @throws
|
48 |
*/
|
49 |
-
public function executeRequest(
|
50 |
{
|
51 |
$default_options = stream_context_get_options(stream_context_get_default());
|
52 |
|
@@ -115,7 +115,7 @@ class Google_IO_Stream extends Google_IO_Abstract
|
|
115 |
}
|
116 |
|
117 |
if (false === $response_data) {
|
118 |
-
throw new
|
119 |
sprintf(
|
120 |
"HTTP Error: Unable to connect: '%s'",
|
121 |
$respHttpCode
|
16 |
*/
|
17 |
|
18 |
/**
|
19 |
+
* Http Streams based implementation of IWP_google_IO.
|
20 |
*
|
21 |
* @author Stuart Langley <slangley@google.com>
|
22 |
*/
|
23 |
|
24 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/IO/Abstract.php';
|
25 |
|
26 |
+
class IWP_google_IO_Stream extends IWP_google_IO_Abstract
|
27 |
{
|
28 |
const TIMEOUT = "timeout";
|
29 |
const ZLIB = "compress.zlib://";
|
41 |
/**
|
42 |
* Execute an HTTP Request
|
43 |
*
|
44 |
+
* @param IWP_google_HttpRequest $request the http request to be executed
|
45 |
+
* @return IWP_google_HttpRequest http request with the response http code,
|
46 |
* response headers and response body filled in
|
47 |
+
* @throws IWP_google_IO_Exception on curl or IO error
|
48 |
*/
|
49 |
+
public function executeRequest(IWP_google_Http_Request $request)
|
50 |
{
|
51 |
$default_options = stream_context_get_options(stream_context_get_default());
|
52 |
|
115 |
}
|
116 |
|
117 |
if (false === $response_data) {
|
118 |
+
throw new IWP_google_IO_Exception(
|
119 |
sprintf(
|
120 |
"HTTP Error: Unable to connect: '%s'",
|
121 |
$respHttpCode
|
lib/Google/Model.php
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
* @author Chirag Shah <chirags@google.com>
|
24 |
*
|
25 |
*/
|
26 |
-
class
|
27 |
{
|
28 |
protected $modelData = array();
|
29 |
protected $processed = array();
|
@@ -92,7 +92,7 @@ class Google_Model implements ArrayAccess
|
|
92 |
property_exists($this, $key)) {
|
93 |
$this->$key = $val;
|
94 |
unset($array[$key]);
|
95 |
-
} elseif (property_exists($this, $camelKey =
|
96 |
// This checks if property exists as camelCase, leaving it in array as snake_case
|
97 |
// in case of backwards compatibility issues.
|
98 |
$this->$camelKey = $val;
|
@@ -139,7 +139,7 @@ class Google_Model implements ArrayAccess
|
|
139 |
*/
|
140 |
private function getSimpleValue($value)
|
141 |
{
|
142 |
-
if ($value instanceof
|
143 |
return $value->toSimpleObject();
|
144 |
} else if (is_array($value)) {
|
145 |
$return = array();
|
@@ -188,14 +188,14 @@ class Google_Model implements ArrayAccess
|
|
188 |
|
189 |
/**
|
190 |
* Verify if $obj is an array.
|
191 |
-
* @throws
|
192 |
* @param array $obj Items that should be validated.
|
193 |
* @param string $method Method expecting an array as an argument.
|
194 |
*/
|
195 |
public function assertIsArray($obj, $method)
|
196 |
{
|
197 |
if ($obj && !is_array($obj)) {
|
198 |
-
throw new
|
199 |
"Incorrect parameter type passed to $method(). Expected an array."
|
200 |
);
|
201 |
}
|
23 |
* @author Chirag Shah <chirags@google.com>
|
24 |
*
|
25 |
*/
|
26 |
+
class IWP_google_Model implements ArrayAccess
|
27 |
{
|
28 |
protected $modelData = array();
|
29 |
protected $processed = array();
|
92 |
property_exists($this, $key)) {
|
93 |
$this->$key = $val;
|
94 |
unset($array[$key]);
|
95 |
+
} elseif (property_exists($this, $camelKey = IWP_google_Utils::camelCase($key))) {
|
96 |
// This checks if property exists as camelCase, leaving it in array as snake_case
|
97 |
// in case of backwards compatibility issues.
|
98 |
$this->$camelKey = $val;
|
139 |
*/
|
140 |
private function getSimpleValue($value)
|
141 |
{
|
142 |
+
if ($value instanceof IWP_google_Model) {
|
143 |
return $value->toSimpleObject();
|
144 |
} else if (is_array($value)) {
|
145 |
$return = array();
|
188 |
|
189 |
/**
|
190 |
* Verify if $obj is an array.
|
191 |
+
* @throws IWP_google_Exception Thrown if $obj isn't an array.
|
192 |
* @param array $obj Items that should be validated.
|
193 |
* @param string $method Method expecting an array as an argument.
|
194 |
*/
|
195 |
public function assertIsArray($obj, $method)
|
196 |
{
|
197 |
if ($obj && !is_array($obj)) {
|
198 |
+
throw new IWP_google_Exception(
|
199 |
"Incorrect parameter type passed to $method(). Expected an array."
|
200 |
);
|
201 |
}
|
lib/Google/Service.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* limitations under the License.
|
16 |
*/
|
17 |
|
18 |
-
class
|
19 |
{
|
20 |
public $version;
|
21 |
public $servicePath;
|
@@ -23,14 +23,14 @@ class Google_Service
|
|
23 |
public $resource;
|
24 |
private $client;
|
25 |
|
26 |
-
public function __construct(
|
27 |
{
|
28 |
$this->client = $client;
|
29 |
}
|
30 |
|
31 |
/**
|
32 |
-
* Return the associated
|
33 |
-
* @return
|
34 |
*/
|
35 |
public function getClient()
|
36 |
{
|
15 |
* limitations under the License.
|
16 |
*/
|
17 |
|
18 |
+
class IWP_google_Service
|
19 |
{
|
20 |
public $version;
|
21 |
public $servicePath;
|
23 |
public $resource;
|
24 |
private $client;
|
25 |
|
26 |
+
public function __construct(IWP_google_Client $client)
|
27 |
{
|
28 |
$this->client = $client;
|
29 |
}
|
30 |
|
31 |
/**
|
32 |
+
* Return the associated IWP_google_Client class.
|
33 |
+
* @return IWP_google_Client
|
34 |
*/
|
35 |
public function getClient()
|
36 |
{
|
lib/Google/Service/Drive.php
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
*
|
30 |
* @author Google, Inc.
|
31 |
*/
|
32 |
-
class
|
33 |
{
|
34 |
/** View and manage the files and documents in your Google Drive. */
|
35 |
const DRIVE = "https://www.googleapis.com/auth/drive";
|
@@ -64,16 +64,16 @@ class Google_Service_Drive extends Google_Service
|
|
64 |
/**
|
65 |
* Constructs the internal representation of the Drive service.
|
66 |
*
|
67 |
-
* @param
|
68 |
*/
|
69 |
-
public function __construct(
|
70 |
{
|
71 |
parent::__construct($client);
|
72 |
$this->servicePath = 'drive/v2/';
|
73 |
$this->version = 'v2';
|
74 |
$this->serviceName = 'drive';
|
75 |
|
76 |
-
$this->about = new
|
77 |
$this,
|
78 |
$this->serviceName,
|
79 |
'about',
|
@@ -100,7 +100,7 @@ class Google_Service_Drive extends Google_Service
|
|
100 |
)
|
101 |
)
|
102 |
);
|
103 |
-
$this->apps = new
|
104 |
$this,
|
105 |
$this->serviceName,
|
106 |
'apps',
|
@@ -124,7 +124,7 @@ class Google_Service_Drive extends Google_Service
|
|
124 |
)
|
125 |
)
|
126 |
);
|
127 |
-
$this->changes = new
|
128 |
$this,
|
129 |
$this->serviceName,
|
130 |
'changes',
|
@@ -194,7 +194,7 @@ class Google_Service_Drive extends Google_Service
|
|
194 |
)
|
195 |
)
|
196 |
);
|
197 |
-
$this->channels = new
|
198 |
$this,
|
199 |
$this->serviceName,
|
200 |
'channels',
|
@@ -208,7 +208,7 @@ class Google_Service_Drive extends Google_Service
|
|
208 |
)
|
209 |
)
|
210 |
);
|
211 |
-
$this->children = new
|
212 |
$this,
|
213 |
$this->serviceName,
|
214 |
'children',
|
@@ -280,7 +280,7 @@ class Google_Service_Drive extends Google_Service
|
|
280 |
)
|
281 |
)
|
282 |
);
|
283 |
-
$this->comments = new
|
284 |
$this,
|
285 |
$this->serviceName,
|
286 |
'comments',
|
@@ -390,7 +390,7 @@ class Google_Service_Drive extends Google_Service
|
|
390 |
)
|
391 |
)
|
392 |
);
|
393 |
-
$this->files = new
|
394 |
$this,
|
395 |
$this->serviceName,
|
396 |
'files',
|
@@ -672,7 +672,7 @@ class Google_Service_Drive extends Google_Service
|
|
672 |
)
|
673 |
)
|
674 |
);
|
675 |
-
$this->parents = new
|
676 |
$this,
|
677 |
$this->serviceName,
|
678 |
'parents',
|
@@ -732,7 +732,7 @@ class Google_Service_Drive extends Google_Service
|
|
732 |
)
|
733 |
)
|
734 |
);
|
735 |
-
$this->permissions = new
|
736 |
$this,
|
737 |
$this->serviceName,
|
738 |
'permissions',
|
@@ -848,7 +848,7 @@ class Google_Service_Drive extends Google_Service
|
|
848 |
)
|
849 |
)
|
850 |
);
|
851 |
-
$this->properties = new
|
852 |
$this,
|
853 |
$this->serviceName,
|
854 |
'properties',
|
@@ -954,7 +954,7 @@ class Google_Service_Drive extends Google_Service
|
|
954 |
)
|
955 |
)
|
956 |
);
|
957 |
-
$this->realtime = new
|
958 |
$this,
|
959 |
$this->serviceName,
|
960 |
'realtime',
|
@@ -988,7 +988,7 @@ class Google_Service_Drive extends Google_Service
|
|
988 |
)
|
989 |
)
|
990 |
);
|
991 |
-
$this->replies = new
|
992 |
$this,
|
993 |
$this->serviceName,
|
994 |
'replies',
|
@@ -1124,7 +1124,7 @@ class Google_Service_Drive extends Google_Service
|
|
1124 |
)
|
1125 |
)
|
1126 |
);
|
1127 |
-
$this->revisions = new
|
1128 |
$this,
|
1129 |
$this->serviceName,
|
1130 |
'revisions',
|
@@ -1212,11 +1212,11 @@ class Google_Service_Drive extends Google_Service
|
|
1212 |
* The "about" collection of methods.
|
1213 |
* Typical usage is:
|
1214 |
* <code>
|
1215 |
-
* $driveService = new
|
1216 |
* $about = $driveService->about;
|
1217 |
* </code>
|
1218 |
*/
|
1219 |
-
class
|
1220 |
{
|
1221 |
|
1222 |
/**
|
@@ -1233,13 +1233,13 @@ class Google_Service_Drive_About_Resource extends Google_Service_Resource
|
|
1233 |
* Maximum number of remaining change IDs to count
|
1234 |
* @opt_param string startChangeId
|
1235 |
* Change ID to start counting from when calculating number of remaining change IDs
|
1236 |
-
* @return
|
1237 |
*/
|
1238 |
public function get($optParams = array())
|
1239 |
{
|
1240 |
$params = array();
|
1241 |
$params = array_merge($params, $optParams);
|
1242 |
-
return $this->call('get', array($params), "
|
1243 |
}
|
1244 |
}
|
1245 |
|
@@ -1247,11 +1247,11 @@ class Google_Service_Drive_About_Resource extends Google_Service_Resource
|
|
1247 |
* The "apps" collection of methods.
|
1248 |
* Typical usage is:
|
1249 |
* <code>
|
1250 |
-
* $driveService = new
|
1251 |
* $apps = $driveService->apps;
|
1252 |
* </code>
|
1253 |
*/
|
1254 |
-
class
|
1255 |
{
|
1256 |
|
1257 |
/**
|
@@ -1260,25 +1260,25 @@ class Google_Service_Drive_Apps_Resource extends Google_Service_Resource
|
|
1260 |
* @param string $appId
|
1261 |
* The ID of the app.
|
1262 |
* @param array $optParams Optional parameters.
|
1263 |
-
* @return
|
1264 |
*/
|
1265 |
public function get($appId, $optParams = array())
|
1266 |
{
|
1267 |
$params = array('appId' => $appId);
|
1268 |
$params = array_merge($params, $optParams);
|
1269 |
-
return $this->call('get', array($params), "
|
1270 |
}
|
1271 |
/**
|
1272 |
* Lists a user's installed apps. (apps.listApps)
|
1273 |
*
|
1274 |
* @param array $optParams Optional parameters.
|
1275 |
-
* @return
|
1276 |
*/
|
1277 |
public function listApps($optParams = array())
|
1278 |
{
|
1279 |
$params = array();
|
1280 |
$params = array_merge($params, $optParams);
|
1281 |
-
return $this->call('list', array($params), "
|
1282 |
}
|
1283 |
}
|
1284 |
|
@@ -1286,11 +1286,11 @@ class Google_Service_Drive_Apps_Resource extends Google_Service_Resource
|
|
1286 |
* The "changes" collection of methods.
|
1287 |
* Typical usage is:
|
1288 |
* <code>
|
1289 |
-
* $driveService = new
|
1290 |
* $changes = $driveService->changes;
|
1291 |
* </code>
|
1292 |
*/
|
1293 |
-
class
|
1294 |
{
|
1295 |
|
1296 |
/**
|
@@ -1299,13 +1299,13 @@ class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
|
|
1299 |
* @param string $changeId
|
1300 |
* The ID of the change.
|
1301 |
* @param array $optParams Optional parameters.
|
1302 |
-
* @return
|
1303 |
*/
|
1304 |
public function get($changeId, $optParams = array())
|
1305 |
{
|
1306 |
$params = array('changeId' => $changeId);
|
1307 |
$params = array_merge($params, $optParams);
|
1308 |
-
return $this->call('get', array($params), "
|
1309 |
}
|
1310 |
/**
|
1311 |
* Lists the changes for a user. (changes.listChanges)
|
@@ -1324,18 +1324,18 @@ class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
|
|
1324 |
* Maximum number of changes to return.
|
1325 |
* @opt_param string pageToken
|
1326 |
* Page token for changes.
|
1327 |
-
* @return
|
1328 |
*/
|
1329 |
public function listChanges($optParams = array())
|
1330 |
{
|
1331 |
$params = array();
|
1332 |
$params = array_merge($params, $optParams);
|
1333 |
-
return $this->call('list', array($params), "
|
1334 |
}
|
1335 |
/**
|
1336 |
* Subscribe to changes for a user. (changes.watch)
|
1337 |
*
|
1338 |
-
* @param
|
1339 |
* @param array $optParams Optional parameters.
|
1340 |
*
|
1341 |
* @opt_param bool includeSubscribed
|
@@ -1350,13 +1350,13 @@ class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
|
|
1350 |
* Maximum number of changes to return.
|
1351 |
* @opt_param string pageToken
|
1352 |
* Page token for changes.
|
1353 |
-
* @return
|
1354 |
*/
|
1355 |
-
public function watch(
|
1356 |
{
|
1357 |
$params = array('postBody' => $postBody);
|
1358 |
$params = array_merge($params, $optParams);
|
1359 |
-
return $this->call('watch', array($params), "
|
1360 |
}
|
1361 |
}
|
1362 |
|
@@ -1364,20 +1364,20 @@ class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
|
|
1364 |
* The "channels" collection of methods.
|
1365 |
* Typical usage is:
|
1366 |
* <code>
|
1367 |
-
* $driveService = new
|
1368 |
* $channels = $driveService->channels;
|
1369 |
* </code>
|
1370 |
*/
|
1371 |
-
class
|
1372 |
{
|
1373 |
|
1374 |
/**
|
1375 |
* Stop watching resources through this channel (channels.stop)
|
1376 |
*
|
1377 |
-
* @param
|
1378 |
* @param array $optParams Optional parameters.
|
1379 |
*/
|
1380 |
-
public function stop(
|
1381 |
{
|
1382 |
$params = array('postBody' => $postBody);
|
1383 |
$params = array_merge($params, $optParams);
|
@@ -1389,11 +1389,11 @@ class Google_Service_Drive_Channels_Resource extends Google_Service_Resource
|
|
1389 |
* The "children" collection of methods.
|
1390 |
* Typical usage is:
|
1391 |
* <code>
|
1392 |
-
* $driveService = new
|
1393 |
* $children = $driveService->children;
|
1394 |
* </code>
|
1395 |
*/
|
1396 |
-
class
|
1397 |
{
|
1398 |
|
1399 |
/**
|
@@ -1419,28 +1419,28 @@ class Google_Service_Drive_Children_Resource extends Google_Service_Resource
|
|
1419 |
* @param string $childId
|
1420 |
* The ID of the child.
|
1421 |
* @param array $optParams Optional parameters.
|
1422 |
-
* @return
|
1423 |
*/
|
1424 |
public function get($folderId, $childId, $optParams = array())
|
1425 |
{
|
1426 |
$params = array('folderId' => $folderId, 'childId' => $childId);
|
1427 |
$params = array_merge($params, $optParams);
|
1428 |
-
return $this->call('get', array($params), "
|
1429 |
}
|
1430 |
/**
|
1431 |
* Inserts a file into a folder. (children.insert)
|
1432 |
*
|
1433 |
* @param string $folderId
|
1434 |
* The ID of the folder.
|
1435 |
-
* @param
|
1436 |
* @param array $optParams Optional parameters.
|
1437 |
-
* @return
|
1438 |
*/
|
1439 |
-
public function insert($folderId,
|
1440 |
{
|
1441 |
$params = array('folderId' => $folderId, 'postBody' => $postBody);
|
1442 |
$params = array_merge($params, $optParams);
|
1443 |
-
return $this->call('insert', array($params), "
|
1444 |
}
|
1445 |
/**
|
1446 |
* Lists a folder's children. (children.listChildren)
|
@@ -1455,13 +1455,13 @@ class Google_Service_Drive_Children_Resource extends Google_Service_Resource
|
|
1455 |
* Page token for children.
|
1456 |
* @opt_param int maxResults
|
1457 |
* Maximum number of children to return.
|
1458 |
-
* @return
|
1459 |
*/
|
1460 |
public function listChildren($folderId, $optParams = array())
|
1461 |
{
|
1462 |
$params = array('folderId' => $folderId);
|
1463 |
$params = array_merge($params, $optParams);
|
1464 |
-
return $this->call('list', array($params), "
|
1465 |
}
|
1466 |
}
|
1467 |
|
@@ -1469,11 +1469,11 @@ class Google_Service_Drive_Children_Resource extends Google_Service_Resource
|
|
1469 |
* The "comments" collection of methods.
|
1470 |
* Typical usage is:
|
1471 |
* <code>
|
1472 |
-
* $driveService = new
|
1473 |
* $comments = $driveService->comments;
|
1474 |
* </code>
|
1475 |
*/
|
1476 |
-
class
|
1477 |
{
|
1478 |
|
1479 |
/**
|
@@ -1503,28 +1503,28 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
|
|
1503 |
* @opt_param bool includeDeleted
|
1504 |
* If set, this will succeed when retrieving a deleted comment, and will include any deleted
|
1505 |
* replies.
|
1506 |
-
* @return
|
1507 |
*/
|
1508 |
public function get($fileId, $commentId, $optParams = array())
|
1509 |
{
|
1510 |
$params = array('fileId' => $fileId, 'commentId' => $commentId);
|
1511 |
$params = array_merge($params, $optParams);
|
1512 |
-
return $this->call('get', array($params), "
|
1513 |
}
|
1514 |
/**
|
1515 |
* Creates a new comment on the given file. (comments.insert)
|
1516 |
*
|
1517 |
* @param string $fileId
|
1518 |
* The ID of the file.
|
1519 |
-
* @param
|
1520 |
* @param array $optParams Optional parameters.
|
1521 |
-
* @return
|
1522 |
*/
|
1523 |
-
public function insert($fileId,
|
1524 |
{
|
1525 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1526 |
$params = array_merge($params, $optParams);
|
1527 |
-
return $this->call('insert', array($params), "
|
1528 |
}
|
1529 |
/**
|
1530 |
* Lists a file's comments. (comments.listComments)
|
@@ -1544,13 +1544,13 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
|
|
1544 |
* will be returned.
|
1545 |
* @opt_param int maxResults
|
1546 |
* The maximum number of discussions to include in the response, used for paging.
|
1547 |
-
* @return
|
1548 |
*/
|
1549 |
public function listComments($fileId, $optParams = array())
|
1550 |
{
|
1551 |
$params = array('fileId' => $fileId);
|
1552 |
$params = array_merge($params, $optParams);
|
1553 |
-
return $this->call('list', array($params), "
|
1554 |
}
|
1555 |
/**
|
1556 |
* Updates an existing comment. This method supports patch semantics.
|
@@ -1560,15 +1560,15 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
|
|
1560 |
* The ID of the file.
|
1561 |
* @param string $commentId
|
1562 |
* The ID of the comment.
|
1563 |
-
* @param
|
1564 |
* @param array $optParams Optional parameters.
|
1565 |
-
* @return
|
1566 |
*/
|
1567 |
-
public function patch($fileId, $commentId,
|
1568 |
{
|
1569 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
|
1570 |
$params = array_merge($params, $optParams);
|
1571 |
-
return $this->call('patch', array($params), "
|
1572 |
}
|
1573 |
/**
|
1574 |
* Updates an existing comment. (comments.update)
|
@@ -1577,15 +1577,15 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
|
|
1577 |
* The ID of the file.
|
1578 |
* @param string $commentId
|
1579 |
* The ID of the comment.
|
1580 |
-
* @param
|
1581 |
* @param array $optParams Optional parameters.
|
1582 |
-
* @return
|
1583 |
*/
|
1584 |
-
public function update($fileId, $commentId,
|
1585 |
{
|
1586 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
|
1587 |
$params = array_merge($params, $optParams);
|
1588 |
-
return $this->call('update', array($params), "
|
1589 |
}
|
1590 |
}
|
1591 |
|
@@ -1593,11 +1593,11 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
|
|
1593 |
* The "files" collection of methods.
|
1594 |
* Typical usage is:
|
1595 |
* <code>
|
1596 |
-
* $driveService = new
|
1597 |
* $files = $driveService->files;
|
1598 |
* </code>
|
1599 |
*/
|
1600 |
-
class
|
1601 |
{
|
1602 |
|
1603 |
/**
|
@@ -1605,7 +1605,7 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1605 |
*
|
1606 |
* @param string $fileId
|
1607 |
* The ID of the file to copy.
|
1608 |
-
* @param
|
1609 |
* @param array $optParams Optional parameters.
|
1610 |
*
|
1611 |
* @opt_param bool convert
|
@@ -1623,13 +1623,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1623 |
* The timed text track name.
|
1624 |
* @opt_param string timedTextLanguage
|
1625 |
* The language of the timed text.
|
1626 |
-
* @return
|
1627 |
*/
|
1628 |
-
public function copy($fileId,
|
1629 |
{
|
1630 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1631 |
$params = array_merge($params, $optParams);
|
1632 |
-
return $this->call('copy', array($params), "
|
1633 |
}
|
1634 |
/**
|
1635 |
* Permanently deletes a file by ID. Skips the trash. (files.delete)
|
@@ -1655,18 +1655,18 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1655 |
* Whether to update the view date after successfully retrieving the file.
|
1656 |
* @opt_param string projection
|
1657 |
* This parameter is deprecated and has no function.
|
1658 |
-
* @return
|
1659 |
*/
|
1660 |
public function get($fileId, $optParams = array())
|
1661 |
{
|
1662 |
$params = array('fileId' => $fileId);
|
1663 |
$params = array_merge($params, $optParams);
|
1664 |
-
return $this->call('get', array($params), "
|
1665 |
}
|
1666 |
/**
|
1667 |
* Insert a new file. (files.insert)
|
1668 |
*
|
1669 |
-
* @param
|
1670 |
* @param array $optParams Optional parameters.
|
1671 |
*
|
1672 |
* @opt_param bool convert
|
@@ -1685,13 +1685,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1685 |
* The timed text track name.
|
1686 |
* @opt_param string timedTextLanguage
|
1687 |
* The language of the timed text.
|
1688 |
-
* @return
|
1689 |
*/
|
1690 |
-
public function insert(
|
1691 |
{
|
1692 |
$params = array('postBody' => $postBody);
|
1693 |
$params = array_merge($params, $optParams);
|
1694 |
-
return $this->call('insert', array($params), "
|
1695 |
}
|
1696 |
/**
|
1697 |
* Lists the user's files. (files.listFiles)
|
@@ -1706,13 +1706,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1706 |
* This parameter is deprecated and has no function.
|
1707 |
* @opt_param int maxResults
|
1708 |
* Maximum number of files to return.
|
1709 |
-
* @return
|
1710 |
*/
|
1711 |
public function listFiles($optParams = array())
|
1712 |
{
|
1713 |
$params = array();
|
1714 |
$params = array_merge($params, $optParams);
|
1715 |
-
return $this->call('list', array($params), "
|
1716 |
}
|
1717 |
/**
|
1718 |
* Updates file metadata and/or content. This method supports patch semantics.
|
@@ -1720,7 +1720,7 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1720 |
*
|
1721 |
* @param string $fileId
|
1722 |
* The ID of the file to update.
|
1723 |
-
* @param
|
1724 |
* @param array $optParams Optional parameters.
|
1725 |
*
|
1726 |
* @opt_param bool convert
|
@@ -1745,13 +1745,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1745 |
* The language of the timed text.
|
1746 |
* @opt_param string timedTextTrackName
|
1747 |
* The timed text track name.
|
1748 |
-
* @return
|
1749 |
*/
|
1750 |
-
public function patch($fileId,
|
1751 |
{
|
1752 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1753 |
$params = array_merge($params, $optParams);
|
1754 |
-
return $this->call('patch', array($params), "
|
1755 |
}
|
1756 |
/**
|
1757 |
* Set the file's updated time to the current server time. (files.touch)
|
@@ -1759,13 +1759,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1759 |
* @param string $fileId
|
1760 |
* The ID of the file to update.
|
1761 |
* @param array $optParams Optional parameters.
|
1762 |
-
* @return
|
1763 |
*/
|
1764 |
public function touch($fileId, $optParams = array())
|
1765 |
{
|
1766 |
$params = array('fileId' => $fileId);
|
1767 |
$params = array_merge($params, $optParams);
|
1768 |
-
return $this->call('touch', array($params), "
|
1769 |
}
|
1770 |
/**
|
1771 |
* Moves a file to the trash. (files.trash)
|
@@ -1773,13 +1773,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1773 |
* @param string $fileId
|
1774 |
* The ID of the file to trash.
|
1775 |
* @param array $optParams Optional parameters.
|
1776 |
-
* @return
|
1777 |
*/
|
1778 |
public function trash($fileId, $optParams = array())
|
1779 |
{
|
1780 |
$params = array('fileId' => $fileId);
|
1781 |
$params = array_merge($params, $optParams);
|
1782 |
-
return $this->call('trash', array($params), "
|
1783 |
}
|
1784 |
/**
|
1785 |
* Restores a file from the trash. (files.untrash)
|
@@ -1787,20 +1787,20 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1787 |
* @param string $fileId
|
1788 |
* The ID of the file to untrash.
|
1789 |
* @param array $optParams Optional parameters.
|
1790 |
-
* @return
|
1791 |
*/
|
1792 |
public function untrash($fileId, $optParams = array())
|
1793 |
{
|
1794 |
$params = array('fileId' => $fileId);
|
1795 |
$params = array_merge($params, $optParams);
|
1796 |
-
return $this->call('untrash', array($params), "
|
1797 |
}
|
1798 |
/**
|
1799 |
* Updates file metadata and/or content. (files.update)
|
1800 |
*
|
1801 |
* @param string $fileId
|
1802 |
* The ID of the file to update.
|
1803 |
-
* @param
|
1804 |
* @param array $optParams Optional parameters.
|
1805 |
*
|
1806 |
* @opt_param bool convert
|
@@ -1825,33 +1825,33 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1825 |
* The language of the timed text.
|
1826 |
* @opt_param string timedTextTrackName
|
1827 |
* The timed text track name.
|
1828 |
-
* @return
|
1829 |
*/
|
1830 |
-
public function update($fileId,
|
1831 |
{
|
1832 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1833 |
$params = array_merge($params, $optParams);
|
1834 |
-
return $this->call('update', array($params), "
|
1835 |
}
|
1836 |
/**
|
1837 |
* Subscribe to changes on a file (files.watch)
|
1838 |
*
|
1839 |
* @param string $fileId
|
1840 |
* The ID for the file in question.
|
1841 |
-
* @param
|
1842 |
* @param array $optParams Optional parameters.
|
1843 |
*
|
1844 |
* @opt_param bool updateViewedDate
|
1845 |
* Whether to update the view date after successfully retrieving the file.
|
1846 |
* @opt_param string projection
|
1847 |
* This parameter is deprecated and has no function.
|
1848 |
-
* @return
|
1849 |
*/
|
1850 |
-
public function watch($fileId,
|
1851 |
{
|
1852 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1853 |
$params = array_merge($params, $optParams);
|
1854 |
-
return $this->call('watch', array($params), "
|
1855 |
}
|
1856 |
}
|
1857 |
|
@@ -1859,11 +1859,11 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
|
|
1859 |
* The "parents" collection of methods.
|
1860 |
* Typical usage is:
|
1861 |
* <code>
|
1862 |
-
* $driveService = new
|
1863 |
* $parents = $driveService->parents;
|
1864 |
* </code>
|
1865 |
*/
|
1866 |
-
class
|
1867 |
{
|
1868 |
|
1869 |
/**
|
@@ -1889,28 +1889,28 @@ class Google_Service_Drive_Parents_Resource extends Google_Service_Resource
|
|
1889 |
* @param string $parentId
|
1890 |
* The ID of the parent.
|
1891 |
* @param array $optParams Optional parameters.
|
1892 |
-
* @return
|
1893 |
*/
|
1894 |
public function get($fileId, $parentId, $optParams = array())
|
1895 |
{
|
1896 |
$params = array('fileId' => $fileId, 'parentId' => $parentId);
|
1897 |
$params = array_merge($params, $optParams);
|
1898 |
-
return $this->call('get', array($params), "
|
1899 |
}
|
1900 |
/**
|
1901 |
* Adds a parent folder for a file. (parents.insert)
|
1902 |
*
|
1903 |
* @param string $fileId
|
1904 |
* The ID of the file.
|
1905 |
-
* @param
|
1906 |
* @param array $optParams Optional parameters.
|
1907 |
-
* @return
|
1908 |
*/
|
1909 |
-
public function insert($fileId,
|
1910 |
{
|
1911 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1912 |
$params = array_merge($params, $optParams);
|
1913 |
-
return $this->call('insert', array($params), "
|
1914 |
}
|
1915 |
/**
|
1916 |
* Lists a file's parents. (parents.listParents)
|
@@ -1918,13 +1918,13 @@ class Google_Service_Drive_Parents_Resource extends Google_Service_Resource
|
|
1918 |
* @param string $fileId
|
1919 |
* The ID of the file.
|
1920 |
* @param array $optParams Optional parameters.
|
1921 |
-
* @return
|
1922 |
*/
|
1923 |
public function listParents($fileId, $optParams = array())
|
1924 |
{
|
1925 |
$params = array('fileId' => $fileId);
|
1926 |
$params = array_merge($params, $optParams);
|
1927 |
-
return $this->call('list', array($params), "
|
1928 |
}
|
1929 |
}
|
1930 |
|
@@ -1932,11 +1932,11 @@ class Google_Service_Drive_Parents_Resource extends Google_Service_Resource
|
|
1932 |
* The "permissions" collection of methods.
|
1933 |
* Typical usage is:
|
1934 |
* <code>
|
1935 |
-
* $driveService = new
|
1936 |
* $permissions = $driveService->permissions;
|
1937 |
* </code>
|
1938 |
*/
|
1939 |
-
class
|
1940 |
{
|
1941 |
|
1942 |
/**
|
@@ -1962,13 +1962,13 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
|
|
1962 |
* @param string $permissionId
|
1963 |
* The ID for the permission.
|
1964 |
* @param array $optParams Optional parameters.
|
1965 |
-
* @return
|
1966 |
*/
|
1967 |
public function get($fileId, $permissionId, $optParams = array())
|
1968 |
{
|
1969 |
$params = array('fileId' => $fileId, 'permissionId' => $permissionId);
|
1970 |
$params = array_merge($params, $optParams);
|
1971 |
-
return $this->call('get', array($params), "
|
1972 |
}
|
1973 |
/**
|
1974 |
* Returns the permission ID for an email address. (permissions.getIdForEmail)
|
@@ -1976,33 +1976,33 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
|
|
1976 |
* @param string $email
|
1977 |
* The email address for which to return a permission ID
|
1978 |
* @param array $optParams Optional parameters.
|
1979 |
-
* @return
|
1980 |
*/
|
1981 |
public function getIdForEmail($email, $optParams = array())
|
1982 |
{
|
1983 |
$params = array('email' => $email);
|
1984 |
$params = array_merge($params, $optParams);
|
1985 |
-
return $this->call('getIdForEmail', array($params), "
|
1986 |
}
|
1987 |
/**
|
1988 |
* Inserts a permission for a file. (permissions.insert)
|
1989 |
*
|
1990 |
* @param string $fileId
|
1991 |
* The ID for the file.
|
1992 |
-
* @param
|
1993 |
* @param array $optParams Optional parameters.
|
1994 |
*
|
1995 |
* @opt_param string emailMessage
|
1996 |
* A custom message to include in notification emails.
|
1997 |
* @opt_param bool sendNotificationEmails
|
1998 |
* Whether to send notification emails when sharing to users or groups.
|
1999 |
-
* @return
|
2000 |
*/
|
2001 |
-
public function insert($fileId,
|
2002 |
{
|
2003 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
2004 |
$params = array_merge($params, $optParams);
|
2005 |
-
return $this->call('insert', array($params), "
|
2006 |
}
|
2007 |
/**
|
2008 |
* Lists a file's permissions. (permissions.listPermissions)
|
@@ -2010,13 +2010,13 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
|
|
2010 |
* @param string $fileId
|
2011 |
* The ID for the file.
|
2012 |
* @param array $optParams Optional parameters.
|
2013 |
-
* @return
|
2014 |
*/
|
2015 |
public function listPermissions($fileId, $optParams = array())
|
2016 |
{
|
2017 |
$params = array('fileId' => $fileId);
|
2018 |
$params = array_merge($params, $optParams);
|
2019 |
-
return $this->call('list', array($params), "
|
2020 |
}
|
2021 |
/**
|
2022 |
* Updates a permission. This method supports patch semantics.
|
@@ -2026,18 +2026,18 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
|
|
2026 |
* The ID for the file.
|
2027 |
* @param string $permissionId
|
2028 |
* The ID for the permission.
|
2029 |
-
* @param
|
2030 |
* @param array $optParams Optional parameters.
|
2031 |
*
|
2032 |
* @opt_param bool transferOwnership
|
2033 |
* Whether changing a role to 'owner' should also downgrade the current owners to writers.
|
2034 |
-
* @return
|
2035 |
*/
|
2036 |
-
public function patch($fileId, $permissionId,
|
2037 |
{
|
2038 |
$params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
|
2039 |
$params = array_merge($params, $optParams);
|
2040 |
-
return $this->call('patch', array($params), "
|
2041 |
}
|
2042 |
/**
|
2043 |
* Updates a permission. (permissions.update)
|
@@ -2046,18 +2046,18 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
|
|
2046 |
* The ID for the file.
|
2047 |
* @param string $permissionId
|
2048 |
* The ID for the permission.
|
2049 |
-
* @param
|
2050 |
* @param array $optParams Optional parameters.
|
2051 |
*
|
2052 |
* @opt_param bool transferOwnership
|
2053 |
* Whether changing a role to 'owner' should also downgrade the current owners to writers.
|
2054 |
-
* @return
|
2055 |
*/
|
2056 |
-
public function update($fileId, $permissionId,
|
2057 |
{
|
2058 |
$params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
|
2059 |
$params = array_merge($params, $optParams);
|
2060 |
-
return $this->call('update', array($params), "
|
2061 |
}
|
2062 |
}
|
2063 |
|
@@ -2065,11 +2065,11 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
|
|
2065 |
* The "properties" collection of methods.
|
2066 |
* Typical usage is:
|
2067 |
* <code>
|
2068 |
-
* $driveService = new
|
2069 |
* $properties = $driveService->properties;
|
2070 |
* </code>
|
2071 |
*/
|
2072 |
-
class
|
2073 |
{
|
2074 |
|
2075 |
/**
|
@@ -2101,28 +2101,28 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
|
|
2101 |
*
|
2102 |
* @opt_param string visibility
|
2103 |
* The visibility of the property.
|
2104 |
-
* @return
|
2105 |
*/
|
2106 |
public function get($fileId, $propertyKey, $optParams = array())
|
2107 |
{
|
2108 |
$params = array('fileId' => $fileId, 'propertyKey' => $propertyKey);
|
2109 |
$params = array_merge($params, $optParams);
|
2110 |
-
return $this->call('get', array($params), "
|
2111 |
}
|
2112 |
/**
|
2113 |
* Adds a property to a file. (properties.insert)
|
2114 |
*
|
2115 |
* @param string $fileId
|
2116 |
* The ID of the file.
|
2117 |
-
* @param
|
2118 |
* @param array $optParams Optional parameters.
|
2119 |
-
* @return
|
2120 |
*/
|
2121 |
-
public function insert($fileId,
|
2122 |
{
|
2123 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
2124 |
$params = array_merge($params, $optParams);
|
2125 |
-
return $this->call('insert', array($params), "
|
2126 |
}
|
2127 |
/**
|
2128 |
* Lists a file's properties. (properties.listProperties)
|
@@ -2130,13 +2130,13 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
|
|
2130 |
* @param string $fileId
|
2131 |
* The ID of the file.
|
2132 |
* @param array $optParams Optional parameters.
|
2133 |
-
* @return
|
2134 |
*/
|
2135 |
public function listProperties($fileId, $optParams = array())
|
2136 |
{
|
2137 |
$params = array('fileId' => $fileId);
|
2138 |
$params = array_merge($params, $optParams);
|
2139 |
-
return $this->call('list', array($params), "
|
2140 |
}
|
2141 |
/**
|
2142 |
* Updates a property. This method supports patch semantics. (properties.patch)
|
@@ -2145,18 +2145,18 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
|
|
2145 |
* The ID of the file.
|
2146 |
* @param string $propertyKey
|
2147 |
* The key of the property.
|
2148 |
-
* @param
|
2149 |
* @param array $optParams Optional parameters.
|
2150 |
*
|
2151 |
* @opt_param string visibility
|
2152 |
* The visibility of the property.
|
2153 |
-
* @return
|
2154 |
*/
|
2155 |
-
public function patch($fileId, $propertyKey,
|
2156 |
{
|
2157 |
$params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
|
2158 |
$params = array_merge($params, $optParams);
|
2159 |
-
return $this->call('patch', array($params), "
|
2160 |
}
|
2161 |
/**
|
2162 |
* Updates a property. (properties.update)
|
@@ -2165,18 +2165,18 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
|
|
2165 |
* The ID of the file.
|
2166 |
* @param string $propertyKey
|
2167 |
* The key of the property.
|
2168 |
-
* @param
|
2169 |
* @param array $optParams Optional parameters.
|
2170 |
*
|
2171 |
* @opt_param string visibility
|
2172 |
* The visibility of the property.
|
2173 |
-
* @return
|
2174 |
*/
|
2175 |
-
public function update($fileId, $propertyKey,
|
2176 |
{
|
2177 |
$params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
|
2178 |
$params = array_merge($params, $optParams);
|
2179 |
-
return $this->call('update', array($params), "
|
2180 |
}
|
2181 |
}
|
2182 |
|
@@ -2184,11 +2184,11 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
|
|
2184 |
* The "realtime" collection of methods.
|
2185 |
* Typical usage is:
|
2186 |
* <code>
|
2187 |
-
* $driveService = new
|
2188 |
* $realtime = $driveService->realtime;
|
2189 |
* </code>
|
2190 |
*/
|
2191 |
-
class
|
2192 |
{
|
2193 |
|
2194 |
/**
|
@@ -2231,11 +2231,11 @@ class Google_Service_Drive_Realtime_Resource extends Google_Service_Resource
|
|
2231 |
* The "replies" collection of methods.
|
2232 |
* Typical usage is:
|
2233 |
* <code>
|
2234 |
-
* $driveService = new
|
2235 |
* $replies = $driveService->replies;
|
2236 |
* </code>
|
2237 |
*/
|
2238 |
-
class
|
2239 |
{
|
2240 |
|
2241 |
/**
|
@@ -2268,13 +2268,13 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
|
|
2268 |
*
|
2269 |
* @opt_param bool includeDeleted
|
2270 |
* If set, this will succeed when retrieving a deleted reply.
|
2271 |
-
* @return
|
2272 |
*/
|
2273 |
public function get($fileId, $commentId, $replyId, $optParams = array())
|
2274 |
{
|
2275 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId);
|
2276 |
$params = array_merge($params, $optParams);
|
2277 |
-
return $this->call('get', array($params), "
|
2278 |
}
|
2279 |
/**
|
2280 |
* Creates a new reply to the given comment. (replies.insert)
|
@@ -2283,15 +2283,15 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
|
|
2283 |
* The ID of the file.
|
2284 |
* @param string $commentId
|
2285 |
* The ID of the comment.
|
2286 |
-
* @param
|
2287 |
* @param array $optParams Optional parameters.
|
2288 |
-
* @return
|
2289 |
*/
|
2290 |
-
public function insert($fileId, $commentId,
|
2291 |
{
|
2292 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
|
2293 |
$params = array_merge($params, $optParams);
|
2294 |
-
return $this->call('insert', array($params), "
|
2295 |
}
|
2296 |
/**
|
2297 |
* Lists all of the replies to a comment. (replies.listReplies)
|
@@ -2309,13 +2309,13 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
|
|
2309 |
* If set, all replies, including deleted replies (with content stripped) will be returned.
|
2310 |
* @opt_param int maxResults
|
2311 |
* The maximum number of replies to include in the response, used for paging.
|
2312 |
-
* @return
|
2313 |
*/
|
2314 |
public function listReplies($fileId, $commentId, $optParams = array())
|
2315 |
{
|
2316 |
$params = array('fileId' => $fileId, 'commentId' => $commentId);
|
2317 |
$params = array_merge($params, $optParams);
|
2318 |
-
return $this->call('list', array($params), "
|
2319 |
}
|
2320 |
/**
|
2321 |
* Updates an existing reply. This method supports patch semantics.
|
@@ -2327,15 +2327,15 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
|
|
2327 |
* The ID of the comment.
|
2328 |
* @param string $replyId
|
2329 |
* The ID of the reply.
|
2330 |
-
* @param
|
2331 |
* @param array $optParams Optional parameters.
|
2332 |
-
* @return
|
2333 |
*/
|
2334 |
-
public function patch($fileId, $commentId, $replyId,
|
2335 |
{
|
2336 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
|
2337 |
$params = array_merge($params, $optParams);
|
2338 |
-
return $this->call('patch', array($params), "
|
2339 |
}
|
2340 |
/**
|
2341 |
* Updates an existing reply. (replies.update)
|
@@ -2346,15 +2346,15 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
|
|
2346 |
* The ID of the comment.
|
2347 |
* @param string $replyId
|
2348 |
* The ID of the reply.
|
2349 |
-
* @param
|
2350 |
* @param array $optParams Optional parameters.
|
2351 |
-
* @return
|
2352 |
*/
|
2353 |
-
public function update($fileId, $commentId, $replyId,
|
2354 |
{
|
2355 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
|
2356 |
$params = array_merge($params, $optParams);
|
2357 |
-
return $this->call('update', array($params), "
|
2358 |
}
|
2359 |
}
|
2360 |
|
@@ -2362,11 +2362,11 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
|
|
2362 |
* The "revisions" collection of methods.
|
2363 |
* Typical usage is:
|
2364 |
* <code>
|
2365 |
-
* $driveService = new
|
2366 |
* $revisions = $driveService->revisions;
|
2367 |
* </code>
|
2368 |
*/
|
2369 |
-
class
|
2370 |
{
|
2371 |
|
2372 |
/**
|
@@ -2392,13 +2392,13 @@ class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
|
|
2392 |
* @param string $revisionId
|
2393 |
* The ID of the revision.
|
2394 |
* @param array $optParams Optional parameters.
|
2395 |
-
* @return
|
2396 |
*/
|
2397 |
public function get($fileId, $revisionId, $optParams = array())
|
2398 |
{
|
2399 |
$params = array('fileId' => $fileId, 'revisionId' => $revisionId);
|
2400 |
$params = array_merge($params, $optParams);
|
2401 |
-
return $this->call('get', array($params), "
|
2402 |
}
|
2403 |
/**
|
2404 |
* Lists a file's revisions. (revisions.listRevisions)
|
@@ -2406,13 +2406,13 @@ class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
|
|
2406 |
* @param string $fileId
|
2407 |
* The ID of the file.
|
2408 |
* @param array $optParams Optional parameters.
|
2409 |
-
* @return
|
2410 |
*/
|
2411 |
public function listRevisions($fileId, $optParams = array())
|
2412 |
{
|
2413 |
$params = array('fileId' => $fileId);
|
2414 |
$params = array_merge($params, $optParams);
|
2415 |
-
return $this->call('list', array($params), "
|
2416 |
}
|
2417 |
/**
|
2418 |
* Updates a revision. This method supports patch semantics. (revisions.patch)
|
@@ -2421,15 +2421,15 @@ class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
|
|
2421 |
* The ID for the file.
|
2422 |
* @param string $revisionId
|
2423 |
* The ID for the revision.
|
2424 |
-
* @param
|
2425 |
* @param array $optParams Optional parameters.
|
2426 |
-
* @return
|
2427 |
*/
|
2428 |
-
public function patch($fileId, $revisionId,
|
2429 |
{
|
2430 |
$params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
|
2431 |
$params = array_merge($params, $optParams);
|
2432 |
-
return $this->call('patch', array($params), "
|
2433 |
}
|
2434 |
/**
|
2435 |
* Updates a revision. (revisions.update)
|
@@ -2438,37 +2438,37 @@ class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
|
|
2438 |
* The ID for the file.
|
2439 |
* @param string $revisionId
|
2440 |
* The ID for the revision.
|
2441 |
-
* @param
|
2442 |
* @param array $optParams Optional parameters.
|
2443 |
-
* @return
|
2444 |
*/
|
2445 |
-
public function update($fileId, $revisionId,
|
2446 |
{
|
2447 |
$params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
|
2448 |
$params = array_merge($params, $optParams);
|
2449 |
-
return $this->call('update', array($params), "
|
2450 |
}
|
2451 |
}
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 |
-
class
|
2457 |
{
|
2458 |
-
protected $additionalRoleInfoType = '
|
2459 |
protected $additionalRoleInfoDataType = 'array';
|
2460 |
public $domainSharingPolicy;
|
2461 |
public $etag;
|
2462 |
-
protected $exportFormatsType = '
|
2463 |
protected $exportFormatsDataType = 'array';
|
2464 |
-
protected $featuresType = '
|
2465 |
protected $featuresDataType = 'array';
|
2466 |
-
protected $importFormatsType = '
|
2467 |
protected $importFormatsDataType = 'array';
|
2468 |
public $isCurrentAppInstalled;
|
2469 |
public $kind;
|
2470 |
public $largestChangeId;
|
2471 |
-
protected $maxUploadSizesType = '
|
2472 |
protected $maxUploadSizesDataType = 'array';
|
2473 |
public $name;
|
2474 |
public $permissionId;
|
@@ -2479,7 +2479,7 @@ class Google_Service_Drive_About extends Google_Collection
|
|
2479 |
public $remainingChangeIds;
|
2480 |
public $rootFolderId;
|
2481 |
public $selfLink;
|
2482 |
-
protected $userType = '
|
2483 |
protected $userDataType = '';
|
2484 |
|
2485 |
public function setAdditionalRoleInfo($additionalRoleInfo)
|
@@ -2672,7 +2672,7 @@ class Google_Service_Drive_About extends Google_Collection
|
|
2672 |
return $this->selfLink;
|
2673 |
}
|
2674 |
|
2675 |
-
public function setUser(
|
2676 |
{
|
2677 |
$this->user = $user;
|
2678 |
}
|
@@ -2683,9 +2683,9 @@ class Google_Service_Drive_About extends Google_Collection
|
|
2683 |
}
|
2684 |
}
|
2685 |
|
2686 |
-
class
|
2687 |
{
|
2688 |
-
protected $roleSetsType = '
|
2689 |
protected $roleSetsDataType = 'array';
|
2690 |
public $type;
|
2691 |
|
@@ -2710,7 +2710,7 @@ class Google_Service_Drive_AboutAdditionalRoleInfo extends Google_Collection
|
|
2710 |
}
|
2711 |
}
|
2712 |
|
2713 |
-
class
|
2714 |
{
|
2715 |
public $additionalRoles;
|
2716 |
public $primaryRole;
|
@@ -2736,7 +2736,7 @@ class Google_Service_Drive_AboutAdditionalRoleInfoRoleSets extends Google_Collec
|
|
2736 |
}
|
2737 |
}
|
2738 |
|
2739 |
-
class
|
2740 |
{
|
2741 |
public $source;
|
2742 |
public $targets;
|
@@ -2762,7 +2762,7 @@ class Google_Service_Drive_AboutExportFormats extends Google_Collection
|
|
2762 |
}
|
2763 |
}
|
2764 |
|
2765 |
-
class
|
2766 |
{
|
2767 |
public $featureName;
|
2768 |
public $featureRate;
|
@@ -2788,7 +2788,7 @@ class Google_Service_Drive_AboutFeatures extends Google_Model
|
|
2788 |
}
|
2789 |
}
|
2790 |
|
2791 |
-
class
|
2792 |
{
|
2793 |
public $source;
|
2794 |
public $targets;
|
@@ -2814,7 +2814,7 @@ class Google_Service_Drive_AboutImportFormats extends Google_Collection
|
|
2814 |
}
|
2815 |
}
|
2816 |
|
2817 |
-
class
|
2818 |
{
|
2819 |
public $size;
|
2820 |
public $type;
|
@@ -2840,12 +2840,12 @@ class Google_Service_Drive_AboutMaxUploadSizes extends Google_Model
|
|
2840 |
}
|
2841 |
}
|
2842 |
|
2843 |
-
class
|
2844 |
{
|
2845 |
public $authorized;
|
2846 |
public $createInFolderTemplate;
|
2847 |
public $createUrl;
|
2848 |
-
protected $iconsType = '
|
2849 |
protected $iconsDataType = 'array';
|
2850 |
public $id;
|
2851 |
public $installed;
|
@@ -3087,7 +3087,7 @@ class Google_Service_Drive_App extends Google_Collection
|
|
3087 |
}
|
3088 |
}
|
3089 |
|
3090 |
-
class
|
3091 |
{
|
3092 |
public $category;
|
3093 |
public $iconUrl;
|
@@ -3124,10 +3124,10 @@ class Google_Service_Drive_AppIcons extends Google_Model
|
|
3124 |
}
|
3125 |
}
|
3126 |
|
3127 |
-
class
|
3128 |
{
|
3129 |
public $etag;
|
3130 |
-
protected $itemsType = '
|
3131 |
protected $itemsDataType = 'array';
|
3132 |
public $kind;
|
3133 |
public $selfLink;
|
@@ -3173,10 +3173,10 @@ class Google_Service_Drive_AppList extends Google_Collection
|
|
3173 |
}
|
3174 |
}
|
3175 |
|
3176 |
-
class
|
3177 |
{
|
3178 |
public $deleted;
|
3179 |
-
protected $fileType = '
|
3180 |
protected $fileDataType = '';
|
3181 |
public $fileId;
|
3182 |
public $id;
|
@@ -3194,7 +3194,7 @@ class Google_Service_Drive_Change extends Google_Model
|
|
3194 |
return $this->deleted;
|
3195 |
}
|
3196 |
|
3197 |
-
public function setFile(
|
3198 |
{
|
3199 |
$this->file = $file;
|
3200 |
}
|
@@ -3255,10 +3255,10 @@ class Google_Service_Drive_Change extends Google_Model
|
|
3255 |
}
|
3256 |
}
|
3257 |
|
3258 |
-
class
|
3259 |
{
|
3260 |
public $etag;
|
3261 |
-
protected $itemsType = '
|
3262 |
protected $itemsDataType = 'array';
|
3263 |
public $kind;
|
3264 |
public $largestChangeId;
|
@@ -3337,7 +3337,7 @@ class Google_Service_Drive_ChangeList extends Google_Collection
|
|
3337 |
}
|
3338 |
}
|
3339 |
|
3340 |
-
class
|
3341 |
{
|
3342 |
public $address;
|
3343 |
public $expiration;
|
@@ -3451,10 +3451,10 @@ class Google_Service_Drive_Channel extends Google_Model
|
|
3451 |
}
|
3452 |
}
|
3453 |
|
3454 |
-
class
|
3455 |
{
|
3456 |
public $etag;
|
3457 |
-
protected $itemsType = '
|
3458 |
protected $itemsDataType = 'array';
|
3459 |
public $kind;
|
3460 |
public $nextLink;
|
@@ -3522,7 +3522,7 @@ class Google_Service_Drive_ChildList extends Google_Collection
|
|
3522 |
}
|
3523 |
}
|
3524 |
|
3525 |
-
class
|
3526 |
{
|
3527 |
public $childLink;
|
3528 |
public $id;
|
@@ -3570,14 +3570,14 @@ class Google_Service_Drive_ChildReference extends Google_Model
|
|
3570 |
}
|
3571 |
}
|
3572 |
|
3573 |
-
class
|
3574 |
{
|
3575 |
public $anchor;
|
3576 |
-
protected $authorType = '
|
3577 |
protected $authorDataType = '';
|
3578 |
public $commentId;
|
3579 |
public $content;
|
3580 |
-
protected $contextType = '
|
3581 |
protected $contextDataType = '';
|
3582 |
public $createdDate;
|
3583 |
public $deleted;
|
@@ -3586,7 +3586,7 @@ class Google_Service_Drive_Comment extends Google_Collection
|
|
3586 |
public $htmlContent;
|
3587 |
public $kind;
|
3588 |
public $modifiedDate;
|
3589 |
-
protected $repliesType = '
|
3590 |
protected $repliesDataType = 'array';
|
3591 |
public $selfLink;
|
3592 |
public $status;
|
@@ -3601,7 +3601,7 @@ class Google_Service_Drive_Comment extends Google_Collection
|
|
3601 |
return $this->anchor;
|
3602 |
}
|
3603 |
|
3604 |
-
public function setAuthor(
|
3605 |
{
|
3606 |
$this->author = $author;
|
3607 |
}
|
@@ -3631,7 +3631,7 @@ class Google_Service_Drive_Comment extends Google_Collection
|
|
3631 |
return $this->content;
|
3632 |
}
|
3633 |
|
3634 |
-
public function setContext(
|
3635 |
{
|
3636 |
$this->context = $context;
|
3637 |
}
|
@@ -3742,7 +3742,7 @@ class Google_Service_Drive_Comment extends Google_Collection
|
|
3742 |
}
|
3743 |
}
|
3744 |
|
3745 |
-
class
|
3746 |
{
|
3747 |
public $type;
|
3748 |
public $value;
|
@@ -3768,9 +3768,9 @@ class Google_Service_Drive_CommentContext extends Google_Model
|
|
3768 |
}
|
3769 |
}
|
3770 |
|
3771 |
-
class
|
3772 |
{
|
3773 |
-
protected $itemsType = '
|
3774 |
protected $itemsDataType = 'array';
|
3775 |
public $kind;
|
3776 |
public $nextLink;
|
@@ -3828,9 +3828,9 @@ class Google_Service_Drive_CommentList extends Google_Collection
|
|
3828 |
}
|
3829 |
}
|
3830 |
|
3831 |
-
class
|
3832 |
{
|
3833 |
-
protected $authorType = '
|
3834 |
protected $authorDataType = '';
|
3835 |
public $content;
|
3836 |
public $createdDate;
|
@@ -3841,7 +3841,7 @@ class Google_Service_Drive_CommentReply extends Google_Model
|
|
3841 |
public $replyId;
|
3842 |
public $verb;
|
3843 |
|
3844 |
-
public function setAuthor(
|
3845 |
{
|
3846 |
$this->author = $author;
|
3847 |
}
|
@@ -3932,9 +3932,9 @@ class Google_Service_Drive_CommentReply extends Google_Model
|
|
3932 |
}
|
3933 |
}
|
3934 |
|
3935 |
-
class
|
3936 |
{
|
3937 |
-
protected $itemsType = '
|
3938 |
protected $itemsDataType = 'array';
|
3939 |
public $kind;
|
3940 |
public $nextLink;
|
@@ -3992,7 +3992,7 @@ class Google_Service_Drive_CommentReplyList extends Google_Collection
|
|
3992 |
}
|
3993 |
}
|
3994 |
|
3995 |
-
class
|
3996 |
{
|
3997 |
public $alternateLink;
|
3998 |
public $appDataContents;
|
@@ -4011,14 +4011,14 @@ class Google_Service_Drive_DriveFile extends Google_Collection
|
|
4011 |
public $headRevisionId;
|
4012 |
public $iconLink;
|
4013 |
public $id;
|
4014 |
-
protected $imageMediaMetadataType = '
|
4015 |
protected $imageMediaMetadataDataType = '';
|
4016 |
-
protected $indexableTextType = '
|
4017 |
protected $indexableTextDataType = '';
|
4018 |
public $kind;
|
4019 |
-
protected $labelsType = '
|
4020 |
protected $labelsDataType = '';
|
4021 |
-
protected $lastModifyingUserType = '
|
4022 |
protected $lastModifyingUserDataType = '';
|
4023 |
public $lastModifyingUserName;
|
4024 |
public $lastViewedByMeDate;
|
@@ -4029,21 +4029,21 @@ class Google_Service_Drive_DriveFile extends Google_Collection
|
|
4029 |
public $openWithLinks;
|
4030 |
public $originalFilename;
|
4031 |
public $ownerNames;
|
4032 |
-
protected $ownersType = '
|
4033 |
protected $ownersDataType = 'array';
|
4034 |
-
protected $parentsType = '
|
4035 |
protected $parentsDataType = 'array';
|
4036 |
-
protected $propertiesType = '
|
4037 |
protected $propertiesDataType = 'array';
|
4038 |
public $quotaBytesUsed;
|
4039 |
public $selfLink;
|
4040 |
public $shared;
|
4041 |
public $sharedWithMeDate;
|
4042 |
-
protected $thumbnailType = '
|
4043 |
protected $thumbnailDataType = '';
|
4044 |
public $thumbnailLink;
|
4045 |
public $title;
|
4046 |
-
protected $userPermissionType = '
|
4047 |
protected $userPermissionDataType = '';
|
4048 |
public $webContentLink;
|
4049 |
public $webViewLink;
|
@@ -4219,7 +4219,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
|
|
4219 |
return $this->id;
|
4220 |
}
|
4221 |
|
4222 |
-
public function setImageMediaMetadata(
|
4223 |
{
|
4224 |
$this->imageMediaMetadata = $imageMediaMetadata;
|
4225 |
}
|
@@ -4229,7 +4229,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
|
|
4229 |
return $this->imageMediaMetadata;
|
4230 |
}
|
4231 |
|
4232 |
-
public function setIndexableText(
|
4233 |
{
|
4234 |
$this->indexableText = $indexableText;
|
4235 |
}
|
@@ -4249,7 +4249,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
|
|
4249 |
return $this->kind;
|
4250 |
}
|
4251 |
|
4252 |
-
public function setLabels(
|
4253 |
{
|
4254 |
$this->labels = $labels;
|
4255 |
}
|
@@ -4259,7 +4259,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
|
|
4259 |
return $this->labels;
|
4260 |
}
|
4261 |
|
4262 |
-
public function setLastModifyingUser(
|
4263 |
{
|
4264 |
$this->lastModifyingUser = $lastModifyingUser;
|
4265 |
}
|
@@ -4429,7 +4429,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
|
|
4429 |
return $this->sharedWithMeDate;
|
4430 |
}
|
4431 |
|
4432 |
-
public function setThumbnail(
|
4433 |
{
|
4434 |
$this->thumbnail = $thumbnail;
|
4435 |
}
|
@@ -4459,7 +4459,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
|
|
4459 |
return $this->title;
|
4460 |
}
|
4461 |
|
4462 |
-
public function setUserPermission(
|
4463 |
{
|
4464 |
$this->userPermission = $userPermission;
|
4465 |
}
|
@@ -4500,7 +4500,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
|
|
4500 |
}
|
4501 |
}
|
4502 |
|
4503 |
-
class
|
4504 |
{
|
4505 |
public $aperture;
|
4506 |
public $cameraMake;
|
@@ -4515,7 +4515,7 @@ class Google_Service_Drive_DriveFileImageMediaMetadata extends Google_Model
|
|
4515 |
public $height;
|
4516 |
public $isoSpeed;
|
4517 |
public $lens;
|
4518 |
-
protected $locationType = '
|
4519 |
protected $locationDataType = '';
|
4520 |
public $maxApertureValue;
|
4521 |
public $meteringMode;
|
@@ -4655,7 +4655,7 @@ class Google_Service_Drive_DriveFileImageMediaMetadata extends Google_Model
|
|
4655 |
return $this->lens;
|
4656 |
}
|
4657 |
|
4658 |
-
public function setLocation(
|
4659 |
{
|
4660 |
$this->location = $location;
|
4661 |
}
|
@@ -4736,7 +4736,7 @@ class Google_Service_Drive_DriveFileImageMediaMetadata extends Google_Model
|
|
4736 |
}
|
4737 |
}
|
4738 |
|
4739 |
-
class
|
4740 |
{
|
4741 |
public $altitude;
|
4742 |
public $latitude;
|
@@ -4773,7 +4773,7 @@ class Google_Service_Drive_DriveFileImageMediaMetadataLocation extends Google_Mo
|
|
4773 |
}
|
4774 |
}
|
4775 |
|
4776 |
-
class
|
4777 |
{
|
4778 |
public $text;
|
4779 |
|
@@ -4788,7 +4788,7 @@ class Google_Service_Drive_DriveFileIndexableText extends Google_Model
|
|
4788 |
}
|
4789 |
}
|
4790 |
|
4791 |
-
class
|
4792 |
{
|
4793 |
public $hidden;
|
4794 |
public $restricted;
|
@@ -4847,7 +4847,7 @@ class Google_Service_Drive_DriveFileLabels extends Google_Model
|
|
4847 |
}
|
4848 |
}
|
4849 |
|
4850 |
-
class
|
4851 |
{
|
4852 |
public $image;
|
4853 |
public $mimeType;
|
@@ -4873,10 +4873,10 @@ class Google_Service_Drive_DriveFileThumbnail extends Google_Model
|
|
4873 |
}
|
4874 |
}
|
4875 |
|
4876 |
-
class
|
4877 |
{
|
4878 |
public $etag;
|
4879 |
-
protected $itemsType = '
|
4880 |
protected $itemsDataType = 'array';
|
4881 |
public $kind;
|
4882 |
public $nextLink;
|
@@ -4944,10 +4944,10 @@ class Google_Service_Drive_FileList extends Google_Collection
|
|
4944 |
}
|
4945 |
}
|
4946 |
|
4947 |
-
class
|
4948 |
{
|
4949 |
public $etag;
|
4950 |
-
protected $itemsType = '
|
4951 |
protected $itemsDataType = 'array';
|
4952 |
public $kind;
|
4953 |
public $selfLink;
|
@@ -4993,7 +4993,7 @@ class Google_Service_Drive_ParentList extends Google_Collection
|
|
4993 |
}
|
4994 |
}
|
4995 |
|
4996 |
-
class
|
4997 |
{
|
4998 |
public $id;
|
4999 |
public $isRoot;
|
@@ -5052,7 +5052,7 @@ class Google_Service_Drive_ParentReference extends Google_Model
|
|
5052 |
}
|
5053 |
}
|
5054 |
|
5055 |
-
class
|
5056 |
{
|
5057 |
public $additionalRoles;
|
5058 |
public $authKey;
|
@@ -5210,7 +5210,7 @@ class Google_Service_Drive_Permission extends Google_Collection
|
|
5210 |
}
|
5211 |
}
|
5212 |
|
5213 |
-
class
|
5214 |
{
|
5215 |
public $id;
|
5216 |
public $kind;
|
@@ -5236,10 +5236,10 @@ class Google_Service_Drive_PermissionId extends Google_Model
|
|
5236 |
}
|
5237 |
}
|
5238 |
|
5239 |
-
class
|
5240 |
{
|
5241 |
public $etag;
|
5242 |
-
protected $itemsType = '
|
5243 |
protected $itemsDataType = 'array';
|
5244 |
public $kind;
|
5245 |
public $selfLink;
|
@@ -5285,7 +5285,7 @@ class Google_Service_Drive_PermissionList extends Google_Collection
|
|
5285 |
}
|
5286 |
}
|
5287 |
|
5288 |
-
class
|
5289 |
{
|
5290 |
public $etag;
|
5291 |
public $key;
|
@@ -5355,10 +5355,10 @@ class Google_Service_Drive_Property extends Google_Model
|
|
5355 |
}
|
5356 |
}
|
5357 |
|
5358 |
-
class
|
5359 |
{
|
5360 |
public $etag;
|
5361 |
-
protected $itemsType = '
|
5362 |
protected $itemsDataType = 'array';
|
5363 |
public $kind;
|
5364 |
public $selfLink;
|
@@ -5404,7 +5404,7 @@ class Google_Service_Drive_PropertyList extends Google_Collection
|
|
5404 |
}
|
5405 |
}
|
5406 |
|
5407 |
-
class
|
5408 |
{
|
5409 |
public $downloadUrl;
|
5410 |
public $etag;
|
@@ -5412,7 +5412,7 @@ class Google_Service_Drive_Revision extends Google_Model
|
|
5412 |
public $fileSize;
|
5413 |
public $id;
|
5414 |
public $kind;
|
5415 |
-
protected $lastModifyingUserType = '
|
5416 |
protected $lastModifyingUserDataType = '';
|
5417 |
public $lastModifyingUserName;
|
5418 |
public $md5Checksum;
|
@@ -5486,7 +5486,7 @@ class Google_Service_Drive_Revision extends Google_Model
|
|
5486 |
return $this->kind;
|
5487 |
}
|
5488 |
|
5489 |
-
public function setLastModifyingUser(
|
5490 |
{
|
5491 |
$this->lastModifyingUser = $lastModifyingUser;
|
5492 |
}
|
@@ -5607,10 +5607,10 @@ class Google_Service_Drive_Revision extends Google_Model
|
|
5607 |
}
|
5608 |
}
|
5609 |
|
5610 |
-
class
|
5611 |
{
|
5612 |
public $etag;
|
5613 |
-
protected $itemsType = '
|
5614 |
protected $itemsDataType = 'array';
|
5615 |
public $kind;
|
5616 |
public $selfLink;
|
@@ -5656,13 +5656,13 @@ class Google_Service_Drive_RevisionList extends Google_Collection
|
|
5656 |
}
|
5657 |
}
|
5658 |
|
5659 |
-
class
|
5660 |
{
|
5661 |
public $displayName;
|
5662 |
public $isAuthenticatedUser;
|
5663 |
public $kind;
|
5664 |
public $permissionId;
|
5665 |
-
protected $pictureType = '
|
5666 |
protected $pictureDataType = '';
|
5667 |
|
5668 |
public function setDisplayName($displayName)
|
@@ -5705,7 +5705,7 @@ class Google_Service_Drive_User extends Google_Model
|
|
5705 |
return $this->permissionId;
|
5706 |
}
|
5707 |
|
5708 |
-
public function setPicture(
|
5709 |
{
|
5710 |
$this->picture = $picture;
|
5711 |
}
|
@@ -5716,7 +5716,7 @@ class Google_Service_Drive_User extends Google_Model
|
|
5716 |
}
|
5717 |
}
|
5718 |
|
5719 |
-
class
|
5720 |
{
|
5721 |
public $url;
|
5722 |
|
29 |
*
|
30 |
* @author Google, Inc.
|
31 |
*/
|
32 |
+
class IWP_google_Service_Drive extends IWP_google_Service
|
33 |
{
|
34 |
/** View and manage the files and documents in your Google Drive. */
|
35 |
const DRIVE = "https://www.googleapis.com/auth/drive";
|
64 |
/**
|
65 |
* Constructs the internal representation of the Drive service.
|
66 |
*
|
67 |
+
* @param IWP_google_Client $client
|
68 |
*/
|
69 |
+
public function __construct(IWP_google_Client $client)
|
70 |
{
|
71 |
parent::__construct($client);
|
72 |
$this->servicePath = 'drive/v2/';
|
73 |
$this->version = 'v2';
|
74 |
$this->serviceName = 'drive';
|
75 |
|
76 |
+
$this->about = new IWP_google_Service_Drive_About_Resource(
|
77 |
$this,
|
78 |
$this->serviceName,
|
79 |
'about',
|
100 |
)
|
101 |
)
|
102 |
);
|
103 |
+
$this->apps = new IWP_google_Service_Drive_Apps_Resource(
|
104 |
$this,
|
105 |
$this->serviceName,
|
106 |
'apps',
|
124 |
)
|
125 |
)
|
126 |
);
|
127 |
+
$this->changes = new IWP_google_Service_Drive_Changes_Resource(
|
128 |
$this,
|
129 |
$this->serviceName,
|
130 |
'changes',
|
194 |
)
|
195 |
)
|
196 |
);
|
197 |
+
$this->channels = new IWP_google_Service_Drive_Channels_Resource(
|
198 |
$this,
|
199 |
$this->serviceName,
|
200 |
'channels',
|
208 |
)
|
209 |
)
|
210 |
);
|
211 |
+
$this->children = new IWP_google_Service_Drive_Children_Resource(
|
212 |
$this,
|
213 |
$this->serviceName,
|
214 |
'children',
|
280 |
)
|
281 |
)
|
282 |
);
|
283 |
+
$this->comments = new IWP_google_Service_Drive_Comments_Resource(
|
284 |
$this,
|
285 |
$this->serviceName,
|
286 |
'comments',
|
390 |
)
|
391 |
)
|
392 |
);
|
393 |
+
$this->files = new IWP_google_Service_Drive_Files_Resource(
|
394 |
$this,
|
395 |
$this->serviceName,
|
396 |
'files',
|
672 |
)
|
673 |
)
|
674 |
);
|
675 |
+
$this->parents = new IWP_google_Service_Drive_Parents_Resource(
|
676 |
$this,
|
677 |
$this->serviceName,
|
678 |
'parents',
|
732 |
)
|
733 |
)
|
734 |
);
|
735 |
+
$this->permissions = new IWP_google_Service_Drive_Permissions_Resource(
|
736 |
$this,
|
737 |
$this->serviceName,
|
738 |
'permissions',
|
848 |
)
|
849 |
)
|
850 |
);
|
851 |
+
$this->properties = new IWP_google_Service_Drive_Properties_Resource(
|
852 |
$this,
|
853 |
$this->serviceName,
|
854 |
'properties',
|
954 |
)
|
955 |
)
|
956 |
);
|
957 |
+
$this->realtime = new IWP_google_Service_Drive_Realtime_Resource(
|
958 |
$this,
|
959 |
$this->serviceName,
|
960 |
'realtime',
|
988 |
)
|
989 |
)
|
990 |
);
|
991 |
+
$this->replies = new IWP_google_Service_Drive_Replies_Resource(
|
992 |
$this,
|
993 |
$this->serviceName,
|
994 |
'replies',
|
1124 |
)
|
1125 |
)
|
1126 |
);
|
1127 |
+
$this->revisions = new IWP_google_Service_Drive_Revisions_Resource(
|
1128 |
$this,
|
1129 |
$this->serviceName,
|
1130 |
'revisions',
|
1212 |
* The "about" collection of methods.
|
1213 |
* Typical usage is:
|
1214 |
* <code>
|
1215 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
1216 |
* $about = $driveService->about;
|
1217 |
* </code>
|
1218 |
*/
|
1219 |
+
class IWP_google_Service_Drive_About_Resource extends IWP_google_Service_Resource
|
1220 |
{
|
1221 |
|
1222 |
/**
|
1233 |
* Maximum number of remaining change IDs to count
|
1234 |
* @opt_param string startChangeId
|
1235 |
* Change ID to start counting from when calculating number of remaining change IDs
|
1236 |
+
* @return IWP_google_Service_Drive_About
|
1237 |
*/
|
1238 |
public function get($optParams = array())
|
1239 |
{
|
1240 |
$params = array();
|
1241 |
$params = array_merge($params, $optParams);
|
1242 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_About");
|
1243 |
}
|
1244 |
}
|
1245 |
|
1247 |
* The "apps" collection of methods.
|
1248 |
* Typical usage is:
|
1249 |
* <code>
|
1250 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
1251 |
* $apps = $driveService->apps;
|
1252 |
* </code>
|
1253 |
*/
|
1254 |
+
class IWP_google_Service_Drive_Apps_Resource extends IWP_google_Service_Resource
|
1255 |
{
|
1256 |
|
1257 |
/**
|
1260 |
* @param string $appId
|
1261 |
* The ID of the app.
|
1262 |
* @param array $optParams Optional parameters.
|
1263 |
+
* @return IWP_google_Service_Drive_App
|
1264 |
*/
|
1265 |
public function get($appId, $optParams = array())
|
1266 |
{
|
1267 |
$params = array('appId' => $appId);
|
1268 |
$params = array_merge($params, $optParams);
|
1269 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_App");
|
1270 |
}
|
1271 |
/**
|
1272 |
* Lists a user's installed apps. (apps.listApps)
|
1273 |
*
|
1274 |
* @param array $optParams Optional parameters.
|
1275 |
+
* @return IWP_google_Service_Drive_AppList
|
1276 |
*/
|
1277 |
public function listApps($optParams = array())
|
1278 |
{
|
1279 |
$params = array();
|
1280 |
$params = array_merge($params, $optParams);
|
1281 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_AppList");
|
1282 |
}
|
1283 |
}
|
1284 |
|
1286 |
* The "changes" collection of methods.
|
1287 |
* Typical usage is:
|
1288 |
* <code>
|
1289 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
1290 |
* $changes = $driveService->changes;
|
1291 |
* </code>
|
1292 |
*/
|
1293 |
+
class IWP_google_Service_Drive_Changes_Resource extends IWP_google_Service_Resource
|
1294 |
{
|
1295 |
|
1296 |
/**
|
1299 |
* @param string $changeId
|
1300 |
* The ID of the change.
|
1301 |
* @param array $optParams Optional parameters.
|
1302 |
+
* @return IWP_google_Service_Drive_Change
|
1303 |
*/
|
1304 |
public function get($changeId, $optParams = array())
|
1305 |
{
|
1306 |
$params = array('changeId' => $changeId);
|
1307 |
$params = array_merge($params, $optParams);
|
1308 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_Change");
|
1309 |
}
|
1310 |
/**
|
1311 |
* Lists the changes for a user. (changes.listChanges)
|
1324 |
* Maximum number of changes to return.
|
1325 |
* @opt_param string pageToken
|
1326 |
* Page token for changes.
|
1327 |
+
* @return IWP_google_Service_Drive_ChangeList
|
1328 |
*/
|
1329 |
public function listChanges($optParams = array())
|
1330 |
{
|
1331 |
$params = array();
|
1332 |
$params = array_merge($params, $optParams);
|
1333 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_ChangeList");
|
1334 |
}
|
1335 |
/**
|
1336 |
* Subscribe to changes for a user. (changes.watch)
|
1337 |
*
|
1338 |
+
* @param IWP_google_Channel $postBody
|
1339 |
* @param array $optParams Optional parameters.
|
1340 |
*
|
1341 |
* @opt_param bool includeSubscribed
|
1350 |
* Maximum number of changes to return.
|
1351 |
* @opt_param string pageToken
|
1352 |
* Page token for changes.
|
1353 |
+
* @return IWP_google_Service_Drive_Channel
|
1354 |
*/
|
1355 |
+
public function watch(IWP_google_Service_Drive_Channel $postBody, $optParams = array())
|
1356 |
{
|
1357 |
$params = array('postBody' => $postBody);
|
1358 |
$params = array_merge($params, $optParams);
|
1359 |
+
return $this->call('watch', array($params), "IWP_google_Service_Drive_Channel");
|
1360 |
}
|
1361 |
}
|
1362 |
|
1364 |
* The "channels" collection of methods.
|
1365 |
* Typical usage is:
|
1366 |
* <code>
|
1367 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
1368 |
* $channels = $driveService->channels;
|
1369 |
* </code>
|
1370 |
*/
|
1371 |
+
class IWP_google_Service_Drive_Channels_Resource extends IWP_google_Service_Resource
|
1372 |
{
|
1373 |
|
1374 |
/**
|
1375 |
* Stop watching resources through this channel (channels.stop)
|
1376 |
*
|
1377 |
+
* @param IWP_google_Channel $postBody
|
1378 |
* @param array $optParams Optional parameters.
|
1379 |
*/
|
1380 |
+
public function stop(IWP_google_Service_Drive_Channel $postBody, $optParams = array())
|
1381 |
{
|
1382 |
$params = array('postBody' => $postBody);
|
1383 |
$params = array_merge($params, $optParams);
|
1389 |
* The "children" collection of methods.
|
1390 |
* Typical usage is:
|
1391 |
* <code>
|
1392 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
1393 |
* $children = $driveService->children;
|
1394 |
* </code>
|
1395 |
*/
|
1396 |
+
class IWP_google_Service_Drive_Children_Resource extends IWP_google_Service_Resource
|
1397 |
{
|
1398 |
|
1399 |
/**
|
1419 |
* @param string $childId
|
1420 |
* The ID of the child.
|
1421 |
* @param array $optParams Optional parameters.
|
1422 |
+
* @return IWP_google_Service_Drive_ChildReference
|
1423 |
*/
|
1424 |
public function get($folderId, $childId, $optParams = array())
|
1425 |
{
|
1426 |
$params = array('folderId' => $folderId, 'childId' => $childId);
|
1427 |
$params = array_merge($params, $optParams);
|
1428 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_ChildReference");
|
1429 |
}
|
1430 |
/**
|
1431 |
* Inserts a file into a folder. (children.insert)
|
1432 |
*
|
1433 |
* @param string $folderId
|
1434 |
* The ID of the folder.
|
1435 |
+
* @param IWP_google_ChildReference $postBody
|
1436 |
* @param array $optParams Optional parameters.
|
1437 |
+
* @return IWP_google_Service_Drive_ChildReference
|
1438 |
*/
|
1439 |
+
public function insert($folderId, IWP_google_Service_Drive_ChildReference $postBody, $optParams = array())
|
1440 |
{
|
1441 |
$params = array('folderId' => $folderId, 'postBody' => $postBody);
|
1442 |
$params = array_merge($params, $optParams);
|
1443 |
+
return $this->call('insert', array($params), "IWP_google_Service_Drive_ChildReference");
|
1444 |
}
|
1445 |
/**
|
1446 |
* Lists a folder's children. (children.listChildren)
|
1455 |
* Page token for children.
|
1456 |
* @opt_param int maxResults
|
1457 |
* Maximum number of children to return.
|
1458 |
+
* @return IWP_google_Service_Drive_ChildList
|
1459 |
*/
|
1460 |
public function listChildren($folderId, $optParams = array())
|
1461 |
{
|
1462 |
$params = array('folderId' => $folderId);
|
1463 |
$params = array_merge($params, $optParams);
|
1464 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_ChildList");
|
1465 |
}
|
1466 |
}
|
1467 |
|
1469 |
* The "comments" collection of methods.
|
1470 |
* Typical usage is:
|
1471 |
* <code>
|
1472 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
1473 |
* $comments = $driveService->comments;
|
1474 |
* </code>
|
1475 |
*/
|
1476 |
+
class IWP_google_Service_Drive_Comments_Resource extends IWP_google_Service_Resource
|
1477 |
{
|
1478 |
|
1479 |
/**
|
1503 |
* @opt_param bool includeDeleted
|
1504 |
* If set, this will succeed when retrieving a deleted comment, and will include any deleted
|
1505 |
* replies.
|
1506 |
+
* @return IWP_google_Service_Drive_Comment
|
1507 |
*/
|
1508 |
public function get($fileId, $commentId, $optParams = array())
|
1509 |
{
|
1510 |
$params = array('fileId' => $fileId, 'commentId' => $commentId);
|
1511 |
$params = array_merge($params, $optParams);
|
1512 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_Comment");
|
1513 |
}
|
1514 |
/**
|
1515 |
* Creates a new comment on the given file. (comments.insert)
|
1516 |
*
|
1517 |
* @param string $fileId
|
1518 |
* The ID of the file.
|
1519 |
+
* @param IWP_google_Comment $postBody
|
1520 |
* @param array $optParams Optional parameters.
|
1521 |
+
* @return IWP_google_Service_Drive_Comment
|
1522 |
*/
|
1523 |
+
public function insert($fileId, IWP_google_Service_Drive_Comment $postBody, $optParams = array())
|
1524 |
{
|
1525 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1526 |
$params = array_merge($params, $optParams);
|
1527 |
+
return $this->call('insert', array($params), "IWP_google_Service_Drive_Comment");
|
1528 |
}
|
1529 |
/**
|
1530 |
* Lists a file's comments. (comments.listComments)
|
1544 |
* will be returned.
|
1545 |
* @opt_param int maxResults
|
1546 |
* The maximum number of discussions to include in the response, used for paging.
|
1547 |
+
* @return IWP_google_Service_Drive_CommentList
|
1548 |
*/
|
1549 |
public function listComments($fileId, $optParams = array())
|
1550 |
{
|
1551 |
$params = array('fileId' => $fileId);
|
1552 |
$params = array_merge($params, $optParams);
|
1553 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_CommentList");
|
1554 |
}
|
1555 |
/**
|
1556 |
* Updates an existing comment. This method supports patch semantics.
|
1560 |
* The ID of the file.
|
1561 |
* @param string $commentId
|
1562 |
* The ID of the comment.
|
1563 |
+
* @param IWP_google_Comment $postBody
|
1564 |
* @param array $optParams Optional parameters.
|
1565 |
+
* @return IWP_google_Service_Drive_Comment
|
1566 |
*/
|
1567 |
+
public function patch($fileId, $commentId, IWP_google_Service_Drive_Comment $postBody, $optParams = array())
|
1568 |
{
|
1569 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
|
1570 |
$params = array_merge($params, $optParams);
|
1571 |
+
return $this->call('patch', array($params), "IWP_google_Service_Drive_Comment");
|
1572 |
}
|
1573 |
/**
|
1574 |
* Updates an existing comment. (comments.update)
|
1577 |
* The ID of the file.
|
1578 |
* @param string $commentId
|
1579 |
* The ID of the comment.
|
1580 |
+
* @param IWP_google_Comment $postBody
|
1581 |
* @param array $optParams Optional parameters.
|
1582 |
+
* @return IWP_google_Service_Drive_Comment
|
1583 |
*/
|
1584 |
+
public function update($fileId, $commentId, IWP_google_Service_Drive_Comment $postBody, $optParams = array())
|
1585 |
{
|
1586 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
|
1587 |
$params = array_merge($params, $optParams);
|
1588 |
+
return $this->call('update', array($params), "IWP_google_Service_Drive_Comment");
|
1589 |
}
|
1590 |
}
|
1591 |
|
1593 |
* The "files" collection of methods.
|
1594 |
* Typical usage is:
|
1595 |
* <code>
|
1596 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
1597 |
* $files = $driveService->files;
|
1598 |
* </code>
|
1599 |
*/
|
1600 |
+
class IWP_google_Service_Drive_Files_Resource extends IWP_google_Service_Resource
|
1601 |
{
|
1602 |
|
1603 |
/**
|
1605 |
*
|
1606 |
* @param string $fileId
|
1607 |
* The ID of the file to copy.
|
1608 |
+
* @param IWP_google_DriveFile $postBody
|
1609 |
* @param array $optParams Optional parameters.
|
1610 |
*
|
1611 |
* @opt_param bool convert
|
1623 |
* The timed text track name.
|
1624 |
* @opt_param string timedTextLanguage
|
1625 |
* The language of the timed text.
|
1626 |
+
* @return IWP_google_Service_Drive_DriveFile
|
1627 |
*/
|
1628 |
+
public function copy($fileId, IWP_google_Service_Drive_DriveFile $postBody, $optParams = array())
|
1629 |
{
|
1630 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1631 |
$params = array_merge($params, $optParams);
|
1632 |
+
return $this->call('copy', array($params), "IWP_google_Service_Drive_DriveFile");
|
1633 |
}
|
1634 |
/**
|
1635 |
* Permanently deletes a file by ID. Skips the trash. (files.delete)
|
1655 |
* Whether to update the view date after successfully retrieving the file.
|
1656 |
* @opt_param string projection
|
1657 |
* This parameter is deprecated and has no function.
|
1658 |
+
* @return IWP_google_Service_Drive_DriveFile
|
1659 |
*/
|
1660 |
public function get($fileId, $optParams = array())
|
1661 |
{
|
1662 |
$params = array('fileId' => $fileId);
|
1663 |
$params = array_merge($params, $optParams);
|
1664 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_DriveFile");
|
1665 |
}
|
1666 |
/**
|
1667 |
* Insert a new file. (files.insert)
|
1668 |
*
|
1669 |
+
* @param IWP_google_DriveFile $postBody
|
1670 |
* @param array $optParams Optional parameters.
|
1671 |
*
|
1672 |
* @opt_param bool convert
|
1685 |
* The timed text track name.
|
1686 |
* @opt_param string timedTextLanguage
|
1687 |
* The language of the timed text.
|
1688 |
+
* @return IWP_google_Service_Drive_DriveFile
|
1689 |
*/
|
1690 |
+
public function insert(IWP_google_Service_Drive_DriveFile $postBody, $optParams = array())
|
1691 |
{
|
1692 |
$params = array('postBody' => $postBody);
|
1693 |
$params = array_merge($params, $optParams);
|
1694 |
+
return $this->call('insert', array($params), "IWP_google_Service_Drive_DriveFile");
|
1695 |
}
|
1696 |
/**
|
1697 |
* Lists the user's files. (files.listFiles)
|
1706 |
* This parameter is deprecated and has no function.
|
1707 |
* @opt_param int maxResults
|
1708 |
* Maximum number of files to return.
|
1709 |
+
* @return IWP_google_Service_Drive_FileList
|
1710 |
*/
|
1711 |
public function listFiles($optParams = array())
|
1712 |
{
|
1713 |
$params = array();
|
1714 |
$params = array_merge($params, $optParams);
|
1715 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_FileList");
|
1716 |
}
|
1717 |
/**
|
1718 |
* Updates file metadata and/or content. This method supports patch semantics.
|
1720 |
*
|
1721 |
* @param string $fileId
|
1722 |
* The ID of the file to update.
|
1723 |
+
* @param IWP_google_DriveFile $postBody
|
1724 |
* @param array $optParams Optional parameters.
|
1725 |
*
|
1726 |
* @opt_param bool convert
|
1745 |
* The language of the timed text.
|
1746 |
* @opt_param string timedTextTrackName
|
1747 |
* The timed text track name.
|
1748 |
+
* @return IWP_google_Service_Drive_DriveFile
|
1749 |
*/
|
1750 |
+
public function patch($fileId, IWP_google_Service_Drive_DriveFile $postBody, $optParams = array())
|
1751 |
{
|
1752 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1753 |
$params = array_merge($params, $optParams);
|
1754 |
+
return $this->call('patch', array($params), "IWP_google_Service_Drive_DriveFile");
|
1755 |
}
|
1756 |
/**
|
1757 |
* Set the file's updated time to the current server time. (files.touch)
|
1759 |
* @param string $fileId
|
1760 |
* The ID of the file to update.
|
1761 |
* @param array $optParams Optional parameters.
|
1762 |
+
* @return IWP_google_Service_Drive_DriveFile
|
1763 |
*/
|
1764 |
public function touch($fileId, $optParams = array())
|
1765 |
{
|
1766 |
$params = array('fileId' => $fileId);
|
1767 |
$params = array_merge($params, $optParams);
|
1768 |
+
return $this->call('touch', array($params), "IWP_google_Service_Drive_DriveFile");
|
1769 |
}
|
1770 |
/**
|
1771 |
* Moves a file to the trash. (files.trash)
|
1773 |
* @param string $fileId
|
1774 |
* The ID of the file to trash.
|
1775 |
* @param array $optParams Optional parameters.
|
1776 |
+
* @return IWP_google_Service_Drive_DriveFile
|
1777 |
*/
|
1778 |
public function trash($fileId, $optParams = array())
|
1779 |
{
|
1780 |
$params = array('fileId' => $fileId);
|
1781 |
$params = array_merge($params, $optParams);
|
1782 |
+
return $this->call('trash', array($params), "IWP_google_Service_Drive_DriveFile");
|
1783 |
}
|
1784 |
/**
|
1785 |
* Restores a file from the trash. (files.untrash)
|
1787 |
* @param string $fileId
|
1788 |
* The ID of the file to untrash.
|
1789 |
* @param array $optParams Optional parameters.
|
1790 |
+
* @return IWP_google_Service_Drive_DriveFile
|
1791 |
*/
|
1792 |
public function untrash($fileId, $optParams = array())
|
1793 |
{
|
1794 |
$params = array('fileId' => $fileId);
|
1795 |
$params = array_merge($params, $optParams);
|
1796 |
+
return $this->call('untrash', array($params), "IWP_google_Service_Drive_DriveFile");
|
1797 |
}
|
1798 |
/**
|
1799 |
* Updates file metadata and/or content. (files.update)
|
1800 |
*
|
1801 |
* @param string $fileId
|
1802 |
* The ID of the file to update.
|
1803 |
+
* @param IWP_google_DriveFile $postBody
|
1804 |
* @param array $optParams Optional parameters.
|
1805 |
*
|
1806 |
* @opt_param bool convert
|
1825 |
* The language of the timed text.
|
1826 |
* @opt_param string timedTextTrackName
|
1827 |
* The timed text track name.
|
1828 |
+
* @return IWP_google_Service_Drive_DriveFile
|
1829 |
*/
|
1830 |
+
public function update($fileId, IWP_google_Service_Drive_DriveFile $postBody, $optParams = array())
|
1831 |
{
|
1832 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1833 |
$params = array_merge($params, $optParams);
|
1834 |
+
return $this->call('update', array($params), "IWP_google_Service_Drive_DriveFile");
|
1835 |
}
|
1836 |
/**
|
1837 |
* Subscribe to changes on a file (files.watch)
|
1838 |
*
|
1839 |
* @param string $fileId
|
1840 |
* The ID for the file in question.
|
1841 |
+
* @param IWP_google_Channel $postBody
|
1842 |
* @param array $optParams Optional parameters.
|
1843 |
*
|
1844 |
* @opt_param bool updateViewedDate
|
1845 |
* Whether to update the view date after successfully retrieving the file.
|
1846 |
* @opt_param string projection
|
1847 |
* This parameter is deprecated and has no function.
|
1848 |
+
* @return IWP_google_Service_Drive_Channel
|
1849 |
*/
|
1850 |
+
public function watch($fileId, IWP_google_Service_Drive_Channel $postBody, $optParams = array())
|
1851 |
{
|
1852 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1853 |
$params = array_merge($params, $optParams);
|
1854 |
+
return $this->call('watch', array($params), "IWP_google_Service_Drive_Channel");
|
1855 |
}
|
1856 |
}
|
1857 |
|
1859 |
* The "parents" collection of methods.
|
1860 |
* Typical usage is:
|
1861 |
* <code>
|
1862 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
1863 |
* $parents = $driveService->parents;
|
1864 |
* </code>
|
1865 |
*/
|
1866 |
+
class IWP_google_Service_Drive_Parents_Resource extends IWP_google_Service_Resource
|
1867 |
{
|
1868 |
|
1869 |
/**
|
1889 |
* @param string $parentId
|
1890 |
* The ID of the parent.
|
1891 |
* @param array $optParams Optional parameters.
|
1892 |
+
* @return IWP_google_Service_Drive_ParentReference
|
1893 |
*/
|
1894 |
public function get($fileId, $parentId, $optParams = array())
|
1895 |
{
|
1896 |
$params = array('fileId' => $fileId, 'parentId' => $parentId);
|
1897 |
$params = array_merge($params, $optParams);
|
1898 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_ParentReference");
|
1899 |
}
|
1900 |
/**
|
1901 |
* Adds a parent folder for a file. (parents.insert)
|
1902 |
*
|
1903 |
* @param string $fileId
|
1904 |
* The ID of the file.
|
1905 |
+
* @param IWP_google_ParentReference $postBody
|
1906 |
* @param array $optParams Optional parameters.
|
1907 |
+
* @return IWP_google_Service_Drive_ParentReference
|
1908 |
*/
|
1909 |
+
public function insert($fileId, IWP_google_Service_Drive_ParentReference $postBody, $optParams = array())
|
1910 |
{
|
1911 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
1912 |
$params = array_merge($params, $optParams);
|
1913 |
+
return $this->call('insert', array($params), "IWP_google_Service_Drive_ParentReference");
|
1914 |
}
|
1915 |
/**
|
1916 |
* Lists a file's parents. (parents.listParents)
|
1918 |
* @param string $fileId
|
1919 |
* The ID of the file.
|
1920 |
* @param array $optParams Optional parameters.
|
1921 |
+
* @return IWP_google_Service_Drive_ParentList
|
1922 |
*/
|
1923 |
public function listParents($fileId, $optParams = array())
|
1924 |
{
|
1925 |
$params = array('fileId' => $fileId);
|
1926 |
$params = array_merge($params, $optParams);
|
1927 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_ParentList");
|
1928 |
}
|
1929 |
}
|
1930 |
|
1932 |
* The "permissions" collection of methods.
|
1933 |
* Typical usage is:
|
1934 |
* <code>
|
1935 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
1936 |
* $permissions = $driveService->permissions;
|
1937 |
* </code>
|
1938 |
*/
|
1939 |
+
class IWP_google_Service_Drive_Permissions_Resource extends IWP_google_Service_Resource
|
1940 |
{
|
1941 |
|
1942 |
/**
|
1962 |
* @param string $permissionId
|
1963 |
* The ID for the permission.
|
1964 |
* @param array $optParams Optional parameters.
|
1965 |
+
* @return IWP_google_Service_Drive_Permission
|
1966 |
*/
|
1967 |
public function get($fileId, $permissionId, $optParams = array())
|
1968 |
{
|
1969 |
$params = array('fileId' => $fileId, 'permissionId' => $permissionId);
|
1970 |
$params = array_merge($params, $optParams);
|
1971 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_Permission");
|
1972 |
}
|
1973 |
/**
|
1974 |
* Returns the permission ID for an email address. (permissions.getIdForEmail)
|
1976 |
* @param string $email
|
1977 |
* The email address for which to return a permission ID
|
1978 |
* @param array $optParams Optional parameters.
|
1979 |
+
* @return IWP_google_Service_Drive_PermissionId
|
1980 |
*/
|
1981 |
public function getIdForEmail($email, $optParams = array())
|
1982 |
{
|
1983 |
$params = array('email' => $email);
|
1984 |
$params = array_merge($params, $optParams);
|
1985 |
+
return $this->call('getIdForEmail', array($params), "IWP_google_Service_Drive_PermissionId");
|
1986 |
}
|
1987 |
/**
|
1988 |
* Inserts a permission for a file. (permissions.insert)
|
1989 |
*
|
1990 |
* @param string $fileId
|
1991 |
* The ID for the file.
|
1992 |
+
* @param IWP_google_Permission $postBody
|
1993 |
* @param array $optParams Optional parameters.
|
1994 |
*
|
1995 |
* @opt_param string emailMessage
|
1996 |
* A custom message to include in notification emails.
|
1997 |
* @opt_param bool sendNotificationEmails
|
1998 |
* Whether to send notification emails when sharing to users or groups.
|
1999 |
+
* @return IWP_google_Service_Drive_Permission
|
2000 |
*/
|
2001 |
+
public function insert($fileId, IWP_google_Service_Drive_Permission $postBody, $optParams = array())
|
2002 |
{
|
2003 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
2004 |
$params = array_merge($params, $optParams);
|
2005 |
+
return $this->call('insert', array($params), "IWP_google_Service_Drive_Permission");
|
2006 |
}
|
2007 |
/**
|
2008 |
* Lists a file's permissions. (permissions.listPermissions)
|
2010 |
* @param string $fileId
|
2011 |
* The ID for the file.
|
2012 |
* @param array $optParams Optional parameters.
|
2013 |
+
* @return IWP_google_Service_Drive_PermissionList
|
2014 |
*/
|
2015 |
public function listPermissions($fileId, $optParams = array())
|
2016 |
{
|
2017 |
$params = array('fileId' => $fileId);
|
2018 |
$params = array_merge($params, $optParams);
|
2019 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_PermissionList");
|
2020 |
}
|
2021 |
/**
|
2022 |
* Updates a permission. This method supports patch semantics.
|
2026 |
* The ID for the file.
|
2027 |
* @param string $permissionId
|
2028 |
* The ID for the permission.
|
2029 |
+
* @param IWP_google_Permission $postBody
|
2030 |
* @param array $optParams Optional parameters.
|
2031 |
*
|
2032 |
* @opt_param bool transferOwnership
|
2033 |
* Whether changing a role to 'owner' should also downgrade the current owners to writers.
|
2034 |
+
* @return IWP_google_Service_Drive_Permission
|
2035 |
*/
|
2036 |
+
public function patch($fileId, $permissionId, IWP_google_Service_Drive_Permission $postBody, $optParams = array())
|
2037 |
{
|
2038 |
$params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
|
2039 |
$params = array_merge($params, $optParams);
|
2040 |
+
return $this->call('patch', array($params), "IWP_google_Service_Drive_Permission");
|
2041 |
}
|
2042 |
/**
|
2043 |
* Updates a permission. (permissions.update)
|
2046 |
* The ID for the file.
|
2047 |
* @param string $permissionId
|
2048 |
* The ID for the permission.
|
2049 |
+
* @param IWP_google_Permission $postBody
|
2050 |
* @param array $optParams Optional parameters.
|
2051 |
*
|
2052 |
* @opt_param bool transferOwnership
|
2053 |
* Whether changing a role to 'owner' should also downgrade the current owners to writers.
|
2054 |
+
* @return IWP_google_Service_Drive_Permission
|
2055 |
*/
|
2056 |
+
public function update($fileId, $permissionId, IWP_google_Service_Drive_Permission $postBody, $optParams = array())
|
2057 |
{
|
2058 |
$params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
|
2059 |
$params = array_merge($params, $optParams);
|
2060 |
+
return $this->call('update', array($params), "IWP_google_Service_Drive_Permission");
|
2061 |
}
|
2062 |
}
|
2063 |
|
2065 |
* The "properties" collection of methods.
|
2066 |
* Typical usage is:
|
2067 |
* <code>
|
2068 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
2069 |
* $properties = $driveService->properties;
|
2070 |
* </code>
|
2071 |
*/
|
2072 |
+
class IWP_google_Service_Drive_Properties_Resource extends IWP_google_Service_Resource
|
2073 |
{
|
2074 |
|
2075 |
/**
|
2101 |
*
|
2102 |
* @opt_param string visibility
|
2103 |
* The visibility of the property.
|
2104 |
+
* @return IWP_google_Service_Drive_Property
|
2105 |
*/
|
2106 |
public function get($fileId, $propertyKey, $optParams = array())
|
2107 |
{
|
2108 |
$params = array('fileId' => $fileId, 'propertyKey' => $propertyKey);
|
2109 |
$params = array_merge($params, $optParams);
|
2110 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_Property");
|
2111 |
}
|
2112 |
/**
|
2113 |
* Adds a property to a file. (properties.insert)
|
2114 |
*
|
2115 |
* @param string $fileId
|
2116 |
* The ID of the file.
|
2117 |
+
* @param IWP_google_Property $postBody
|
2118 |
* @param array $optParams Optional parameters.
|
2119 |
+
* @return IWP_google_Service_Drive_Property
|
2120 |
*/
|
2121 |
+
public function insert($fileId, IWP_google_Service_Drive_Property $postBody, $optParams = array())
|
2122 |
{
|
2123 |
$params = array('fileId' => $fileId, 'postBody' => $postBody);
|
2124 |
$params = array_merge($params, $optParams);
|
2125 |
+
return $this->call('insert', array($params), "IWP_google_Service_Drive_Property");
|
2126 |
}
|
2127 |
/**
|
2128 |
* Lists a file's properties. (properties.listProperties)
|
2130 |
* @param string $fileId
|
2131 |
* The ID of the file.
|
2132 |
* @param array $optParams Optional parameters.
|
2133 |
+
* @return IWP_google_Service_Drive_PropertyList
|
2134 |
*/
|
2135 |
public function listProperties($fileId, $optParams = array())
|
2136 |
{
|
2137 |
$params = array('fileId' => $fileId);
|
2138 |
$params = array_merge($params, $optParams);
|
2139 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_PropertyList");
|
2140 |
}
|
2141 |
/**
|
2142 |
* Updates a property. This method supports patch semantics. (properties.patch)
|
2145 |
* The ID of the file.
|
2146 |
* @param string $propertyKey
|
2147 |
* The key of the property.
|
2148 |
+
* @param IWP_google_Property $postBody
|
2149 |
* @param array $optParams Optional parameters.
|
2150 |
*
|
2151 |
* @opt_param string visibility
|
2152 |
* The visibility of the property.
|
2153 |
+
* @return IWP_google_Service_Drive_Property
|
2154 |
*/
|
2155 |
+
public function patch($fileId, $propertyKey, IWP_google_Service_Drive_Property $postBody, $optParams = array())
|
2156 |
{
|
2157 |
$params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
|
2158 |
$params = array_merge($params, $optParams);
|
2159 |
+
return $this->call('patch', array($params), "IWP_google_Service_Drive_Property");
|
2160 |
}
|
2161 |
/**
|
2162 |
* Updates a property. (properties.update)
|
2165 |
* The ID of the file.
|
2166 |
* @param string $propertyKey
|
2167 |
* The key of the property.
|
2168 |
+
* @param IWP_google_Property $postBody
|
2169 |
* @param array $optParams Optional parameters.
|
2170 |
*
|
2171 |
* @opt_param string visibility
|
2172 |
* The visibility of the property.
|
2173 |
+
* @return IWP_google_Service_Drive_Property
|
2174 |
*/
|
2175 |
+
public function update($fileId, $propertyKey, IWP_google_Service_Drive_Property $postBody, $optParams = array())
|
2176 |
{
|
2177 |
$params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
|
2178 |
$params = array_merge($params, $optParams);
|
2179 |
+
return $this->call('update', array($params), "IWP_google_Service_Drive_Property");
|
2180 |
}
|
2181 |
}
|
2182 |
|
2184 |
* The "realtime" collection of methods.
|
2185 |
* Typical usage is:
|
2186 |
* <code>
|
2187 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
2188 |
* $realtime = $driveService->realtime;
|
2189 |
* </code>
|
2190 |
*/
|
2191 |
+
class IWP_google_Service_Drive_Realtime_Resource extends IWP_google_Service_Resource
|
2192 |
{
|
2193 |
|
2194 |
/**
|
2231 |
* The "replies" collection of methods.
|
2232 |
* Typical usage is:
|
2233 |
* <code>
|
2234 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
2235 |
* $replies = $driveService->replies;
|
2236 |
* </code>
|
2237 |
*/
|
2238 |
+
class IWP_google_Service_Drive_Replies_Resource extends IWP_google_Service_Resource
|
2239 |
{
|
2240 |
|
2241 |
/**
|
2268 |
*
|
2269 |
* @opt_param bool includeDeleted
|
2270 |
* If set, this will succeed when retrieving a deleted reply.
|
2271 |
+
* @return IWP_google_Service_Drive_CommentReply
|
2272 |
*/
|
2273 |
public function get($fileId, $commentId, $replyId, $optParams = array())
|
2274 |
{
|
2275 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId);
|
2276 |
$params = array_merge($params, $optParams);
|
2277 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_CommentReply");
|
2278 |
}
|
2279 |
/**
|
2280 |
* Creates a new reply to the given comment. (replies.insert)
|
2283 |
* The ID of the file.
|
2284 |
* @param string $commentId
|
2285 |
* The ID of the comment.
|
2286 |
+
* @param IWP_google_CommentReply $postBody
|
2287 |
* @param array $optParams Optional parameters.
|
2288 |
+
* @return IWP_google_Service_Drive_CommentReply
|
2289 |
*/
|
2290 |
+
public function insert($fileId, $commentId, IWP_google_Service_Drive_CommentReply $postBody, $optParams = array())
|
2291 |
{
|
2292 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
|
2293 |
$params = array_merge($params, $optParams);
|
2294 |
+
return $this->call('insert', array($params), "IWP_google_Service_Drive_CommentReply");
|
2295 |
}
|
2296 |
/**
|
2297 |
* Lists all of the replies to a comment. (replies.listReplies)
|
2309 |
* If set, all replies, including deleted replies (with content stripped) will be returned.
|
2310 |
* @opt_param int maxResults
|
2311 |
* The maximum number of replies to include in the response, used for paging.
|
2312 |
+
* @return IWP_google_Service_Drive_CommentReplyList
|
2313 |
*/
|
2314 |
public function listReplies($fileId, $commentId, $optParams = array())
|
2315 |
{
|
2316 |
$params = array('fileId' => $fileId, 'commentId' => $commentId);
|
2317 |
$params = array_merge($params, $optParams);
|
2318 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_CommentReplyList");
|
2319 |
}
|
2320 |
/**
|
2321 |
* Updates an existing reply. This method supports patch semantics.
|
2327 |
* The ID of the comment.
|
2328 |
* @param string $replyId
|
2329 |
* The ID of the reply.
|
2330 |
+
* @param IWP_google_CommentReply $postBody
|
2331 |
* @param array $optParams Optional parameters.
|
2332 |
+
* @return IWP_google_Service_Drive_CommentReply
|
2333 |
*/
|
2334 |
+
public function patch($fileId, $commentId, $replyId, IWP_google_Service_Drive_CommentReply $postBody, $optParams = array())
|
2335 |
{
|
2336 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
|
2337 |
$params = array_merge($params, $optParams);
|
2338 |
+
return $this->call('patch', array($params), "IWP_google_Service_Drive_CommentReply");
|
2339 |
}
|
2340 |
/**
|
2341 |
* Updates an existing reply. (replies.update)
|
2346 |
* The ID of the comment.
|
2347 |
* @param string $replyId
|
2348 |
* The ID of the reply.
|
2349 |
+
* @param IWP_google_CommentReply $postBody
|
2350 |
* @param array $optParams Optional parameters.
|
2351 |
+
* @return IWP_google_Service_Drive_CommentReply
|
2352 |
*/
|
2353 |
+
public function update($fileId, $commentId, $replyId, IWP_google_Service_Drive_CommentReply $postBody, $optParams = array())
|
2354 |
{
|
2355 |
$params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
|
2356 |
$params = array_merge($params, $optParams);
|
2357 |
+
return $this->call('update', array($params), "IWP_google_Service_Drive_CommentReply");
|
2358 |
}
|
2359 |
}
|
2360 |
|
2362 |
* The "revisions" collection of methods.
|
2363 |
* Typical usage is:
|
2364 |
* <code>
|
2365 |
+
* $driveService = new IWP_google_Service_Drive(...);
|
2366 |
* $revisions = $driveService->revisions;
|
2367 |
* </code>
|
2368 |
*/
|
2369 |
+
class IWP_google_Service_Drive_Revisions_Resource extends IWP_google_Service_Resource
|
2370 |
{
|
2371 |
|
2372 |
/**
|
2392 |
* @param string $revisionId
|
2393 |
* The ID of the revision.
|
2394 |
* @param array $optParams Optional parameters.
|
2395 |
+
* @return IWP_google_Service_Drive_Revision
|
2396 |
*/
|
2397 |
public function get($fileId, $revisionId, $optParams = array())
|
2398 |
{
|
2399 |
$params = array('fileId' => $fileId, 'revisionId' => $revisionId);
|
2400 |
$params = array_merge($params, $optParams);
|
2401 |
+
return $this->call('get', array($params), "IWP_google_Service_Drive_Revision");
|
2402 |
}
|
2403 |
/**
|
2404 |
* Lists a file's revisions. (revisions.listRevisions)
|
2406 |
* @param string $fileId
|
2407 |
* The ID of the file.
|
2408 |
* @param array $optParams Optional parameters.
|
2409 |
+
* @return IWP_google_Service_Drive_RevisionList
|
2410 |
*/
|
2411 |
public function listRevisions($fileId, $optParams = array())
|
2412 |
{
|
2413 |
$params = array('fileId' => $fileId);
|
2414 |
$params = array_merge($params, $optParams);
|
2415 |
+
return $this->call('list', array($params), "IWP_google_Service_Drive_RevisionList");
|
2416 |
}
|
2417 |
/**
|
2418 |
* Updates a revision. This method supports patch semantics. (revisions.patch)
|
2421 |
* The ID for the file.
|
2422 |
* @param string $revisionId
|
2423 |
* The ID for the revision.
|
2424 |
+
* @param IWP_google_Revision $postBody
|
2425 |
* @param array $optParams Optional parameters.
|
2426 |
+
* @return IWP_google_Service_Drive_Revision
|
2427 |
*/
|
2428 |
+
public function patch($fileId, $revisionId, IWP_google_Service_Drive_Revision $postBody, $optParams = array())
|
2429 |
{
|
2430 |
$params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
|
2431 |
$params = array_merge($params, $optParams);
|
2432 |
+
return $this->call('patch', array($params), "IWP_google_Service_Drive_Revision");
|
2433 |
}
|
2434 |
/**
|
2435 |
* Updates a revision. (revisions.update)
|
2438 |
* The ID for the file.
|
2439 |
* @param string $revisionId
|
2440 |
* The ID for the revision.
|
2441 |
+
* @param IWP_google_Revision $postBody
|
2442 |
* @param array $optParams Optional parameters.
|
2443 |
+
* @return IWP_google_Service_Drive_Revision
|
2444 |
*/
|
2445 |
+
public function update($fileId, $revisionId, IWP_google_Service_Drive_Revision $postBody, $optParams = array())
|
2446 |
{
|
2447 |
$params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
|
2448 |
$params = array_merge($params, $optParams);
|
2449 |
+
return $this->call('update', array($params), "IWP_google_Service_Drive_Revision");
|
2450 |
}
|
2451 |
}
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 |
+
class IWP_google_Service_Drive_About extends IWP_google_Collection
|
2457 |
{
|
2458 |
+
protected $additionalRoleInfoType = 'IWP_google_Service_Drive_AboutAdditionalRoleInfo';
|
2459 |
protected $additionalRoleInfoDataType = 'array';
|
2460 |
public $domainSharingPolicy;
|
2461 |
public $etag;
|
2462 |
+
protected $exportFormatsType = 'IWP_google_Service_Drive_AboutExportFormats';
|
2463 |
protected $exportFormatsDataType = 'array';
|
2464 |
+
protected $featuresType = 'IWP_google_Service_Drive_AboutFeatures';
|
2465 |
protected $featuresDataType = 'array';
|
2466 |
+
protected $importFormatsType = 'IWP_google_Service_Drive_AboutImportFormats';
|
2467 |
protected $importFormatsDataType = 'array';
|
2468 |
public $isCurrentAppInstalled;
|
2469 |
public $kind;
|
2470 |
public $largestChangeId;
|
2471 |
+
protected $maxUploadSizesType = 'IWP_google_Service_Drive_AboutMaxUploadSizes';
|
2472 |
protected $maxUploadSizesDataType = 'array';
|
2473 |
public $name;
|
2474 |
public $permissionId;
|
2479 |
public $remainingChangeIds;
|
2480 |
public $rootFolderId;
|
2481 |
public $selfLink;
|
2482 |
+
protected $userType = 'IWP_google_Service_Drive_User';
|
2483 |
protected $userDataType = '';
|
2484 |
|
2485 |
public function setAdditionalRoleInfo($additionalRoleInfo)
|
2672 |
return $this->selfLink;
|
2673 |
}
|
2674 |
|
2675 |
+
public function setUser(IWP_google_Service_Drive_User $user)
|
2676 |
{
|
2677 |
$this->user = $user;
|
2678 |
}
|
2683 |
}
|
2684 |
}
|
2685 |
|
2686 |
+
class IWP_google_Service_Drive_AboutAdditionalRoleInfo extends IWP_google_Collection
|
2687 |
{
|
2688 |
+
protected $roleSetsType = 'IWP_google_Service_Drive_AboutAdditionalRoleInfoRoleSets';
|
2689 |
protected $roleSetsDataType = 'array';
|
2690 |
public $type;
|
2691 |
|
2710 |
}
|
2711 |
}
|
2712 |
|
2713 |
+
class IWP_google_Service_Drive_AboutAdditionalRoleInfoRoleSets extends IWP_google_Collection
|
2714 |
{
|
2715 |
public $additionalRoles;
|
2716 |
public $primaryRole;
|
2736 |
}
|
2737 |
}
|
2738 |
|
2739 |
+
class IWP_google_Service_Drive_AboutExportFormats extends IWP_google_Collection
|
2740 |
{
|
2741 |
public $source;
|
2742 |
public $targets;
|
2762 |
}
|
2763 |
}
|
2764 |
|
2765 |
+
class IWP_google_Service_Drive_AboutFeatures extends IWP_google_Model
|
2766 |
{
|
2767 |
public $featureName;
|
2768 |
public $featureRate;
|
2788 |
}
|
2789 |
}
|
2790 |
|
2791 |
+
class IWP_google_Service_Drive_AboutImportFormats extends IWP_google_Collection
|
2792 |
{
|
2793 |
public $source;
|
2794 |
public $targets;
|
2814 |
}
|
2815 |
}
|
2816 |
|
2817 |
+
class IWP_google_Service_Drive_AboutMaxUploadSizes extends IWP_google_Model
|
2818 |
{
|
2819 |
public $size;
|
2820 |
public $type;
|
2840 |
}
|
2841 |
}
|
2842 |
|
2843 |
+
class IWP_google_Service_Drive_App extends IWP_google_Collection
|
2844 |
{
|
2845 |
public $authorized;
|
2846 |
public $createInFolderTemplate;
|
2847 |
public $createUrl;
|
2848 |
+
protected $iconsType = 'IWP_google_Service_Drive_AppIcons';
|
2849 |
protected $iconsDataType = 'array';
|
2850 |
public $id;
|
2851 |
public $installed;
|
3087 |
}
|
3088 |
}
|
3089 |
|
3090 |
+
class IWP_google_Service_Drive_AppIcons extends IWP_google_Model
|
3091 |
{
|
3092 |
public $category;
|
3093 |
public $iconUrl;
|
3124 |
}
|
3125 |
}
|
3126 |
|
3127 |
+
class IWP_google_Service_Drive_AppList extends IWP_google_Collection
|
3128 |
{
|
3129 |
public $etag;
|
3130 |
+
protected $itemsType = 'IWP_google_Service_Drive_App';
|
3131 |
protected $itemsDataType = 'array';
|
3132 |
public $kind;
|
3133 |
public $selfLink;
|
3173 |
}
|
3174 |
}
|
3175 |
|
3176 |
+
class IWP_google_Service_Drive_Change extends IWP_google_Model
|
3177 |
{
|
3178 |
public $deleted;
|
3179 |
+
protected $fileType = 'IWP_google_Service_Drive_DriveFile';
|
3180 |
protected $fileDataType = '';
|
3181 |
public $fileId;
|
3182 |
public $id;
|
3194 |
return $this->deleted;
|
3195 |
}
|
3196 |
|
3197 |
+
public function setFile(IWP_google_Service_Drive_DriveFile $file)
|
3198 |
{
|
3199 |
$this->file = $file;
|
3200 |
}
|
3255 |
}
|
3256 |
}
|
3257 |
|
3258 |
+
class IWP_google_Service_Drive_ChangeList extends IWP_google_Collection
|
3259 |
{
|
3260 |
public $etag;
|
3261 |
+
protected $itemsType = 'IWP_google_Service_Drive_Change';
|
3262 |
protected $itemsDataType = 'array';
|
3263 |
public $kind;
|
3264 |
public $largestChangeId;
|
3337 |
}
|
3338 |
}
|
3339 |
|
3340 |
+
class IWP_google_Service_Drive_Channel extends IWP_google_Model
|
3341 |
{
|
3342 |
public $address;
|
3343 |
public $expiration;
|
3451 |
}
|
3452 |
}
|
3453 |
|
3454 |
+
class IWP_google_Service_Drive_ChildList extends IWP_google_Collection
|
3455 |
{
|
3456 |
public $etag;
|
3457 |
+
protected $itemsType = 'IWP_google_Service_Drive_ChildReference';
|
3458 |
protected $itemsDataType = 'array';
|
3459 |
public $kind;
|
3460 |
public $nextLink;
|
3522 |
}
|
3523 |
}
|
3524 |
|
3525 |
+
class IWP_google_Service_Drive_ChildReference extends IWP_google_Model
|
3526 |
{
|
3527 |
public $childLink;
|
3528 |
public $id;
|
3570 |
}
|
3571 |
}
|
3572 |
|
3573 |
+
class IWP_google_Service_Drive_Comment extends IWP_google_Collection
|
3574 |
{
|
3575 |
public $anchor;
|
3576 |
+
protected $authorType = 'IWP_google_Service_Drive_User';
|
3577 |
protected $authorDataType = '';
|
3578 |
public $commentId;
|
3579 |
public $content;
|
3580 |
+
protected $contextType = 'IWP_google_Service_Drive_CommentContext';
|
3581 |
protected $contextDataType = '';
|
3582 |
public $createdDate;
|
3583 |
public $deleted;
|
3586 |
public $htmlContent;
|
3587 |
public $kind;
|
3588 |
public $modifiedDate;
|
3589 |
+
protected $repliesType = 'IWP_google_Service_Drive_CommentReply';
|
3590 |
protected $repliesDataType = 'array';
|
3591 |
public $selfLink;
|
3592 |
public $status;
|
3601 |
return $this->anchor;
|
3602 |
}
|
3603 |
|
3604 |
+
public function setAuthor(IWP_google_Service_Drive_User $author)
|
3605 |
{
|
3606 |
$this->author = $author;
|
3607 |
}
|
3631 |
return $this->content;
|
3632 |
}
|
3633 |
|
3634 |
+
public function setContext(IWP_google_Service_Drive_CommentContext $context)
|
3635 |
{
|
3636 |
$this->context = $context;
|
3637 |
}
|
3742 |
}
|
3743 |
}
|
3744 |
|
3745 |
+
class IWP_google_Service_Drive_CommentContext extends IWP_google_Model
|
3746 |
{
|
3747 |
public $type;
|
3748 |
public $value;
|
3768 |
}
|
3769 |
}
|
3770 |
|
3771 |
+
class IWP_google_Service_Drive_CommentList extends IWP_google_Collection
|
3772 |
{
|
3773 |
+
protected $itemsType = 'IWP_google_Service_Drive_Comment';
|
3774 |
protected $itemsDataType = 'array';
|
3775 |
public $kind;
|
3776 |
public $nextLink;
|
3828 |
}
|
3829 |
}
|
3830 |
|
3831 |
+
class IWP_google_Service_Drive_CommentReply extends IWP_google_Model
|
3832 |
{
|
3833 |
+
protected $authorType = 'IWP_google_Service_Drive_User';
|
3834 |
protected $authorDataType = '';
|
3835 |
public $content;
|
3836 |
public $createdDate;
|
3841 |
public $replyId;
|
3842 |
public $verb;
|
3843 |
|
3844 |
+
public function setAuthor(IWP_google_Service_Drive_User $author)
|
3845 |
{
|
3846 |
$this->author = $author;
|
3847 |
}
|
3932 |
}
|
3933 |
}
|
3934 |
|
3935 |
+
class IWP_google_Service_Drive_CommentReplyList extends IWP_google_Collection
|
3936 |
{
|
3937 |
+
protected $itemsType = 'IWP_google_Service_Drive_CommentReply';
|
3938 |
protected $itemsDataType = 'array';
|
3939 |
public $kind;
|
3940 |
public $nextLink;
|
3992 |
}
|
3993 |
}
|
3994 |
|
3995 |
+
class IWP_google_Service_Drive_DriveFile extends IWP_google_Collection
|
3996 |
{
|
3997 |
public $alternateLink;
|
3998 |
public $appDataContents;
|
4011 |
public $headRevisionId;
|
4012 |
public $iconLink;
|
4013 |
public $id;
|
4014 |
+
protected $imageMediaMetadataType = 'IWP_google_Service_Drive_DriveFileImageMediaMetadata';
|
4015 |
protected $imageMediaMetadataDataType = '';
|
4016 |
+
protected $indexableTextType = 'IWP_google_Service_Drive_DriveFileIndexableText';
|
4017 |
protected $indexableTextDataType = '';
|
4018 |
public $kind;
|
4019 |
+
protected $labelsType = 'IWP_google_Service_Drive_DriveFileLabels';
|
4020 |
protected $labelsDataType = '';
|
4021 |
+
protected $lastModifyingUserType = 'IWP_google_Service_Drive_User';
|
4022 |
protected $lastModifyingUserDataType = '';
|
4023 |
public $lastModifyingUserName;
|
4024 |
public $lastViewedByMeDate;
|
4029 |
public $openWithLinks;
|
4030 |
public $originalFilename;
|
4031 |
public $ownerNames;
|
4032 |
+
protected $ownersType = 'IWP_google_Service_Drive_User';
|
4033 |
protected $ownersDataType = 'array';
|
4034 |
+
protected $parentsType = 'IWP_google_Service_Drive_ParentReference';
|
4035 |
protected $parentsDataType = 'array';
|
4036 |
+
protected $propertiesType = 'IWP_google_Service_Drive_Property';
|
4037 |
protected $propertiesDataType = 'array';
|
4038 |
public $quotaBytesUsed;
|
4039 |
public $selfLink;
|
4040 |
public $shared;
|
4041 |
public $sharedWithMeDate;
|
4042 |
+
protected $thumbnailType = 'IWP_google_Service_Drive_DriveFileThumbnail';
|
4043 |
protected $thumbnailDataType = '';
|
4044 |
public $thumbnailLink;
|
4045 |
public $title;
|
4046 |
+
protected $userPermissionType = 'IWP_google_Service_Drive_Permission';
|
4047 |
protected $userPermissionDataType = '';
|
4048 |
public $webContentLink;
|
4049 |
public $webViewLink;
|
4219 |
return $this->id;
|
4220 |
}
|
4221 |
|
4222 |
+
public function setImageMediaMetadata(IWP_google_Service_Drive_DriveFileImageMediaMetadata $imageMediaMetadata)
|
4223 |
{
|
4224 |
$this->imageMediaMetadata = $imageMediaMetadata;
|
4225 |
}
|
4229 |
return $this->imageMediaMetadata;
|
4230 |
}
|
4231 |
|
4232 |
+
public function setIndexableText(IWP_google_Service_Drive_DriveFileIndexableText $indexableText)
|
4233 |
{
|
4234 |
$this->indexableText = $indexableText;
|
4235 |
}
|
4249 |
return $this->kind;
|
4250 |
}
|
4251 |
|
4252 |
+
public function setLabels(IWP_google_Service_Drive_DriveFileLabels $labels)
|
4253 |
{
|
4254 |
$this->labels = $labels;
|
4255 |
}
|
4259 |
return $this->labels;
|
4260 |
}
|
4261 |
|
4262 |
+
public function setLastModifyingUser(IWP_google_Service_Drive_User $lastModifyingUser)
|
4263 |
{
|
4264 |
$this->lastModifyingUser = $lastModifyingUser;
|
4265 |
}
|
4429 |
return $this->sharedWithMeDate;
|
4430 |
}
|
4431 |
|
4432 |
+
public function setThumbnail(IWP_google_Service_Drive_DriveFileThumbnail $thumbnail)
|
4433 |
{
|
4434 |
$this->thumbnail = $thumbnail;
|
4435 |
}
|
4459 |
return $this->title;
|
4460 |
}
|
4461 |
|
4462 |
+
public function setUserPermission(IWP_google_Service_Drive_Permission $userPermission)
|
4463 |
{
|
4464 |
$this->userPermission = $userPermission;
|
4465 |
}
|
4500 |
}
|
4501 |
}
|
4502 |
|
4503 |
+
class IWP_google_Service_Drive_DriveFileImageMediaMetadata extends IWP_google_Model
|
4504 |
{
|
4505 |
public $aperture;
|
4506 |
public $cameraMake;
|
4515 |
public $height;
|
4516 |
public $isoSpeed;
|
4517 |
public $lens;
|
4518 |
+
protected $locationType = 'IWP_google_Service_Drive_DriveFileImageMediaMetadataLocation';
|
4519 |
protected $locationDataType = '';
|
4520 |
public $maxApertureValue;
|
4521 |
public $meteringMode;
|
4655 |
return $this->lens;
|
4656 |
}
|
4657 |
|
4658 |
+
public function setLocation(IWP_google_Service_Drive_DriveFileImageMediaMetadataLocation $location)
|
4659 |
{
|
4660 |
$this->location = $location;
|
4661 |
}
|
4736 |
}
|
4737 |
}
|
4738 |
|
4739 |
+
class IWP_google_Service_Drive_DriveFileImageMediaMetadataLocation extends IWP_google_Model
|
4740 |
{
|
4741 |
public $altitude;
|
4742 |
public $latitude;
|
4773 |
}
|
4774 |
}
|
4775 |
|
4776 |
+
class IWP_google_Service_Drive_DriveFileIndexableText extends IWP_google_Model
|
4777 |
{
|
4778 |
public $text;
|
4779 |
|
4788 |
}
|
4789 |
}
|
4790 |
|
4791 |
+
class IWP_google_Service_Drive_DriveFileLabels extends IWP_google_Model
|
4792 |
{
|
4793 |
public $hidden;
|
4794 |
public $restricted;
|
4847 |
}
|
4848 |
}
|
4849 |
|
4850 |
+
class IWP_google_Service_Drive_DriveFileThumbnail extends IWP_google_Model
|
4851 |
{
|
4852 |
public $image;
|
4853 |
public $mimeType;
|
4873 |
}
|
4874 |
}
|
4875 |
|
4876 |
+
class IWP_google_Service_Drive_FileList extends IWP_google_Collection
|
4877 |
{
|
4878 |
public $etag;
|
4879 |
+
protected $itemsType = 'IWP_google_Service_Drive_DriveFile';
|
4880 |
protected $itemsDataType = 'array';
|
4881 |
public $kind;
|
4882 |
public $nextLink;
|
4944 |
}
|
4945 |
}
|
4946 |
|
4947 |
+
class IWP_google_Service_Drive_ParentList extends IWP_google_Collection
|
4948 |
{
|
4949 |
public $etag;
|
4950 |
+
protected $itemsType = 'IWP_google_Service_Drive_ParentReference';
|
4951 |
protected $itemsDataType = 'array';
|
4952 |
public $kind;
|
4953 |
public $selfLink;
|
4993 |
}
|
4994 |
}
|
4995 |
|
4996 |
+
class IWP_google_Service_Drive_ParentReference extends IWP_google_Model
|
4997 |
{
|
4998 |
public $id;
|
4999 |
public $isRoot;
|
5052 |
}
|
5053 |
}
|
5054 |
|
5055 |
+
class IWP_google_Service_Drive_Permission extends IWP_google_Collection
|
5056 |
{
|
5057 |
public $additionalRoles;
|
5058 |
public $authKey;
|
5210 |
}
|
5211 |
}
|
5212 |
|
5213 |
+
class IWP_google_Service_Drive_PermissionId extends IWP_google_Model
|
5214 |
{
|
5215 |
public $id;
|
5216 |
public $kind;
|
5236 |
}
|
5237 |
}
|
5238 |
|
5239 |
+
class IWP_google_Service_Drive_PermissionList extends IWP_google_Collection
|
5240 |
{
|
5241 |
public $etag;
|
5242 |
+
protected $itemsType = 'IWP_google_Service_Drive_Permission';
|
5243 |
protected $itemsDataType = 'array';
|
5244 |
public $kind;
|
5245 |
public $selfLink;
|
5285 |
}
|
5286 |
}
|
5287 |
|
5288 |
+
class IWP_google_Service_Drive_Property extends IWP_google_Model
|
5289 |
{
|
5290 |
public $etag;
|
5291 |
public $key;
|
5355 |
}
|
5356 |
}
|
5357 |
|
5358 |
+
class IWP_google_Service_Drive_PropertyList extends IWP_google_Collection
|
5359 |
{
|
5360 |
public $etag;
|
5361 |
+
protected $itemsType = 'IWP_google_Service_Drive_Property';
|
5362 |
protected $itemsDataType = 'array';
|
5363 |
public $kind;
|
5364 |
public $selfLink;
|
5404 |
}
|
5405 |
}
|
5406 |
|
5407 |
+
class IWP_google_Service_Drive_Revision extends IWP_google_Model
|
5408 |
{
|
5409 |
public $downloadUrl;
|
5410 |
public $etag;
|
5412 |
public $fileSize;
|
5413 |
public $id;
|
5414 |
public $kind;
|
5415 |
+
protected $lastModifyingUserType = 'IWP_google_Service_Drive_User';
|
5416 |
protected $lastModifyingUserDataType = '';
|
5417 |
public $lastModifyingUserName;
|
5418 |
public $md5Checksum;
|
5486 |
return $this->kind;
|
5487 |
}
|
5488 |
|
5489 |
+
public function setLastModifyingUser(IWP_google_Service_Drive_User $lastModifyingUser)
|
5490 |
{
|
5491 |
$this->lastModifyingUser = $lastModifyingUser;
|
5492 |
}
|
5607 |
}
|
5608 |
}
|
5609 |
|
5610 |
+
class IWP_google_Service_Drive_RevisionList extends IWP_google_Collection
|
5611 |
{
|
5612 |
public $etag;
|
5613 |
+
protected $itemsType = 'IWP_google_Service_Drive_Revision';
|
5614 |
protected $itemsDataType = 'array';
|
5615 |
public $kind;
|
5616 |
public $selfLink;
|
5656 |
}
|
5657 |
}
|
5658 |
|
5659 |
+
class IWP_google_Service_Drive_User extends IWP_google_Model
|
5660 |
{
|
5661 |
public $displayName;
|
5662 |
public $isAuthenticatedUser;
|
5663 |
public $kind;
|
5664 |
public $permissionId;
|
5665 |
+
protected $pictureType = 'IWP_google_Service_Drive_UserPicture';
|
5666 |
protected $pictureDataType = '';
|
5667 |
|
5668 |
public function setDisplayName($displayName)
|
5705 |
return $this->permissionId;
|
5706 |
}
|
5707 |
|
5708 |
+
public function setPicture(IWP_google_Service_Drive_UserPicture $picture)
|
5709 |
{
|
5710 |
$this->picture = $picture;
|
5711 |
}
|
5716 |
}
|
5717 |
}
|
5718 |
|
5719 |
+
class IWP_google_Service_Drive_UserPicture extends IWP_google_Model
|
5720 |
{
|
5721 |
public $url;
|
5722 |
|
lib/Google/Service/Exception.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Exception.php';
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
/**
|
8 |
* Optional list of errors returned in a JSON body of an HTTP error response.
|
2 |
|
3 |
require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Exception.php';
|
4 |
|
5 |
+
class IWP_google_Service_Exception extends IWP_google_Exception
|
6 |
{
|
7 |
/**
|
8 |
* Optional list of errors returned in a JSON body of an HTTP error response.
|
lib/Google/Service/Oauth2.php
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
*
|
30 |
* @author Google, Inc.
|
31 |
*/
|
32 |
-
class
|
33 |
{
|
34 |
/** Know your basic profile info and list of people in your circles.. */
|
35 |
const PLUS_LOGIN = "https://www.googleapis.com/auth/plus.login";
|
@@ -47,16 +47,16 @@ class Google_Service_Oauth2 extends Google_Service
|
|
47 |
/**
|
48 |
* Constructs the internal representation of the Oauth2 service.
|
49 |
*
|
50 |
-
* @param
|
51 |
*/
|
52 |
-
public function __construct(
|
53 |
{
|
54 |
parent::__construct($client);
|
55 |
$this->servicePath = '';
|
56 |
$this->version = 'v2';
|
57 |
$this->serviceName = 'oauth2';
|
58 |
|
59 |
-
$this->userinfo = new
|
60 |
$this,
|
61 |
$this->serviceName,
|
62 |
'userinfo',
|
@@ -70,7 +70,7 @@ class Google_Service_Oauth2 extends Google_Service
|
|
70 |
)
|
71 |
)
|
72 |
);
|
73 |
-
$this->userinfo_v2_me = new
|
74 |
$this,
|
75 |
$this->serviceName,
|
76 |
'me',
|
@@ -84,7 +84,7 @@ class Google_Service_Oauth2 extends Google_Service
|
|
84 |
)
|
85 |
)
|
86 |
);
|
87 |
-
$this->base_methods = new
|
88 |
$this,
|
89 |
$this->serviceName,
|
90 |
'',
|
@@ -117,13 +117,13 @@ class Google_Service_Oauth2 extends Google_Service
|
|
117 |
*
|
118 |
* @opt_param string id_token
|
119 |
*
|
120 |
-
* @return
|
121 |
*/
|
122 |
public function tokeninfo($optParams = array())
|
123 |
{
|
124 |
$params = array();
|
125 |
$params = array_merge($params, $optParams);
|
126 |
-
return $this->base_methods->call('tokeninfo', array($params), "
|
127 |
}
|
128 |
}
|
129 |
|
@@ -132,24 +132,24 @@ class Google_Service_Oauth2 extends Google_Service
|
|
132 |
* The "userinfo" collection of methods.
|
133 |
* Typical usage is:
|
134 |
* <code>
|
135 |
-
* $oauth2Service = new
|
136 |
* $userinfo = $oauth2Service->userinfo;
|
137 |
* </code>
|
138 |
*/
|
139 |
-
class
|
140 |
{
|
141 |
|
142 |
/**
|
143 |
* (userinfo.get)
|
144 |
*
|
145 |
* @param array $optParams Optional parameters.
|
146 |
-
* @return
|
147 |
*/
|
148 |
public function get($optParams = array())
|
149 |
{
|
150 |
$params = array();
|
151 |
$params = array_merge($params, $optParams);
|
152 |
-
return $this->call('get', array($params), "
|
153 |
}
|
154 |
}
|
155 |
|
@@ -157,11 +157,11 @@ class Google_Service_Oauth2_Userinfo_Resource extends Google_Service_Resource
|
|
157 |
* The "v2" collection of methods.
|
158 |
* Typical usage is:
|
159 |
* <code>
|
160 |
-
* $oauth2Service = new
|
161 |
* $v2 = $oauth2Service->v2;
|
162 |
* </code>
|
163 |
*/
|
164 |
-
class
|
165 |
{
|
166 |
|
167 |
}
|
@@ -170,31 +170,31 @@ class Google_Service_Oauth2_UserinfoV2_Resource extends Google_Service_Resource
|
|
170 |
* The "me" collection of methods.
|
171 |
* Typical usage is:
|
172 |
* <code>
|
173 |
-
* $oauth2Service = new
|
174 |
* $me = $oauth2Service->me;
|
175 |
* </code>
|
176 |
*/
|
177 |
-
class
|
178 |
{
|
179 |
|
180 |
/**
|
181 |
* (me.get)
|
182 |
*
|
183 |
* @param array $optParams Optional parameters.
|
184 |
-
* @return
|
185 |
*/
|
186 |
public function get($optParams = array())
|
187 |
{
|
188 |
$params = array();
|
189 |
$params = array_merge($params, $optParams);
|
190 |
-
return $this->call('get', array($params), "
|
191 |
}
|
192 |
}
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
-
class
|
198 |
{
|
199 |
public $accessType;
|
200 |
public $audience;
|
@@ -286,7 +286,7 @@ class Google_Service_Oauth2_Tokeninfo extends Google_Model
|
|
286 |
}
|
287 |
}
|
288 |
|
289 |
-
class
|
290 |
{
|
291 |
public $email;
|
292 |
public $familyName;
|
29 |
*
|
30 |
* @author Google, Inc.
|
31 |
*/
|
32 |
+
class IWP_google_Service_Oauth2 extends IWP_google_Service
|
33 |
{
|
34 |
/** Know your basic profile info and list of people in your circles.. */
|
35 |
const PLUS_LOGIN = "https://www.googleapis.com/auth/plus.login";
|
47 |
/**
|
48 |
* Constructs the internal representation of the Oauth2 service.
|
49 |
*
|
50 |
+
* @param IWP_google_Client $client
|
51 |
*/
|
52 |
+
public function __construct(IWP_google_Client $client)
|
53 |
{
|
54 |
parent::__construct($client);
|
55 |
$this->servicePath = '';
|
56 |
$this->version = 'v2';
|
57 |
$this->serviceName = 'oauth2';
|
58 |
|
59 |
+
$this->userinfo = new IWP_google_Service_Oauth2_Userinfo_Resource(
|
60 |
$this,
|
61 |
$this->serviceName,
|
62 |
'userinfo',
|
70 |
)
|
71 |
)
|
72 |
);
|
73 |
+
$this->userinfo_v2_me = new IWP_google_Service_Oauth2_UserinfoV2Me_Resource(
|
74 |
$this,
|
75 |
$this->serviceName,
|
76 |
'me',
|
84 |
)
|
85 |
)
|
86 |
);
|
87 |
+
$this->base_methods = new IWP_google_Service_Resource(
|
88 |
$this,
|
89 |
$this->serviceName,
|
90 |
'',
|
117 |
*
|
118 |
* @opt_param string id_token
|
119 |
*
|
120 |
+
* @return IWP_google_Service_Oauth2_Tokeninfo
|
121 |
*/
|
122 |
public function tokeninfo($optParams = array())
|
123 |
{
|
124 |
$params = array();
|
125 |
$params = array_merge($params, $optParams);
|
126 |
+
return $this->base_methods->call('tokeninfo', array($params), "IWP_google_Service_Oauth2_Tokeninfo");
|
127 |
}
|
128 |
}
|
129 |
|
132 |
* The "userinfo" collection of methods.
|
133 |
* Typical usage is:
|
134 |
* <code>
|
135 |
+
* $oauth2Service = new IWP_google_Service_Oauth2(...);
|
136 |
* $userinfo = $oauth2Service->userinfo;
|
137 |
* </code>
|
138 |
*/
|
139 |
+
class IWP_google_Service_Oauth2_Userinfo_Resource extends IWP_google_Service_Resource
|
140 |
{
|
141 |
|
142 |
/**
|
143 |
* (userinfo.get)
|
144 |
*
|
145 |
* @param array $optParams Optional parameters.
|
146 |
+
* @return IWP_google_Service_Oauth2_Userinfoplus
|
147 |
*/
|
148 |
public function get($optParams = array())
|
149 |
{
|
150 |
$params = array();
|
151 |
$params = array_merge($params, $optParams);
|
152 |
+
return $this->call('get', array($params), "IWP_google_Service_Oauth2_Userinfoplus");
|
153 |
}
|
154 |
}
|
155 |
|
157 |
* The "v2" collection of methods.
|
158 |
* Typical usage is:
|
159 |
* <code>
|
160 |
+
* $oauth2Service = new IWP_google_Service_Oauth2(...);
|
161 |
* $v2 = $oauth2Service->v2;
|
162 |
* </code>
|
163 |
*/
|
164 |
+
class IWP_google_Service_Oauth2_UserinfoV2_Resource extends IWP_google_Service_Resource
|
165 |
{
|
166 |
|
167 |
}
|
170 |
* The "me" collection of methods.
|
171 |
* Typical usage is:
|
172 |
* <code>
|
173 |
+
* $oauth2Service = new IWP_google_Service_Oauth2(...);
|
174 |
* $me = $oauth2Service->me;
|
175 |
* </code>
|
176 |
*/
|
177 |
+
class IWP_google_Service_Oauth2_UserinfoV2Me_Resource extends IWP_google_Service_Resource
|
178 |
{
|
179 |
|
180 |
/**
|
181 |
* (me.get)
|
182 |
*
|
183 |
* @param array $optParams Optional parameters.
|
184 |
+
* @return IWP_google_Service_Oauth2_Userinfoplus
|
185 |
*/
|
186 |
public function get($optParams = array())
|
187 |
{
|
188 |
$params = array();
|
189 |
$params = array_merge($params, $optParams);
|
190 |
+
return $this->call('get', array($params), "IWP_google_Service_Oauth2_Userinfoplus");
|
191 |
}
|
192 |
}
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
+
class IWP_google_Service_Oauth2_Tokeninfo extends IWP_google_Model
|
198 |
{
|
199 |
public $accessType;
|
200 |
public $audience;
|
286 |
}
|
287 |
}
|
288 |
|
289 |
+
class IWP_google_Service_Oauth2_Userinfoplus extends IWP_google_Model
|
290 |
{
|
291 |
public $email;
|
292 |
public $familyName;
|
lib/Google/Service/Resource.php
CHANGED
@@ -31,7 +31,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Http/REST.php';
|
|
31 |
* @author Chirag Shah <chirags@google.com>
|
32 |
*
|
33 |
*/
|
34 |
-
class
|
35 |
{
|
36 |
// Valid query parameters that work, but don't appear in discovery.
|
37 |
private $stackParameters = array(
|
@@ -47,10 +47,10 @@ class Google_Service_Resource
|
|
47 |
'mediaUpload' => array('type' => 'complex', 'location' => 'query'),
|
48 |
);
|
49 |
|
50 |
-
/** @var
|
51 |
private $service;
|
52 |
|
53 |
-
/** @var
|
54 |
private $client;
|
55 |
|
56 |
/** @var string $serviceName */
|
@@ -78,13 +78,13 @@ class Google_Service_Resource
|
|
78 |
* @param $name
|
79 |
* @param $arguments
|
80 |
* @param $expected_class - optional, the expected class name
|
81 |
-
* @return
|
82 |
-
* @throws
|
83 |
*/
|
84 |
public function call($name, $arguments, $expected_class = null)
|
85 |
{
|
86 |
if (! isset($this->methods[$name])) {
|
87 |
-
throw new
|
88 |
"Unknown function: " .
|
89 |
"{$this->serviceName}->{$this->resourceName}->{$name}()"
|
90 |
);
|
@@ -96,7 +96,7 @@ class Google_Service_Resource
|
|
96 |
// document as parameter, but we abuse the param entry for storing it.
|
97 |
$postBody = null;
|
98 |
if (isset($parameters['postBody'])) {
|
99 |
-
if ($parameters['postBody'] instanceof
|
100 |
// In the cases the post body is an existing object, we want
|
101 |
// to use the smart method to create a simple object for
|
102 |
// for JSONification.
|
@@ -129,7 +129,7 @@ class Google_Service_Resource
|
|
129 |
);
|
130 |
foreach ($parameters as $key => $val) {
|
131 |
if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
|
132 |
-
throw new
|
133 |
}
|
134 |
}
|
135 |
|
@@ -138,7 +138,7 @@ class Google_Service_Resource
|
|
138 |
$paramSpec['required'] &&
|
139 |
! isset($parameters[$paramName])
|
140 |
) {
|
141 |
-
throw new
|
142 |
}
|
143 |
if (isset($parameters[$paramName])) {
|
144 |
$value = $parameters[$paramName];
|
@@ -153,12 +153,12 @@ class Google_Service_Resource
|
|
153 |
|
154 |
$servicePath = $this->service->servicePath;
|
155 |
|
156 |
-
$url =
|
157 |
$servicePath,
|
158 |
$method['path'],
|
159 |
$parameters
|
160 |
);
|
161 |
-
$httpRequest = new
|
162 |
$url,
|
163 |
$method['httpMethod'],
|
164 |
null,
|
@@ -179,7 +179,7 @@ class Google_Service_Resource
|
|
179 |
if (isset($parameters['data']) &&
|
180 |
($parameters['uploadType']['value'] == 'media' || $parameters['uploadType']['value'] == 'multipart')) {
|
181 |
// If we are doing a simple media upload, trigger that as a convenience.
|
182 |
-
$mfu = new
|
183 |
$this->client,
|
184 |
$httpRequest,
|
185 |
isset($parameters['mimeType']) ? $parameters['mimeType']['value'] : 'application/octet-stream',
|
31 |
* @author Chirag Shah <chirags@google.com>
|
32 |
*
|
33 |
*/
|
34 |
+
class IWP_google_Service_Resource
|
35 |
{
|
36 |
// Valid query parameters that work, but don't appear in discovery.
|
37 |
private $stackParameters = array(
|
47 |
'mediaUpload' => array('type' => 'complex', 'location' => 'query'),
|
48 |
);
|
49 |
|
50 |
+
/** @var IWP_google_Service $service */
|
51 |
private $service;
|
52 |
|
53 |
+
/** @var IWP_google_Client $client */
|
54 |
private $client;
|
55 |
|
56 |
/** @var string $serviceName */
|
78 |
* @param $name
|
79 |
* @param $arguments
|
80 |
* @param $expected_class - optional, the expected class name
|
81 |
+
* @return IWP_google_Http_Request|expected_class
|
82 |
+
* @throws IWP_google_Exception
|
83 |
*/
|
84 |
public function call($name, $arguments, $expected_class = null)
|
85 |
{
|
86 |
if (! isset($this->methods[$name])) {
|
87 |
+
throw new IWP_google_Exception(
|
88 |
"Unknown function: " .
|
89 |
"{$this->serviceName}->{$this->resourceName}->{$name}()"
|
90 |
);
|
96 |
// document as parameter, but we abuse the param entry for storing it.
|
97 |
$postBody = null;
|
98 |
if (isset($parameters['postBody'])) {
|
99 |
+
if ($parameters['postBody'] instanceof IWP_google_Model) {
|
100 |
// In the cases the post body is an existing object, we want
|
101 |
// to use the smart method to create a simple object for
|
102 |
// for JSONification.
|
129 |
);
|
130 |
foreach ($parameters as $key => $val) {
|
131 |
if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
|
132 |
+
throw new IWP_google_Exception("($name) unknown parameter: '$key'");
|
133 |
}
|
134 |
}
|
135 |
|
138 |
$paramSpec['required'] &&
|
139 |
! isset($parameters[$paramName])
|
140 |
) {
|
141 |
+
throw new IWP_google_Exception("($name) missing required param: '$paramName'");
|
142 |
}
|
143 |
if (isset($parameters[$paramName])) {
|
144 |
$value = $parameters[$paramName];
|
153 |
|
154 |
$servicePath = $this->service->servicePath;
|
155 |
|
156 |
+
$url = IWP_google_Http_REST::createRequestUri(
|
157 |
$servicePath,
|
158 |
$method['path'],
|
159 |
$parameters
|
160 |
);
|
161 |
+
$httpRequest = new IWP_google_Http_Request(
|
162 |
$url,
|
163 |
$method['httpMethod'],
|
164 |
null,
|
179 |
if (isset($parameters['data']) &&
|
180 |
($parameters['uploadType']['value'] == 'media' || $parameters['uploadType']['value'] == 'multipart')) {
|
181 |
// If we are doing a simple media upload, trigger that as a convenience.
|
182 |
+
$mfu = new IWP_google_Http_MediaFileUpload(
|
183 |
$this->client,
|
184 |
$httpRequest,
|
185 |
isset($parameters['mimeType']) ? $parameters['mimeType']['value'] : 'application/octet-stream',
|
lib/Google/Signer/Abstract.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
*
|
21 |
* @author Brian Eaton <beaton@google.com>
|
22 |
*/
|
23 |
-
abstract class
|
24 |
{
|
25 |
/**
|
26 |
* Signs data, returns the signature as binary data.
|
20 |
*
|
21 |
* @author Brian Eaton <beaton@google.com>
|
22 |
*/
|
23 |
+
abstract class IWP_google_Signer_Abstract
|
24 |
{
|
25 |
/**
|
26 |
* Signs data, returns the signature as binary data.
|
lib/Google/Signer/P12.php
CHANGED
@@ -25,7 +25,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Signer/Abstract.php';
|
|
25 |
*
|
26 |
* @author Brian Eaton <beaton@google.com>
|
27 |
*/
|
28 |
-
class
|
29 |
{
|
30 |
// OpenSSL private key resource
|
31 |
private $privateKey;
|
@@ -34,7 +34,7 @@ class Google_Signer_P12 extends Google_Signer_Abstract
|
|
34 |
public function __construct($p12, $password)
|
35 |
{
|
36 |
if (!function_exists('openssl_x509_read')) {
|
37 |
-
throw new
|
38 |
'The Google PHP API library needs the openssl PHP extension'
|
39 |
);
|
40 |
}
|
@@ -49,7 +49,7 @@ class Google_Signer_P12 extends Google_Signer_Abstract
|
|
49 |
// This throws on error
|
50 |
$certs = array();
|
51 |
if (!openssl_pkcs12_read($p12, $certs, $password)) {
|
52 |
-
throw new
|
53 |
"Unable to parse the p12 file. " .
|
54 |
"Is this a .p12 file? Is the password correct? OpenSSL error: " .
|
55 |
openssl_error_string()
|
@@ -58,13 +58,13 @@ class Google_Signer_P12 extends Google_Signer_Abstract
|
|
58 |
// TODO(beaton): is this part of the contract for the openssl_pkcs12_read
|
59 |
// method? What happens if there are multiple private keys? Do we care?
|
60 |
if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
|
61 |
-
throw new
|
62 |
}
|
63 |
$this->privateKey = openssl_pkey_get_private($certs['pkey']);
|
64 |
}
|
65 |
|
66 |
if (!$this->privateKey) {
|
67 |
-
throw new
|
68 |
}
|
69 |
}
|
70 |
|
@@ -78,13 +78,13 @@ class Google_Signer_P12 extends Google_Signer_Abstract
|
|
78 |
public function sign($data)
|
79 |
{
|
80 |
if (version_compare(PHP_VERSION, '5.3.0') < 0) {
|
81 |
-
throw new
|
82 |
"PHP 5.3.0 or higher is required to use service accounts."
|
83 |
);
|
84 |
}
|
85 |
$hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
|
86 |
if (!openssl_sign($data, $signature, $this->privateKey, $hash)) {
|
87 |
-
throw new
|
88 |
}
|
89 |
return $signature;
|
90 |
}
|
25 |
*
|
26 |
* @author Brian Eaton <beaton@google.com>
|
27 |
*/
|
28 |
+
class IWP_google_Signer_P12 extends IWP_google_Signer_Abstract
|
29 |
{
|
30 |
// OpenSSL private key resource
|
31 |
private $privateKey;
|
34 |
public function __construct($p12, $password)
|
35 |
{
|
36 |
if (!function_exists('openssl_x509_read')) {
|
37 |
+
throw new IWP_google_Exception(
|
38 |
'The Google PHP API library needs the openssl PHP extension'
|
39 |
);
|
40 |
}
|
49 |
// This throws on error
|
50 |
$certs = array();
|
51 |
if (!openssl_pkcs12_read($p12, $certs, $password)) {
|
52 |
+
throw new IWP_google_Auth_Exception(
|
53 |
"Unable to parse the p12 file. " .
|
54 |
"Is this a .p12 file? Is the password correct? OpenSSL error: " .
|
55 |
openssl_error_string()
|
58 |
// TODO(beaton): is this part of the contract for the openssl_pkcs12_read
|
59 |
// method? What happens if there are multiple private keys? Do we care?
|
60 |
if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
|
61 |
+
throw new IWP_google_Auth_Exception("No private key found in p12 file.");
|
62 |
}
|
63 |
$this->privateKey = openssl_pkey_get_private($certs['pkey']);
|
64 |
}
|
65 |
|
66 |
if (!$this->privateKey) {
|
67 |
+
throw new IWP_google_Auth_Exception("Unable to load private key");
|
68 |
}
|
69 |
}
|
70 |
|
78 |
public function sign($data)
|
79 |
{
|
80 |
if (version_compare(PHP_VERSION, '5.3.0') < 0) {
|
81 |
+
throw new IWP_google_Auth_Exception(
|
82 |
"PHP 5.3.0 or higher is required to use service accounts."
|
83 |
);
|
84 |
}
|
85 |
$hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
|
86 |
if (!openssl_sign($data, $signature, $this->privateKey, $hash)) {
|
87 |
+
throw new IWP_google_Auth_Exception("Unable to sign data");
|
88 |
}
|
89 |
return $signature;
|
90 |
}
|
lib/Google/Utils.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
*
|
22 |
* @author Chirag Shah <chirags@google.com>
|
23 |
*/
|
24 |
-
class
|
25 |
{
|
26 |
public static function urlSafeB64Encode($data)
|
27 |
{
|
21 |
*
|
22 |
* @author Chirag Shah <chirags@google.com>
|
23 |
*/
|
24 |
+
class IWP_google_Utils
|
25 |
{
|
26 |
public static function urlSafeB64Encode($data)
|
27 |
{
|
lib/Google/Utils/URITemplate.php
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
* Implementation of levels 1-3 of the URI Template spec.
|
20 |
* @see http://tools.ietf.org/html/rfc6570
|
21 |
*/
|
22 |
-
class
|
23 |
{
|
24 |
const TYPE_MAP = "1";
|
25 |
const TYPE_LIST = "2";
|
19 |
* Implementation of levels 1-3 of the URI Template spec.
|
20 |
* @see http://tools.ietf.org/html/rfc6570
|
21 |
*/
|
22 |
+
class IWP_google_Utils_URITemplate
|
23 |
{
|
24 |
const TYPE_MAP = "1";
|
25 |
const TYPE_LIST = "2";
|
lib/Google/Verifier/Abstract.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
*
|
21 |
* @author Brian Eaton <beaton@google.com>
|
22 |
*/
|
23 |
-
abstract class
|
24 |
{
|
25 |
/**
|
26 |
* Checks a signature, returns true if the signature is correct,
|
20 |
*
|
21 |
* @author Brian Eaton <beaton@google.com>
|
22 |
*/
|
23 |
+
abstract class IWP_google_Verifier_Abstract
|
24 |
{
|
25 |
/**
|
26 |
* Checks a signature, returns true if the signature is correct,
|
lib/Google/Verifier/Pem.php
CHANGED
@@ -23,7 +23,7 @@ require_once $GLOBALS['iwp_mmb_plugin_dir'].'/lib/Google/Verifier/Abstract.php';
|
|
23 |
*
|
24 |
* @author Brian Eaton <beaton@google.com>
|
25 |
*/
|
26 |
-
class
|
27 |
{
|
28 |
private $publicKey;
|
29 |
|
@@ -32,17 +32,17 @@ class Google_Verifier_Pem extends Google_Verifier_Abstract
|
|
32 |
*
|
33 |
* $pem: a PEM encoded certificate (not a file).
|
34 |
* @param $pem
|
35 |
-
* @throws
|
36 |
-
* @throws
|
37 |
*/
|
38 |
public function __construct($pem)
|
39 |
{
|
40 |
if (!function_exists('openssl_x509_read')) {
|
41 |
-
throw new
|
42 |
}
|
43 |
$this->publicKey = openssl_x509_read($pem);
|
44 |
if (!$this->publicKey) {
|
45 |
-
throw new
|
46 |
}
|
47 |
}
|
48 |
|
@@ -59,7 +59,7 @@ class Google_Verifier_Pem extends Google_Verifier_Abstract
|
|
59 |
* Returns true if the signature is valid, false otherwise.
|
60 |
* @param $data
|
61 |
* @param $signature
|
62 |
-
* @throws
|
63 |
* @return bool
|
64 |
*/
|
65 |
public function verify($data, $signature)
|
@@ -67,7 +67,7 @@ class Google_Verifier_Pem extends Google_Verifier_Abstract
|
|
67 |
$hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
|
68 |
$status = openssl_verify($data, $signature, $this->publicKey, $hash);
|
69 |
if ($status === -1) {
|
70 |
-
throw new
|
71 |
}
|
72 |
return $status === 1;
|
73 |
}
|
23 |
*
|
24 |
* @author Brian Eaton <beaton@google.com>
|
25 |
*/
|
26 |
+
class IWP_google_Verifier_Pem extends IWP_google_Verifier_Abstract
|
27 |
{
|
28 |
private $publicKey;
|
29 |
|
32 |
*
|
33 |
* $pem: a PEM encoded certificate (not a file).
|
34 |
* @param $pem
|
35 |
+
* @throws IWP_google_Auth_Exception
|
36 |
+
* @throws IWP_google_Exception
|
37 |
*/
|
38 |
public function __construct($pem)
|
39 |
{
|
40 |
if (!function_exists('openssl_x509_read')) {
|
41 |
+
throw new IWP_google_Exception('Google API PHP client needs the openssl PHP extension');
|
42 |
}
|
43 |
$this->publicKey = openssl_x509_read($pem);
|
44 |
if (!$this->publicKey) {
|
45 |
+
throw new IWP_google_Auth_Exception("Unable to parse PEM: $pem");
|
46 |
}
|
47 |
}
|
48 |
|
59 |
* Returns true if the signature is valid, false otherwise.
|
60 |
* @param $data
|
61 |
* @param $signature
|
62 |
+
* @throws IWP_google_Auth_Exception
|
63 |
* @return bool
|
64 |
*/
|
65 |
public function verify($data, $signature)
|
67 |
$hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
|
68 |
$status = openssl_verify($data, $signature, $this->publicKey, $hash);
|
69 |
if ($status === -1) {
|
70 |
+
throw new IWP_google_Auth_Exception('Signature verification error: ' . openssl_error_string());
|
71 |
}
|
72 |
return $status === 1;
|
73 |
}
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: infinitewp
|
3 |
Tags: admin, administration, amazon, api, authentication, automatic, dashboard, dropbox, events, integration, manage, multisite, multiple, notification, performance, s3, security, seo, stats, tracking, infinitewp, updates, backup, restore, iwp, infinite
|
4 |
Requires at least: 3.0
|
5 |
-
Tested up to: 3.9
|
6 |
Stable tag: trunk
|
7 |
|
8 |
Install this plugin on unlimited sites and manage them all from a central dashboard.
|
@@ -48,6 +48,9 @@ Credits: [Vladimir Prelovac](http://prelovac.com/vladimir) for his worker plugin
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
51 |
= 1.2.12 =
|
52 |
* Improvement: Backup process will only backup WordPress tables which have configured prefix in wp-config.php.
|
53 |
* Improvement: Support for Google Drive for cloud backup addon.
|
2 |
Contributors: infinitewp
|
3 |
Tags: admin, administration, amazon, api, authentication, automatic, dashboard, dropbox, events, integration, manage, multisite, multiple, notification, performance, s3, security, seo, stats, tracking, infinitewp, updates, backup, restore, iwp, infinite
|
4 |
Requires at least: 3.0
|
5 |
+
Tested up to: 3.9.1
|
6 |
Stable tag: trunk
|
7 |
|
8 |
Install this plugin on unlimited sites and manage them all from a central dashboard.
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 1.2.13 =
|
52 |
+
* Fix: Google library conflict issues are fixed.
|
53 |
+
|
54 |
= 1.2.12 =
|
55 |
* Improvement: Backup process will only backup WordPress tables which have configured prefix in wp-config.php.
|
56 |
* Improvement: Support for Google Drive for cloud backup addon.
|