updated plugin WP Mail SMTP
version 2.1.1
This commit is contained in:
@ -19,8 +19,7 @@
|
||||
* Service definition for Gmail (v1).
|
||||
*
|
||||
* <p>
|
||||
* The Gmail API lets you view and manage Gmail mailbox data like threads,
|
||||
* messages, and labels.</p>
|
||||
* Access Gmail mailboxes including sending user email.</p>
|
||||
*
|
||||
* <p>
|
||||
* For more information about this service, see the API
|
||||
@ -98,8 +97,8 @@ class Google_Service_Gmail extends Google_Service
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->rootUrl = $rootUrl ?: 'https://www.googleapis.com/';
|
||||
$this->servicePath = '';
|
||||
$this->batchPath = 'batch';
|
||||
$this->servicePath = 'gmail/v1/users/';
|
||||
$this->batchPath = 'batch/gmail/v1';
|
||||
$this->version = 'v1';
|
||||
$this->serviceName = 'gmail';
|
||||
|
||||
@ -110,7 +109,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'getProfile' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/profile',
|
||||
'path' => '{userId}/profile',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -120,7 +119,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'stop' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/stop',
|
||||
'path' => '{userId}/stop',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -130,7 +129,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'watch' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/watch',
|
||||
'path' => '{userId}/watch',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -150,7 +149,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'create' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/drafts',
|
||||
'path' => '{userId}/drafts',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -160,7 +159,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/drafts/{id}',
|
||||
'path' => '{userId}/drafts/{id}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -175,7 +174,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/drafts/{id}',
|
||||
'path' => '{userId}/drafts/{id}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -194,7 +193,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/drafts',
|
||||
'path' => '{userId}/drafts',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -206,6 +205,10 @@ class Google_Service_Gmail extends Google_Service
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
@ -214,13 +217,9 @@ class Google_Service_Gmail extends Google_Service
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
),'send' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/drafts/send',
|
||||
'path' => '{userId}/drafts/send',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -230,7 +229,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/drafts/{id}',
|
||||
'path' => '{userId}/drafts/{id}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -255,7 +254,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/history',
|
||||
'path' => '{userId}/history',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -263,9 +262,10 @@ class Google_Service_Gmail extends Google_Service
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'pageToken' => array(
|
||||
'historyTypes' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'labelId' => array(
|
||||
'location' => 'query',
|
||||
@ -275,10 +275,9 @@ class Google_Service_Gmail extends Google_Service
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'historyTypes' => array(
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'startHistoryId' => array(
|
||||
'location' => 'query',
|
||||
@ -296,7 +295,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'create' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/labels',
|
||||
'path' => '{userId}/labels',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -306,7 +305,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/labels/{id}',
|
||||
'path' => '{userId}/labels/{id}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -321,7 +320,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/labels/{id}',
|
||||
'path' => '{userId}/labels/{id}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -336,7 +335,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/labels',
|
||||
'path' => '{userId}/labels',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -346,7 +345,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'patch' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/labels/{id}',
|
||||
'path' => '{userId}/labels/{id}',
|
||||
'httpMethod' => 'PATCH',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -361,7 +360,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/labels/{id}',
|
||||
'path' => '{userId}/labels/{id}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -386,7 +385,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'batchDelete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/batchDelete',
|
||||
'path' => '{userId}/messages/batchDelete',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -396,7 +395,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'batchModify' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/batchModify',
|
||||
'path' => '{userId}/messages/batchModify',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -406,7 +405,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/{id}',
|
||||
'path' => '{userId}/messages/{id}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -421,7 +420,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/{id}',
|
||||
'path' => '{userId}/messages/{id}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -434,18 +433,18 @@ class Google_Service_Gmail extends Google_Service
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'format' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'metadataHeaders' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'format' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'import' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/import',
|
||||
'path' => '{userId}/messages/import',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -453,7 +452,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'processForCalendar' => array(
|
||||
'deleted' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
@ -465,13 +464,13 @@ class Google_Service_Gmail extends Google_Service
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'deleted' => array(
|
||||
'processForCalendar' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
),
|
||||
),'insert' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages',
|
||||
'path' => '{userId}/messages',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -479,17 +478,17 @@ class Google_Service_Gmail extends Google_Service
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'internalDateSource' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'deleted' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'internalDateSource' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages',
|
||||
'path' => '{userId}/messages',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -501,26 +500,26 @@ class Google_Service_Gmail extends Google_Service
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'labelIds' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'q' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'q' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'modify' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/{id}/modify',
|
||||
'path' => '{userId}/messages/{id}/modify',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -535,7 +534,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'send' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/send',
|
||||
'path' => '{userId}/messages/send',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -545,7 +544,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'trash' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/{id}/trash',
|
||||
'path' => '{userId}/messages/{id}/trash',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -560,7 +559,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'untrash' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/{id}/untrash',
|
||||
'path' => '{userId}/messages/{id}/untrash',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -585,7 +584,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}',
|
||||
'path' => '{userId}/messages/{messageId}/attachments/{id}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -615,7 +614,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'getAutoForwarding' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/autoForwarding',
|
||||
'path' => '{userId}/settings/autoForwarding',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -625,7 +624,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'getImap' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/imap',
|
||||
'path' => '{userId}/settings/imap',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -635,7 +634,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'getLanguage' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/language',
|
||||
'path' => '{userId}/settings/language',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -645,7 +644,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'getPop' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/pop',
|
||||
'path' => '{userId}/settings/pop',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -655,7 +654,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'getVacation' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/vacation',
|
||||
'path' => '{userId}/settings/vacation',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -665,7 +664,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'updateAutoForwarding' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/autoForwarding',
|
||||
'path' => '{userId}/settings/autoForwarding',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -675,7 +674,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'updateImap' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/imap',
|
||||
'path' => '{userId}/settings/imap',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -685,7 +684,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'updateLanguage' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/language',
|
||||
'path' => '{userId}/settings/language',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -695,7 +694,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'updatePop' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/pop',
|
||||
'path' => '{userId}/settings/pop',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -705,7 +704,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'updateVacation' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/vacation',
|
||||
'path' => '{userId}/settings/vacation',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -725,7 +724,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'create' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/delegates',
|
||||
'path' => '{userId}/settings/delegates',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -735,7 +734,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/delegates/{delegateEmail}',
|
||||
'path' => '{userId}/settings/delegates/{delegateEmail}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -750,7 +749,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/delegates/{delegateEmail}',
|
||||
'path' => '{userId}/settings/delegates/{delegateEmail}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -765,7 +764,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/delegates',
|
||||
'path' => '{userId}/settings/delegates',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -785,7 +784,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'create' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/filters',
|
||||
'path' => '{userId}/settings/filters',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -795,7 +794,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/filters/{id}',
|
||||
'path' => '{userId}/settings/filters/{id}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -810,7 +809,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/filters/{id}',
|
||||
'path' => '{userId}/settings/filters/{id}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -825,7 +824,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/filters',
|
||||
'path' => '{userId}/settings/filters',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -845,7 +844,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'create' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses',
|
||||
'path' => '{userId}/settings/forwardingAddresses',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -855,7 +854,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}',
|
||||
'path' => '{userId}/settings/forwardingAddresses/{forwardingEmail}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -870,7 +869,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}',
|
||||
'path' => '{userId}/settings/forwardingAddresses/{forwardingEmail}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -885,7 +884,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses',
|
||||
'path' => '{userId}/settings/forwardingAddresses',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -905,7 +904,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'create' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs',
|
||||
'path' => '{userId}/settings/sendAs',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -915,7 +914,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'delete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -930,7 +929,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -945,7 +944,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs',
|
||||
'path' => '{userId}/settings/sendAs',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -955,7 +954,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'patch' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}',
|
||||
'httpMethod' => 'PATCH',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -970,7 +969,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'update' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}',
|
||||
'httpMethod' => 'PUT',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -985,7 +984,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'verify' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}/verify',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1010,7 +1009,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'delete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1030,7 +1029,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1050,7 +1049,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'insert' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1065,7 +1064,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1080,7 +1079,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'setDefault' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault',
|
||||
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1110,7 +1109,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
array(
|
||||
'methods' => array(
|
||||
'delete' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/threads/{id}',
|
||||
'path' => '{userId}/threads/{id}',
|
||||
'httpMethod' => 'DELETE',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1125,7 +1124,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'get' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/threads/{id}',
|
||||
'path' => '{userId}/threads/{id}',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1138,18 +1137,18 @@ class Google_Service_Gmail extends Google_Service
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'format' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'metadataHeaders' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'format' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'list' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/threads',
|
||||
'path' => '{userId}/threads',
|
||||
'httpMethod' => 'GET',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1157,30 +1156,30 @@ class Google_Service_Gmail extends Google_Service
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'pageToken' => array(
|
||||
'includeSpamTrash' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'labelIds' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
'repeated' => true,
|
||||
),
|
||||
'q' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
'maxResults' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'includeSpamTrash' => array(
|
||||
'pageToken' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'boolean',
|
||||
'type' => 'string',
|
||||
),
|
||||
'q' => array(
|
||||
'location' => 'query',
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),'modify' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/threads/{id}/modify',
|
||||
'path' => '{userId}/threads/{id}/modify',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1195,7 +1194,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'trash' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/threads/{id}/trash',
|
||||
'path' => '{userId}/threads/{id}/trash',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
@ -1210,7 +1209,7 @@ class Google_Service_Gmail extends Google_Service
|
||||
),
|
||||
),
|
||||
),'untrash' => array(
|
||||
'path' => 'gmail/v1/users/{userId}/threads/{id}/untrash',
|
||||
'path' => '{userId}/threads/{id}/untrash',
|
||||
'httpMethod' => 'POST',
|
||||
'parameters' => array(
|
||||
'userId' => array(
|
||||
|
@ -81,12 +81,12 @@ class Google_Service_Gmail_Resource_UsersDrafts extends Google_Service_Resource
|
||||
*
|
||||
* @opt_param bool includeSpamTrash Include drafts from SPAM and TRASH in the
|
||||
* results.
|
||||
* @opt_param string maxResults Maximum number of drafts to return.
|
||||
* @opt_param string pageToken Page token to retrieve a specific page of results
|
||||
* in the list.
|
||||
* @opt_param string q Only return draft messages matching the specified query.
|
||||
* Supports the same query format as the Gmail search box. For example,
|
||||
* "from:someuser@example.com rfc822msgid: is:unread".
|
||||
* @opt_param string maxResults Maximum number of drafts to return.
|
||||
* @return Google_Service_Gmail_ListDraftsResponse
|
||||
*/
|
||||
public function listUsersDrafts($userId, $optParams = array())
|
||||
|
@ -34,11 +34,11 @@ class Google_Service_Gmail_Resource_UsersHistory extends Google_Service_Resource
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string pageToken Page token to retrieve a specific page of results
|
||||
* in the list.
|
||||
* @opt_param string historyTypes History types to be returned by the function
|
||||
* @opt_param string labelId Only return messages with a label matching the ID.
|
||||
* @opt_param string maxResults The maximum number of history records to return.
|
||||
* @opt_param string historyTypes History types to be returned by the function
|
||||
* @opt_param string pageToken Page token to retrieve a specific page of results
|
||||
* in the list.
|
||||
* @opt_param string startHistoryId Required. Returns history records after the
|
||||
* specified startHistoryId. The supplied startHistoryId should be obtained from
|
||||
* the historyId of a message, thread, or previous list response. History IDs
|
||||
@ -46,7 +46,7 @@ class Google_Service_Gmail_Resource_UsersHistory extends Google_Service_Resource
|
||||
* valid IDs. Supplying an invalid or out of date startHistoryId typically
|
||||
* returns an HTTP 404 error code. A historyId is typically valid for at least a
|
||||
* week, but in some rare circumstances may be valid for only a few hours. If
|
||||
* you receive an HTTP 404 error response, your application should perform a
|
||||
* you receive an HTTP 404 error response, your application should perform a
|
||||
* full sync. If you receive no nextPageToken in the response, there are no
|
||||
* updates to retrieve and you can store the returned historyId for a future
|
||||
* request.
|
||||
|
@ -85,7 +85,8 @@ class Google_Service_Gmail_Resource_UsersLabels extends Google_Service_Resource
|
||||
return $this->call('list', array($params), "Google_Service_Gmail_ListLabelsResponse");
|
||||
}
|
||||
/**
|
||||
* Patch the specified label. (labels.patch)
|
||||
* Updates the specified label. This method supports patch semantics.
|
||||
* (labels.patch)
|
||||
*
|
||||
* @param string $userId The user's email address. The special value me can be
|
||||
* used to indicate the authenticated user.
|
||||
|
@ -26,7 +26,7 @@
|
||||
class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resource
|
||||
{
|
||||
/**
|
||||
* Deletes many messages by message ID. Provides no guarantees that messages
|
||||
* Deletes many messages by message ID. Provides no guarantees that messages
|
||||
* were not already deleted or even existed at all. (messages.batchDelete)
|
||||
*
|
||||
* @param string $userId The user's email address. The special value me can be
|
||||
@ -56,7 +56,7 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
|
||||
}
|
||||
/**
|
||||
* Immediately and permanently deletes the specified message. This operation
|
||||
* cannot be undone. Prefer messages.trash instead. (messages.delete)
|
||||
* cannot be undone. Prefer messages.trash instead. (messages.delete)
|
||||
*
|
||||
* @param string $userId The user's email address. The special value me can be
|
||||
* used to indicate the authenticated user.
|
||||
@ -77,9 +77,9 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
|
||||
* @param string $id The ID of the message to retrieve.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string format The format to return the message in.
|
||||
* @opt_param string metadataHeaders When given and format is METADATA, only
|
||||
* include headers specified.
|
||||
* @opt_param string format The format to return the message in.
|
||||
* @return Google_Service_Gmail_Message
|
||||
*/
|
||||
public function get($userId, $id, $optParams = array())
|
||||
@ -98,15 +98,15 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
|
||||
* @param Google_Service_Gmail_Message $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param bool processForCalendar Process calendar invites in the email and
|
||||
* add any extracted meetings to the Google Calendar for this user.
|
||||
* @opt_param bool deleted Mark the email as permanently deleted (not TRASH) and
|
||||
* only visible in Google Vault to a Vault administrator. Only used for G Suite
|
||||
* accounts.
|
||||
* @opt_param string internalDateSource Source for Gmail's internal date of the
|
||||
* message.
|
||||
* @opt_param bool neverMarkSpam Ignore the Gmail spam classifier decision and
|
||||
* never mark this email as SPAM in the mailbox.
|
||||
* @opt_param bool deleted Mark the email as permanently deleted (not TRASH) and
|
||||
* only visible in Google Vault to a Vault administrator. Only used for G Suite
|
||||
* accounts.
|
||||
* @opt_param bool processForCalendar Process calendar invites in the email and
|
||||
* add any extracted meetings to the Google Calendar for this user.
|
||||
* @return Google_Service_Gmail_Message
|
||||
*/
|
||||
public function import($userId, Google_Service_Gmail_Message $postBody, $optParams = array())
|
||||
@ -125,11 +125,11 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
|
||||
* @param Google_Service_Gmail_Message $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string internalDateSource Source for Gmail's internal date of the
|
||||
* message.
|
||||
* @opt_param bool deleted Mark the email as permanently deleted (not TRASH) and
|
||||
* only visible in Google Vault to a Vault administrator. Only used for G Suite
|
||||
* accounts.
|
||||
* @opt_param string internalDateSource Source for Gmail's internal date of the
|
||||
* message.
|
||||
* @return Google_Service_Gmail_Message
|
||||
*/
|
||||
public function insert($userId, Google_Service_Gmail_Message $postBody, $optParams = array())
|
||||
@ -147,16 +147,15 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
|
||||
*
|
||||
* @opt_param bool includeSpamTrash Include messages from SPAM and TRASH in the
|
||||
* results.
|
||||
* @opt_param string pageToken Page token to retrieve a specific page of results
|
||||
* in the list.
|
||||
* @opt_param string labelIds Only return messages with labels that match all of
|
||||
* the specified label IDs.
|
||||
* @opt_param string maxResults Maximum number of messages to return.
|
||||
* @opt_param string pageToken Page token to retrieve a specific page of results
|
||||
* in the list.
|
||||
* @opt_param string q Only return messages matching the specified query.
|
||||
* Supports the same query format as the Gmail search box. For example,
|
||||
* "from:someuser@example.com rfc822msgid:somemsgid@example.com is:unread".
|
||||
* Parameter cannot be used when accessing the api using the gmail.metadata
|
||||
* scope.
|
||||
* @opt_param string maxResults Maximum number of messages to return.
|
||||
* "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be used
|
||||
* when accessing the api using the gmail.metadata scope.
|
||||
* @return Google_Service_Gmail_ListMessagesResponse
|
||||
*/
|
||||
public function listUsersMessages($userId, $optParams = array())
|
||||
|
@ -29,7 +29,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
* Gets the auto-forwarding setting for the specified account.
|
||||
* (settings.getAutoForwarding)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Gmail_AutoForwarding
|
||||
@ -43,7 +43,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
/**
|
||||
* Gets IMAP settings. (settings.getImap)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Gmail_ImapSettings
|
||||
@ -57,7 +57,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
/**
|
||||
* Gets language settings. (settings.getLanguage)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Gmail_LanguageSettings
|
||||
@ -71,7 +71,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
/**
|
||||
* Gets POP settings. (settings.getPop)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Gmail_PopSettings
|
||||
@ -85,7 +85,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
/**
|
||||
* Gets vacation responder settings. (settings.getVacation)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Gmail_VacationSettings
|
||||
@ -97,13 +97,13 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
return $this->call('getVacation', array($params), "Google_Service_Gmail_VacationSettings");
|
||||
}
|
||||
/**
|
||||
* Updates the auto-forwarding setting for the specified account. A verified
|
||||
* Updates the auto-forwarding setting for the specified account. A verified
|
||||
* forwarding address must be specified when auto-forwarding is enabled.
|
||||
*
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (settings.updateAutoForwarding)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param Google_Service_Gmail_AutoForwarding $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -118,7 +118,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
/**
|
||||
* Updates IMAP settings. (settings.updateImap)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param Google_Service_Gmail_ImapSettings $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -139,7 +139,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
* Gmail but have a close variant that is, and so the variant may be chosen and
|
||||
* saved instead. (settings.updateLanguage)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param Google_Service_Gmail_LanguageSettings $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -154,7 +154,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
/**
|
||||
* Updates POP settings. (settings.updatePop)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param Google_Service_Gmail_PopSettings $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -169,7 +169,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
|
||||
/**
|
||||
* Updates vacation responder settings. (settings.updateVacation)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param Google_Service_Gmail_VacationSettings $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
|
@ -27,8 +27,8 @@ class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Servic
|
||||
{
|
||||
/**
|
||||
* Adds a delegate with its verification status set directly to accepted,
|
||||
* without sending any verification email. The delegate user must be a member
|
||||
* of the same G Suite organization as the delegator user.
|
||||
* without sending any verification email. The delegate user must be a member of
|
||||
* the same G Suite organization as the delegator user.
|
||||
*
|
||||
* Gmail imposes limitations on the number of delegates and delegators each user
|
||||
* in a G Suite organization can have. These limits depend on your organization,
|
||||
@ -43,7 +43,7 @@ class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Servic
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (delegates.create)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param Google_Service_Gmail_Delegate $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -65,7 +65,7 @@ class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Servic
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (delegates.delete)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param string $delegateEmail The email address of the user to be removed as a
|
||||
* delegate.
|
||||
@ -86,7 +86,7 @@ class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Servic
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (delegates.get)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param string $delegateEmail The email address of the user whose delegate
|
||||
* relationship is to be retrieved.
|
||||
@ -105,7 +105,7 @@ class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Servic
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (delegates.listUsersSettingsDelegates)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Gmail_ListDelegatesResponse
|
||||
|
@ -26,7 +26,7 @@
|
||||
class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Google_Service_Resource
|
||||
{
|
||||
/**
|
||||
* Creates a forwarding address. If ownership verification is required, a
|
||||
* Creates a forwarding address. If ownership verification is required, a
|
||||
* message will be sent to the recipient and the resource's verification status
|
||||
* will be set to pending; otherwise, the resource will be created with
|
||||
* verification status set to accepted.
|
||||
@ -34,7 +34,7 @@ class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Goo
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (forwardingAddresses.create)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param Google_Service_Gmail_ForwardingAddress $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -53,7 +53,7 @@ class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Goo
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (forwardingAddresses.delete)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param string $forwardingEmail The forwarding address to be deleted.
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -67,7 +67,7 @@ class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Goo
|
||||
/**
|
||||
* Gets the specified forwarding address. (forwardingAddresses.get)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param string $forwardingEmail The forwarding address to be retrieved.
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -83,7 +83,7 @@ class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Goo
|
||||
* Lists the forwarding addresses for the specified account.
|
||||
* (forwardingAddresses.listUsersSettingsForwardingAddresses)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Gmail_ListForwardingAddressesResponse
|
||||
|
@ -26,18 +26,18 @@
|
||||
class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_Resource
|
||||
{
|
||||
/**
|
||||
* Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail
|
||||
* Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail
|
||||
* will attempt to connect to the SMTP service to validate the configuration
|
||||
* before creating the alias. If ownership verification is required for the
|
||||
* before creating the alias. If ownership verification is required for the
|
||||
* alias, a message will be sent to the email address and the resource's
|
||||
* verification status will be set to pending; otherwise, the resource will be
|
||||
* created with verification status set to accepted. If a signature is
|
||||
* provided, Gmail will sanitize the HTML before saving it with the alias.
|
||||
* created with verification status set to accepted. If a signature is provided,
|
||||
* Gmail will sanitize the HTML before saving it with the alias.
|
||||
*
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (sendAs.create)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param Google_Service_Gmail_SendAs $postBody
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -50,13 +50,13 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
|
||||
return $this->call('create', array($params), "Google_Service_Gmail_SendAs");
|
||||
}
|
||||
/**
|
||||
* Deletes the specified send-as alias. Revokes any verification that may have
|
||||
* Deletes the specified send-as alias. Revokes any verification that may have
|
||||
* been required for using it.
|
||||
*
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (sendAs.delete)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param string $sendAsEmail The send-as alias to be deleted.
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -68,10 +68,10 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
|
||||
return $this->call('delete', array($params));
|
||||
}
|
||||
/**
|
||||
* Gets the specified send-as alias. Fails with an HTTP 404 error if the
|
||||
* Gets the specified send-as alias. Fails with an HTTP 404 error if the
|
||||
* specified address is not a member of the collection. (sendAs.get)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param string $sendAsEmail The send-as alias to be retrieved.
|
||||
* @param array $optParams Optional parameters.
|
||||
@ -84,11 +84,11 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
|
||||
return $this->call('get', array($params), "Google_Service_Gmail_SendAs");
|
||||
}
|
||||
/**
|
||||
* Lists the send-as aliases for the specified account. The result includes the
|
||||
* Lists the send-as aliases for the specified account. The result includes the
|
||||
* primary send-as address associated with the account as well as any custom
|
||||
* "from" aliases. (sendAs.listUsersSettingsSendAs)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
* @return Google_Service_Gmail_ListSendAsResponse
|
||||
@ -100,9 +100,14 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
|
||||
return $this->call('list', array($params), "Google_Service_Gmail_ListSendAsResponse");
|
||||
}
|
||||
/**
|
||||
* Patch the specified send-as alias. (sendAs.patch)
|
||||
* Updates a send-as alias. If a signature is provided, Gmail will sanitize the
|
||||
* HTML before saving it with the alias.
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* Addresses other than the primary address for the account can only be updated
|
||||
* by service account clients that have been delegated domain-wide authority.
|
||||
* This method supports patch semantics. (sendAs.patch)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param string $sendAsEmail The send-as alias to be updated.
|
||||
* @param Google_Service_Gmail_SendAs $postBody
|
||||
@ -116,14 +121,14 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
|
||||
return $this->call('patch', array($params), "Google_Service_Gmail_SendAs");
|
||||
}
|
||||
/**
|
||||
* Updates a send-as alias. If a signature is provided, Gmail will sanitize the
|
||||
* Updates a send-as alias. If a signature is provided, Gmail will sanitize the
|
||||
* HTML before saving it with the alias.
|
||||
*
|
||||
* Addresses other than the primary address for the account can only be updated
|
||||
* by service account clients that have been delegated domain-wide authority.
|
||||
* (sendAs.update)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param string $sendAsEmail The send-as alias to be updated.
|
||||
* @param Google_Service_Gmail_SendAs $postBody
|
||||
@ -143,7 +148,7 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
|
||||
* This method is only available to service account clients that have been
|
||||
* delegated domain-wide authority. (sendAs.verify)
|
||||
*
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* @param string $userId User's email address. The special value "me" can be
|
||||
* used to indicate the authenticated user.
|
||||
* @param string $sendAsEmail The send-as alias to be verified.
|
||||
* @param array $optParams Optional parameters.
|
||||
|
@ -48,9 +48,9 @@ class Google_Service_Gmail_Resource_UsersThreads extends Google_Service_Resource
|
||||
* @param string $id The ID of the thread to retrieve.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string format The format to return the messages in.
|
||||
* @opt_param string metadataHeaders When given and format is METADATA, only
|
||||
* include headers specified.
|
||||
* @opt_param string format The format to return the messages in.
|
||||
* @return Google_Service_Gmail_Thread
|
||||
*/
|
||||
public function get($userId, $id, $optParams = array())
|
||||
@ -66,17 +66,17 @@ class Google_Service_Gmail_Resource_UsersThreads extends Google_Service_Resource
|
||||
* used to indicate the authenticated user.
|
||||
* @param array $optParams Optional parameters.
|
||||
*
|
||||
* @opt_param string pageToken Page token to retrieve a specific page of results
|
||||
* in the list.
|
||||
* @opt_param bool includeSpamTrash Include threads from SPAM and TRASH in the
|
||||
* results.
|
||||
* @opt_param string labelIds Only return threads with labels that match all of
|
||||
* the specified label IDs.
|
||||
* @opt_param string maxResults Maximum number of threads to return.
|
||||
* @opt_param string pageToken Page token to retrieve a specific page of results
|
||||
* in the list.
|
||||
* @opt_param string q Only return threads matching the specified query.
|
||||
* Supports the same query format as the Gmail search box. For example,
|
||||
* "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be used
|
||||
* when accessing the api using the gmail.metadata scope.
|
||||
* @opt_param string maxResults Maximum number of threads to return.
|
||||
* @opt_param bool includeSpamTrash Include threads from SPAM and TRASH in the
|
||||
* results.
|
||||
* @return Google_Service_Gmail_ListThreadsResponse
|
||||
*/
|
||||
public function listUsersThreads($userId, $optParams = array())
|
||||
|
@ -23,7 +23,7 @@ function oauth2client_php_autoload($className)
|
||||
}
|
||||
if (count($classPath) > 3) {
|
||||
// Maximum class file path depth in this project is 3.
|
||||
$classPath = array_slice($classPath, 0, 3);
|
||||
$classPath = array_slice($classPath, 0, 3);
|
||||
}
|
||||
$filePath = dirname(__FILE__) . '/src/' . implode('/', $classPath) . '.php';
|
||||
if (file_exists($filePath)) {
|
||||
|
@ -82,22 +82,19 @@ class AccessToken
|
||||
* accepted. By default, the id token must have been issued to this OAuth2 client.
|
||||
*
|
||||
* @param string $token The JSON Web Token to be verified.
|
||||
* @param array $options [optional] {
|
||||
* Configuration options.
|
||||
*
|
||||
* @type string $audience The indended recipient of the token.
|
||||
* @type string $issuer The intended issuer of the token.
|
||||
* @type string $certsLocation The location (remote or local) from which
|
||||
* @param array $options [optional] Configuration options.
|
||||
* @param string $options.audience The indended recipient of the token.
|
||||
* @param string $options.issuer The intended issuer of the token.
|
||||
* @param string $options.cacheKey The cache key of the cached certs. Defaults to
|
||||
* the sha1 of $certsLocation if provided, otherwise is set to
|
||||
* "federated_signon_certs_v3".
|
||||
* @param string $options.certsLocation The location (remote or local) from which
|
||||
* to retrieve certificates, if not cached. This value should only be
|
||||
* provided in limited circumstances in which you are sure of the
|
||||
* behavior.
|
||||
* @type string $cacheKey The cache key of the cached certs. Defaults to
|
||||
* the sha1 of $certsLocation if provided, otherwise is set to
|
||||
* "federated_signon_certs_v3".
|
||||
* @type bool $throwException Whether the function should throw an
|
||||
* @param bool $options.throwException Whether the function should throw an
|
||||
* exception if the verification fails. This is useful for
|
||||
* determining the reason verification failed.
|
||||
* }
|
||||
* @return array|bool the token payload, if successful, or false if not.
|
||||
* @throws InvalidArgumentException If certs could not be retrieved from a local file.
|
||||
* @throws InvalidArgumentException If received certs are in an invalid format.
|
||||
@ -129,7 +126,8 @@ class AccessToken
|
||||
$alg = $this->determineAlg($certs);
|
||||
if (!in_array($alg, ['RS256', 'ES256'])) {
|
||||
throw new InvalidArgumentException(
|
||||
'unrecognized "alg" in certs, expected ES256 or RS256');
|
||||
'unrecognized "alg" in certs, expected ES256 or RS256'
|
||||
);
|
||||
}
|
||||
try {
|
||||
if ($alg == 'RS256') {
|
||||
@ -186,13 +184,11 @@ class AccessToken
|
||||
*
|
||||
* @param string $token The JSON Web Token to be verified.
|
||||
* @param array $certs Certificate array according to the JWK spec (see
|
||||
* https://tools.ietf.org/html/rfc7517).
|
||||
* https://tools.ietf.org/html/rfc7517).
|
||||
* @param string|null $audience If set, returns false if the provided
|
||||
* audience does not match the "aud" claim on
|
||||
* the JWT.
|
||||
* audience does not match the "aud" claim on the JWT.
|
||||
* @param string|null $issuer If set, returns false if the provided
|
||||
* issuer does not match the "iss" claim on
|
||||
* the JWT.
|
||||
* issuer does not match the "iss" claim on the JWT.
|
||||
* @return array|bool the token payload, if successful, or false if not.
|
||||
*/
|
||||
private function verifyEs256($token, array $certs, $audience = null, $issuer = null)
|
||||
@ -228,13 +224,11 @@ class AccessToken
|
||||
*
|
||||
* @param string $token The JSON Web Token to be verified.
|
||||
* @param array $certs Certificate array according to the JWK spec (see
|
||||
* https://tools.ietf.org/html/rfc7517).
|
||||
* https://tools.ietf.org/html/rfc7517).
|
||||
* @param string|null $audience If set, returns false if the provided
|
||||
* audience does not match the "aud" claim on
|
||||
* the JWT.
|
||||
* audience does not match the "aud" claim on the JWT.
|
||||
* @param string|null $issuer If set, returns false if the provided
|
||||
* issuer does not match the "iss" claim on
|
||||
* the JWT.
|
||||
* issuer does not match the "iss" claim on the JWT.
|
||||
* @return array|bool the token payload, if successful, or false if not.
|
||||
*/
|
||||
private function verifyRs256($token, array $certs, $audience = null, $issuer = null)
|
||||
@ -325,6 +319,7 @@ class AccessToken
|
||||
* are PEM encoded certificates.
|
||||
*
|
||||
* @param string $location The location from which to retrieve certs.
|
||||
* @param string $cacheKey The key under which to cache the retrieved certs.
|
||||
* @param array $options [optional] Configuration options.
|
||||
* @return array
|
||||
* @throws InvalidArgumentException If received certs are in an invalid format.
|
||||
|
@ -46,23 +46,25 @@ use Psr\Cache\CacheItemPoolInterface;
|
||||
*
|
||||
* This allows it to be used as follows with GuzzleHttp\Client:
|
||||
*
|
||||
* use Google\Auth\ApplicationDefaultCredentials;
|
||||
* use GuzzleHttp\Client;
|
||||
* use GuzzleHttp\HandlerStack;
|
||||
* ```
|
||||
* use Google\Auth\ApplicationDefaultCredentials;
|
||||
* use GuzzleHttp\Client;
|
||||
* use GuzzleHttp\HandlerStack;
|
||||
*
|
||||
* $middleware = ApplicationDefaultCredentials::getMiddleware(
|
||||
* 'https://www.googleapis.com/auth/taskqueue'
|
||||
* );
|
||||
* $stack = HandlerStack::create();
|
||||
* $stack->push($middleware);
|
||||
* $middleware = ApplicationDefaultCredentials::getMiddleware(
|
||||
* 'https://www.googleapis.com/auth/taskqueue'
|
||||
* );
|
||||
* $stack = HandlerStack::create();
|
||||
* $stack->push($middleware);
|
||||
*
|
||||
* $client = new Client([
|
||||
* 'handler' => $stack,
|
||||
* 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
|
||||
* 'auth' => 'google_auth' // authorize all requests
|
||||
* ]);
|
||||
* $client = new Client([
|
||||
* 'handler' => $stack,
|
||||
* 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
|
||||
* 'auth' => 'google_auth' // authorize all requests
|
||||
* ]);
|
||||
*
|
||||
* $res = $client->get('myproject/taskqueues/myqueue');
|
||||
* $res = $client->get('myproject/taskqueues/myqueue');
|
||||
* ```
|
||||
*/
|
||||
class ApplicationDefaultCredentials
|
||||
{
|
||||
@ -74,13 +76,12 @@ class ApplicationDefaultCredentials
|
||||
* this does not fallback to the compute engine defaults.
|
||||
*
|
||||
* @param string|array scope the scope of the access request, expressed
|
||||
* either as an Array or as a space-delimited String.
|
||||
* either as an Array or as a space-delimited String.
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
* @param array $cacheConfig configuration for the cache when it's present
|
||||
* @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface
|
||||
*
|
||||
* @param CacheItemPoolInterface $cache A cache implementation, may be
|
||||
* provided if you have one already available for use.
|
||||
* @return AuthTokenSubscriber
|
||||
*
|
||||
* @throws DomainException if no implementation can be obtained.
|
||||
*/
|
||||
public static function getSubscriber(
|
||||
@ -102,13 +103,12 @@ class ApplicationDefaultCredentials
|
||||
* this does not fallback to the compute engine defaults.
|
||||
*
|
||||
* @param string|array scope the scope of the access request, expressed
|
||||
* either as an Array or as a space-delimited String.
|
||||
* either as an Array or as a space-delimited String.
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
* @param array $cacheConfig configuration for the cache when it's present
|
||||
* @param CacheItemPoolInterface $cache
|
||||
*
|
||||
* @param CacheItemPoolInterface $cache A cache implementation, may be
|
||||
* provided if you have one already available for use.
|
||||
* @return AuthTokenMiddleware
|
||||
*
|
||||
* @throws DomainException if no implementation can be obtained.
|
||||
*/
|
||||
public static function getMiddleware(
|
||||
@ -131,20 +131,23 @@ class ApplicationDefaultCredentials
|
||||
* this does not fallback to the Compute Engine defaults.
|
||||
*
|
||||
* @param string|array scope the scope of the access request, expressed
|
||||
* either as an Array or as a space-delimited String.
|
||||
* either as an Array or as a space-delimited String.
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
* @param array $cacheConfig configuration for the cache when it's present
|
||||
* @param CacheItemPoolInterface $cache
|
||||
* @param CacheItemPoolInterface $cache A cache implementation, may be
|
||||
* provided if you have one already available for use.
|
||||
* @param string $quotaProject specifies a project to bill for access
|
||||
* charges associated with the request.
|
||||
*
|
||||
* @return CredentialsLoader
|
||||
*
|
||||
* @throws DomainException if no implementation can be obtained.
|
||||
*/
|
||||
public static function getCredentials(
|
||||
$scope = null,
|
||||
callable $httpHandler = null,
|
||||
array $cacheConfig = null,
|
||||
CacheItemPoolInterface $cache = null
|
||||
CacheItemPoolInterface $cache = null,
|
||||
$quotaProject = null
|
||||
) {
|
||||
$creds = null;
|
||||
$jsonKey = CredentialsLoader::fromEnv()
|
||||
@ -160,11 +163,12 @@ class ApplicationDefaultCredentials
|
||||
}
|
||||
|
||||
if (!is_null($jsonKey)) {
|
||||
$jsonKey['quota_project'] = $quotaProject;
|
||||
$creds = CredentialsLoader::makeCredentials($scope, $jsonKey);
|
||||
} elseif (AppIdentityCredentials::onAppEngine() && !GCECredentials::onAppEngineFlexible()) {
|
||||
$creds = new AppIdentityCredentials($scope);
|
||||
} elseif (GCECredentials::onGce($httpHandler)) {
|
||||
$creds = new GCECredentials(null, $scope);
|
||||
$creds = new GCECredentials(null, $scope, null, $quotaProject);
|
||||
}
|
||||
|
||||
if (is_null($creds)) {
|
||||
@ -187,10 +191,9 @@ class ApplicationDefaultCredentials
|
||||
* @param string $targetAudience The audience for the ID token.
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
* @param array $cacheConfig configuration for the cache when it's present
|
||||
* @param CacheItemPoolInterface $cache
|
||||
*
|
||||
* @param CacheItemPoolInterface $cache A cache implementation, may be
|
||||
* provided if you have one already available for use.
|
||||
* @return AuthTokenMiddleware
|
||||
*
|
||||
* @throws DomainException if no implementation can be obtained.
|
||||
*/
|
||||
public static function getIdTokenMiddleware(
|
||||
@ -198,7 +201,6 @@ class ApplicationDefaultCredentials
|
||||
callable $httpHandler = null,
|
||||
array $cacheConfig = null,
|
||||
CacheItemPoolInterface $cache = null
|
||||
|
||||
) {
|
||||
$creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache);
|
||||
|
||||
@ -213,10 +215,9 @@ class ApplicationDefaultCredentials
|
||||
* @param string $targetAudience The audience for the ID token.
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
* @param array $cacheConfig configuration for the cache when it's present
|
||||
* @param CacheItemPoolInterface $cache
|
||||
*
|
||||
* @param CacheItemPoolInterface $cache A cache implementation, may be
|
||||
* provided if you have one already available for use.
|
||||
* @return CredentialsLoader
|
||||
*
|
||||
* @throws DomainException if no implementation can be obtained.
|
||||
* @throws InvalidArgumentException if JSON "type" key is invalid
|
||||
*/
|
||||
|
@ -62,22 +62,22 @@ class SysVCacheItemPool implements CacheItemPoolInterface
|
||||
/**
|
||||
* Create a SystemV shared memory based CacheItemPool.
|
||||
*
|
||||
* @param array $options [optional] {
|
||||
* Configuration options.
|
||||
*
|
||||
* @type int $variableKey The variable key for getting the data from
|
||||
* the shared memory. **Defaults to** 1.
|
||||
* @type string $proj The project identifier for ftok. This needs to
|
||||
* be a one character string. **Defaults to** 'A'.
|
||||
* @type int $memsize The memory size in bytes for shm_attach.
|
||||
* **Defaults to** 10000.
|
||||
* @type int $perm The permission for shm_attach. **Defaults to** 0600.
|
||||
* @param array $options [optional] Configuration options.
|
||||
* @param int $options.variableKey The variable key for getting the data from
|
||||
* the shared memory. **Defaults to** 1.
|
||||
* @param $options.proj string The project identifier for ftok. This needs to
|
||||
* be a one character string. **Defaults to** 'A'.
|
||||
* @param $options.memsize int The memory size in bytes for shm_attach.
|
||||
* **Defaults to** 10000.
|
||||
* @param $options.perm int The permission for shm_attach. **Defaults to**
|
||||
* 0600.
|
||||
*/
|
||||
public function __construct($options = [])
|
||||
{
|
||||
if (! extension_loaded('sysvshm')) {
|
||||
throw new \RuntimeException(
|
||||
'sysvshm extension is required to use this ItemPool');
|
||||
'sysvshm extension is required to use this ItemPool'
|
||||
);
|
||||
}
|
||||
$this->options = $options + [
|
||||
'variableKey' => self::VAR_KEY,
|
||||
@ -90,9 +90,6 @@ class SysVCacheItemPool implements CacheItemPoolInterface
|
||||
$this->sysvKey = ftok(__FILE__, $this->options['proj']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getItem($key)
|
||||
{
|
||||
$this->loadItems();
|
||||
|
@ -90,7 +90,7 @@ class AppIdentityCredentials extends CredentialsLoader implements
|
||||
* SERVER_SOFTWARE environment variable (prod) or the APPENGINE_RUNTIME
|
||||
* environment variable (dev).
|
||||
*
|
||||
* @return true if this an App Engine Instance, false otherwise
|
||||
* @return bool true if this an App Engine Instance, false otherwise
|
||||
*/
|
||||
public static function onAppEngine()
|
||||
{
|
||||
@ -115,7 +115,6 @@ class AppIdentityCredentials extends CredentialsLoader implements
|
||||
* the GuzzleHttp\ClientInterface instance passed in will not be used.
|
||||
*
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
*
|
||||
* @return array A set of auth related metadata, containing the following
|
||||
* keys:
|
||||
* - access_token (string)
|
||||
|
@ -18,6 +18,7 @@
|
||||
namespace Google\Auth\Credentials;
|
||||
|
||||
use Google\Auth\CredentialsLoader;
|
||||
use Google\Auth\GetQuotaProjectInterface;
|
||||
use Google\Auth\HttpHandler\HttpClientCache;
|
||||
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
||||
use Google\Auth\Iam;
|
||||
@ -55,9 +56,12 @@ use InvalidArgumentException;
|
||||
*/
|
||||
class GCECredentials extends CredentialsLoader implements
|
||||
SignBlobInterface,
|
||||
ProjectIdProviderInterface
|
||||
ProjectIdProviderInterface,
|
||||
GetQuotaProjectInterface
|
||||
{
|
||||
// phpcs:disable
|
||||
const cacheKey = 'GOOGLE_AUTH_PHP_GCE';
|
||||
// phpcs:enable
|
||||
|
||||
/**
|
||||
* The metadata IP address on appengine instances.
|
||||
@ -149,19 +153,27 @@ class GCECredentials extends CredentialsLoader implements
|
||||
*/
|
||||
private $targetAudience;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $quotaProject;
|
||||
|
||||
/**
|
||||
* @param Iam $iam [optional] An IAM instance.
|
||||
* @param string|array $scope [optional] the scope of the access request,
|
||||
* expressed either as an array or as a space-delimited string.
|
||||
* @param string $targetAudience [optional] The audience for the ID token.
|
||||
* @param string $quotaProject [optional] Specifies a project to bill for access
|
||||
* charges associated with the request.
|
||||
*/
|
||||
public function __construct(Iam $iam = null, $scope = null, $targetAudience = null)
|
||||
public function __construct(Iam $iam = null, $scope = null, $targetAudience = null, $quotaProject = null)
|
||||
{
|
||||
$this->iam = $iam;
|
||||
|
||||
if ($scope && $targetAudience) {
|
||||
throw new InvalidArgumentException(
|
||||
'Scope and targetAudience cannot both be supplied');
|
||||
'Scope and targetAudience cannot both be supplied'
|
||||
);
|
||||
}
|
||||
|
||||
$tokenUri = self::getTokenUri();
|
||||
@ -174,7 +186,8 @@ class GCECredentials extends CredentialsLoader implements
|
||||
|
||||
$tokenUri = $tokenUri . '?scopes='. $scope;
|
||||
} elseif ($targetAudience) {
|
||||
$tokenUri = sprintf('http://%s/computeMetadata/%s?audience=%s',
|
||||
$tokenUri = sprintf(
|
||||
'http://%s/computeMetadata/%s?audience=%s',
|
||||
self::METADATA_IP,
|
||||
self::ID_TOKEN_URI_PATH,
|
||||
$targetAudience
|
||||
@ -183,6 +196,7 @@ class GCECredentials extends CredentialsLoader implements
|
||||
}
|
||||
|
||||
$this->tokenUri = $tokenUri;
|
||||
$this->quotaProject = $quotaProject;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -225,7 +239,7 @@ class GCECredentials extends CredentialsLoader implements
|
||||
* Determines if this an App Engine Flexible instance, by accessing the
|
||||
* GAE_INSTANCE environment variable.
|
||||
*
|
||||
* @return true if this an App Engine Flexible Instance, false otherwise
|
||||
* @return bool true if this an App Engine Flexible Instance, false otherwise
|
||||
*/
|
||||
public static function onAppEngineFlexible()
|
||||
{
|
||||
@ -456,4 +470,14 @@ class GCECredentials extends CredentialsLoader implements
|
||||
|
||||
return (string) $resp->getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the quota project used for this API request
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getQuotaProject()
|
||||
{
|
||||
return $this->quotaProject;
|
||||
}
|
||||
}
|
||||
|
@ -43,11 +43,13 @@ class IAMCredentials
|
||||
{
|
||||
if (!is_string($selector)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'selector must be a string');
|
||||
'selector must be a string'
|
||||
);
|
||||
}
|
||||
if (!is_string($token)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'token must be a string');
|
||||
'token must be a string'
|
||||
);
|
||||
}
|
||||
|
||||
$this->selector = $selector;
|
||||
|
@ -112,18 +112,21 @@ class ServiceAccountCredentials extends CredentialsLoader implements
|
||||
}
|
||||
if (!array_key_exists('client_email', $jsonKey)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'json key is missing the client_email field');
|
||||
'json key is missing the client_email field'
|
||||
);
|
||||
}
|
||||
if (!array_key_exists('private_key', $jsonKey)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'json key is missing the private_key field');
|
||||
'json key is missing the private_key field'
|
||||
);
|
||||
}
|
||||
if (array_key_exists('quota_project', $jsonKey)) {
|
||||
$this->quotaProject = (string) $jsonKey['quota_project'];
|
||||
}
|
||||
if ($scope && $targetAudience) {
|
||||
throw new InvalidArgumentException(
|
||||
'Scope and targetAudience cannot both be supplied');
|
||||
'Scope and targetAudience cannot both be supplied'
|
||||
);
|
||||
}
|
||||
$additionalClaims = [];
|
||||
if ($targetAudience) {
|
||||
@ -199,7 +202,6 @@ class ServiceAccountCredentials extends CredentialsLoader implements
|
||||
* @param array $metadata metadata hashmap
|
||||
* @param string $authUri optional auth uri
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
*
|
||||
* @return array updated metadata hashmap
|
||||
*/
|
||||
public function updateMetadata(
|
||||
|
@ -71,11 +71,13 @@ class ServiceAccountJwtAccessCredentials extends CredentialsLoader implements
|
||||
}
|
||||
if (!array_key_exists('client_email', $jsonKey)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'json key is missing the client_email field');
|
||||
'json key is missing the client_email field'
|
||||
);
|
||||
}
|
||||
if (!array_key_exists('private_key', $jsonKey)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'json key is missing the private_key field');
|
||||
'json key is missing the private_key field'
|
||||
);
|
||||
}
|
||||
if (array_key_exists('quota_project', $jsonKey)) {
|
||||
$this->quotaProject = (string) $jsonKey['quota_project'];
|
||||
@ -98,7 +100,6 @@ class ServiceAccountJwtAccessCredentials extends CredentialsLoader implements
|
||||
* @param array $metadata metadata hashmap
|
||||
* @param string $authUri optional auth uri
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
*
|
||||
* @return array updated metadata hashmap
|
||||
*/
|
||||
public function updateMetadata(
|
||||
|
@ -74,15 +74,18 @@ class UserRefreshCredentials extends CredentialsLoader implements GetQuotaProjec
|
||||
}
|
||||
if (!array_key_exists('client_id', $jsonKey)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'json key is missing the client_id field');
|
||||
'json key is missing the client_id field'
|
||||
);
|
||||
}
|
||||
if (!array_key_exists('client_secret', $jsonKey)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'json key is missing the client_secret field');
|
||||
'json key is missing the client_secret field'
|
||||
);
|
||||
}
|
||||
if (!array_key_exists('refresh_token', $jsonKey)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'json key is missing the refresh_token field');
|
||||
'json key is missing the refresh_token field'
|
||||
);
|
||||
}
|
||||
$this->auth = new OAuth2([
|
||||
'clientId' => $jsonKey['client_id'],
|
||||
@ -109,7 +112,8 @@ class UserRefreshCredentials extends CredentialsLoader implements GetQuotaProjec
|
||||
. 'To disable this warning, set '
|
||||
. self::SUPPRESS_CLOUD_SDK_CREDS_WARNING_ENV
|
||||
. ' environment variable to "true".',
|
||||
E_USER_WARNING);
|
||||
E_USER_WARNING
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ abstract class CredentialsLoader implements FetchAuthTokenInterface
|
||||
* variable GOOGLE_APPLICATION_CREDENTIALS. Return null if
|
||||
* GOOGLE_APPLICATION_CREDENTIALS is not specified.
|
||||
*
|
||||
* @return array JSON key | null
|
||||
* @return array|null JSON key | null
|
||||
*/
|
||||
public static function fromEnv()
|
||||
{
|
||||
@ -81,12 +81,13 @@ abstract class CredentialsLoader implements FetchAuthTokenInterface
|
||||
* Load a JSON key from a well known path.
|
||||
*
|
||||
* The well known path is OS dependent:
|
||||
* - windows: %APPDATA%/gcloud/application_default_credentials.json
|
||||
* - others: $HOME/.config/gcloud/application_default_credentials.json
|
||||
*
|
||||
* If the file does not exists, this returns null.
|
||||
* * windows: %APPDATA%/gcloud/application_default_credentials.json
|
||||
* * others: $HOME/.config/gcloud/application_default_credentials.json
|
||||
*
|
||||
* @return array JSON key | null
|
||||
* If the file does not exist, this returns null.
|
||||
*
|
||||
* @return array|null JSON key | null
|
||||
*/
|
||||
public static function fromWellKnownFile()
|
||||
{
|
||||
@ -108,9 +109,8 @@ abstract class CredentialsLoader implements FetchAuthTokenInterface
|
||||
* Create a new Credentials instance.
|
||||
*
|
||||
* @param string|array $scope the scope of the access request, expressed
|
||||
* either as an Array or as a space-delimited String.
|
||||
* either as an Array or as a space-delimited String.
|
||||
* @param array $jsonKey the JSON credentials.
|
||||
*
|
||||
* @return ServiceAccountCredentials|UserRefreshCredentials
|
||||
*/
|
||||
public static function makeCredentials($scope, array $jsonKey)
|
||||
@ -134,10 +134,9 @@ abstract class CredentialsLoader implements FetchAuthTokenInterface
|
||||
* Create an authorized HTTP Client from an instance of FetchAuthTokenInterface.
|
||||
*
|
||||
* @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
|
||||
* @param array $httpClientOptoins (optional) Array of request options to apply.
|
||||
* @param array $httpClientOptions (optional) Array of request options to apply.
|
||||
* @param callable $httpHandler (optional) http client to fetch the token.
|
||||
* @param callable $tokenCallback (optional) function to be called when a new token is fetched.
|
||||
*
|
||||
* @return \GuzzleHttp\Client
|
||||
*/
|
||||
public static function makeHttpClient(
|
||||
@ -203,7 +202,6 @@ abstract class CredentialsLoader implements FetchAuthTokenInterface
|
||||
* @param array $metadata metadata hashmap
|
||||
* @param string $authUri optional auth uri
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
*
|
||||
* @return array updated metadata hashmap
|
||||
*/
|
||||
public function updateMetadata(
|
||||
|
@ -46,6 +46,11 @@ class FetchAuthTokenCache implements
|
||||
*/
|
||||
private $cache;
|
||||
|
||||
/**
|
||||
* @param FetchAuthTokenInterface $fetcher A credentials fetcher
|
||||
* @param array $cacheConfig Configuration for the cache
|
||||
* @param CacheItemPoolInterface $cache
|
||||
*/
|
||||
public function __construct(
|
||||
FetchAuthTokenInterface $fetcher,
|
||||
array $cacheConfig = null,
|
||||
@ -66,9 +71,7 @@ class FetchAuthTokenCache implements
|
||||
* from the supplied fetcher.
|
||||
*
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
*
|
||||
* @return array the response
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function fetchAuthToken(callable $httpHandler = null)
|
||||
@ -125,14 +128,14 @@ class FetchAuthTokenCache implements
|
||||
* Sign a blob using the fetcher.
|
||||
*
|
||||
* @param string $stringToSign The string to sign.
|
||||
* @param bool $forceOpenssl Require use of OpenSSL for local signing. Does
|
||||
* @param bool $forceOpenSsl Require use of OpenSSL for local signing. Does
|
||||
* not apply to signing done using external services. **Defaults to**
|
||||
* `false`.
|
||||
* @return string The resulting signature.
|
||||
* @throws \RuntimeException If the fetcher does not implement
|
||||
* `Google\Auth\SignBlobInterface`.
|
||||
*/
|
||||
public function signBlob($stringToSign, $forceOpenSsl = false)
|
||||
public function signBlob($stringToSign, $forceOpenSsl = false)
|
||||
{
|
||||
if (!$this->fetcher instanceof SignBlobInterface) {
|
||||
throw new \RuntimeException(
|
||||
|
@ -26,7 +26,6 @@ interface FetchAuthTokenInterface
|
||||
* Fetches the auth tokens based on the current state.
|
||||
*
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
*
|
||||
* @return array a hash of auth tokens
|
||||
*/
|
||||
public function fetchAuthToken(callable $httpHandler = null);
|
||||
|
@ -45,7 +45,6 @@ class Guzzle5HttpHandler
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
* @param array $options
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function __invoke(RequestInterface $request, array $options = [])
|
||||
@ -62,7 +61,6 @@ class Guzzle5HttpHandler
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
* @param array $options
|
||||
*
|
||||
* @return Promise
|
||||
*/
|
||||
public function async(RequestInterface $request, array $options = [])
|
||||
|
@ -26,7 +26,6 @@ class Guzzle6HttpHandler
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
* @param array $options
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function __invoke(RequestInterface $request, array $options = [])
|
||||
@ -40,7 +39,7 @@ class Guzzle6HttpHandler
|
||||
* @param RequestInterface $request
|
||||
* @param array $options
|
||||
*
|
||||
* @return \GuzzleHttp\Promise\Promise
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function async(RequestInterface $request, array $options = [])
|
||||
{
|
||||
|
@ -89,7 +89,6 @@ class AuthTokenMiddleware
|
||||
* $res = $client->get('myproject/taskqueues/myqueue');
|
||||
*
|
||||
* @param callable $handler
|
||||
*
|
||||
* @return \Closure
|
||||
*/
|
||||
public function __invoke(callable $handler)
|
||||
|
@ -76,7 +76,8 @@ class ScopedAccessTokenMiddleware
|
||||
$this->tokenFunc = $tokenFunc;
|
||||
if (!(is_string($scopes) || is_array($scopes))) {
|
||||
throw new \InvalidArgumentException(
|
||||
'wants scope should be string or array');
|
||||
'wants scope should be string or array'
|
||||
);
|
||||
}
|
||||
$this->scopes = $scopes;
|
||||
|
||||
@ -119,7 +120,6 @@ class ScopedAccessTokenMiddleware
|
||||
* $res = $client->get('myproject/taskqueues/myqueue');
|
||||
*
|
||||
* @param callable $handler
|
||||
*
|
||||
* @return \Closure
|
||||
*/
|
||||
public function __invoke(callable $handler)
|
||||
|
@ -71,7 +71,6 @@ class SimpleMiddleware
|
||||
* $res = $client->get('drive/v2/rest');
|
||||
*
|
||||
* @param callable $handler
|
||||
*
|
||||
* @return \Closure
|
||||
*/
|
||||
public function __invoke(callable $handler)
|
||||
|
@ -120,7 +120,7 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* The scope of the access request, expressed either as an Array or as a
|
||||
* space-delimited string.
|
||||
*
|
||||
* @var string
|
||||
* @var array
|
||||
*/
|
||||
private $scope;
|
||||
|
||||
@ -175,6 +175,13 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
*/
|
||||
private $signingKey;
|
||||
|
||||
/**
|
||||
* The signing key id when using assertion profile. Param kid in jwt header
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $signingKeyId;
|
||||
|
||||
/**
|
||||
* The signing algorithm when using an assertion profile.
|
||||
*
|
||||
@ -294,6 +301,9 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* - signingKey
|
||||
* Signing key when using assertion profile
|
||||
*
|
||||
* - signingKeyId
|
||||
* Signing key id when using assertion profile
|
||||
*
|
||||
* - refreshToken
|
||||
* The refresh token associated with the access token
|
||||
* to be refreshed.
|
||||
@ -327,6 +337,7 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
'sub' => null,
|
||||
'audience' => null,
|
||||
'signingKey' => null,
|
||||
'signingKeyId' => null,
|
||||
'signingAlgorithm' => null,
|
||||
'scope' => null,
|
||||
'additionalClaims' => [],
|
||||
@ -345,6 +356,7 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
$this->setExpiry($opts['expiry']);
|
||||
$this->setAudience($opts['audience']);
|
||||
$this->setSigningKey($opts['signingKey']);
|
||||
$this->setSigningKeyId($opts['signingKeyId']);
|
||||
$this->setSigningAlgorithm($opts['signingAlgorithm']);
|
||||
$this->setScope($opts['scope']);
|
||||
$this->setExtensionParams($opts['extensionParams']);
|
||||
@ -359,11 +371,21 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* - if present, but invalid, raises DomainException.
|
||||
* - otherwise returns the payload in the idtoken as a PHP object.
|
||||
*
|
||||
* if $publicKey is null, the key is decoded without being verified.
|
||||
* The behavior of this method varies depending on the version of
|
||||
* `firebase/php-jwt` you are using. In versions lower than 3.0.0, if
|
||||
* `$publicKey` is null, the key is decoded without being verified. In
|
||||
* newer versions, if a public key is not given, this method will throw an
|
||||
* `\InvalidArgumentException`.
|
||||
*
|
||||
* @param string $publicKey The public key to use to authenticate the token
|
||||
* @param array $allowed_algs List of supported verification algorithms
|
||||
*
|
||||
* @throws \DomainException if the token is missing an audience.
|
||||
* @throws \DomainException if the audience does not match the one set in
|
||||
* the OAuth2 class instance.
|
||||
* @throws \UnexpectedValueException If the token is invalid
|
||||
* @throws SignatureInvalidException If the signature is invalid.
|
||||
* @throws BeforeValidException If the token is not yet valid.
|
||||
* @throws ExpiredException If the token has expired.
|
||||
* @return null|object
|
||||
*/
|
||||
public function verifyIdToken($publicKey = null, $allowed_algs = array())
|
||||
@ -388,7 +410,6 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* Obtains the encoded jwt from the instance data.
|
||||
*
|
||||
* @param array $config array optional configuration parameters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toJwt(array $config = [])
|
||||
@ -424,8 +445,12 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
}
|
||||
$assertion += $this->getAdditionalClaims();
|
||||
|
||||
return $this->jwtEncode($assertion, $this->getSigningKey(),
|
||||
$this->getSigningAlgorithm());
|
||||
return $this->jwtEncode(
|
||||
$assertion,
|
||||
$this->getSigningKey(),
|
||||
$this->getSigningAlgorithm(),
|
||||
$this->getSigningKeyId()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -490,7 +515,6 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* Fetches the auth tokens based on the current state.
|
||||
*
|
||||
* @param callable $httpHandler callback which delivers psr7 request
|
||||
*
|
||||
* @return array the response
|
||||
*/
|
||||
public function fetchAuthToken(callable $httpHandler = null)
|
||||
@ -515,10 +539,6 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
*/
|
||||
public function getCacheKey()
|
||||
{
|
||||
if (is_string($this->scope)) {
|
||||
return $this->scope;
|
||||
}
|
||||
|
||||
if (is_array($this->scope)) {
|
||||
return implode(':', $this->scope);
|
||||
}
|
||||
@ -531,9 +551,7 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* Parses the fetched tokens.
|
||||
*
|
||||
* @param ResponseInterface $resp the response.
|
||||
*
|
||||
* @return array the tokens parsed from the response body.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function parseTokenResponse(ResponseInterface $resp)
|
||||
@ -559,12 +577,14 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
/**
|
||||
* Updates an OAuth 2.0 client.
|
||||
*
|
||||
* @example
|
||||
* client.updateToken([
|
||||
* Example:
|
||||
* ```
|
||||
* $oauth->updateToken([
|
||||
* 'refresh_token' => 'n4E9O119d',
|
||||
* 'access_token' => 'FJQbwq9',
|
||||
* 'expires_in' => 3600
|
||||
* ])
|
||||
* ]);
|
||||
* ```
|
||||
*
|
||||
* @param array $config
|
||||
* The configuration parameters related to the token.
|
||||
@ -621,16 +641,15 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* Builds the authorization Uri that the user should be redirected to.
|
||||
*
|
||||
* @param array $config configuration options that customize the return url
|
||||
*
|
||||
* @return UriInterface the authorization Url.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function buildFullAuthorizationUri(array $config = [])
|
||||
{
|
||||
if (is_null($this->getAuthorizationUri())) {
|
||||
throw new InvalidArgumentException(
|
||||
'requires an authorizationUri to have been set');
|
||||
'requires an authorizationUri to have been set'
|
||||
);
|
||||
}
|
||||
|
||||
$params = array_merge([
|
||||
@ -645,14 +664,16 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
// Validate the auth_params
|
||||
if (is_null($params['client_id'])) {
|
||||
throw new InvalidArgumentException(
|
||||
'missing the required client identifier');
|
||||
'missing the required client identifier'
|
||||
);
|
||||
}
|
||||
if (is_null($params['redirect_uri'])) {
|
||||
throw new InvalidArgumentException('missing the required redirect URI');
|
||||
}
|
||||
if (!empty($params['prompt']) && !empty($params['approval_prompt'])) {
|
||||
throw new InvalidArgumentException(
|
||||
'prompt and approval_prompt are mutually exclusive');
|
||||
'prompt and approval_prompt are mutually exclusive'
|
||||
);
|
||||
}
|
||||
|
||||
// Construct the uri object; return it if it is valid.
|
||||
@ -665,7 +686,8 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
|
||||
if ($result->getScheme() != 'https') {
|
||||
throw new InvalidArgumentException(
|
||||
'Authorization endpoint must be protected by TLS');
|
||||
'Authorization endpoint must be protected by TLS'
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -743,7 +765,8 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
// @see https://developers.google.com/identity/sign-in/web/server-side-flow
|
||||
if ('postmessage' !== (string)$uri) {
|
||||
throw new InvalidArgumentException(
|
||||
'Redirect URI must be absolute');
|
||||
'Redirect URI must be absolute'
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->redirectUri = (string)$uri;
|
||||
@ -768,7 +791,6 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* a space-delimited String.
|
||||
*
|
||||
* @param string|array $scope
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function setScope($scope)
|
||||
@ -782,13 +804,15 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
$pos = strpos($s, ' ');
|
||||
if ($pos !== false) {
|
||||
throw new InvalidArgumentException(
|
||||
'array scope values should not contain spaces');
|
||||
'array scope values should not contain spaces'
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->scope = $scope;
|
||||
} else {
|
||||
throw new InvalidArgumentException(
|
||||
'scopes should be a string or array of strings');
|
||||
'scopes should be a string or array of strings'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -828,7 +852,6 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* Sets the current grant type.
|
||||
*
|
||||
* @param $grantType
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function setGrantType($grantType)
|
||||
@ -839,7 +862,8 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
// validate URI
|
||||
if (!$this->isAbsoluteUri($grantType)) {
|
||||
throw new InvalidArgumentException(
|
||||
'invalid grant type');
|
||||
'invalid grant type'
|
||||
);
|
||||
}
|
||||
$this->grantType = (string)$grantType;
|
||||
}
|
||||
@ -1031,6 +1055,26 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
$this->signingKey = $signingKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the signing key id when using an assertion profile.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSigningKeyId()
|
||||
{
|
||||
return $this->signingKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the signing key id when using an assertion profile.
|
||||
*
|
||||
* @param string $signingKeyId
|
||||
*/
|
||||
public function setSigningKeyId($signingKeyId)
|
||||
{
|
||||
$this->signingKeyId = $signingKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the signing algorithm when using an assertion profile.
|
||||
*
|
||||
@ -1287,7 +1331,6 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* @todo handle uri as array
|
||||
*
|
||||
* @param string $uri
|
||||
*
|
||||
* @return null|UriInterface
|
||||
*/
|
||||
private function coerceUri($uri)
|
||||
@ -1303,7 +1346,6 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* @param string $idToken
|
||||
* @param string|array|null $publicKey
|
||||
* @param array $allowedAlgs
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
private function jwtDecode($idToken, $publicKey, $allowedAlgs)
|
||||
@ -1315,14 +1357,18 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
return \JWT::decode($idToken, $publicKey, $allowedAlgs);
|
||||
}
|
||||
|
||||
private function jwtEncode($assertion, $signingKey, $signingAlgorithm)
|
||||
private function jwtEncode($assertion, $signingKey, $signingAlgorithm, $signingKeyId = null)
|
||||
{
|
||||
if (class_exists('Firebase\JWT\JWT')) {
|
||||
return \Firebase\JWT\JWT::encode($assertion, $signingKey,
|
||||
$signingAlgorithm);
|
||||
return \Firebase\JWT\JWT::encode(
|
||||
$assertion,
|
||||
$signingKey,
|
||||
$signingAlgorithm,
|
||||
$signingKeyId
|
||||
);
|
||||
}
|
||||
|
||||
return \JWT::encode($assertion, $signingKey, $signingAlgorithm);
|
||||
return \JWT::encode($assertion, $signingKey, $signingAlgorithm, $signingKeyId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1330,7 +1376,6 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
* (RFC 3986).
|
||||
*
|
||||
* @param string $uri
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isAbsoluteUri($uri)
|
||||
@ -1342,7 +1387,6 @@ class OAuth2 implements FetchAuthTokenInterface
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function addClientCredentials(&$params)
|
||||
|
@ -79,21 +79,24 @@ class AuthTokenSubscriber implements SubscriberInterface
|
||||
/**
|
||||
* Updates the request with an Authorization header when auth is 'fetched_auth_token'.
|
||||
*
|
||||
* use GuzzleHttp\Client;
|
||||
* use Google\Auth\OAuth2;
|
||||
* use Google\Auth\Subscriber\AuthTokenSubscriber;
|
||||
* Example:
|
||||
* ```
|
||||
* use GuzzleHttp\Client;
|
||||
* use Google\Auth\OAuth2;
|
||||
* use Google\Auth\Subscriber\AuthTokenSubscriber;
|
||||
*
|
||||
* $config = [..<oauth config param>.];
|
||||
* $oauth2 = new OAuth2($config)
|
||||
* $subscriber = new AuthTokenSubscriber($oauth2);
|
||||
* $config = [..<oauth config param>.];
|
||||
* $oauth2 = new OAuth2($config)
|
||||
* $subscriber = new AuthTokenSubscriber($oauth2);
|
||||
*
|
||||
* $client = new Client([
|
||||
* 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
|
||||
* 'defaults' => ['auth' => 'google_auth']
|
||||
* ]);
|
||||
* $client->getEmitter()->attach($subscriber);
|
||||
* $client = new Client([
|
||||
* 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
|
||||
* 'defaults' => ['auth' => 'google_auth']
|
||||
* ]);
|
||||
* $client->getEmitter()->attach($subscriber);
|
||||
*
|
||||
* $res = $client->get('myproject/taskqueues/myqueue');
|
||||
* $res = $client->get('myproject/taskqueues/myqueue');
|
||||
* ```
|
||||
*
|
||||
* @param BeforeEvent $event
|
||||
*/
|
||||
|
@ -78,7 +78,8 @@ class ScopedAccessTokenSubscriber implements SubscriberInterface
|
||||
$this->tokenFunc = $tokenFunc;
|
||||
if (!(is_string($scopes) || is_array($scopes))) {
|
||||
throw new \InvalidArgumentException(
|
||||
'wants scope should be string or array');
|
||||
'wants scope should be string or array'
|
||||
);
|
||||
}
|
||||
$this->scopes = $scopes;
|
||||
|
||||
@ -102,28 +103,30 @@ class ScopedAccessTokenSubscriber implements SubscriberInterface
|
||||
/**
|
||||
* Updates the request with an Authorization header when auth is 'scoped'.
|
||||
*
|
||||
* E.g this could be used to authenticate using the AppEngine
|
||||
* AppIdentityService.
|
||||
* E.g this could be used to authenticate using the AppEngine AppIdentityService.
|
||||
*
|
||||
* use google\appengine\api\app_identity\AppIdentityService;
|
||||
* use Google\Auth\Subscriber\ScopedAccessTokenSubscriber;
|
||||
* use GuzzleHttp\Client;
|
||||
* Example:
|
||||
* ```
|
||||
* use google\appengine\api\app_identity\AppIdentityService;
|
||||
* use Google\Auth\Subscriber\ScopedAccessTokenSubscriber;
|
||||
* use GuzzleHttp\Client;
|
||||
*
|
||||
* $scope = 'https://www.googleapis.com/auth/taskqueue'
|
||||
* $subscriber = new ScopedAccessToken(
|
||||
* 'AppIdentityService::getAccessToken',
|
||||
* $scope,
|
||||
* ['prefix' => 'Google\Auth\ScopedAccessToken::'],
|
||||
* $cache = new Memcache()
|
||||
* );
|
||||
* $scope = 'https://www.googleapis.com/auth/taskqueue'
|
||||
* $subscriber = new ScopedAccessToken(
|
||||
* 'AppIdentityService::getAccessToken',
|
||||
* $scope,
|
||||
* ['prefix' => 'Google\Auth\ScopedAccessToken::'],
|
||||
* $cache = new Memcache()
|
||||
* );
|
||||
*
|
||||
* $client = new Client([
|
||||
* 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
|
||||
* 'defaults' => ['auth' => 'scoped']
|
||||
* ]);
|
||||
* $client->getEmitter()->attach($subscriber);
|
||||
* $client = new Client([
|
||||
* 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
|
||||
* 'defaults' => ['auth' => 'scoped']
|
||||
* ]);
|
||||
* $client->getEmitter()->attach($subscriber);
|
||||
*
|
||||
* $res = $client->get('myproject/taskqueues/myqueue');
|
||||
* $res = $client->get('myproject/taskqueues/myqueue');
|
||||
* ```
|
||||
*
|
||||
* @param BeforeEvent $event
|
||||
*/
|
||||
|
@ -62,19 +62,22 @@ class SimpleSubscriber implements SubscriberInterface
|
||||
/**
|
||||
* Updates the request query with the developer key if auth is set to simple.
|
||||
*
|
||||
* use Google\Auth\Subscriber\SimpleSubscriber;
|
||||
* use GuzzleHttp\Client;
|
||||
* Example:
|
||||
* ```
|
||||
* use Google\Auth\Subscriber\SimpleSubscriber;
|
||||
* use GuzzleHttp\Client;
|
||||
*
|
||||
* $my_key = 'is not the same as yours';
|
||||
* $subscriber = new SimpleSubscriber(['key' => $my_key]);
|
||||
* $my_key = 'is not the same as yours';
|
||||
* $subscriber = new SimpleSubscriber(['key' => $my_key]);
|
||||
*
|
||||
* $client = new Client([
|
||||
* 'base_url' => 'https://www.googleapis.com/discovery/v1/',
|
||||
* 'defaults' => ['auth' => 'simple']
|
||||
* ]);
|
||||
* $client->getEmitter()->attach($subscriber);
|
||||
* $client = new Client([
|
||||
* 'base_url' => 'https://www.googleapis.com/discovery/v1/',
|
||||
* 'defaults' => ['auth' => 'simple']
|
||||
* ]);
|
||||
* $client->getEmitter()->attach($subscriber);
|
||||
*
|
||||
* $res = $client->get('drive/v2/rest');
|
||||
* $res = $client->get('drive/v2/rest');
|
||||
* ```
|
||||
*
|
||||
* @param BeforeEvent $event
|
||||
*/
|
||||
|
Reference in New Issue
Block a user