updated plugin WP Mail SMTP version 2.0.0

This commit is contained in:
2020-05-04 15:57:12 +00:00
committed by Gitium
parent 6a7ce488aa
commit 57b2d39b8f
321 changed files with 18242 additions and 5880 deletions

View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit4589a9f05a03f0a29add21e0e493a064::getLoader();
return ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352::getLoader();

View File

@ -9,6 +9,9 @@ return array(
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
);

View File

@ -8,6 +8,9 @@ $baseDir = dirname($vendorDir);
return array(
'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
'WPMailSMTP\\' => array($baseDir . '/src'),
'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'),
'SendinBlue\\Client\\' => array($vendorDir . '/sendinblue/api-v3-sdk/lib'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit4589a9f05a03f0a29add21e0e493a064
class ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352
{
private static $loader;
@ -13,21 +13,24 @@ class ComposerAutoloaderInit4589a9f05a03f0a29add21e0e493a064
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit4589a9f05a03f0a29add21e0e493a064', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit4589a9f05a03f0a29add21e0e493a064', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit4589a9f05a03f0a29add21e0e493a064::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
@ -48,19 +51,19 @@ class ComposerAutoloaderInit4589a9f05a03f0a29add21e0e493a064
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit4589a9f05a03f0a29add21e0e493a064::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire4589a9f05a03f0a29add21e0e493a064($fileIdentifier, $file);
composerRequire72f613a3d0c2cc77892490951b6e5352($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire4589a9f05a03f0a29add21e0e493a064($fileIdentifier, $file)
function composerRequire72f613a3d0c2cc77892490951b6e5352($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,12 +4,15 @@
namespace Composer\Autoload;
class ComposerStaticInit4589a9f05a03f0a29add21e0e493a064
class ComposerStaticInit72f613a3d0c2cc77892490951b6e5352
{
public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
);
@ -25,6 +28,9 @@ class ComposerStaticInit4589a9f05a03f0a29add21e0e493a064
),
'S' =>
array (
'Symfony\\Polyfill\\Php72\\' => 23,
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Polyfill\\Intl\\Idn\\' => 26,
'SendinBlue\\Client\\' => 18,
),
'P' =>
@ -63,6 +69,18 @@ class ComposerStaticInit4589a9f05a03f0a29add21e0e493a064
array (
0 => __DIR__ . '/../..' . '/src',
),
'Symfony\\Polyfill\\Php72\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php72',
),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Polyfill\\Intl\\Idn\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-idn',
),
'SendinBlue\\Client\\' =>
array (
0 => __DIR__ . '/..' . '/sendinblue/api-v3-sdk/lib',
@ -131,10 +149,10 @@ class ComposerStaticInit4589a9f05a03f0a29add21e0e493a064
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit4589a9f05a03f0a29add21e0e493a064::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4589a9f05a03f0a29add21e0e493a064::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit4589a9f05a03f0a29add21e0e493a064::$prefixesPsr0;
$loader->classMap = ComposerStaticInit4589a9f05a03f0a29add21e0e493a064::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$prefixesPsr0;
$loader->classMap = ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$classMap;
}, null, ClassLoader::class);
}

View File

@ -19,7 +19,8 @@
* Service definition for Gmail (v1).
*
* <p>
* Access Gmail mailboxes including sending user email.</p>
* The Gmail API lets you view and manage Gmail mailbox data like threads,
* messages, and labels.</p>
*
* <p>
* For more information about this service, see the API
@ -33,6 +34,18 @@ class Google_Service_Gmail extends Google_Service
/** Read, compose, send, and permanently delete all your email from Gmail. */
const MAIL_GOOGLE_COM =
"https://mail.google.com/";
/** Manage drafts and send emails when you interact with the add-on. */
const GMAIL_ADDONS_CURRENT_ACTION_COMPOSE =
"https://www.googleapis.com/auth/gmail.addons.current.action.compose";
/** View your email messages when you interact with the add-on. */
const GMAIL_ADDONS_CURRENT_MESSAGE_ACTION =
"https://www.googleapis.com/auth/gmail.addons.current.message.action";
/** View your email message metadata when the add-on is running. */
const GMAIL_ADDONS_CURRENT_MESSAGE_METADATA =
"https://www.googleapis.com/auth/gmail.addons.current.message.metadata";
/** View your email messages when the add-on is running. */
const GMAIL_ADDONS_CURRENT_MESSAGE_READONLY =
"https://www.googleapis.com/auth/gmail.addons.current.message.readonly";
/** Manage drafts and send emails. */
const GMAIL_COMPOSE =
"https://www.googleapis.com/auth/gmail.compose";
@ -85,8 +98,8 @@ class Google_Service_Gmail extends Google_Service
{
parent::__construct($client);
$this->rootUrl = $rootUrl ?: 'https://www.googleapis.com/';
$this->servicePath = 'gmail/v1/users/';
$this->batchPath = 'batch/gmail/v1';
$this->servicePath = '';
$this->batchPath = 'batch';
$this->version = 'v1';
$this->serviceName = 'gmail';
@ -97,7 +110,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'getProfile' => array(
'path' => '{userId}/profile',
'path' => 'gmail/v1/users/{userId}/profile',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -107,7 +120,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'stop' => array(
'path' => '{userId}/stop',
'path' => 'gmail/v1/users/{userId}/stop',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -117,7 +130,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'watch' => array(
'path' => '{userId}/watch',
'path' => 'gmail/v1/users/{userId}/watch',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -137,7 +150,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'create' => array(
'path' => '{userId}/drafts',
'path' => 'gmail/v1/users/{userId}/drafts',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -147,7 +160,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'delete' => array(
'path' => '{userId}/drafts/{id}',
'path' => 'gmail/v1/users/{userId}/drafts/{id}',
'httpMethod' => 'DELETE',
'parameters' => array(
'userId' => array(
@ -162,7 +175,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'get' => array(
'path' => '{userId}/drafts/{id}',
'path' => 'gmail/v1/users/{userId}/drafts/{id}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -181,7 +194,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'list' => array(
'path' => '{userId}/drafts',
'path' => 'gmail/v1/users/{userId}/drafts',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -193,10 +206,6 @@ class Google_Service_Gmail extends Google_Service
'location' => 'query',
'type' => 'boolean',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
@ -205,9 +214,13 @@ class Google_Service_Gmail extends Google_Service
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
),
),'send' => array(
'path' => '{userId}/drafts/send',
'path' => 'gmail/v1/users/{userId}/drafts/send',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -217,7 +230,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'update' => array(
'path' => '{userId}/drafts/{id}',
'path' => 'gmail/v1/users/{userId}/drafts/{id}',
'httpMethod' => 'PUT',
'parameters' => array(
'userId' => array(
@ -242,7 +255,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'list' => array(
'path' => '{userId}/history',
'path' => 'gmail/v1/users/{userId}/history',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -250,10 +263,9 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string',
'required' => true,
),
'historyTypes' => array(
'pageToken' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
'labelId' => array(
'location' => 'query',
@ -263,9 +275,10 @@ class Google_Service_Gmail extends Google_Service
'location' => 'query',
'type' => 'integer',
),
'pageToken' => array(
'historyTypes' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
'startHistoryId' => array(
'location' => 'query',
@ -283,7 +296,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'create' => array(
'path' => '{userId}/labels',
'path' => 'gmail/v1/users/{userId}/labels',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -293,7 +306,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'delete' => array(
'path' => '{userId}/labels/{id}',
'path' => 'gmail/v1/users/{userId}/labels/{id}',
'httpMethod' => 'DELETE',
'parameters' => array(
'userId' => array(
@ -308,7 +321,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'get' => array(
'path' => '{userId}/labels/{id}',
'path' => 'gmail/v1/users/{userId}/labels/{id}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -323,7 +336,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'list' => array(
'path' => '{userId}/labels',
'path' => 'gmail/v1/users/{userId}/labels',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -333,7 +346,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'patch' => array(
'path' => '{userId}/labels/{id}',
'path' => 'gmail/v1/users/{userId}/labels/{id}',
'httpMethod' => 'PATCH',
'parameters' => array(
'userId' => array(
@ -348,7 +361,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'update' => array(
'path' => '{userId}/labels/{id}',
'path' => 'gmail/v1/users/{userId}/labels/{id}',
'httpMethod' => 'PUT',
'parameters' => array(
'userId' => array(
@ -373,7 +386,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'batchDelete' => array(
'path' => '{userId}/messages/batchDelete',
'path' => 'gmail/v1/users/{userId}/messages/batchDelete',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -383,7 +396,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'batchModify' => array(
'path' => '{userId}/messages/batchModify',
'path' => 'gmail/v1/users/{userId}/messages/batchModify',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -393,7 +406,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'delete' => array(
'path' => '{userId}/messages/{id}',
'path' => 'gmail/v1/users/{userId}/messages/{id}',
'httpMethod' => 'DELETE',
'parameters' => array(
'userId' => array(
@ -408,7 +421,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'get' => array(
'path' => '{userId}/messages/{id}',
'path' => 'gmail/v1/users/{userId}/messages/{id}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -421,18 +434,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' => '{userId}/messages/import',
'path' => 'gmail/v1/users/{userId}/messages/import',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -440,7 +453,7 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string',
'required' => true,
),
'deleted' => array(
'processForCalendar' => array(
'location' => 'query',
'type' => 'boolean',
),
@ -452,13 +465,13 @@ class Google_Service_Gmail extends Google_Service
'location' => 'query',
'type' => 'boolean',
),
'processForCalendar' => array(
'deleted' => array(
'location' => 'query',
'type' => 'boolean',
),
),
),'insert' => array(
'path' => '{userId}/messages',
'path' => 'gmail/v1/users/{userId}/messages',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -466,17 +479,17 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string',
'required' => true,
),
'deleted' => array(
'location' => 'query',
'type' => 'boolean',
),
'internalDateSource' => array(
'location' => 'query',
'type' => 'string',
),
'deleted' => array(
'location' => 'query',
'type' => 'boolean',
),
),
),'list' => array(
'path' => '{userId}/messages',
'path' => 'gmail/v1/users/{userId}/messages',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -488,26 +501,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,
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'q' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
),
),'modify' => array(
'path' => '{userId}/messages/{id}/modify',
'path' => 'gmail/v1/users/{userId}/messages/{id}/modify',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -522,7 +535,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'send' => array(
'path' => '{userId}/messages/send',
'path' => 'gmail/v1/users/{userId}/messages/send',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -532,7 +545,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'trash' => array(
'path' => '{userId}/messages/{id}/trash',
'path' => 'gmail/v1/users/{userId}/messages/{id}/trash',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -547,7 +560,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'untrash' => array(
'path' => '{userId}/messages/{id}/untrash',
'path' => 'gmail/v1/users/{userId}/messages/{id}/untrash',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -572,7 +585,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'get' => array(
'path' => '{userId}/messages/{messageId}/attachments/{id}',
'path' => 'gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -602,7 +615,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'getAutoForwarding' => array(
'path' => '{userId}/settings/autoForwarding',
'path' => 'gmail/v1/users/{userId}/settings/autoForwarding',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -612,7 +625,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'getImap' => array(
'path' => '{userId}/settings/imap',
'path' => 'gmail/v1/users/{userId}/settings/imap',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -622,7 +635,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'getLanguage' => array(
'path' => '{userId}/settings/language',
'path' => 'gmail/v1/users/{userId}/settings/language',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -632,7 +645,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'getPop' => array(
'path' => '{userId}/settings/pop',
'path' => 'gmail/v1/users/{userId}/settings/pop',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -642,7 +655,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'getVacation' => array(
'path' => '{userId}/settings/vacation',
'path' => 'gmail/v1/users/{userId}/settings/vacation',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -652,7 +665,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'updateAutoForwarding' => array(
'path' => '{userId}/settings/autoForwarding',
'path' => 'gmail/v1/users/{userId}/settings/autoForwarding',
'httpMethod' => 'PUT',
'parameters' => array(
'userId' => array(
@ -662,7 +675,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'updateImap' => array(
'path' => '{userId}/settings/imap',
'path' => 'gmail/v1/users/{userId}/settings/imap',
'httpMethod' => 'PUT',
'parameters' => array(
'userId' => array(
@ -672,7 +685,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'updateLanguage' => array(
'path' => '{userId}/settings/language',
'path' => 'gmail/v1/users/{userId}/settings/language',
'httpMethod' => 'PUT',
'parameters' => array(
'userId' => array(
@ -682,7 +695,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'updatePop' => array(
'path' => '{userId}/settings/pop',
'path' => 'gmail/v1/users/{userId}/settings/pop',
'httpMethod' => 'PUT',
'parameters' => array(
'userId' => array(
@ -692,7 +705,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'updateVacation' => array(
'path' => '{userId}/settings/vacation',
'path' => 'gmail/v1/users/{userId}/settings/vacation',
'httpMethod' => 'PUT',
'parameters' => array(
'userId' => array(
@ -712,7 +725,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'create' => array(
'path' => '{userId}/settings/delegates',
'path' => 'gmail/v1/users/{userId}/settings/delegates',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -722,7 +735,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'delete' => array(
'path' => '{userId}/settings/delegates/{delegateEmail}',
'path' => 'gmail/v1/users/{userId}/settings/delegates/{delegateEmail}',
'httpMethod' => 'DELETE',
'parameters' => array(
'userId' => array(
@ -737,7 +750,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'get' => array(
'path' => '{userId}/settings/delegates/{delegateEmail}',
'path' => 'gmail/v1/users/{userId}/settings/delegates/{delegateEmail}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -752,7 +765,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'list' => array(
'path' => '{userId}/settings/delegates',
'path' => 'gmail/v1/users/{userId}/settings/delegates',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -772,7 +785,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'create' => array(
'path' => '{userId}/settings/filters',
'path' => 'gmail/v1/users/{userId}/settings/filters',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -782,7 +795,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'delete' => array(
'path' => '{userId}/settings/filters/{id}',
'path' => 'gmail/v1/users/{userId}/settings/filters/{id}',
'httpMethod' => 'DELETE',
'parameters' => array(
'userId' => array(
@ -797,7 +810,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'get' => array(
'path' => '{userId}/settings/filters/{id}',
'path' => 'gmail/v1/users/{userId}/settings/filters/{id}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -812,7 +825,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'list' => array(
'path' => '{userId}/settings/filters',
'path' => 'gmail/v1/users/{userId}/settings/filters',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -832,7 +845,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'create' => array(
'path' => '{userId}/settings/forwardingAddresses',
'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -842,7 +855,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'delete' => array(
'path' => '{userId}/settings/forwardingAddresses/{forwardingEmail}',
'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}',
'httpMethod' => 'DELETE',
'parameters' => array(
'userId' => array(
@ -857,7 +870,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'get' => array(
'path' => '{userId}/settings/forwardingAddresses/{forwardingEmail}',
'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -872,7 +885,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'list' => array(
'path' => '{userId}/settings/forwardingAddresses',
'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -892,7 +905,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'create' => array(
'path' => '{userId}/settings/sendAs',
'path' => 'gmail/v1/users/{userId}/settings/sendAs',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -902,7 +915,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'delete' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
'httpMethod' => 'DELETE',
'parameters' => array(
'userId' => array(
@ -917,7 +930,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'get' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -932,7 +945,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'list' => array(
'path' => '{userId}/settings/sendAs',
'path' => 'gmail/v1/users/{userId}/settings/sendAs',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -942,7 +955,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'patch' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
'httpMethod' => 'PATCH',
'parameters' => array(
'userId' => array(
@ -957,7 +970,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'update' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
'httpMethod' => 'PUT',
'parameters' => array(
'userId' => array(
@ -972,7 +985,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'verify' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/verify',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -997,7 +1010,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'delete' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
'httpMethod' => 'DELETE',
'parameters' => array(
'userId' => array(
@ -1017,7 +1030,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'get' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -1037,7 +1050,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'insert' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -1052,7 +1065,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'list' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -1067,7 +1080,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'setDefault' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault',
'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -1097,7 +1110,7 @@ class Google_Service_Gmail extends Google_Service
array(
'methods' => array(
'delete' => array(
'path' => '{userId}/threads/{id}',
'path' => 'gmail/v1/users/{userId}/threads/{id}',
'httpMethod' => 'DELETE',
'parameters' => array(
'userId' => array(
@ -1112,7 +1125,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'get' => array(
'path' => '{userId}/threads/{id}',
'path' => 'gmail/v1/users/{userId}/threads/{id}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -1125,18 +1138,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' => '{userId}/threads',
'path' => 'gmail/v1/users/{userId}/threads',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
@ -1144,30 +1157,30 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string',
'required' => true,
),
'includeSpamTrash' => array(
'pageToken' => array(
'location' => 'query',
'type' => 'boolean',
'type' => 'string',
),
'labelIds' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'q' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
'includeSpamTrash' => array(
'location' => 'query',
'type' => 'boolean',
),
),
),'modify' => array(
'path' => '{userId}/threads/{id}/modify',
'path' => 'gmail/v1/users/{userId}/threads/{id}/modify',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -1182,7 +1195,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'trash' => array(
'path' => '{userId}/threads/{id}/trash',
'path' => 'gmail/v1/users/{userId}/threads/{id}/trash',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
@ -1197,7 +1210,7 @@ class Google_Service_Gmail extends Google_Service
),
),
),'untrash' => array(
'path' => '{userId}/threads/{id}/untrash',
'path' => 'gmail/v1/users/{userId}/threads/{id}/untrash',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(

View File

@ -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())

View File

@ -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 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 pageToken Page token to retrieve a specific page of results
* in the list.
* @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 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.

View File

@ -85,8 +85,7 @@ class Google_Service_Gmail_Resource_UsersLabels extends Google_Service_Resource
return $this->call('list', array($params), "Google_Service_Gmail_ListLabelsResponse");
}
/**
* Updates the specified label. This method supports patch semantics.
* (labels.patch)
* Patch the specified label. (labels.patch)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.

View File

@ -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 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.
* @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 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.
* @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,15 +147,16 @@ 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 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 labelIds Only return messages with labels that match all of
* the specified label IDs.
* @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: is:unread". Parameter cannot be used
* when accessing the api using the gmail.metadata scope.
* "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.
* @return Google_Service_Gmail_ListMessagesResponse
*/
public function listUsersMessages($userId, $optParams = array())

View File

@ -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.

View File

@ -27,10 +27,10 @@ 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 limtations on the number of delegates and delegators each 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,
* but in general each user can have up to 25 delegates and up to 10 delegators.
*
@ -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

View File

@ -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

View File

@ -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,14 +100,9 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
return $this->call('list', array($params), "Google_Service_Gmail_ListSendAsResponse");
}
/**
* Updates a send-as alias. If a signature is provided, Gmail will sanitize the
* HTML before saving it with the alias.
* Patch the specified send-as alias. (sendAs.patch)
*
* 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
* @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
@ -121,14 +116,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
@ -148,7 +143,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.

View File

@ -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 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 labelIds Only return threads with labels that match all of
* the specified label IDs.
* @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())

View File

@ -38,7 +38,7 @@ use Monolog\Handler\SyslogHandler as MonologSyslogHandler;
*/
class Google_Client
{
const LIBVER = "2.2.3";
const LIBVER = "2.4.1";
const USER_AGENT_SUFFIX = "google-api-php-client/";
const OAUTH2_REVOKE_URI = 'https://oauth2.googleapis.com/revoke';
const OAUTH2_TOKEN_URI = 'https://oauth2.googleapis.com/token';
@ -142,6 +142,10 @@ class Google_Client
// Service class used in Google_Client::verifyIdToken.
// Explicitly pass this in to avoid setting JWT::$leeway
'jwt' => null,
// Setting api_format_v2 will return more detailed error messages
// from certain APIs.
'api_format_v2' => false
],
$config
);
@ -412,6 +416,17 @@ class Google_Client
}
/**
* Set the access token used for requests.
*
* Note that at the time requests are sent, tokens are cached. A token will be
* cached for each combination of service and authentication scopes. If a
* cache pool is not provided, creating a new instance of the client will
* allow modification of access tokens. If a persistent cache pool is
* provided, in order to change the access token, you must clear the cached
* token by calling `$client->getCache()->clear()`. (Use caution in this case,
* as calling `clear()` will remove all cache items, including any items not
* related to Google API PHP Client.)
*
* @param string|array $token
* @throws InvalidArgumentException
*/
@ -789,12 +804,31 @@ class Google_Client
*/
public function execute(RequestInterface $request, $expectedClass = null)
{
$request = $request->withHeader(
'User-Agent',
$this->config['application_name']
. " " . self::USER_AGENT_SUFFIX
. $this->getLibraryVersion()
);
$request = $request
->withHeader(
'User-Agent',
sprintf(
'%s %s%s',
$this->config['application_name'],
self::USER_AGENT_SUFFIX,
$this->getLibraryVersion()
)
)
->withHeader(
'x-goog-api-client',
sprintf(
'gl-php/%s gdcl/%s',
phpversion(),
$this->getLibraryVersion()
)
);
if ($this->config['api_format_v2']) {
$request = $request->withHeader(
'X-GOOG-API-FORMAT-VERSION',
2
);
}
// call the authorize method
// this is where most of the grunt work is done
@ -1056,6 +1090,18 @@ class Google_Client
return $this->http;
}
/**
* Set the API format version.
*
* `true` will use V2, which may return more useful error messages.
*
* @param bool $value
*/
public function setApiFormatV2($value)
{
$this->config['api_format_v2'] = (bool) $value;
}
protected function createDefaultHttpClient()
{
$options = ['exceptions' => false];

View File

@ -67,9 +67,11 @@ class Google_Http_MediaFileUpload
private $httpResultCode;
/**
* @param $mimeType string
* @param $data string The bytes you want to upload.
* @param $resumable bool
* @param Google_Client $client
* @param RequestInterface $request
* @param string $mimeType
* @param string $data The bytes you want to upload.
* @param bool $resumable
* @param bool $chunkSize File will be uploaded in chunks of this many bytes.
* only used if resumable=True
*/

View File

@ -294,7 +294,7 @@ class Google_Service_Resource
}
if (count($queryVars)) {
$requestUrl .= '?' . implode($queryVars, '&');
$requestUrl .= '?' . implode('&', $queryVars);
}
return $requestUrl;

View File

@ -17,6 +17,8 @@
namespace Google\Auth;
use DateTime;
use Exception;
use Firebase\JWT\ExpiredException;
use Firebase\JWT\JWT;
use Firebase\JWT\SignatureInvalidException;
@ -25,9 +27,16 @@ use Google\Auth\HttpHandler\HttpClientCache;
use Google\Auth\HttpHandler\HttpHandlerFactory;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use InvalidArgumentException;
use phpseclib\Crypt\RSA;
use phpseclib\Math\BigInteger;
use Psr\Cache\CacheItemPoolInterface;
use RuntimeException;
use SimpleJWT\InvalidTokenException;
use SimpleJWT\JWT as SimpleJWT;
use SimpleJWT\Keys\KeyFactory;
use SimpleJWT\Keys\KeySet;
use UnexpectedValueException;
/**
* Wrapper around Google Access Tokens which provides convenience functions.
@ -37,6 +46,8 @@ use Psr\Cache\CacheItemPoolInterface;
class AccessToken
{
const FEDERATED_SIGNON_CERT_URL = 'https://www.googleapis.com/oauth2/v3/certs';
const IAP_CERT_URL = 'https://www.gstatic.com/iap/verify/public_key-jwk';
const IAP_ISSUER = 'https://cloud.google.com/iap';
const OAUTH2_ISSUER = 'accounts.google.com';
const OAUTH2_ISSUER_HTTPS = 'https://accounts.google.com';
const OAUTH2_REVOKE_URI = 'https://oauth2.googleapis.com/revoke';
@ -59,19 +70,9 @@ class AccessToken
callable $httpHandler = null,
CacheItemPoolInterface $cache = null
) {
// @codeCoverageIgnoreStart
if (!class_exists('phpseclib\Crypt\RSA')) {
throw new \RuntimeException('Please require phpseclib/phpseclib v2 to use this utility.');
}
// @codeCoverageIgnoreEnd
$this->httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
$this->cache = $cache ?: new MemoryCacheItemPool();
$this->configureJwtService();
// set phpseclib constants if applicable
$this->setPhpsecConstants();
}
/**
@ -85,87 +86,215 @@ class AccessToken
* 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
* 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
* 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.
* @throws \RuntimeException If certs could not be retrieved from a remote location.
* @throws InvalidArgumentException If certs could not be retrieved from a local file.
* @throws InvalidArgumentException If received certs are in an invalid format.
* @throws InvalidArgumentException If the cert alg is not supported.
* @throws RuntimeException If certs could not be retrieved from a remote location.
* @throws UnexpectedValueException If the token issuer does not match.
* @throws UnexpectedValueException If the token audience does not match.
*/
public function verify($token, array $options = [])
{
$audience = isset($options['audience'])
? $options['audience']
: null;
$issuer = isset($options['issuer'])
? $options['issuer']
: null;
$certsLocation = isset($options['certsLocation'])
? $options['certsLocation']
: self::FEDERATED_SIGNON_CERT_URL;
unset($options['audience'], $options['certsLocation']);
$cacheKey = isset($options['cacheKey'])
? $options['cacheKey']
: $this->getCacheKeyFromCertLocation($certsLocation);
$throwException = isset($options['throwException'])
? $options['throwException']
: false; // for backwards compatibility
// Check signature against each available cert.
// allow the loop to complete unless a known bad result is encountered.
$certs = $this->getFederatedSignOnCerts($certsLocation, $options);
foreach ($certs as $cert) {
$rsa = new RSA();
$rsa->loadKey([
'n' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [
$cert['n']
]), 256),
'e' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [
$cert['e']
]), 256)
]);
try {
$pubkey = $rsa->getPublicKey();
$payload = $this->callJwtStatic('decode', [
$token,
$pubkey,
['RS256']
]);
if (property_exists($payload, 'aud')) {
if ($audience && $payload->aud != $audience) {
return false;
}
}
// support HTTP and HTTPS issuers
// @see https://developers.google.com/identity/sign-in/web/backend-auth
$issuers = [self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS];
if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) {
return false;
}
return (array) $payload;
} catch (ExpiredException $e) {
return false;
} catch (\ExpiredException $e) {
// (firebase/php-jwt 2)
return false;
} catch (SignatureInvalidException $e) {
// continue
} catch (\SignatureInvalidException $e) {
// continue (firebase/php-jwt 2)
} catch (\DomainException $e) {
// continue
$certs = $this->getCerts($certsLocation, $cacheKey, $options);
$alg = $this->determineAlg($certs);
if (!in_array($alg, ['RS256', 'ES256'])) {
throw new InvalidArgumentException(
'unrecognized "alg" in certs, expected ES256 or RS256');
}
try {
if ($alg == 'RS256') {
return $this->verifyRs256($token, $certs, $audience, $issuer);
}
return $this->verifyEs256($token, $certs, $audience, $issuer);
} catch (ExpiredException $e) { // firebase/php-jwt 3+
} catch (\ExpiredException $e) { // firebase/php-jwt 2
} catch (SignatureInvalidException $e) { // firebase/php-jwt 3+
} catch (\SignatureInvalidException $e) { // firebase/php-jwt 2
} catch (InvalidTokenException $e) { // simplejwt
} catch (DomainException $e) {
} catch (InvalidArgumentException $e) {
} catch (UnexpectedValueException $e) {
}
if ($throwException) {
throw $e;
}
return false;
}
/**
* Identifies the expected algorithm to verify by looking at the "alg" key
* of the provided certs.
*
* @param array $certs Certificate array according to the JWK spec (see
* https://tools.ietf.org/html/rfc7517).
* @return string The expected algorithm, such as "ES256" or "RS256".
*/
private function determineAlg(array $certs)
{
$alg = null;
foreach ($certs as $cert) {
if (empty($cert['alg'])) {
throw new InvalidArgumentException(
'certs expects "alg" to be set'
);
}
$alg = $alg ?: $cert['alg'];
if ($alg != $cert['alg']) {
throw new InvalidArgumentException(
'More than one alg detected in certs'
);
}
}
return $alg;
}
/**
* Verifies an ES256-signed JWT.
*
* @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).
* @param string|null $audience If set, returns false if the provided
* 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.
* @return array|bool the token payload, if successful, or false if not.
*/
private function verifyEs256($token, array $certs, $audience = null, $issuer = null)
{
$this->checkSimpleJwt();
$jwkset = new KeySet();
foreach ($certs as $cert) {
$jwkset->add(KeyFactory::create($cert, 'php'));
}
// Validate the signature using the key set and ES256 algorithm.
$jwt = $this->callSimpleJwtDecode([$token, $jwkset, 'ES256']);
$payload = $jwt->getClaims();
if (isset($payload['aud'])) {
if ($audience && $payload['aud'] != $audience) {
throw new UnexpectedValueException('Audience does not match');
}
}
// @see https://cloud.google.com/iap/docs/signed-headers-howto#verifying_the_jwt_payload
$issuer = $issuer ?: self::IAP_ISSUER;
if (!isset($payload['iss']) || $payload['iss'] !== $issuer) {
throw new UnexpectedValueException('Issuer does not match');
}
return $payload;
}
/**
* Verifies an RS256-signed JWT.
*
* @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).
* @param string|null $audience If set, returns false if the provided
* 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.
* @return array|bool the token payload, if successful, or false if not.
*/
private function verifyRs256($token, array $certs, $audience = null, $issuer = null)
{
$this->checkAndInitializePhpsec();
$keys = [];
foreach ($certs as $cert) {
if (empty($cert['kid'])) {
throw new InvalidArgumentException(
'certs expects "kid" to be set'
);
}
if (empty($cert['n']) || empty($cert['e'])) {
throw new InvalidArgumentException(
'RSA certs expects "n" and "e" to be set'
);
}
$rsa = new RSA();
$rsa->loadKey([
'n' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [
$cert['n'],
]), 256),
'e' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [
$cert['e']
]), 256),
]);
// create an array of key IDs to certs for the JWT library
$keys[$cert['kid']] = $rsa->getPublicKey();
}
$payload = $this->callJwtStatic('decode', [
$token,
$keys,
['RS256']
]);
if (property_exists($payload, 'aud')) {
if ($audience && $payload->aud != $audience) {
throw new UnexpectedValueException('Audience does not match');
}
}
// support HTTP and HTTPS issuers
// @see https://developers.google.com/identity/sign-in/web/backend-auth
$issuers = $issuer ? [$issuer] : [self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS];
if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) {
throw new UnexpectedValueException('Issuer does not match');
}
return (array) $payload;
}
/**
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
* token, if a token isn't provided.
*
* @param string|array $token The token (access token or a refresh token) that should be revoked.
* @param array $options [optional] Configuration options.
* @return boolean Returns True if the revocation was successful, otherwise False.
* @return bool Returns True if the revocation was successful, otherwise False.
*/
public function revoke($token, array $options = [])
{
@ -198,11 +327,11 @@ class AccessToken
* @param string $location The location from which to retrieve certs.
* @param array $options [optional] Configuration options.
* @return array
* @throws \InvalidArgumentException If received certs are in an invalid format.
* @throws InvalidArgumentException If received certs are in an invalid format.
*/
private function getFederatedSignOnCerts($location, array $options = [])
private function getCerts($location, $cacheKey, array $options = [])
{
$cacheItem = $this->cache->getItem('federated_signon_certs_v3');
$cacheItem = $this->cache->getItem($cacheKey);
$certs = $cacheItem ? $cacheItem->get() : null;
$gotNewCerts = false;
@ -213,15 +342,20 @@ class AccessToken
}
if (!isset($certs['keys'])) {
throw new \InvalidArgumentException(
'federated sign-on certs expects "keys" to be set'
if ($location !== self::IAP_CERT_URL) {
throw new InvalidArgumentException(
'federated sign-on certs expects "keys" to be set'
);
}
throw new InvalidArgumentException(
'certs expects "keys" to be set'
);
}
// Push caching off until after verifying certs are in a valid format.
// Don't want to cache bad data.
if ($gotNewCerts) {
$cacheItem->expiresAt(new \DateTime('+1 hour'));
$cacheItem->expiresAt(new DateTime('+1 hour'));
$cacheItem->set($certs);
$this->cache->save($cacheItem);
}
@ -234,17 +368,16 @@ class AccessToken
*
* @param $url string location
* @param array $options [optional] Configuration options.
* @throws \RuntimeException
* @return array certificates
* @throws \InvalidArgumentException If certs could not be retrieved from a local file.
* @throws \RuntimeException If certs could not be retrieved from a remote location.
* @throws InvalidArgumentException If certs could not be retrieved from a local file.
* @throws RuntimeException If certs could not be retrieved from a remote location.
*/
private function retrieveCertsFromLocation($url, array $options = [])
{
// If we're retrieving a local file, just grab it.
if (strpos($url, 'http') !== 0) {
if (!file_exists($url)) {
throw new \InvalidArgumentException(sprintf(
throw new InvalidArgumentException(sprintf(
'Failed to retrieve verification certificates from path: %s.',
$url
));
@ -260,26 +393,30 @@ class AccessToken
return json_decode((string) $response->getBody(), true);
}
throw new \RuntimeException(sprintf(
throw new RuntimeException(sprintf(
'Failed to retrieve verification certificates: "%s".',
$response->getBody()->getContents()
), $response->getStatusCode());
}
/**
* Set required defaults for JWT.
*/
private function configureJwtService()
private function checkAndInitializePhpsec()
{
$class = class_exists('Firebase\JWT\JWT')
? 'Firebase\JWT\JWT'
: '\JWT';
if (property_exists($class, 'leeway') && $class::$leeway < 1) {
// Ensures JWT leeway is at least 1
// @see https://github.com/google/google-api-php-client/issues/827
$class::$leeway = 1;
// @codeCoverageIgnoreStart
if (!class_exists('phpseclib\Crypt\RSA')) {
throw new RuntimeException('Please require phpseclib/phpseclib v2 to use this utility.');
}
// @codeCoverageIgnoreEnd
$this->setPhpsecConstants();
}
private function checkSimpleJwt()
{
// @codeCoverageIgnoreStart
if (!class_exists('SimpleJWT\JWT')) {
throw new RuntimeException('Please require kelvinmo/simplejwt ^0.2 to use this utility.');
}
// @codeCoverageIgnoreEnd
}
/**
@ -317,4 +454,31 @@ class AccessToken
: 'JWT';
return call_user_func_array([$class, $method], $args);
}
/**
* Provide a hook to mock calls to the JWT static methods.
*
* @param array $args
* @return mixed
*/
protected function callSimpleJwtDecode(array $args = [])
{
return call_user_func_array(['SimpleJWT\JWT', 'decode'], $args);
}
/**
* Generate a cache key based on the cert location using sha1 with the
* exception of using "federated_signon_certs_v3" to preserve BC.
*
* @param string $certsLocation
* @return string
*/
private function getCacheKeyFromCertLocation($certsLocation)
{
$key = $certsLocation === self::FEDERATED_SIGNON_CERT_URL
? 'federated_signon_certs_v3'
: sha1($certsLocation);
return 'google_auth_certs_cache|' . $key;
}
}

View File

@ -20,11 +20,13 @@ namespace Google\Auth;
use DomainException;
use Google\Auth\Credentials\AppIdentityCredentials;
use Google\Auth\Credentials\GCECredentials;
use Google\Auth\Credentials\ServiceAccountCredentials;
use Google\Auth\HttpHandler\HttpClientCache;
use Google\Auth\HttpHandler\HttpHandlerFactory;
use Google\Auth\Middleware\AuthTokenMiddleware;
use Google\Auth\Subscriber\AuthTokenSubscriber;
use GuzzleHttp\Client;
use InvalidArgumentException;
use Psr\Cache\CacheItemPoolInterface;
/**
@ -121,8 +123,9 @@ class ApplicationDefaultCredentials
}
/**
* Obtains the default FetchAuthTokenInterface implementation to use
* in this environment.
* Obtains an AuthTokenMiddleware which will fetch an access token to use in
* the Authorization header. The middleware is configured with the default
* FetchAuthTokenInterface implementation to use in this environment.
*
* If supplied, $scope is used to in creating the credentials instance if
* this does not fallback to the Compute Engine defaults.
@ -165,7 +168,97 @@ class ApplicationDefaultCredentials
}
if (is_null($creds)) {
throw new \DomainException(self::notFound());
throw new DomainException(self::notFound());
}
if (!is_null($cache)) {
$creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache);
}
return $creds;
}
/**
* Obtains an AuthTokenMiddleware which will fetch an ID token to use in the
* Authorization header. The middleware is configured with the default
* FetchAuthTokenInterface implementation to use in this environment.
*
* If supplied, $targetAudience is used to set the "aud" on the resulting
* ID token.
*
* @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
*
* @return AuthTokenMiddleware
*
* @throws DomainException if no implementation can be obtained.
*/
public static function getIdTokenMiddleware(
$targetAudience,
callable $httpHandler = null,
array $cacheConfig = null,
CacheItemPoolInterface $cache = null
) {
$creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache);
return new AuthTokenMiddleware($creds, $httpHandler);
}
/**
* Obtains the default FetchAuthTokenInterface implementation to use
* in this environment, configured with a $targetAudience for fetching an ID
* token.
*
* @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
*
* @return CredentialsLoader
*
* @throws DomainException if no implementation can be obtained.
* @throws InvalidArgumentException if JSON "type" key is invalid
*/
public static function getIdTokenCredentials(
$targetAudience,
callable $httpHandler = null,
array $cacheConfig = null,
CacheItemPoolInterface $cache = null
) {
$creds = null;
$jsonKey = CredentialsLoader::fromEnv()
?: CredentialsLoader::fromWellKnownFile();
if (!$httpHandler) {
if (!($client = HttpClientCache::getHttpClient())) {
$client = new Client();
HttpClientCache::setHttpClient($client);
}
$httpHandler = HttpHandlerFactory::build($client);
}
if (!is_null($jsonKey)) {
if (!array_key_exists('type', $jsonKey)) {
throw new \InvalidArgumentException('json key is missing the type field');
}
if ($jsonKey['type'] == 'authorized_user') {
throw new InvalidArgumentException('ID tokens are not supported for end user credentials');
}
if ($jsonKey['type'] != 'service_account') {
throw new InvalidArgumentException('invalid value in the type field');
}
$creds = new ServiceAccountCredentials(null, $jsonKey, null, $targetAudience);
} elseif (GCECredentials::onGce($httpHandler)) {
$creds = new GCECredentials(null, null, $targetAudience);
}
if (is_null($creds)) {
throw new DomainException(self::notFound());
}
if (!is_null($cache)) {
$creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache);

View File

@ -76,7 +76,7 @@ class SysVCacheItemPool implements CacheItemPoolInterface
public function __construct($options = [])
{
if (! extension_loaded('sysvshm')) {
throw \RuntimeException(
throw new \RuntimeException(
'sysvshm extension is required to use this ItemPool');
}
$this->options = $options + [

View File

@ -24,6 +24,7 @@ namespace Google\Auth\Credentials;
*/
use google\appengine\api\app_identity\AppIdentityService;
use Google\Auth\CredentialsLoader;
use Google\Auth\ProjectIdProviderInterface;
use Google\Auth\SignBlobInterface;
/**
@ -32,35 +33,42 @@ use Google\Auth\SignBlobInterface;
* It can be used to authorize requests using the AuthTokenMiddleware or
* AuthTokenSubscriber, but will only succeed if being run on App Engine:
*
* use Google\Auth\Credentials\AppIdentityCredentials;
* use Google\Auth\Middleware\AuthTokenMiddleware;
* use GuzzleHttp\Client;
* use GuzzleHttp\HandlerStack;
* Example:
* ```
* use Google\Auth\Credentials\AppIdentityCredentials;
* use Google\Auth\Middleware\AuthTokenMiddleware;
* use GuzzleHttp\Client;
* use GuzzleHttp\HandlerStack;
*
* $gae = new AppIdentityCredentials('https://www.googleapis.com/auth/books');
* $middleware = new AuthTokenMiddleware($gae);
* $stack = HandlerStack::create();
* $stack->push($middleware);
* $gae = new AppIdentityCredentials('https://www.googleapis.com/auth/books');
* $middleware = new AuthTokenMiddleware($gae);
* $stack = HandlerStack::create();
* $stack->push($middleware);
*
* $client = new Client([
* 'handler' => $stack,
* 'base_uri' => 'https://www.googleapis.com/books/v1',
* 'auth' => 'google_auth'
* ]);
* $client = new Client([
* 'handler' => $stack,
* 'base_uri' => 'https://www.googleapis.com/books/v1',
* 'auth' => 'google_auth'
* ]);
*
* $res = $client->get('volumes?q=Henry+David+Thoreau&country=US');
* $res = $client->get('volumes?q=Henry+David+Thoreau&country=US');
* ```
*/
class AppIdentityCredentials extends CredentialsLoader implements SignBlobInterface
class AppIdentityCredentials extends CredentialsLoader implements
SignBlobInterface,
ProjectIdProviderInterface
{
/**
* Result of fetchAuthToken.
*
* @array
* @var array
*/
protected $lastReceivedToken;
/**
* Array of OAuth2 scopes to be requested.
*
* @var array
*/
private $scope;
@ -69,6 +77,9 @@ class AppIdentityCredentials extends CredentialsLoader implements SignBlobInterf
*/
private $clientName;
/**
* @param array $scope One or more scopes.
*/
public function __construct($scope = array())
{
$this->scope = $scope;
@ -143,6 +154,25 @@ class AppIdentityCredentials extends CredentialsLoader implements SignBlobInterf
return base64_encode(AppIdentityService::signForApp($stringToSign)['signature']);
}
/**
* Get the project ID from AppIdentityService.
*
* Returns null if AppIdentityService is unavailable.
*
* @param callable $httpHandler Not used by this type.
* @return string|null
*/
public function getProjectId(callable $httpHander = null)
{
try {
$this->checkAppEngineContext();
} catch (\Exception $e) {
return null;
}
return AppIdentityService::getApplicationId();
}
/**
* Get the client name from AppIdentityService.
*

View File

@ -21,11 +21,13 @@ use Google\Auth\CredentialsLoader;
use Google\Auth\HttpHandler\HttpClientCache;
use Google\Auth\HttpHandler\HttpHandlerFactory;
use Google\Auth\Iam;
use Google\Auth\ProjectIdProviderInterface;
use Google\Auth\SignBlobInterface;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Psr7\Request;
use InvalidArgumentException;
/**
* GCECredentials supports authorization on Google Compute Engine.
@ -51,7 +53,9 @@ use GuzzleHttp\Psr7\Request;
*
* $res = $client->get('myproject/taskqueues/myqueue');
*/
class GCECredentials extends CredentialsLoader implements SignBlobInterface
class GCECredentials extends CredentialsLoader implements
SignBlobInterface,
ProjectIdProviderInterface
{
const cacheKey = 'GOOGLE_AUTH_PHP_GCE';
@ -68,11 +72,21 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
*/
const TOKEN_URI_PATH = 'v1/instance/service-accounts/default/token';
/**
* The metadata path of the default id token.
*/
const ID_TOKEN_URI_PATH = 'v1/instance/service-accounts/default/identity';
/**
* The metadata path of the client ID.
*/
const CLIENT_ID_URI_PATH = 'v1/instance/service-accounts/default/email';
/**
* The metadata path of the project ID.
*/
const PROJECT_ID_URI_PATH = 'v1/project/project-id';
/**
* The header whose presence indicates GCE presence.
*/
@ -111,10 +125,15 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
protected $lastReceivedToken;
/**
* @var string
* @var string|null
*/
private $clientName;
/**
* @var string|null
*/
private $projectId;
/**
* @var Iam|null
*/
@ -125,15 +144,26 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
*/
private $tokenUri;
/**
* @var string
*/
private $targetAudience;
/**
* @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.
*/
public function __construct(Iam $iam = null, $scope = null)
public function __construct(Iam $iam = null, $scope = null, $targetAudience = null)
{
$this->iam = $iam;
if ($scope && $targetAudience) {
throw new InvalidArgumentException(
'Scope and targetAudience cannot both be supplied');
}
$tokenUri = self::getTokenUri();
if ($scope) {
if (is_string($scope)) {
@ -143,6 +173,13 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
$scope = implode(',', $scope);
$tokenUri = $tokenUri . '?scopes='. $scope;
} elseif ($targetAudience) {
$tokenUri = sprintf('http://%s/computeMetadata/%s?audience=%s',
self::METADATA_IP,
self::ID_TOKEN_URI_PATH,
$targetAudience
);
$this->targetAudience = $targetAudience;
}
$this->tokenUri = $tokenUri;
@ -172,6 +209,18 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
return $base . self::CLIENT_ID_URI_PATH;
}
/**
* The full uri for accessing the default project ID.
*
* @return string
*/
private static function getProjectIdUri()
{
$base = 'http://' . self::METADATA_IP . '/computeMetadata/';
return $base . self::PROJECT_ID_URI_PATH;
}
/**
* Determines if this an App Engine Flexible instance, by accessing the
* GAE_INSTANCE environment variable.
@ -189,8 +238,7 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
* If $httpHandler is not specified a the default HttpHandler is used.
*
* @param callable $httpHandler callback which delivers psr7 request
*
* @return true if this a GCEInstance false otherwise
* @return bool True if this a GCEInstance, false otherwise
*/
public static function onGce(callable $httpHandler = null)
{
@ -234,11 +282,14 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
*
* @param callable $httpHandler callback which delivers psr7 request
*
* @return array A set of auth related metadata, containing the following
* keys:
* @return array A set of auth related metadata, based on the token type.
*
* Access tokens have the following keys:
* - access_token (string)
* - expires_in (int)
* - token_type (string)
* ID tokens have the following keys:
* - id_token (string)
*
* @throws \Exception
*/
@ -255,8 +306,13 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
return array(); // return an empty array with no access token
}
$json = $this->getFromMetadata($httpHandler, $this->tokenUri);
if (null === $json = json_decode($json, true)) {
$response = $this->getFromMetadata($httpHandler, $this->tokenUri);
if ($this->targetAudience) {
return ['id_token' => $response];
}
if (null === $json = json_decode($response, true)) {
throw new \Exception('Invalid JSON response');
}
@ -351,6 +407,36 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
return $signer->signBlob($email, $accessToken, $stringToSign);
}
/**
* Fetch the default Project ID from compute engine.
*
* Returns null if called outside GCE.
*
* @param callable $httpHandler Callback which delivers psr7 request
* @return string|null
*/
public function getProjectId(callable $httpHandler = null)
{
if ($this->projectId) {
return $this->projectId;
}
$httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
if (!$this->hasCheckedOnGce) {
$this->isOnGce = self::onGce($httpHandler);
$this->hasCheckedOnGce = true;
}
if (!$this->isOnGce) {
return null;
}
$this->projectId = $this->getFromMetadata($httpHandler, self::getProjectIdUri());
return $this->projectId;
}
/**
* Fetch the value of a GCE metadata server URI.
*

View File

@ -18,9 +18,12 @@
namespace Google\Auth\Credentials;
use Google\Auth\CredentialsLoader;
use Google\Auth\GetQuotaProjectInterface;
use Google\Auth\OAuth2;
use Google\Auth\ProjectIdProviderInterface;
use Google\Auth\ServiceAccountSignerTrait;
use Google\Auth\SignBlobInterface;
use InvalidArgumentException;
/**
* ServiceAccountCredentials supports authorization using a Google service
@ -55,7 +58,10 @@ use Google\Auth\SignBlobInterface;
*
* $res = $client->get('myproject/taskqueues/myqueue');
*/
class ServiceAccountCredentials extends CredentialsLoader implements SignBlobInterface
class ServiceAccountCredentials extends CredentialsLoader implements
GetQuotaProjectInterface,
SignBlobInterface,
ProjectIdProviderInterface
{
use ServiceAccountSignerTrait;
@ -66,6 +72,18 @@ class ServiceAccountCredentials extends CredentialsLoader implements SignBlobInt
*/
protected $auth;
/**
* The quota project associated with the JSON credentials
*
* @var string
*/
protected $quotaProject;
/*
* @var string|null
*/
protected $projectId;
/**
* Create a new ServiceAccountCredentials.
*
@ -75,11 +93,13 @@ class ServiceAccountCredentials extends CredentialsLoader implements SignBlobInt
* as an associative array
* @param string $sub an email address account to impersonate, in situations when
* the service account has been delegated domain wide access.
* @param string $targetAudience The audience for the ID token.
*/
public function __construct(
$scope,
$jsonKey,
$sub = null
$sub = null,
$targetAudience = null
) {
if (is_string($jsonKey)) {
if (!file_exists($jsonKey)) {
@ -98,6 +118,17 @@ class ServiceAccountCredentials extends CredentialsLoader implements SignBlobInt
throw new \InvalidArgumentException(
'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');
}
$additionalClaims = [];
if ($targetAudience) {
$additionalClaims = ['target_audience' => $targetAudience];
}
$this->auth = new OAuth2([
'audience' => self::TOKEN_CREDENTIAL_URI,
'issuer' => $jsonKey['client_email'],
@ -106,7 +137,12 @@ class ServiceAccountCredentials extends CredentialsLoader implements SignBlobInt
'signingKey' => $jsonKey['private_key'],
'sub' => $sub,
'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI,
'additionalClaims' => $additionalClaims,
]);
$this->projectId = isset($jsonKey['project_id'])
? $jsonKey['project_id']
: null;
}
/**
@ -144,6 +180,19 @@ class ServiceAccountCredentials extends CredentialsLoader implements SignBlobInt
return $this->auth->getLastReceivedToken();
}
/**
* Get the project ID from the service account keyfile.
*
* Returns null if the project ID does not exist in the keyfile.
*
* @param callable $httpHandler Not used by this credentials type.
* @return string|null
*/
public function getProjectId(callable $httpHandler = null)
{
return $this->projectId;
}
/**
* Updates metadata with the authorization token.
*
@ -195,4 +244,14 @@ class ServiceAccountCredentials extends CredentialsLoader implements SignBlobInt
{
return $this->auth->getIssuer();
}
/**
* Get the quota project used for this API request
*
* @return string|null
*/
public function getQuotaProject()
{
return $this->quotaProject;
}
}

View File

@ -18,7 +18,9 @@
namespace Google\Auth\Credentials;
use Google\Auth\CredentialsLoader;
use Google\Auth\GetQuotaProjectInterface;
use Google\Auth\OAuth2;
use Google\Auth\ProjectIdProviderInterface;
use Google\Auth\ServiceAccountSignerTrait;
use Google\Auth\SignBlobInterface;
@ -31,7 +33,10 @@ use Google\Auth\SignBlobInterface;
* console (via 'Generate new Json Key'). It is not part of any OAuth2
* flow, rather it creates a JWT and sends that as a credential.
*/
class ServiceAccountJwtAccessCredentials extends CredentialsLoader implements SignBlobInterface
class ServiceAccountJwtAccessCredentials extends CredentialsLoader implements
GetQuotaProjectInterface,
SignBlobInterface,
ProjectIdProviderInterface
{
use ServiceAccountSignerTrait;
@ -42,6 +47,11 @@ class ServiceAccountJwtAccessCredentials extends CredentialsLoader implements Si
*/
protected $auth;
/**
* The quota project associated with the JSON credentials
*/
protected $quotaProject;
/**
* Create a new ServiceAccountJwtAccessCredentials.
*
@ -67,12 +77,19 @@ class ServiceAccountJwtAccessCredentials extends CredentialsLoader implements Si
throw new \InvalidArgumentException(
'json key is missing the private_key field');
}
if (array_key_exists('quota_project', $jsonKey)) {
$this->quotaProject = (string) $jsonKey['quota_project'];
}
$this->auth = new OAuth2([
'issuer' => $jsonKey['client_email'],
'sub' => $jsonKey['client_email'],
'signingAlgorithm' => 'RS256',
'signingKey' => $jsonKey['private_key'],
]);
$this->projectId = isset($jsonKey['project_id'])
? $jsonKey['project_id']
: null;
}
/**
@ -135,6 +152,19 @@ class ServiceAccountJwtAccessCredentials extends CredentialsLoader implements Si
return $this->auth->getLastReceivedToken();
}
/**
* Get the project ID from the service account keyfile.
*
* Returns null if the project ID does not exist in the keyfile.
*
* @param callable $httpHandler Not used by this credentials type.
* @return string|null
*/
public function getProjectId(callable $httpHandler = null)
{
return $this->projectId;
}
/**
* Get the client name from the keyfile.
*
@ -147,4 +177,14 @@ class ServiceAccountJwtAccessCredentials extends CredentialsLoader implements Si
{
return $this->auth->getIssuer();
}
/**
* Get the quota project used for this API request
*
* @return string|null
*/
public function getQuotaProject()
{
return $this->quotaProject;
}
}

View File

@ -18,6 +18,7 @@
namespace Google\Auth\Credentials;
use Google\Auth\CredentialsLoader;
use Google\Auth\GetQuotaProjectInterface;
use Google\Auth\OAuth2;
/**
@ -31,7 +32,7 @@ use Google\Auth\OAuth2;
*
* @see [Application Default Credentials](http://goo.gl/mkAHpZ)
*/
class UserRefreshCredentials extends CredentialsLoader
class UserRefreshCredentials extends CredentialsLoader implements GetQuotaProjectInterface
{
const CLOUD_SDK_CLIENT_ID =
'764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com';
@ -45,6 +46,11 @@ class UserRefreshCredentials extends CredentialsLoader
*/
protected $auth;
/**
* The quota project associated with the JSON credentials
*/
protected $quotaProject;
/**
* Create a new UserRefreshCredentials.
*
@ -85,7 +91,11 @@ class UserRefreshCredentials extends CredentialsLoader
'scope' => $scope,
'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI,
]);
if (array_key_exists('quota_project', $jsonKey)) {
$this->quotaProject = (string) $jsonKey['quota_project'];
}
if ($jsonKey['client_id'] === self::CLOUD_SDK_CLIENT_ID
&& is_null($this->quotaProject)
&& getenv(self::SUPPRESS_CLOUD_SDK_CREDS_WARNING_ENV) !== 'true') {
trigger_error(
'Your application has authenticated using end user credentials '
@ -134,4 +144,14 @@ class UserRefreshCredentials extends CredentialsLoader
{
return $this->auth->getLastReceivedToken();
}
/**
* Get the quota project used for this API request
*
* @return string|null
*/
public function getQuotaProject()
{
return $this->quotaProject;
}
}

View File

@ -23,7 +23,11 @@ use Psr\Cache\CacheItemPoolInterface;
* A class to implement caching for any object implementing
* FetchAuthTokenInterface
*/
class FetchAuthTokenCache implements FetchAuthTokenInterface, SignBlobInterface
class FetchAuthTokenCache implements
FetchAuthTokenInterface,
GetQuotaProjectInterface,
SignBlobInterface,
ProjectIdProviderInterface
{
use CacheTrait;
@ -139,4 +143,37 @@ class FetchAuthTokenCache implements FetchAuthTokenInterface, SignBlobInterface
return $this->fetcher->signBlob($stringToSign, $forceOpenSsl);
}
/**
* Get the quota project used for this API request from the credentials
* fetcher.
*
* @return string|null
*/
public function getQuotaProject()
{
if ($this->fetcher instanceof GetQuotaProjectInterface) {
return $this->fetcher->getQuotaProject();
}
}
/*
* Get the Project ID from the fetcher.
*
* @param callable $httpHandler Callback which delivers psr7 request
* @return string|null
* @throws \RuntimeException If the fetcher does not implement
* `Google\Auth\ProvidesProjectIdInterface`.
*/
public function getProjectId(callable $httpHandler = null)
{
if (!$this->fetcher instanceof ProjectIdProviderInterface) {
throw new \RuntimeException(
'Credentials fetcher does not implement ' .
'Google\Auth\ProvidesProjectIdInterface'
);
}
return $this->fetcher->getProjectId($httpHandler);
}
}

View File

@ -0,0 +1,33 @@
<?php
/*
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Google\Auth;
/**
* An interface implemented by objects that can get quota projects.
*/
interface GetQuotaProjectInterface
{
const X_GOOG_USER_PROJECT_HEADER = 'X-Goog-User-Project';
/**
* Get the quota project used for this API request
*
* @return string|null
*/
public function getQuotaProject();
}

View File

@ -18,6 +18,7 @@
namespace Google\Auth\Middleware;
use Google\Auth\FetchAuthTokenInterface;
use Google\Auth\GetQuotaProjectInterface;
use Psr\Http\Message\RequestInterface;
/**
@ -101,6 +102,13 @@ class AuthTokenMiddleware
$request = $request->withHeader('authorization', 'Bearer ' . $this->fetchToken());
if ($quotaProject = $this->getQuotaProject()) {
$request = $request->withHeader(
GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER,
$quotaProject
);
}
return $handler($request, $options);
};
}
@ -122,5 +130,16 @@ class AuthTokenMiddleware
return $auth_tokens['access_token'];
}
if (array_key_exists('id_token', $auth_tokens)) {
return $auth_tokens['id_token'];
}
}
private function getQuotaProject()
{
if ($this->fetcher instanceof GetQuotaProjectInterface) {
return $this->fetcher->getQuotaProject();
}
}
}

View File

@ -0,0 +1,32 @@
<?php
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Google\Auth;
/**
* Describes a Credentials object which supports fetching the project ID.
*/
interface ProjectIdProviderInterface
{
/**
* Get the project ID.
*
* @param callable $httpHandler Callback which delivers psr7 request
* @return string|null
*/
public function getProjectId(callable $httpHandler = null);
}

View File

@ -18,6 +18,7 @@
namespace Google\Auth\Subscriber;
use Google\Auth\FetchAuthTokenInterface;
use Google\Auth\GetQuotaProjectInterface;
use GuzzleHttp\Event\BeforeEvent;
use GuzzleHttp\Event\RequestEvents;
use GuzzleHttp\Event\SubscriberInterface;
@ -114,5 +115,19 @@ class AuthTokenSubscriber implements SubscriberInterface
call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $auth_tokens['access_token']);
}
}
if ($quotaProject = $this->getQuotaProject()) {
$request->setHeader(
GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER,
$quotaProject
);
}
}
private function getQuotaProject()
{
if ($this->fetcher instanceof GetQuotaProjectInterface) {
return $this->fetcher->getQuotaProject();
}
}
}

View File

@ -1,18 +0,0 @@
FROM composer:latest as setup
RUN mkdir /guzzle
WORKDIR /guzzle
RUN set -xe \
&& composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár <mark.sagikazar@gmail.com>" --no-interaction \
&& composer require guzzlehttp/guzzle
FROM php:7.3
RUN mkdir /guzzle
WORKDIR /guzzle
COPY --from=setup /guzzle /guzzle

View File

@ -2,11 +2,12 @@
namespace GuzzleHttp;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\InvalidArgumentException;
use GuzzleHttp\Promise;
use GuzzleHttp\Psr7;
use Psr\Http\Message\UriInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
/**
* @method ResponseInterface get(string|UriInterface $uri, array $options = [])
@ -75,6 +76,12 @@ class Client implements ClientInterface
$this->configureDefaults($config);
}
/**
* @param string $method
* @param array $args
*
* @return Promise\PromiseInterface
*/
public function __call($method, $args)
{
if (count($args) < 1) {
@ -89,6 +96,14 @@ class Client implements ClientInterface
: $this->request($method, $uri, $opts);
}
/**
* Asynchronously send an HTTP request.
*
* @param array $options Request options to apply to the given
* request and to the transfer. See \GuzzleHttp\RequestOptions.
*
* @return Promise\PromiseInterface
*/
public function sendAsync(RequestInterface $request, array $options = [])
{
// Merge the base URI into the request URI if needed.
@ -100,12 +115,35 @@ class Client implements ClientInterface
);
}
/**
* Send an HTTP request.
*
* @param array $options Request options to apply to the given
* request and to the transfer. See \GuzzleHttp\RequestOptions.
*
* @return ResponseInterface
* @throws GuzzleException
*/
public function send(RequestInterface $request, array $options = [])
{
$options[RequestOptions::SYNCHRONOUS] = true;
return $this->sendAsync($request, $options)->wait();
}
/**
* Create and send an asynchronous HTTP request.
*
* Use an absolute path to override the base path of the client, or a
* relative path to append to the base path of the client. The URL can
* contain the query string as well. Use an array to provide a URL
* template and additional variables to use in the URL template expansion.
*
* @param string $method HTTP method
* @param string|UriInterface $uri URI object or string.
* @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
*
* @return Promise\PromiseInterface
*/
public function requestAsync($method, $uri = '', array $options = [])
{
$options = $this->prepareDefaults($options);
@ -125,12 +163,37 @@ class Client implements ClientInterface
return $this->transfer($request, $options);
}
/**
* Create and send an HTTP request.
*
* Use an absolute path to override the base path of the client, or a
* relative path to append to the base path of the client. The URL can
* contain the query string as well.
*
* @param string $method HTTP method.
* @param string|UriInterface $uri URI object or string.
* @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
*
* @return ResponseInterface
* @throws GuzzleException
*/
public function request($method, $uri = '', array $options = [])
{
$options[RequestOptions::SYNCHRONOUS] = true;
return $this->requestAsync($method, $uri, $options)->wait();
}
/**
* Get a client configuration option.
*
* These options include default request options of the client, a "handler"
* (if utilized by the concrete client), and a "base_uri" if utilized by
* the concrete client.
*
* @param string|null $option The config option to retrieve.
*
* @return mixed
*/
public function getConfig($option = null)
{
return $option === null
@ -138,6 +201,11 @@ class Client implements ClientInterface
: (isset($this->config[$option]) ? $this->config[$option] : null);
}
/**
* @param string|null $uri
*
* @return UriInterface
*/
private function buildUri($uri, array $config)
{
// for BC we accept null which would otherwise fail in uri_for
@ -147,6 +215,11 @@ class Client implements ClientInterface
$uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
}
if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) {
$idnOptions = ($config['idn_conversion'] === true) ? IDNA_DEFAULT : $config['idn_conversion'];
$uri = Utils::idnUriConvert($uri, $idnOptions);
}
return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
}
@ -154,6 +227,7 @@ class Client implements ClientInterface
* Configures the default options for a client.
*
* @param array $config
* @return void
*/
private function configureDefaults(array $config)
{
@ -162,7 +236,8 @@ class Client implements ClientInterface
'http_errors' => true,
'decode_content' => true,
'verify' => true,
'cookies' => false
'cookies' => false,
'idn_conversion' => true,
];
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
@ -170,7 +245,7 @@ class Client implements ClientInterface
// We can only trust the HTTP_PROXY environment variable in a CLI
// process due to the fact that PHP has no reliable mechanism to
// get environment variables that start with "HTTP_".
if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) {
if (php_sapi_name() === 'cli' && getenv('HTTP_PROXY')) {
$defaults['proxy']['http'] = getenv('HTTP_PROXY');
}
@ -225,7 +300,7 @@ class Client implements ClientInterface
if (array_key_exists('headers', $options)) {
// Allows default headers to be unset.
if ($options['headers'] === null) {
$defaults['_conditional'] = null;
$defaults['_conditional'] = [];
unset($options['headers']);
} elseif (!is_array($options['headers'])) {
throw new \InvalidArgumentException('headers must be an array');
@ -251,8 +326,7 @@ class Client implements ClientInterface
* The URI of the request is not modified and the request options are used
* as-is without merging in default options.
*
* @param RequestInterface $request
* @param array $options
* @param array $options See \GuzzleHttp\RequestOptions.
*
* @return Promise\PromiseInterface
*/
@ -271,6 +345,7 @@ class Client implements ClientInterface
}
$request = $this->applyOptions($request, $options);
/** @var HandlerStack $handler */
$handler = $options['handler'];
try {
@ -411,6 +486,11 @@ class Client implements ClientInterface
return $request;
}
/**
* Throw Exception with pre-set message.
* @return void
* @throws InvalidArgumentException Invalid body.
*/
private function invalidBody()
{
throw new \InvalidArgumentException('Passing in the "body" request '

View File

@ -1,8 +1,8 @@
<?php
namespace GuzzleHttp;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
@ -12,7 +12,10 @@ use Psr\Http\Message\UriInterface;
*/
interface ClientInterface
{
const VERSION = '6.4.1';
/**
* @deprecated Will be removed in Guzzle 7.0.0
*/
const VERSION = '6.5.3';
/**
* Send an HTTP request.

View File

@ -94,8 +94,8 @@ class CookieJar implements CookieJarInterface
*/
public function getCookieByName($name)
{
// don't allow a null name
if ($name === null) {
// don't allow a non string name
if ($name === null || !is_scalar($name)) {
return null;
}
foreach ($this->cookies as $cookie) {
@ -103,6 +103,8 @@ class CookieJar implements CookieJarInterface
return $cookie;
}
}
return null;
}
public function toArray()

View File

@ -58,9 +58,9 @@ interface CookieJarInterface extends \Countable, \IteratorAggregate
* arguments, then the cookie with the specified name, path and domain is
* removed.
*
* @param string $domain Clears cookies matching a domain
* @param string $path Clears cookies matching a domain and path
* @param string $name Clears cookies matching a domain, path, and name
* @param string|null $domain Clears cookies matching a domain
* @param string|null $path Clears cookies matching a domain and path
* @param string|null $name Clears cookies matching a domain, path, and name
*
* @return CookieJarInterface
*/

View File

@ -1,9 +1,9 @@
<?php
namespace GuzzleHttp\Exception;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\UriInterface;
/**
@ -14,7 +14,7 @@ class RequestException extends TransferException
/** @var RequestInterface */
private $request;
/** @var ResponseInterface */
/** @var ResponseInterface|null */
private $response;
/** @var array */
@ -124,42 +124,17 @@ class RequestException extends TransferException
*/
public static function getResponseBodySummary(ResponseInterface $response)
{
$body = $response->getBody();
if (!$body->isSeekable() || !$body->isReadable()) {
return null;
}
$size = $body->getSize();
if ($size === 0) {
return null;
}
$summary = $body->read(120);
$body->rewind();
if ($size > 120) {
$summary .= ' (truncated...)';
}
// Matches any printable character, including unicode characters:
// letters, marks, numbers, punctuation, spacing, and separators.
if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
return null;
}
return $summary;
return \GuzzleHttp\Psr7\get_message_body_summary($response);
}
/**
* Obfuscates URI if there is an username and a password present
* Obfuscates URI if there is a username and a password present
*
* @param UriInterface $uri
*
* @return UriInterface
*/
private static function obfuscateUri($uri)
private static function obfuscateUri(UriInterface $uri)
{
$userInfo = $uri->getUserInfo();

View File

@ -1,8 +1,8 @@
<?php
namespace GuzzleHttp\Handler;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Promise\FulfilledPromise;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\LazyOpenStream;
@ -454,11 +454,16 @@ class CurlFactory implements CurlFactoryInterface
}
if (isset($options['ssl_key'])) {
$sslKey = $options['ssl_key'];
if (is_array($sslKey)) {
$conf[CURLOPT_SSLKEYPASSWD] = $sslKey[1];
$sslKey = $sslKey[0];
if (is_array($options['ssl_key'])) {
if (count($options['ssl_key']) === 2) {
list($sslKey, $conf[CURLOPT_SSLKEYPASSWD]) = $options['ssl_key'];
} else {
list($sslKey) = $options['ssl_key'];
}
}
$sslKey = isset($sslKey) ? $sslKey: $options['ssl_key'];
if (!file_exists($sslKey)) {
throw new \InvalidArgumentException(
"SSL private key not found: {$sslKey}"

View File

@ -1,9 +1,10 @@
<?php
namespace GuzzleHttp\Handler;
use GuzzleHttp\Exception\InvalidArgumentException;
use GuzzleHttp\Promise as P;
use GuzzleHttp\Promise\Promise;
use GuzzleHttp\Psr7;
use GuzzleHttp\Utils;
use Psr\Http\Message\RequestInterface;
/**
@ -23,6 +24,7 @@ class CurlMultiHandler
private $active;
private $handles = [];
private $delays = [];
private $options = [];
/**
* This handler accepts the following options:
@ -30,6 +32,8 @@ class CurlMultiHandler
* - handle_factory: An optional factory used to create curl handles
* - select_timeout: Optional timeout (in seconds) to block before timing
* out while selecting curl handles. Defaults to 1 second.
* - options: An associative array of CURLMOPT_* options and
* corresponding values for curl_multi_setopt()
*
* @param array $options
*/
@ -45,12 +49,23 @@ class CurlMultiHandler
} else {
$this->selectTimeout = 1;
}
$this->options = isset($options['options']) ? $options['options'] : [];
}
public function __get($name)
{
if ($name === '_mh') {
return $this->_mh = curl_multi_init();
$this->_mh = curl_multi_init();
foreach ($this->options as $option => $value) {
// A warning is raised in case of a wrong option.
curl_multi_setopt($this->_mh, $option, $value);
}
// Further calls to _mh will return the value directly, without entering the
// __get() method at all.
return $this->_mh;
}
throw new \BadMethodCallException();
@ -88,7 +103,7 @@ class CurlMultiHandler
{
// Add any delayed handles if needed.
if ($this->delays) {
$currentTime = \GuzzleHttp\_current_time();
$currentTime = Utils::currentTime();
foreach ($this->delays as $id => $delay) {
if ($currentTime >= $delay) {
unset($this->delays[$id]);
@ -140,7 +155,7 @@ class CurlMultiHandler
if (empty($easy->options['delay'])) {
curl_multi_add_handle($this->_mh, $easy->handle);
} else {
$this->delays[$id] = \GuzzleHttp\_current_time() + ($easy->options['delay'] / 1000);
$this->delays[$id] = Utils::currentTime() + ($easy->options['delay'] / 1000);
}
}
@ -192,7 +207,7 @@ class CurlMultiHandler
private function timeToNext()
{
$currentTime = \GuzzleHttp\_current_time();
$currentTime = Utils::currentTime();
$nextTime = PHP_INT_MAX;
foreach ($this->delays as $time) {
if ($time < $nextTime) {

View File

@ -66,7 +66,7 @@ class MockHandler implements \Countable
throw new \OutOfBoundsException('Mock queue is empty');
}
if (isset($options['delay'])) {
if (isset($options['delay']) && is_numeric($options['delay'])) {
usleep($options['delay'] * 1000);
}
@ -175,6 +175,11 @@ class MockHandler implements \Countable
return count($this->queue);
}
public function reset()
{
$this->queue = [];
}
private function invokeStats(
RequestInterface $request,
array $options,

View File

@ -1,12 +1,13 @@
<?php
namespace GuzzleHttp\Handler;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Promise\FulfilledPromise;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Psr7;
use GuzzleHttp\TransferStats;
use GuzzleHttp\Utils;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
@ -33,7 +34,7 @@ class StreamHandler
usleep($options['delay'] * 1000);
}
$startTime = isset($options['on_stats']) ? \GuzzleHttp\_current_time() : null;
$startTime = isset($options['on_stats']) ? Utils::currentTime() : null;
try {
// Does not support the expect header.
@ -82,7 +83,7 @@ class StreamHandler
$stats = new TransferStats(
$request,
$response,
\GuzzleHttp\_current_time() - $startTime,
Utils::currentTime() - $startTime,
$error,
[]
);

View File

@ -1,7 +1,9 @@
<?php
namespace GuzzleHttp;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
* Creates a composed Guzzle handler function by stacking middlewares on top of
@ -9,7 +11,7 @@ use Psr\Http\Message\RequestInterface;
*/
class HandlerStack
{
/** @var callable */
/** @var callable|null */
private $handler;
/** @var array */
@ -59,6 +61,8 @@ class HandlerStack
*
* @param RequestInterface $request
* @param array $options
*
* @return ResponseInterface|PromiseInterface
*/
public function __invoke(RequestInterface $request, array $options)
{

View File

@ -168,6 +168,11 @@ class MessageFormatter
);
}
/**
* Get headers from message as string
*
* @return string
*/
private function headers(MessageInterface $message)
{
$result = '';

View File

@ -1,9 +1,10 @@
<?php
namespace GuzzleHttp;
use GuzzleHttp\Promise\EachPromise;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Promise\PromisorInterface;
use Psr\Http\Message\RequestInterface;
use GuzzleHttp\Promise\EachPromise;
/**
* Sends an iterator of requests concurrently using a capped pool size.
@ -69,6 +70,11 @@ class Pool implements PromisorInterface
$this->each = new EachPromise($requests(), $config);
}
/**
* Get promise
*
* @return PromiseInterface
*/
public function promise()
{
return $this->each->promise();
@ -106,6 +112,11 @@ class Pool implements PromisorInterface
return $res;
}
/**
* Execute callback(s)
*
* @return void
*/
private static function cmpCallback(array &$options, $name, array &$results)
{
if (!isset($options[$name])) {

View File

@ -66,6 +66,11 @@ class PrepareBodyMiddleware
return $fn(Psr7\modify_request($request, $modify), $options);
}
/**
* Add expect header
*
* @return void
*/
private function addExpectHeader(
RequestInterface $request,
array $options,

View File

@ -13,7 +13,7 @@ use Psr\Http\Message\UriInterface;
* Request redirect middleware.
*
* Apply this middleware like other middleware using
* {@see GuzzleHttp\Middleware::redirect()}.
* {@see \GuzzleHttp\Middleware::redirect()}.
*/
class RedirectMiddleware
{
@ -76,7 +76,7 @@ class RedirectMiddleware
/**
* @param RequestInterface $request
* @param array $options
* @param ResponseInterface|PromiseInterface $response
* @param ResponseInterface $response
*
* @return ResponseInterface|PromiseInterface
*/
@ -118,6 +118,11 @@ class RedirectMiddleware
return $promise;
}
/**
* Enable tracking on promise.
*
* @return PromiseInterface
*/
private function withTracking(PromiseInterface $promise, $uri, $statusCode)
{
return $promise->then(
@ -135,6 +140,13 @@ class RedirectMiddleware
);
}
/**
* Check for too many redirects
*
* @return void
*
* @throws TooManyRedirectsException Too many redirects.
*/
private function guardMax(RequestInterface $request, array &$options)
{
$current = isset($options['__redirect_count'])
@ -172,13 +184,19 @@ class RedirectMiddleware
// would do.
$statusCode = $response->getStatusCode();
if ($statusCode == 303 ||
($statusCode <= 302 && $request->getBody() && !$options['allow_redirects']['strict'])
($statusCode <= 302 && !$options['allow_redirects']['strict'])
) {
$modify['method'] = 'GET';
$modify['body'] = '';
}
$modify['uri'] = $this->redirectUri($request, $response, $protocols);
$uri = $this->redirectUri($request, $response, $protocols);
if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) {
$idnOptions = ($options['idn_conversion'] === true) ? IDNA_DEFAULT : $options['idn_conversion'];
$uri = Utils::idnUriConvert($uri, $idnOptions);
}
$modify['uri'] = $uri;
Psr7\rewind_body($request);
// Add the Referer header if it is told to do so and only

View File

@ -132,6 +132,14 @@ final class RequestOptions
*/
const HTTP_ERRORS = 'http_errors';
/**
* idn: (bool|int, default=true) A combination of IDNA_* constants for
* idn_to_ascii() PHP's function (see "options" parameter). Set to false to
* disable IDN support completely, or to true to use the default
* configuration (IDNA_DEFAULT constant).
*/
const IDN_CONVERSION = 'idn_conversion';
/**
* json: (mixed) Adds JSON data to a request. The provided value is JSON
* encoded and a Content-Type header of application/json will be added to

View File

@ -47,11 +47,11 @@ class RetryMiddleware
*
* @param int $retries
*
* @return int
* @return int milliseconds.
*/
public static function exponentialDelay($retries)
{
return (int) pow(2, $retries - 1);
return (int) pow(2, $retries - 1) * 1000;
}
/**
@ -74,6 +74,11 @@ class RetryMiddleware
);
}
/**
* Execute fulfilled closure
*
* @return mixed
*/
private function onFulfilled(RequestInterface $req, array $options)
{
return function ($value) use ($req, $options) {
@ -90,6 +95,11 @@ class RetryMiddleware
};
}
/**
* Execute rejected closure
*
* @return callable
*/
private function onRejected(RequestInterface $req, array $options)
{
return function ($reason) use ($req, $options) {
@ -106,6 +116,9 @@ class RetryMiddleware
};
}
/**
* @return self
*/
private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null)
{
$options['delay'] = call_user_func($this->delay, ++$options['retries'], $response);

View File

@ -18,11 +18,11 @@ final class TransferStats
private $handlerErrorData;
/**
* @param RequestInterface $request Request that was sent.
* @param ResponseInterface $response Response received (if any)
* @param float|null $transferTime Total handler transfer time.
* @param mixed $handlerErrorData Handler error data.
* @param array $handlerStats Handler specific stats.
* @param RequestInterface $request Request that was sent.
* @param ResponseInterface|null $response Response received (if any)
* @param float|null $transferTime Total handler transfer time.
* @param mixed $handlerErrorData Handler error data.
* @param array $handlerStats Handler specific stats.
*/
public function __construct(
RequestInterface $request,
@ -93,7 +93,7 @@ final class TransferStats
/**
* Get the estimated time the request was being transferred by the handler.
*
* @return float Time in seconds.
* @return float|null Time in seconds.
*/
public function getTransferTime()
{

View File

@ -0,0 +1,67 @@
<?php
namespace GuzzleHttp;
use GuzzleHttp\Exception\InvalidArgumentException;
use Psr\Http\Message\UriInterface;
final class Utils
{
/**
* Wrapper for the hrtime() or microtime() functions
* (depending on the PHP version, one of the two is used)
*
* @return float|mixed UNIX timestamp
*
* @internal
*/
public static function currentTime()
{
return function_exists('hrtime') ? hrtime(true) / 1e9 : microtime(true);
}
/**
* @param int $options
*
* @return UriInterface
* @throws InvalidArgumentException
*
* @internal
*/
public static function idnUriConvert(UriInterface $uri, $options = 0)
{
if ($uri->getHost()) {
$idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0;
$asciiHost = $idnaVariant === 0
? idn_to_ascii($uri->getHost(), $options)
: idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info);
if ($asciiHost === false) {
$errorBitSet = isset($info['errors']) ? $info['errors'] : 0;
$errorConstants = array_filter(array_keys(get_defined_constants()), function ($name) {
return substr($name, 0, 11) === 'IDNA_ERROR_';
});
$errors = [];
foreach ($errorConstants as $errorConstant) {
if ($errorBitSet & constant($errorConstant)) {
$errors[] = $errorConstant;
}
}
$errorMessage = 'IDN conversion failed';
if ($errors) {
$errorMessage .= ' (errors: ' . implode(', ', $errors) . ')';
}
throw new InvalidArgumentException($errorMessage);
} else {
if ($uri->getHost() !== $asciiHost) {
// Replace URI only if the ASCII version is different
$uri = $uri->withHost($asciiHost);
}
}
}
return $uri;
}
}

View File

@ -56,7 +56,7 @@ function describe_type($input)
/**
* Parses an array of header lines into an associative array of headers.
*
* @param array $lines Header lines array of strings in the following
* @param iterable $lines Header lines array of strings in the following
* format: "Name: Value"
* @return array
*/
@ -97,8 +97,8 @@ function debug_resource($value = null)
*
* The returned handler is not wrapped by any default middlewares.
*
* @throws \RuntimeException if no viable Handler is available.
* @return callable Returns the best handler for the given system.
* @throws \RuntimeException if no viable Handler is available.
*/
function choose_handler()
{
@ -332,15 +332,3 @@ function json_encode($value, $options = 0, $depth = 512)
return $json;
}
/**
* Wrapper for the hrtime() or microtime() functions
* (depending on the PHP version, one of the two is used)
*
* @return float|mixed UNIX timestamp
* @internal
*/
function _current_time()
{
return function_exists('hrtime') ? hrtime(true) / 1e9 : microtime(true);
}

View File

@ -11,6 +11,8 @@
namespace Monolog\Formatter;
use Monolog\Utils;
/**
* Class FluentdFormatter
*
@ -71,7 +73,7 @@ class FluentdFormatter implements FormatterInterface
$message['level_name'] = $record['level_name'];
}
return json_encode(array($tag, $record['datetime']->getTimestamp(), $message));
return Utils::jsonEncode(array($tag, $record['datetime']->getTimestamp(), $message));
}
public function formatBatch(array $records)

View File

@ -11,6 +11,7 @@
namespace Monolog\Formatter;
use Monolog\Logger;
use Monolog\Utils;
/**
* Formats incoming records into an HTML table
@ -133,9 +134,9 @@ class HtmlFormatter extends NormalizerFormatter
$data = $this->normalize($data);
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
return json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
return Utils::jsonEncode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE, true);
}
return str_replace('\\/', '/', json_encode($data));
return str_replace('\\/', '/', Utils::jsonEncode($data, null, true));
}
}

View File

@ -145,7 +145,7 @@ class JsonFormatter extends NormalizerFormatter
return 'Over 9 levels deep, aborting normalization';
}
if (is_array($data) || $data instanceof \Traversable) {
if (is_array($data)) {
$normalized = array();
$count = 1;
@ -165,6 +165,10 @@ class JsonFormatter extends NormalizerFormatter
return $this->normalizeException($data);
}
if (is_resource($data)) {
return parent::normalize($data);
}
return $data;
}
@ -186,7 +190,7 @@ class JsonFormatter extends NormalizerFormatter
$data = array(
'class' => Utils::getClass($e),
'message' => $e->getMessage(),
'code' => $e->getCode(),
'code' => (int) $e->getCode(),
'file' => $e->getFile().':'.$e->getLine(),
);

View File

@ -163,7 +163,7 @@ class LineFormatter extends NormalizerFormatter
return $this->toJson($data, true);
}
return str_replace('\\/', '/', @json_encode($data));
return str_replace('\\/', '/', $this->toJson($data, true));
}
protected function replaceNewlines($str)

View File

@ -87,7 +87,7 @@ class MongoDBFormatter implements FormatterInterface
$formattedException = array(
'class' => Utils::getClass($exception),
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
'code' => (int) $exception->getCode(),
'file' => $exception->getFile() . ':' . $exception->getLine(),
);

View File

@ -129,7 +129,7 @@ class NormalizerFormatter implements FormatterInterface
$data = array(
'class' => Utils::getClass($e),
'message' => $e->getMessage(),
'code' => $e->getCode(),
'code' => (int) $e->getCode(),
'file' => $e->getFile().':'.$e->getLine(),
);
@ -142,8 +142,8 @@ class NormalizerFormatter implements FormatterInterface
$data['faultactor'] = $e->faultactor;
}
if (isset($e->detail)) {
$data['detail'] = $e->detail;
if (isset($e->detail) && (is_string($e->detail) || is_object($e->detail) || is_array($e->detail))) {
$data['detail'] = is_string($e->detail) ? $e->detail : reset($e->detail);
}
}
@ -171,127 +171,6 @@ class NormalizerFormatter implements FormatterInterface
*/
protected function toJson($data, $ignoreErrors = false)
{
// suppress json_encode errors since it's twitchy with some inputs
if ($ignoreErrors) {
return @$this->jsonEncode($data);
}
$json = $this->jsonEncode($data);
if ($json === false) {
$json = $this->handleJsonError(json_last_error(), $data);
}
return $json;
}
/**
* @param mixed $data
* @return string JSON encoded data or null on failure
*/
private function jsonEncode($data)
{
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}
return json_encode($data);
}
/**
* Handle a json_encode failure.
*
* If the failure is due to invalid string encoding, try to clean the
* input and encode again. If the second encoding attempt fails, the
* inital error is not encoding related or the input can't be cleaned then
* raise a descriptive exception.
*
* @param int $code return code of json_last_error function
* @param mixed $data data that was meant to be encoded
* @throws \RuntimeException if failure can't be corrected
* @return string JSON encoded data after error correction
*/
private function handleJsonError($code, $data)
{
if ($code !== JSON_ERROR_UTF8) {
$this->throwEncodeError($code, $data);
}
if (is_string($data)) {
$this->detectAndCleanUtf8($data);
} elseif (is_array($data)) {
array_walk_recursive($data, array($this, 'detectAndCleanUtf8'));
} else {
$this->throwEncodeError($code, $data);
}
$json = $this->jsonEncode($data);
if ($json === false) {
$this->throwEncodeError(json_last_error(), $data);
}
return $json;
}
/**
* Throws an exception according to a given code with a customized message
*
* @param int $code return code of json_last_error function
* @param mixed $data data that was meant to be encoded
* @throws \RuntimeException
*/
private function throwEncodeError($code, $data)
{
switch ($code) {
case JSON_ERROR_DEPTH:
$msg = 'Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
$msg = 'Underflow or the modes mismatch';
break;
case JSON_ERROR_CTRL_CHAR:
$msg = 'Unexpected control character found';
break;
case JSON_ERROR_UTF8:
$msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
$msg = 'Unknown error';
}
throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true));
}
/**
* Detect invalid UTF-8 string characters and convert to valid UTF-8.
*
* Valid UTF-8 input will be left unmodified, but strings containing
* invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed
* original encoding of ISO-8859-15. This conversion may result in
* incorrect output if the actual encoding was not ISO-8859-15, but it
* will be clean UTF-8 output and will not rely on expensive and fragile
* detection algorithms.
*
* Function converts the input in place in the passed variable so that it
* can be used as a callback for array_walk_recursive.
*
* @param mixed &$data Input to check and convert if needed
* @private
*/
public function detectAndCleanUtf8(&$data)
{
if (is_string($data) && !preg_match('//u', $data)) {
$data = preg_replace_callback(
'/[\x80-\xFF]+/',
function ($m) { return utf8_encode($m[0]); },
$data
);
$data = str_replace(
array('¤', '¦', '¨', '´', '¸', '¼', '½', '¾'),
array('€', 'Š', 'š', 'Ž', 'ž', 'Œ', 'œ', 'Ÿ'),
$data
);
}
return Utils::jsonEncode($data, null, $ignoreErrors);
}
}

View File

@ -164,21 +164,22 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
private static function handleStyles($formatted)
{
$args = array(static::quote('font-weight: normal'));
$args = array();
$format = '%c' . $formatted;
preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
foreach (array_reverse($matches) as $match) {
$args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0]));
$args[] = '"font-weight: normal"';
$args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0]));
$pos = $match[0][1];
$format = substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . substr($format, $pos + strlen($match[0][0]));
}
array_unshift($args, static::quote($format));
$args[] = static::quote('font-weight: normal');
$args[] = static::quote($format);
return $args;
return array_reverse($args);
}
private static function handleCustomStyles($style, $string)

View File

@ -13,6 +13,7 @@ namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\ResettableInterface;
use Monolog\Formatter\FormatterInterface;
/**
* Buffers all records until closing the handler and then pass them as batch.
@ -126,4 +127,22 @@ class BufferHandler extends AbstractHandler
$this->handler->reset();
}
}
/**
* {@inheritdoc}
*/
public function setFormatter(FormatterInterface $formatter)
{
$this->handler->setFormatter($formatter);
return $this;
}
/**
* {@inheritdoc}
*/
public function getFormatter()
{
return $this->handler->getFormatter();
}
}

View File

@ -13,6 +13,7 @@ namespace Monolog\Handler;
use Monolog\Formatter\ChromePHPFormatter;
use Monolog\Logger;
use Monolog\Utils;
/**
* Handler sending logs to the ChromePHP extension (http://www.chromephp.com/)
@ -134,7 +135,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
}
$json = @json_encode(self::$json);
$json = Utils::jsonEncode(self::$json, null, true);
$data = base64_encode(utf8_encode($json));
if (strlen($data) > 3 * 1024) {
self::$overflowed = true;
@ -149,7 +150,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
'extra' => array(),
);
self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record);
$json = @json_encode(self::$json);
$json = Utils::jsonEncode(self::$json, null, true);
$data = base64_encode(utf8_encode($json));
}

View File

@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Utils;
/**
* Logs to Cube.
@ -119,9 +120,9 @@ class CubeHandler extends AbstractProcessingHandler
$data['data']['level'] = $record['level'];
if ($this->scheme === 'http') {
$this->writeHttp(json_encode($data));
$this->writeHttp(Utils::jsonEncode($data));
} else {
$this->writeUdp(json_encode($data));
$this->writeUdp(Utils::jsonEncode($data));
}
}

View File

@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Formatter\FormatterInterface;
/**
* Simple handler wrapper that filters records based on a list of levels
@ -45,7 +46,7 @@ class FilterHandler extends AbstractHandler
protected $bubble;
/**
* @param callable|HandlerInterface $handler Handler or factory callable($record, $this).
* @param callable|HandlerInterface $handler Handler or factory callable($record|null, $filterHandler).
* @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
* @param int $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
@ -104,21 +105,13 @@ class FilterHandler extends AbstractHandler
return false;
}
// The same logic as in FingersCrossedHandler
if (!$this->handler instanceof HandlerInterface) {
$this->handler = call_user_func($this->handler, $record, $this);
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}
}
if ($this->processors) {
foreach ($this->processors as $processor) {
$record = call_user_func($processor, $record);
}
}
$this->handler->handle($record);
$this->getHandler($record)->handle($record);
return false === $this->bubble;
}
@ -135,6 +128,45 @@ class FilterHandler extends AbstractHandler
}
}
$this->handler->handleBatch($filtered);
if (count($filtered) > 0) {
$this->getHandler($filtered[count($filtered) - 1])->handleBatch($filtered);
}
}
/**
* Return the nested handler
*
* If the handler was provided as a factory callable, this will trigger the handler's instantiation.
*
* @return HandlerInterface
*/
public function getHandler(array $record = null)
{
if (!$this->handler instanceof HandlerInterface) {
$this->handler = call_user_func($this->handler, $record, $this);
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}
}
return $this->handler;
}
/**
* {@inheritdoc}
*/
public function setFormatter(FormatterInterface $formatter)
{
$this->getHandler()->setFormatter($formatter);
return $this;
}
/**
* {@inheritdoc}
*/
public function getFormatter()
{
return $this->getHandler()->getFormatter();
}
}

View File

@ -15,6 +15,7 @@ use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
use Monolog\Handler\FingersCrossed\ActivationStrategyInterface;
use Monolog\Logger;
use Monolog\ResettableInterface;
use Monolog\Formatter\FormatterInterface;
/**
* Buffers all records until a certain level is reached
@ -39,7 +40,7 @@ class FingersCrossedHandler extends AbstractHandler
protected $passthruLevel;
/**
* @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler).
* @param callable|HandlerInterface $handler Handler or factory callable($record|null, $fingersCrossedHandler).
* @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action
* @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
@ -88,15 +89,7 @@ class FingersCrossedHandler extends AbstractHandler
if ($this->stopBuffering) {
$this->buffering = false;
}
if (!$this->handler instanceof HandlerInterface) {
$record = end($this->buffer) ?: null;
$this->handler = call_user_func($this->handler, $record, $this);
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}
}
$this->handler->handleBatch($this->buffer);
$this->getHandler(end($this->buffer) ?: null)->handleBatch($this->buffer);
$this->buffer = array();
}
@ -120,7 +113,7 @@ class FingersCrossedHandler extends AbstractHandler
$this->activate();
}
} else {
$this->handler->handle($record);
$this->getHandler($record)->handle($record);
}
return false === $this->bubble;
@ -140,8 +133,8 @@ class FingersCrossedHandler extends AbstractHandler
parent::reset();
if ($this->handler instanceof ResettableInterface) {
$this->handler->reset();
if ($this->getHandler() instanceof ResettableInterface) {
$this->getHandler()->reset();
}
}
@ -167,11 +160,48 @@ class FingersCrossedHandler extends AbstractHandler
return $record['level'] >= $level;
});
if (count($this->buffer) > 0) {
$this->handler->handleBatch($this->buffer);
$this->getHandler(end($this->buffer) ?: null)->handleBatch($this->buffer);
}
}
$this->buffer = array();
$this->buffering = true;
}
/**
* Return the nested handler
*
* If the handler was provided as a factory callable, this will trigger the handler's instantiation.
*
* @return HandlerInterface
*/
public function getHandler(array $record = null)
{
if (!$this->handler instanceof HandlerInterface) {
$this->handler = call_user_func($this->handler, $record, $this);
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}
}
return $this->handler;
}
/**
* {@inheritdoc}
*/
public function setFormatter(FormatterInterface $formatter)
{
$this->getHandler()->setFormatter($formatter);
return $this;
}
/**
* {@inheritdoc}
*/
public function getFormatter()
{
return $this->getHandler()->getFormatter();
}
}

View File

@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Utils;
use Monolog\Formatter\FlowdockFormatter;
use Monolog\Formatter\FormatterInterface;
@ -105,7 +106,7 @@ class FlowdockHandler extends SocketHandler
*/
private function buildContent($record)
{
return json_encode($record['formatted']['flowdock']);
return Utils::jsonEncode($record['formatted']['flowdock']);
}
/**

View File

@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Utils;
/**
* IFTTTHandler uses cURL to trigger IFTTT Maker actions
@ -53,7 +54,7 @@ class IFTTTHandler extends AbstractProcessingHandler
"value2" => $record["level_name"],
"value3" => $record["message"],
);
$postString = json_encode($postData);
$postString = Utils::jsonEncode($postData);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->eventName . "/with/key/" . $this->secretKey);

View File

@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Utils;
use Monolog\Formatter\NormalizerFormatter;
/**
@ -190,7 +191,7 @@ class NewRelicHandler extends AbstractProcessingHandler
if (null === $value || is_scalar($value)) {
newrelic_add_custom_parameter($key, $value);
} else {
newrelic_add_custom_parameter($key, @json_encode($value));
newrelic_add_custom_parameter($key, Utils::jsonEncode($value, null, true));
}
}

View File

@ -14,6 +14,7 @@ namespace Monolog\Handler;
use Exception;
use Monolog\Formatter\LineFormatter;
use Monolog\Logger;
use Monolog\Utils;
use PhpConsole\Connector;
use PhpConsole\Handler;
use PhpConsole\Helper;
@ -188,7 +189,7 @@ class PHPConsoleHandler extends AbstractProcessingHandler
$tags = $this->getRecordTags($record);
$message = $record['message'];
if ($record['context']) {
$message .= ' ' . json_encode($this->connector->getDumper()->dump(array_filter($record['context'])));
$message .= ' ' . Utils::jsonEncode($this->connector->getDumper()->dump(array_filter($record['context'])), null, true);
}
$this->connector->getDebugDispatcher()->dispatchDebug($message, $tags, $this->options['classesPartialsTraceIgnore']);
}

View File

@ -73,7 +73,8 @@ class RedisHandler extends AbstractProcessingHandler
protected function writeCapped(array $record)
{
if ($this->redisClient instanceof \Redis) {
$this->redisClient->multi()
$mode = defined('\Redis::MULTI') ? \Redis::MULTI : 1;
$this->redisClient->multi($mode)
->rpush($this->redisKey, $record["formatted"])
->ltrim($this->redisKey, -$this->capSize, -1)
->exec();

View File

@ -11,6 +11,8 @@
namespace Monolog\Handler;
use Monolog\Formatter\FormatterInterface;
/**
* Sampling handler
*
@ -38,7 +40,7 @@ class SamplingHandler extends AbstractHandler
protected $factor;
/**
* @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler).
* @param callable|HandlerInterface $handler Handler or factory callable($record|null, $samplingHandler).
* @param int $factor Sample factor
*/
public function __construct($handler, $factor)
@ -54,29 +56,58 @@ class SamplingHandler extends AbstractHandler
public function isHandling(array $record)
{
return $this->handler->isHandling($record);
return $this->getHandler($record)->isHandling($record);
}
public function handle(array $record)
{
if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) {
// The same logic as in FingersCrossedHandler
if (!$this->handler instanceof HandlerInterface) {
$this->handler = call_user_func($this->handler, $record, $this);
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}
}
if ($this->processors) {
foreach ($this->processors as $processor) {
$record = call_user_func($processor, $record);
}
}
$this->handler->handle($record);
$this->getHandler($record)->handle($record);
}
return false === $this->bubble;
}
/**
* Return the nested handler
*
* If the handler was provided as a factory callable, this will trigger the handler's instantiation.
*
* @return HandlerInterface
*/
public function getHandler(array $record = null)
{
if (!$this->handler instanceof HandlerInterface) {
$this->handler = call_user_func($this->handler, $record, $this);
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}
}
return $this->handler;
}
/**
* {@inheritdoc}
*/
public function setFormatter(FormatterInterface $formatter)
{
$this->getHandler()->setFormatter($formatter);
return $this;
}
/**
* {@inheritdoc}
*/
public function getFormatter()
{
return $this->getHandler()->getFormatter();
}
}

View File

@ -12,6 +12,7 @@
namespace Monolog\Handler\Slack;
use Monolog\Logger;
use Monolog\Utils;
use Monolog\Formatter\NormalizerFormatter;
use Monolog\Formatter\FormatterInterface;
@ -207,13 +208,17 @@ class SlackRecord
{
$normalized = $this->normalizerFormatter->format($fields);
$prettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
$flags = 0;
if (PHP_VERSION_ID >= 50400) {
$flags = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
}
$hasSecondDimension = count(array_filter($normalized, 'is_array'));
$hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric'));
return $hasSecondDimension || $hasNonNumericKeys
? json_encode($normalized, $prettyPrintFlag)
: json_encode($normalized);
? Utils::jsonEncode($normalized, $prettyPrintFlag | $flags)
: Utils::jsonEncode($normalized, $flags);
}
/**

View File

@ -13,6 +13,7 @@ namespace Monolog\Handler;
use Monolog\Formatter\FormatterInterface;
use Monolog\Logger;
use Monolog\Utils;
use Monolog\Handler\Slack\SlackRecord;
/**
@ -118,7 +119,7 @@ class SlackHandler extends SocketHandler
$dataArray['token'] = $this->token;
if (!empty($dataArray['attachments'])) {
$dataArray['attachments'] = json_encode($dataArray['attachments']);
$dataArray['attachments'] = Utils::jsonEncode($dataArray['attachments']);
}
return $dataArray;

View File

@ -13,6 +13,7 @@ namespace Monolog\Handler;
use Monolog\Formatter\FormatterInterface;
use Monolog\Logger;
use Monolog\Utils;
use Monolog\Handler\Slack\SlackRecord;
/**
@ -83,7 +84,7 @@ class SlackWebhookHandler extends AbstractProcessingHandler
protected function write(array $record)
{
$postData = $this->slackRecord->getSlackData($record);
$postString = json_encode($postData);
$postString = Utils::jsonEncode($postData);
$ch = curl_init();
$options = array(

View File

@ -527,8 +527,13 @@ class Logger implements LoggerInterface, ResettableInterface
*/
public static function toMonologLevel($level)
{
if (is_string($level) && defined(__CLASS__.'::'.strtoupper($level))) {
return constant(__CLASS__.'::'.strtoupper($level));
if (is_string($level)) {
// Contains chars of all log levels and avoids using strtoupper() which may have
// strange results depending on locale (for example, "i" will become "İ")
$upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY');
if (defined(__CLASS__.'::'.$upper)) {
return constant(__CLASS__ . '::' . $upper);
}
}
return $level;

View File

@ -22,4 +22,138 @@ class Utils
return 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class;
}
/**
* Return the JSON representation of a value
*
* @param mixed $data
* @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
* @param bool $ignoreErrors whether to ignore encoding errors or to throw on error, when ignored and the encoding fails, "null" is returned which is valid json for null
* @throws \RuntimeException if encoding fails and errors are not ignored
* @return string
*/
public static function jsonEncode($data, $encodeFlags = null, $ignoreErrors = false)
{
if (null === $encodeFlags && version_compare(PHP_VERSION, '5.4.0', '>=')) {
$encodeFlags = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
}
if ($ignoreErrors) {
$json = @json_encode($data, $encodeFlags);
if (false === $json) {
return 'null';
}
return $json;
}
$json = json_encode($data, $encodeFlags);
if (false === $json) {
$json = self::handleJsonError(json_last_error(), $data);
}
return $json;
}
/**
* Handle a json_encode failure.
*
* If the failure is due to invalid string encoding, try to clean the
* input and encode again. If the second encoding attempt fails, the
* inital error is not encoding related or the input can't be cleaned then
* raise a descriptive exception.
*
* @param int $code return code of json_last_error function
* @param mixed $data data that was meant to be encoded
* @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
* @throws \RuntimeException if failure can't be corrected
* @return string JSON encoded data after error correction
*/
public static function handleJsonError($code, $data, $encodeFlags = null)
{
if ($code !== JSON_ERROR_UTF8) {
self::throwEncodeError($code, $data);
}
if (is_string($data)) {
self::detectAndCleanUtf8($data);
} elseif (is_array($data)) {
array_walk_recursive($data, array('Monolog\Utils', 'detectAndCleanUtf8'));
} else {
self::throwEncodeError($code, $data);
}
if (null === $encodeFlags && version_compare(PHP_VERSION, '5.4.0', '>=')) {
$encodeFlags = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
}
$json = json_encode($data, $encodeFlags);
if ($json === false) {
self::throwEncodeError(json_last_error(), $data);
}
return $json;
}
/**
* Throws an exception according to a given code with a customized message
*
* @param int $code return code of json_last_error function
* @param mixed $data data that was meant to be encoded
* @throws \RuntimeException
*/
private static function throwEncodeError($code, $data)
{
switch ($code) {
case JSON_ERROR_DEPTH:
$msg = 'Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
$msg = 'Underflow or the modes mismatch';
break;
case JSON_ERROR_CTRL_CHAR:
$msg = 'Unexpected control character found';
break;
case JSON_ERROR_UTF8:
$msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
$msg = 'Unknown error';
}
throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true));
}
/**
* Detect invalid UTF-8 string characters and convert to valid UTF-8.
*
* Valid UTF-8 input will be left unmodified, but strings containing
* invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed
* original encoding of ISO-8859-15. This conversion may result in
* incorrect output if the actual encoding was not ISO-8859-15, but it
* will be clean UTF-8 output and will not rely on expensive and fragile
* detection algorithms.
*
* Function converts the input in place in the passed variable so that it
* can be used as a callback for array_walk_recursive.
*
* @param mixed &$data Input to check and convert if needed
* @private
*/
public static function detectAndCleanUtf8(&$data)
{
if (is_string($data) && !preg_match('//u', $data)) {
$data = preg_replace_callback(
'/[\x80-\xFF]+/',
function ($m) { return utf8_encode($m[0]); },
$data
);
$data = str_replace(
array('¤', '¦', '¨', '´', '¸', '¼', '½', '¾'),
array('€', 'Š', 'š', 'Ž', 'ž', 'Œ', 'œ', 'Ÿ'),
$data
);
}
}
}

View File

@ -2762,7 +2762,7 @@ class RSA
// if $m is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error
// be output.
$emLen = ($emBits + 1) >> 3; // ie. ceil($emBits / 8);
$emLen = ($emBits + 7) >> 3; // ie. ceil($emBits / 8);
$sLen = $this->sLen !== null ? $this->sLen : $this->hLen;
$mHash = $this->hash->hash($m);
@ -2840,7 +2840,7 @@ class RSA
// RSA verification
$modBits = 8 * $this->k;
$modBits = strlen($this->modulus->toBits());
$s2 = $this->_os2ip($s);
$m2 = $this->_rsavp1($s2);
@ -2848,7 +2848,7 @@ class RSA
user_error('Invalid signature');
return false;
}
$em = $this->_i2osp($m2, $modBits >> 3);
$em = $this->_i2osp($m2, $this->k);
if ($em === false) {
user_error('Invalid signature');
return false;

View File

@ -97,7 +97,10 @@ class Random
$fp = @fopen('/dev/urandom', 'rb');
}
if ($fp !== true && $fp !== false) { // surprisingly faster than !is_bool() or is_resource()
return fread($fp, $length);
$temp = fread($fp, $length);
if (strlen($temp) == $length) {
return $temp;
}
}
// method 3. pretty much does the same thing as method 2 per the following url:
// https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/ext/mcrypt/mcrypt.c#L1391

View File

@ -22,8 +22,8 @@ interface LoggerInterface
/**
* System is unusable.
*
* @param string $message
* @param array $context
* @param string $message
* @param mixed[] $context
*
* @return void
*/
@ -35,8 +35,8 @@ interface LoggerInterface
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
* @param string $message
* @param mixed[] $context
*
* @return void
*/
@ -47,8 +47,8 @@ interface LoggerInterface
*
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
* @param string $message
* @param mixed[] $context
*
* @return void
*/
@ -58,8 +58,8 @@ interface LoggerInterface
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string $message
* @param array $context
* @param string $message
* @param mixed[] $context
*
* @return void
*/
@ -71,8 +71,8 @@ interface LoggerInterface
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
* @param string $message
* @param mixed[] $context
*
* @return void
*/
@ -81,8 +81,8 @@ interface LoggerInterface
/**
* Normal but significant events.
*
* @param string $message
* @param array $context
* @param string $message
* @param mixed[] $context
*
* @return void
*/
@ -93,8 +93,8 @@ interface LoggerInterface
*
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
* @param string $message
* @param mixed[] $context
*
* @return void
*/
@ -103,8 +103,8 @@ interface LoggerInterface
/**
* Detailed debug information.
*
* @param string $message
* @param array $context
* @param string $message
* @param mixed[] $context
*
* @return void
*/
@ -113,9 +113,9 @@ interface LoggerInterface
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
* @param mixed $level
* @param string $message
* @param mixed[] $context
*
* @return void
*

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class AccountApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -279,9 +284,16 @@ class AccountApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -238,19 +238,19 @@ class AttributesApi
protected function createAttributeRequest($attributeCategory, $attributeName, $createAttribute)
{
// verify the required parameter 'attributeCategory' is set
if ($attributeCategory === null) {
if ($attributeCategory === null || (is_array($attributeCategory) && count($attributeCategory) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeCategory when calling createAttribute'
);
}
// verify the required parameter 'attributeName' is set
if ($attributeName === null) {
if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeName when calling createAttribute'
);
}
// verify the required parameter 'createAttribute' is set
if ($createAttribute === null) {
if ($createAttribute === null || (is_array($createAttribute) && count($createAttribute) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $createAttribute when calling createAttribute'
);
@ -302,9 +302,16 @@ class AttributesApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -517,13 +524,13 @@ class AttributesApi
protected function deleteAttributeRequest($attributeCategory, $attributeName)
{
// verify the required parameter 'attributeCategory' is set
if ($attributeCategory === null) {
if ($attributeCategory === null || (is_array($attributeCategory) && count($attributeCategory) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeCategory when calling deleteAttribute'
);
}
// verify the required parameter 'attributeName' is set
if ($attributeName === null) {
if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeName when calling deleteAttribute'
);
@ -572,9 +579,16 @@ class AttributesApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -825,9 +839,16 @@ class AttributesApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1045,19 +1066,19 @@ class AttributesApi
protected function updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute)
{
// verify the required parameter 'attributeCategory' is set
if ($attributeCategory === null) {
if ($attributeCategory === null || (is_array($attributeCategory) && count($attributeCategory) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeCategory when calling updateAttribute'
);
}
// verify the required parameter 'attributeName' is set
if ($attributeName === null) {
if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeName when calling updateAttribute'
);
}
// verify the required parameter 'updateAttribute' is set
if ($updateAttribute === null) {
if ($updateAttribute === null || (is_array($updateAttribute) && count($updateAttribute) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateAttribute when calling updateAttribute'
);
@ -1109,9 +1130,16 @@ class AttributesApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class ContactsApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -278,13 +283,13 @@ class ContactsApi
protected function addContactToListRequest($listId, $contactEmails)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling addContactToList'
);
}
// verify the required parameter 'contactEmails' is set
if ($contactEmails === null) {
if ($contactEmails === null || (is_array($contactEmails) && count($contactEmails) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $contactEmails when calling addContactToList'
);
@ -328,9 +333,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -540,19 +552,19 @@ class ContactsApi
protected function createAttributeRequest($attributeCategory, $attributeName, $createAttribute)
{
// verify the required parameter 'attributeCategory' is set
if ($attributeCategory === null) {
if ($attributeCategory === null || (is_array($attributeCategory) && count($attributeCategory) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeCategory when calling createAttribute'
);
}
// verify the required parameter 'attributeName' is set
if ($attributeName === null) {
if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeName when calling createAttribute'
);
}
// verify the required parameter 'createAttribute' is set
if ($createAttribute === null) {
if ($createAttribute === null || (is_array($createAttribute) && count($createAttribute) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $createAttribute when calling createAttribute'
);
@ -604,9 +616,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -851,7 +870,7 @@ class ContactsApi
protected function createContactRequest($createContact)
{
// verify the required parameter 'createContact' is set
if ($createContact === null) {
if ($createContact === null || (is_array($createContact) && count($createContact) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $createContact when calling createContact'
);
@ -887,9 +906,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1126,7 +1152,7 @@ class ContactsApi
protected function createFolderRequest($createFolder)
{
// verify the required parameter 'createFolder' is set
if ($createFolder === null) {
if ($createFolder === null || (is_array($createFolder) && count($createFolder) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $createFolder when calling createFolder'
);
@ -1162,9 +1188,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1401,7 +1434,7 @@ class ContactsApi
protected function createListRequest($createList)
{
// verify the required parameter 'createList' is set
if ($createList === null) {
if ($createList === null || (is_array($createList) && count($createList) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $createList when calling createList'
);
@ -1437,9 +1470,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1652,13 +1692,13 @@ class ContactsApi
protected function deleteAttributeRequest($attributeCategory, $attributeName)
{
// verify the required parameter 'attributeCategory' is set
if ($attributeCategory === null) {
if ($attributeCategory === null || (is_array($attributeCategory) && count($attributeCategory) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeCategory when calling deleteAttribute'
);
}
// verify the required parameter 'attributeName' is set
if ($attributeName === null) {
if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeName when calling deleteAttribute'
);
@ -1707,9 +1747,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1925,7 +1972,7 @@ class ContactsApi
protected function deleteContactRequest($email)
{
// verify the required parameter 'email' is set
if ($email === null) {
if ($email === null || (is_array($email) && count($email) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email when calling deleteContact'
);
@ -1966,9 +2013,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2176,7 +2230,7 @@ class ContactsApi
protected function deleteFolderRequest($folderId)
{
// verify the required parameter 'folderId' is set
if ($folderId === null) {
if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $folderId when calling deleteFolder'
);
@ -2217,9 +2271,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2427,7 +2488,7 @@ class ContactsApi
protected function deleteListRequest($listId)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling deleteList'
);
@ -2468,9 +2529,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2721,9 +2789,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2968,7 +3043,7 @@ class ContactsApi
protected function getContactInfoRequest($email)
{
// verify the required parameter 'email' is set
if ($email === null) {
if ($email === null || (is_array($email) && count($email) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email when calling getContactInfo'
);
@ -3009,9 +3084,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -3256,7 +3338,7 @@ class ContactsApi
protected function getContactStatsRequest($email)
{
// verify the required parameter 'email' is set
if ($email === null) {
if ($email === null || (is_array($email) && count($email) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email when calling getContactStats'
);
@ -3297,9 +3379,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -3589,9 +3678,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -3851,7 +3947,7 @@ class ContactsApi
protected function getContactsFromListRequest($listId, $modifiedSince = null, $limit = '50', $offset = '0')
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling getContactsFromList'
);
@ -3908,9 +4004,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -4155,7 +4258,7 @@ class ContactsApi
protected function getFolderRequest($folderId)
{
// verify the required parameter 'folderId' is set
if ($folderId === null) {
if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $folderId when calling getFolder'
);
@ -4196,9 +4299,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -4453,7 +4563,7 @@ class ContactsApi
protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0')
{
// verify the required parameter 'folderId' is set
if ($folderId === null) {
if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $folderId when calling getFolderLists'
);
@ -4506,9 +4616,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -4750,7 +4867,7 @@ class ContactsApi
protected function getFoldersRequest($limit, $offset)
{
// verify the required parameter 'limit' is set
if ($limit === null) {
if ($limit === null || (is_array($limit) && count($limit) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $limit when calling getFolders'
);
@ -4760,7 +4877,7 @@ class ContactsApi
}
// verify the required parameter 'offset' is set
if ($offset === null) {
if ($offset === null || (is_array($offset) && count($offset) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $offset when calling getFolders'
);
@ -4801,9 +4918,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -5048,7 +5172,7 @@ class ContactsApi
protected function getListRequest($listId)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling getList'
);
@ -5089,9 +5213,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -5372,9 +5503,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -5611,7 +5749,7 @@ class ContactsApi
protected function importContactsRequest($requestContactImport)
{
// verify the required parameter 'requestContactImport' is set
if ($requestContactImport === null) {
if ($requestContactImport === null || (is_array($requestContactImport) && count($requestContactImport) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $requestContactImport when calling importContacts'
);
@ -5647,9 +5785,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -5899,13 +6044,13 @@ class ContactsApi
protected function removeContactFromListRequest($listId, $contactEmails)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling removeContactFromList'
);
}
// verify the required parameter 'contactEmails' is set
if ($contactEmails === null) {
if ($contactEmails === null || (is_array($contactEmails) && count($contactEmails) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $contactEmails when calling removeContactFromList'
);
@ -5949,9 +6094,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -6188,7 +6340,7 @@ class ContactsApi
protected function requestContactExportRequest($requestContactExport)
{
// verify the required parameter 'requestContactExport' is set
if ($requestContactExport === null) {
if ($requestContactExport === null || (is_array($requestContactExport) && count($requestContactExport) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $requestContactExport when calling requestContactExport'
);
@ -6224,9 +6376,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -6444,19 +6603,19 @@ class ContactsApi
protected function updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute)
{
// verify the required parameter 'attributeCategory' is set
if ($attributeCategory === null) {
if ($attributeCategory === null || (is_array($attributeCategory) && count($attributeCategory) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeCategory when calling updateAttribute'
);
}
// verify the required parameter 'attributeName' is set
if ($attributeName === null) {
if ($attributeName === null || (is_array($attributeName) && count($attributeName) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attributeName when calling updateAttribute'
);
}
// verify the required parameter 'updateAttribute' is set
if ($updateAttribute === null) {
if ($updateAttribute === null || (is_array($updateAttribute) && count($updateAttribute) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateAttribute when calling updateAttribute'
);
@ -6508,9 +6667,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -6723,13 +6889,13 @@ class ContactsApi
protected function updateContactRequest($email, $updateContact)
{
// verify the required parameter 'email' is set
if ($email === null) {
if ($email === null || (is_array($email) && count($email) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email when calling updateContact'
);
}
// verify the required parameter 'updateContact' is set
if ($updateContact === null) {
if ($updateContact === null || (is_array($updateContact) && count($updateContact) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateContact when calling updateContact'
);
@ -6773,9 +6939,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -6988,13 +7161,13 @@ class ContactsApi
protected function updateFolderRequest($folderId, $updateFolder)
{
// verify the required parameter 'folderId' is set
if ($folderId === null) {
if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $folderId when calling updateFolder'
);
}
// verify the required parameter 'updateFolder' is set
if ($updateFolder === null) {
if ($updateFolder === null || (is_array($updateFolder) && count($updateFolder) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateFolder when calling updateFolder'
);
@ -7038,9 +7211,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -7253,13 +7433,13 @@ class ContactsApi
protected function updateListRequest($listId, $updateList)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling updateList'
);
}
// verify the required parameter 'updateList' is set
if ($updateList === null) {
if ($updateList === null || (is_array($updateList) && count($updateList) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateList when calling updateList'
);
@ -7303,9 +7483,16 @@ class ContactsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class EmailCampaignsApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -265,7 +270,7 @@ class EmailCampaignsApi
protected function createEmailCampaignRequest($emailCampaigns)
{
// verify the required parameter 'emailCampaigns' is set
if ($emailCampaigns === null) {
if ($emailCampaigns === null || (is_array($emailCampaigns) && count($emailCampaigns) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $emailCampaigns when calling createEmailCampaign'
);
@ -301,9 +306,16 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -511,7 +523,7 @@ class EmailCampaignsApi
protected function deleteEmailCampaignRequest($campaignId)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling deleteEmailCampaign'
);
@ -552,9 +564,16 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -804,7 +823,7 @@ class EmailCampaignsApi
protected function emailExportRecipientsRequest($campaignId, $recipientExport = null)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling emailExportRecipients'
);
@ -848,9 +867,16 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -904,6 +930,309 @@ class EmailCampaignsApi
);
}
/**
* Operation getAbTestCampaignResult
*
* Get A/B test email campaign result
*
* @param int $campaignId Id of the A/B test campaign (required)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \SendinBlue\Client\Model\AbTestCampaignResult
*/
public function getAbTestCampaignResult($campaignId)
{
list($response) = $this->getAbTestCampaignResultWithHttpInfo($campaignId);
return $response;
}
/**
* Operation getAbTestCampaignResultWithHttpInfo
*
* Get A/B test email campaign result
*
* @param int $campaignId Id of the A/B test campaign (required)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \SendinBlue\Client\Model\AbTestCampaignResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getAbTestCampaignResultWithHttpInfo($campaignId)
{
$returnType = '\SendinBlue\Client\Model\AbTestCampaignResult';
$request = $this->getAbTestCampaignResultRequest($campaignId);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}
$responseBody = $response->getBody();
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\AbTestCampaignResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\ErrorModel',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 404:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\ErrorModel',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 405:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\ErrorModel',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAbTestCampaignResultAsync
*
* Get A/B test email campaign result
*
* @param int $campaignId Id of the A/B test campaign (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAbTestCampaignResultAsync($campaignId)
{
return $this->getAbTestCampaignResultAsyncWithHttpInfo($campaignId)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAbTestCampaignResultAsyncWithHttpInfo
*
* Get A/B test email campaign result
*
* @param int $campaignId Id of the A/B test campaign (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAbTestCampaignResultAsyncWithHttpInfo($campaignId)
{
$returnType = '\SendinBlue\Client\Model\AbTestCampaignResult';
$request = $this->getAbTestCampaignResultRequest($campaignId);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
$responseBody = $response->getBody();
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}
);
}
/**
* Create request for operation 'getAbTestCampaignResult'
*
* @param int $campaignId Id of the A/B test campaign (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function getAbTestCampaignResultRequest($campaignId)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling getAbTestCampaignResult'
);
}
$resourcePath = '/emailCampaigns/{campaignId}/abTestCampaignResult';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($campaignId !== null) {
$resourcePath = str_replace(
'{' . 'campaignId' . '}',
ObjectSerializer::toPathValue($campaignId),
$resourcePath
);
}
// body params
$_tempBody = null;
if ($multipart) {
$headers = $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['application/json']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValue
];
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('api-key');
if ($apiKey !== null) {
$headers['api-key'] = $apiKey;
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('partner-key');
if ($apiKey !== null) {
$headers['partner-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$query = \GuzzleHttp\Psr7\build_query($queryParams);
return new Request(
'GET',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailCampaign
*
@ -1095,7 +1424,7 @@ class EmailCampaignsApi
protected function getEmailCampaignRequest($campaignId)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling getEmailCampaign'
);
@ -1136,9 +1465,16 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1455,9 +1791,311 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValue
];
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('api-key');
if ($apiKey !== null) {
$headers['api-key'] = $apiKey;
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('partner-key');
if ($apiKey !== null) {
$headers['partner-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$query = \GuzzleHttp\Psr7\build_query($queryParams);
return new Request(
'GET',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSharedTemplateUrl
*
* Get a shared template url
*
* @param int $campaignId Id of the campaign or template (required)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \SendinBlue\Client\Model\GetSharedTemplateUrl
*/
public function getSharedTemplateUrl($campaignId)
{
list($response) = $this->getSharedTemplateUrlWithHttpInfo($campaignId);
return $response;
}
/**
* Operation getSharedTemplateUrlWithHttpInfo
*
* Get a shared template url
*
* @param int $campaignId Id of the campaign or template (required)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \SendinBlue\Client\Model\GetSharedTemplateUrl, HTTP status code, HTTP response headers (array of strings)
*/
public function getSharedTemplateUrlWithHttpInfo($campaignId)
{
$returnType = '\SendinBlue\Client\Model\GetSharedTemplateUrl';
$request = $this->getSharedTemplateUrlRequest($campaignId);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}
$responseBody = $response->getBody();
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\GetSharedTemplateUrl',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\ErrorModel',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 404:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\ErrorModel',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSharedTemplateUrlAsync
*
* Get a shared template url
*
* @param int $campaignId Id of the campaign or template (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSharedTemplateUrlAsync($campaignId)
{
return $this->getSharedTemplateUrlAsyncWithHttpInfo($campaignId)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSharedTemplateUrlAsyncWithHttpInfo
*
* Get a shared template url
*
* @param int $campaignId Id of the campaign or template (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSharedTemplateUrlAsyncWithHttpInfo($campaignId)
{
$returnType = '\SendinBlue\Client\Model\GetSharedTemplateUrl';
$request = $this->getSharedTemplateUrlRequest($campaignId);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
$responseBody = $response->getBody();
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}
);
}
/**
* Create request for operation 'getSharedTemplateUrl'
*
* @param int $campaignId Id of the campaign or template (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function getSharedTemplateUrlRequest($campaignId)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling getSharedTemplateUrl'
);
}
$resourcePath = '/emailCampaigns/{campaignId}/sharedUrl';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($campaignId !== null) {
$resourcePath = str_replace(
'{' . 'campaignId' . '}',
ObjectSerializer::toPathValue($campaignId),
$resourcePath
);
}
// body params
$_tempBody = null;
if ($multipart) {
$headers = $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['application/json']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1514,7 +2152,7 @@ class EmailCampaignsApi
/**
* Operation sendEmailCampaignNow
*
* Send an email campaign id of the campaign immediately
* Send an email campaign immediately, based on campaignId
*
* @param int $campaignId Id of the campaign (required)
*
@ -1530,7 +2168,7 @@ class EmailCampaignsApi
/**
* Operation sendEmailCampaignNowWithHttpInfo
*
* Send an email campaign id of the campaign immediately
* Send an email campaign immediately, based on campaignId
*
* @param int $campaignId Id of the campaign (required)
*
@ -1607,7 +2245,7 @@ class EmailCampaignsApi
/**
* Operation sendEmailCampaignNowAsync
*
* Send an email campaign id of the campaign immediately
* Send an email campaign immediately, based on campaignId
*
* @param int $campaignId Id of the campaign (required)
*
@ -1627,7 +2265,7 @@ class EmailCampaignsApi
/**
* Operation sendEmailCampaignNowAsyncWithHttpInfo
*
* Send an email campaign id of the campaign immediately
* Send an email campaign immediately, based on campaignId
*
* @param int $campaignId Id of the campaign (required)
*
@ -1673,7 +2311,7 @@ class EmailCampaignsApi
protected function sendEmailCampaignNowRequest($campaignId)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling sendEmailCampaignNow'
);
@ -1714,9 +2352,16 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1929,13 +2574,13 @@ class EmailCampaignsApi
protected function sendReportRequest($campaignId, $sendReport)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling sendReport'
);
}
// verify the required parameter 'sendReport' is set
if ($sendReport === null) {
if ($sendReport === null || (is_array($sendReport) && count($sendReport) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $sendReport when calling sendReport'
);
@ -1979,9 +2624,16 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2194,13 +2846,13 @@ class EmailCampaignsApi
protected function sendTestEmailRequest($campaignId, $emailTo)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling sendTestEmail'
);
}
// verify the required parameter 'emailTo' is set
if ($emailTo === null) {
if ($emailTo === null || (is_array($emailTo) && count($emailTo) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $emailTo when calling sendTestEmail'
);
@ -2244,9 +2896,16 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2459,13 +3118,13 @@ class EmailCampaignsApi
protected function updateCampaignStatusRequest($campaignId, $status)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling updateCampaignStatus'
);
}
// verify the required parameter 'status' is set
if ($status === null) {
if ($status === null || (is_array($status) && count($status) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $status when calling updateCampaignStatus'
);
@ -2509,9 +3168,16 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2724,13 +3390,13 @@ class EmailCampaignsApi
protected function updateEmailCampaignRequest($campaignId, $emailCampaign)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling updateEmailCampaign'
);
}
// verify the required parameter 'emailCampaign' is set
if ($emailCampaign === null) {
if ($emailCampaign === null || (is_array($emailCampaign) && count($emailCampaign) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $emailCampaign when calling updateEmailCampaign'
);
@ -2774,9 +3440,16 @@ class EmailCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class FoldersApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -265,7 +270,7 @@ class FoldersApi
protected function createFolderRequest($createFolder)
{
// verify the required parameter 'createFolder' is set
if ($createFolder === null) {
if ($createFolder === null || (is_array($createFolder) && count($createFolder) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $createFolder when calling createFolder'
);
@ -301,9 +306,16 @@ class FoldersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -511,7 +523,7 @@ class FoldersApi
protected function deleteFolderRequest($folderId)
{
// verify the required parameter 'folderId' is set
if ($folderId === null) {
if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $folderId when calling deleteFolder'
);
@ -552,9 +564,16 @@ class FoldersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -799,7 +818,7 @@ class FoldersApi
protected function getFolderRequest($folderId)
{
// verify the required parameter 'folderId' is set
if ($folderId === null) {
if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $folderId when calling getFolder'
);
@ -840,9 +859,16 @@ class FoldersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1097,7 +1123,7 @@ class FoldersApi
protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0')
{
// verify the required parameter 'folderId' is set
if ($folderId === null) {
if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $folderId when calling getFolderLists'
);
@ -1150,9 +1176,16 @@ class FoldersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1394,7 +1427,7 @@ class FoldersApi
protected function getFoldersRequest($limit, $offset)
{
// verify the required parameter 'limit' is set
if ($limit === null) {
if ($limit === null || (is_array($limit) && count($limit) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $limit when calling getFolders'
);
@ -1404,7 +1437,7 @@ class FoldersApi
}
// verify the required parameter 'offset' is set
if ($offset === null) {
if ($offset === null || (is_array($offset) && count($offset) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $offset when calling getFolders'
);
@ -1445,9 +1478,16 @@ class FoldersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1660,13 +1700,13 @@ class FoldersApi
protected function updateFolderRequest($folderId, $updateFolder)
{
// verify the required parameter 'folderId' is set
if ($folderId === null) {
if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $folderId when calling updateFolder'
);
}
// verify the required parameter 'updateFolder' is set
if ($updateFolder === null) {
if ($updateFolder === null || (is_array($updateFolder) && count($updateFolder) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateFolder when calling updateFolder'
);
@ -1710,9 +1750,16 @@ class FoldersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class ListsApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -278,13 +283,13 @@ class ListsApi
protected function addContactToListRequest($listId, $contactEmails)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling addContactToList'
);
}
// verify the required parameter 'contactEmails' is set
if ($contactEmails === null) {
if ($contactEmails === null || (is_array($contactEmails) && count($contactEmails) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $contactEmails when calling addContactToList'
);
@ -328,9 +333,16 @@ class ListsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -567,7 +579,7 @@ class ListsApi
protected function createListRequest($createList)
{
// verify the required parameter 'createList' is set
if ($createList === null) {
if ($createList === null || (is_array($createList) && count($createList) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $createList when calling createList'
);
@ -603,9 +615,16 @@ class ListsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -813,7 +832,7 @@ class ListsApi
protected function deleteListRequest($listId)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling deleteList'
);
@ -854,9 +873,16 @@ class ListsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1116,7 +1142,7 @@ class ListsApi
protected function getContactsFromListRequest($listId, $modifiedSince = null, $limit = '50', $offset = '0')
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling getContactsFromList'
);
@ -1173,9 +1199,16 @@ class ListsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1430,7 +1463,7 @@ class ListsApi
protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0')
{
// verify the required parameter 'folderId' is set
if ($folderId === null) {
if ($folderId === null || (is_array($folderId) && count($folderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $folderId when calling getFolderLists'
);
@ -1483,9 +1516,16 @@ class ListsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1730,7 +1770,7 @@ class ListsApi
protected function getListRequest($listId)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling getList'
);
@ -1771,9 +1811,16 @@ class ListsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2054,9 +2101,16 @@ class ListsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2306,13 +2360,13 @@ class ListsApi
protected function removeContactFromListRequest($listId, $contactEmails)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling removeContactFromList'
);
}
// verify the required parameter 'contactEmails' is set
if ($contactEmails === null) {
if ($contactEmails === null || (is_array($contactEmails) && count($contactEmails) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $contactEmails when calling removeContactFromList'
);
@ -2356,9 +2410,16 @@ class ListsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2571,13 +2632,13 @@ class ListsApi
protected function updateListRequest($listId, $updateList)
{
// verify the required parameter 'listId' is set
if ($listId === null) {
if ($listId === null || (is_array($listId) && count($listId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $listId when calling updateList'
);
}
// verify the required parameter 'updateList' is set
if ($updateList === null) {
if ($updateList === null || (is_array($updateList) && count($updateList) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateList when calling updateList'
);
@ -2621,9 +2682,16 @@ class ListsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class ProcessApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -273,7 +278,7 @@ class ProcessApi
protected function getProcessRequest($processId)
{
// verify the required parameter 'processId' is set
if ($processId === null) {
if ($processId === null || (is_array($processId) && count($processId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $processId when calling getProcess'
);
@ -314,9 +319,16 @@ class ProcessApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -597,9 +609,16 @@ class ProcessApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class ResellerApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -286,13 +291,13 @@ class ResellerApi
protected function addCreditsRequest($childAuthKey, $addCredits)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling addCredits'
);
}
// verify the required parameter 'addCredits' is set
if ($addCredits === null) {
if ($addCredits === null || (is_array($addCredits) && count($addCredits) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $addCredits when calling addCredits'
);
@ -336,9 +341,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -551,13 +563,13 @@ class ResellerApi
protected function associateIpToChildRequest($childAuthKey, $ip)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling associateIpToChild'
);
}
// verify the required parameter 'ip' is set
if ($ip === null) {
if ($ip === null || (is_array($ip) && count($ip) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $ip when calling associateIpToChild'
);
@ -601,9 +613,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -663,7 +682,7 @@ class ResellerApi
* Creates a domain for a child account
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
@ -680,7 +699,7 @@ class ResellerApi
* Creates a domain for a child account
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
@ -758,7 +777,7 @@ class ResellerApi
* Creates a domain for a child account
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
@ -779,7 +798,7 @@ class ResellerApi
* Creates a domain for a child account
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
@ -816,7 +835,7 @@ class ResellerApi
* Create request for operation 'createChildDomain'
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
* @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account. This will not be displayed to the parent account. (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
@ -824,13 +843,13 @@ class ResellerApi
protected function createChildDomainRequest($childAuthKey, $addChildDomain)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling createChildDomain'
);
}
// verify the required parameter 'addChildDomain' is set
if ($addChildDomain === null) {
if ($addChildDomain === null || (is_array($addChildDomain) && count($addChildDomain) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $addChildDomain when calling createChildDomain'
);
@ -874,9 +893,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1151,9 +1177,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1374,13 +1407,13 @@ class ResellerApi
protected function deleteChildDomainRequest($childAuthKey, $domainName)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling deleteChildDomain'
);
}
// verify the required parameter 'domainName' is set
if ($domainName === null) {
if ($domainName === null || (is_array($domainName) && count($domainName) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $domainName when calling deleteChildDomain'
);
@ -1429,9 +1462,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1647,7 +1687,7 @@ class ResellerApi
protected function deleteResellerChildRequest($childAuthKey)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling deleteResellerChild'
);
@ -1688,9 +1728,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1903,13 +1950,13 @@ class ResellerApi
protected function dissociateIpFromChildRequest($childAuthKey, $ip)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling dissociateIpFromChild'
);
}
// verify the required parameter 'ip' is set
if ($ip === null) {
if ($ip === null || (is_array($ip) && count($ip) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $ip when calling dissociateIpFromChild'
);
@ -1953,9 +2000,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2009,6 +2063,309 @@ class ResellerApi
);
}
/**
* Operation getChildAccountCreationStatus
*
* Returns the status of reseller's child account creation, whether it is successfully created (exists) or not based on the childAuthKey supplied
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \SendinBlue\Client\Model\GetChildAccountCreationStatus
*/
public function getChildAccountCreationStatus($childAuthKey)
{
list($response) = $this->getChildAccountCreationStatusWithHttpInfo($childAuthKey);
return $response;
}
/**
* Operation getChildAccountCreationStatusWithHttpInfo
*
* Returns the status of reseller's child account creation, whether it is successfully created (exists) or not based on the childAuthKey supplied
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \SendinBlue\Client\Model\GetChildAccountCreationStatus, HTTP status code, HTTP response headers (array of strings)
*/
public function getChildAccountCreationStatusWithHttpInfo($childAuthKey)
{
$returnType = '\SendinBlue\Client\Model\GetChildAccountCreationStatus';
$request = $this->getChildAccountCreationStatusRequest($childAuthKey);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}
$responseBody = $response->getBody();
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\GetChildAccountCreationStatus',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\ErrorModel',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 403:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\ErrorModel',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 404:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\SendinBlue\Client\Model\ErrorModel',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getChildAccountCreationStatusAsync
*
* Returns the status of reseller's child account creation, whether it is successfully created (exists) or not based on the childAuthKey supplied
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getChildAccountCreationStatusAsync($childAuthKey)
{
return $this->getChildAccountCreationStatusAsyncWithHttpInfo($childAuthKey)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getChildAccountCreationStatusAsyncWithHttpInfo
*
* Returns the status of reseller's child account creation, whether it is successfully created (exists) or not based on the childAuthKey supplied
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getChildAccountCreationStatusAsyncWithHttpInfo($childAuthKey)
{
$returnType = '\SendinBlue\Client\Model\GetChildAccountCreationStatus';
$request = $this->getChildAccountCreationStatusRequest($childAuthKey);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
$responseBody = $response->getBody();
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}
);
}
/**
* Create request for operation 'getChildAccountCreationStatus'
*
* @param string $childAuthKey auth key of reseller&#39;s child (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function getChildAccountCreationStatusRequest($childAuthKey)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling getChildAccountCreationStatus'
);
}
$resourcePath = '/reseller/children/{childAuthKey}/accountCreationStatus';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($childAuthKey !== null) {
$resourcePath = str_replace(
'{' . 'childAuthKey' . '}',
ObjectSerializer::toPathValue($childAuthKey),
$resourcePath
);
}
// body params
$_tempBody = null;
if ($multipart) {
$headers = $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['application/json']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValue
];
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('api-key');
if ($apiKey !== null) {
$headers['api-key'] = $apiKey;
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('partner-key');
if ($apiKey !== null) {
$headers['partner-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$query = \GuzzleHttp\Psr7\build_query($queryParams);
return new Request(
'GET',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getChildDomains
*
@ -2208,7 +2565,7 @@ class ResellerApi
protected function getChildDomainsRequest($childAuthKey)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling getChildDomains'
);
@ -2249,9 +2606,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2504,7 +2868,7 @@ class ResellerApi
protected function getChildInfoRequest($childAuthKey)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling getChildInfo'
);
@ -2545,9 +2909,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2606,14 +2977,16 @@ class ResellerApi
*
* Gets the list of all reseller's children accounts
*
* @param int $limit Number of documents for child accounts information per page (optional, default to 10)
* @param int $offset Index of the first document in the page (optional, default to 0)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \SendinBlue\Client\Model\GetChildrenList
*/
public function getResellerChilds()
public function getResellerChilds($limit = '10', $offset = '0')
{
list($response) = $this->getResellerChildsWithHttpInfo();
list($response) = $this->getResellerChildsWithHttpInfo($limit, $offset);
return $response;
}
@ -2622,15 +2995,17 @@ class ResellerApi
*
* Gets the list of all reseller's children accounts
*
* @param int $limit Number of documents for child accounts information per page (optional, default to 10)
* @param int $offset Index of the first document in the page (optional, default to 0)
*
* @throws \SendinBlue\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \SendinBlue\Client\Model\GetChildrenList, HTTP status code, HTTP response headers (array of strings)
*/
public function getResellerChildsWithHttpInfo()
public function getResellerChildsWithHttpInfo($limit = '10', $offset = '0')
{
$returnType = '\SendinBlue\Client\Model\GetChildrenList';
$request = $this->getResellerChildsRequest();
$request = $this->getResellerChildsRequest($limit, $offset);
try {
$options = $this->createHttpClientOption();
@ -2704,13 +3079,15 @@ class ResellerApi
*
* Gets the list of all reseller's children accounts
*
* @param int $limit Number of documents for child accounts information per page (optional, default to 10)
* @param int $offset Index of the first document in the page (optional, default to 0)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getResellerChildsAsync()
public function getResellerChildsAsync($limit = '10', $offset = '0')
{
return $this->getResellerChildsAsyncWithHttpInfo()
return $this->getResellerChildsAsyncWithHttpInfo($limit, $offset)
->then(
function ($response) {
return $response[0];
@ -2723,14 +3100,16 @@ class ResellerApi
*
* Gets the list of all reseller's children accounts
*
* @param int $limit Number of documents for child accounts information per page (optional, default to 10)
* @param int $offset Index of the first document in the page (optional, default to 0)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getResellerChildsAsyncWithHttpInfo()
public function getResellerChildsAsyncWithHttpInfo($limit = '10', $offset = '0')
{
$returnType = '\SendinBlue\Client\Model\GetChildrenList';
$request = $this->getResellerChildsRequest();
$request = $this->getResellerChildsRequest($limit, $offset);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
@ -2772,12 +3151,18 @@ class ResellerApi
/**
* Create request for operation 'getResellerChilds'
*
* @param int $limit Number of documents for child accounts information per page (optional, default to 10)
* @param int $offset Index of the first document in the page (optional, default to 0)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function getResellerChildsRequest()
protected function getResellerChildsRequest($limit = '10', $offset = '0')
{
if ($limit !== null && $limit > 20) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling ResellerApi.getResellerChilds, must be smaller than or equal to 20.');
}
$resourcePath = '/reseller/children';
$formParams = [];
@ -2786,6 +3171,14 @@ class ResellerApi
$httpBody = '';
$multipart = false;
// query params
if ($limit !== null) {
$queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
}
// query params
if ($offset !== null) {
$queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
}
// body params
@ -2806,9 +3199,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -3061,7 +3461,7 @@ class ResellerApi
protected function getSsoTokenRequest($childAuthKey)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling getSsoToken'
);
@ -3102,9 +3502,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -3362,13 +3769,13 @@ class ResellerApi
protected function removeCreditsRequest($childAuthKey, $removeCredits)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling removeCredits'
);
}
// verify the required parameter 'removeCredits' is set
if ($removeCredits === null) {
if ($removeCredits === null || (is_array($removeCredits) && count($removeCredits) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $removeCredits when calling removeCredits'
);
@ -3412,9 +3819,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -3635,13 +4049,13 @@ class ResellerApi
protected function updateChildAccountStatusRequest($childAuthKey, $updateChildAccountStatus)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling updateChildAccountStatus'
);
}
// verify the required parameter 'updateChildAccountStatus' is set
if ($updateChildAccountStatus === null) {
if ($updateChildAccountStatus === null || (is_array($updateChildAccountStatus) && count($updateChildAccountStatus) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateChildAccountStatus when calling updateChildAccountStatus'
);
@ -3685,9 +4099,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -3913,19 +4334,19 @@ class ResellerApi
protected function updateChildDomainRequest($childAuthKey, $domainName, $updateChildDomain)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling updateChildDomain'
);
}
// verify the required parameter 'domainName' is set
if ($domainName === null) {
if ($domainName === null || (is_array($domainName) && count($domainName) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $domainName when calling updateChildDomain'
);
}
// verify the required parameter 'updateChildDomain' is set
if ($updateChildDomain === null) {
if ($updateChildDomain === null || (is_array($updateChildDomain) && count($updateChildDomain) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateChildDomain when calling updateChildDomain'
);
@ -3977,9 +4398,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -4200,13 +4628,13 @@ class ResellerApi
protected function updateResellerChildRequest($childAuthKey, $resellerChild)
{
// verify the required parameter 'childAuthKey' is set
if ($childAuthKey === null) {
if ($childAuthKey === null || (is_array($childAuthKey) && count($childAuthKey) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $childAuthKey when calling updateResellerChild'
);
}
// verify the required parameter 'resellerChild' is set
if ($resellerChild === null) {
if ($resellerChild === null || (is_array($resellerChild) && count($resellerChild) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $resellerChild when calling updateResellerChild'
);
@ -4250,9 +4678,16 @@ class ResellerApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class SMSCampaignsApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -265,7 +270,7 @@ class SMSCampaignsApi
protected function createSmsCampaignRequest($createSmsCampaign)
{
// verify the required parameter 'createSmsCampaign' is set
if ($createSmsCampaign === null) {
if ($createSmsCampaign === null || (is_array($createSmsCampaign) && count($createSmsCampaign) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $createSmsCampaign when calling createSmsCampaign'
);
@ -301,9 +306,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -511,7 +523,7 @@ class SMSCampaignsApi
protected function deleteSmsCampaignRequest($campaignId)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling deleteSmsCampaign'
);
@ -552,9 +564,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -799,7 +818,7 @@ class SMSCampaignsApi
protected function getSmsCampaignRequest($campaignId)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling getSmsCampaign'
);
@ -840,9 +859,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1150,9 +1176,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1402,7 +1435,7 @@ class SMSCampaignsApi
protected function requestSmsRecipientExportRequest($campaignId, $recipientExport = null)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling requestSmsRecipientExport'
);
@ -1446,9 +1479,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1664,7 +1704,7 @@ class SMSCampaignsApi
protected function sendSmsCampaignNowRequest($campaignId)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling sendSmsCampaignNow'
);
@ -1705,9 +1745,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1920,13 +1967,13 @@ class SMSCampaignsApi
protected function sendSmsReportRequest($campaignId, $sendReport)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling sendSmsReport'
);
}
// verify the required parameter 'sendReport' is set
if ($sendReport === null) {
if ($sendReport === null || (is_array($sendReport) && count($sendReport) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $sendReport when calling sendSmsReport'
);
@ -1970,9 +2017,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2185,13 +2239,13 @@ class SMSCampaignsApi
protected function sendTestSmsRequest($campaignId, $phoneNumber)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling sendTestSms'
);
}
// verify the required parameter 'phoneNumber' is set
if ($phoneNumber === null) {
if ($phoneNumber === null || (is_array($phoneNumber) && count($phoneNumber) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $phoneNumber when calling sendTestSms'
);
@ -2235,9 +2289,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2450,13 +2511,13 @@ class SMSCampaignsApi
protected function updateSmsCampaignRequest($campaignId, $updateSmsCampaign)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling updateSmsCampaign'
);
}
// verify the required parameter 'updateSmsCampaign' is set
if ($updateSmsCampaign === null) {
if ($updateSmsCampaign === null || (is_array($updateSmsCampaign) && count($updateSmsCampaign) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateSmsCampaign when calling updateSmsCampaign'
);
@ -2500,9 +2561,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -2715,13 +2783,13 @@ class SMSCampaignsApi
protected function updateSmsCampaignStatusRequest($campaignId, $status)
{
// verify the required parameter 'campaignId' is set
if ($campaignId === null) {
if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $campaignId when calling updateSmsCampaignStatus'
);
}
// verify the required parameter 'status' is set
if ($status === null) {
if ($status === null || (is_array($status) && count($status) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $status when calling updateSmsCampaignStatus'
);
@ -2765,9 +2833,16 @@ class SMSCampaignsApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class SendersApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -295,9 +300,16 @@ class SendersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -505,7 +517,7 @@ class SendersApi
protected function deleteSenderRequest($senderId)
{
// verify the required parameter 'senderId' is set
if ($senderId === null) {
if ($senderId === null || (is_array($senderId) && count($senderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $senderId when calling deleteSender'
);
@ -546,9 +558,16 @@ class SendersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -799,9 +818,16 @@ class SendersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1046,7 +1072,7 @@ class SendersApi
protected function getIpsFromSenderRequest($senderId)
{
// verify the required parameter 'senderId' is set
if ($senderId === null) {
if ($senderId === null || (is_array($senderId) && count($senderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $senderId when calling getIpsFromSender'
);
@ -1087,9 +1113,16 @@ class SendersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1366,9 +1399,16 @@ class SendersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1581,7 +1621,7 @@ class SendersApi
protected function updateSenderRequest($senderId, $sender = null)
{
// verify the required parameter 'senderId' is set
if ($senderId === null) {
if ($senderId === null || (is_array($senderId) && count($senderId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $senderId when calling updateSender'
);
@ -1625,9 +1665,16 @@ class SendersApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class TransactionalSMSApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -363,9 +368,16 @@ class TransactionalSMSApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -660,9 +672,16 @@ class TransactionalSMSApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -957,9 +976,16 @@ class TransactionalSMSApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1204,7 +1230,7 @@ class TransactionalSMSApi
protected function sendTransacSmsRequest($sendTransacSms)
{
// verify the required parameter 'sendTransacSms' is set
if ($sendTransacSms === null) {
if ($sendTransacSms === null || (is_array($sendTransacSms) && count($sendTransacSms) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $sendTransacSms when calling sendTransacSms'
);
@ -1240,9 +1266,16 @@ class TransactionalSMSApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -59,6 +59,11 @@ class WebhooksApi
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @param ClientInterface $client
* @param Configuration $config
@ -265,7 +270,7 @@ class WebhooksApi
protected function createWebhookRequest($createWebhook)
{
// verify the required parameter 'createWebhook' is set
if ($createWebhook === null) {
if ($createWebhook === null || (is_array($createWebhook) && count($createWebhook) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $createWebhook when calling createWebhook'
);
@ -301,9 +306,16 @@ class WebhooksApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -511,7 +523,7 @@ class WebhooksApi
protected function deleteWebhookRequest($webhookId)
{
// verify the required parameter 'webhookId' is set
if ($webhookId === null) {
if ($webhookId === null || (is_array($webhookId) && count($webhookId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhookId when calling deleteWebhook'
);
@ -552,9 +564,16 @@ class WebhooksApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -799,7 +818,7 @@ class WebhooksApi
protected function getWebhookRequest($webhookId)
{
// verify the required parameter 'webhookId' is set
if ($webhookId === null) {
if ($webhookId === null || (is_array($webhookId) && count($webhookId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhookId when calling getWebhook'
);
@ -840,9 +859,16 @@ class WebhooksApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1110,9 +1136,16 @@ class WebhooksApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@ -1325,13 +1358,13 @@ class WebhooksApi
protected function updateWebhookRequest($webhookId, $updateWebhook)
{
// verify the required parameter 'webhookId' is set
if ($webhookId === null) {
if ($webhookId === null || (is_array($webhookId) && count($webhookId) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhookId when calling updateWebhook'
);
}
// verify the required parameter 'updateWebhook' is set
if ($updateWebhook === null) {
if ($updateWebhook === null || (is_array($updateWebhook) && count($updateWebhook) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $updateWebhook when calling updateWebhook'
);
@ -1375,9 +1408,16 @@ class WebhooksApi
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**

View File

@ -12,12 +12,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**

View File

@ -0,0 +1,515 @@
<?php
/**
* AbTestCampaignResult
*
* PHP version 5
*
* @category Class
* @package SendinBlue\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.4.12
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
namespace SendinBlue\Client\Model;
use \ArrayAccess;
use \SendinBlue\Client\ObjectSerializer;
/**
* AbTestCampaignResult Class Doc Comment
*
* @category Class
* @package SendinBlue\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class AbTestCampaignResult implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'abTestCampaignResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $swaggerTypes = [
'winningVersion' => 'string',
'winningCriteria' => 'string',
'winningSubjectLine' => 'string',
'openRate' => 'string',
'clickRate' => 'string',
'winningVersionRate' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $swaggerFormats = [
'winningVersion' => null,
'winningCriteria' => null,
'winningSubjectLine' => null,
'openRate' => null,
'clickRate' => null,
'winningVersionRate' => null
];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'winningVersion' => 'winningVersion',
'winningCriteria' => 'winningCriteria',
'winningSubjectLine' => 'winningSubjectLine',
'openRate' => 'openRate',
'clickRate' => 'clickRate',
'winningVersionRate' => 'winningVersionRate'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'winningVersion' => 'setWinningVersion',
'winningCriteria' => 'setWinningCriteria',
'winningSubjectLine' => 'setWinningSubjectLine',
'openRate' => 'setOpenRate',
'clickRate' => 'setClickRate',
'winningVersionRate' => 'setWinningVersionRate'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'winningVersion' => 'getWinningVersion',
'winningCriteria' => 'getWinningCriteria',
'winningSubjectLine' => 'getWinningSubjectLine',
'openRate' => 'getOpenRate',
'clickRate' => 'getClickRate',
'winningVersionRate' => 'getWinningVersionRate'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
const WINNING_VERSION_NOT_AVAILABLE = 'notAvailable';
const WINNING_VERSION_PENDING = 'pending';
const WINNING_VERSION_TIE = 'tie';
const WINNING_VERSION_A = 'A';
const WINNING_VERSION_B = 'B';
const WINNING_CRITERIA_OPEN = 'Open';
const WINNING_CRITERIA_CLICK = 'Click';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getWinningVersionAllowableValues()
{
return [
self::WINNING_VERSION_NOT_AVAILABLE,
self::WINNING_VERSION_PENDING,
self::WINNING_VERSION_TIE,
self::WINNING_VERSION_A,
self::WINNING_VERSION_B,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getWinningCriteriaAllowableValues()
{
return [
self::WINNING_CRITERIA_OPEN,
self::WINNING_CRITERIA_CLICK,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['winningVersion'] = isset($data['winningVersion']) ? $data['winningVersion'] : null;
$this->container['winningCriteria'] = isset($data['winningCriteria']) ? $data['winningCriteria'] : null;
$this->container['winningSubjectLine'] = isset($data['winningSubjectLine']) ? $data['winningSubjectLine'] : null;
$this->container['openRate'] = isset($data['openRate']) ? $data['openRate'] : null;
$this->container['clickRate'] = isset($data['clickRate']) ? $data['clickRate'] : null;
$this->container['winningVersionRate'] = isset($data['winningVersionRate']) ? $data['winningVersionRate'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
$allowedValues = $this->getWinningVersionAllowableValues();
if (!is_null($this->container['winningVersion']) && !in_array($this->container['winningVersion'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value for 'winningVersion', must be one of '%s'",
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getWinningCriteriaAllowableValues();
if (!is_null($this->container['winningCriteria']) && !in_array($this->container['winningCriteria'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value for 'winningCriteria', must be one of '%s'",
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets winningVersion
*
* @return string
*/
public function getWinningVersion()
{
return $this->container['winningVersion'];
}
/**
* Sets winningVersion
*
* @param string $winningVersion Winning Campaign Info. pending = Campaign has been picked for sending and winning version is yet to be decided, tie = A tie happened between both the versions, notAvailable = Campaign has not yet been picked for sending.
*
* @return $this
*/
public function setWinningVersion($winningVersion)
{
$allowedValues = $this->getWinningVersionAllowableValues();
if (!is_null($winningVersion) && !in_array($winningVersion, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'winningVersion', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
$this->container['winningVersion'] = $winningVersion;
return $this;
}
/**
* Gets winningCriteria
*
* @return string
*/
public function getWinningCriteria()
{
return $this->container['winningCriteria'];
}
/**
* Sets winningCriteria
*
* @param string $winningCriteria Criteria choosen for winning version (Open/Click)
*
* @return $this
*/
public function setWinningCriteria($winningCriteria)
{
$allowedValues = $this->getWinningCriteriaAllowableValues();
if (!is_null($winningCriteria) && !in_array($winningCriteria, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'winningCriteria', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
$this->container['winningCriteria'] = $winningCriteria;
return $this;
}
/**
* Gets winningSubjectLine
*
* @return string
*/
public function getWinningSubjectLine()
{
return $this->container['winningSubjectLine'];
}
/**
* Sets winningSubjectLine
*
* @param string $winningSubjectLine Subject Line of current winning version
*
* @return $this
*/
public function setWinningSubjectLine($winningSubjectLine)
{
$this->container['winningSubjectLine'] = $winningSubjectLine;
return $this;
}
/**
* Gets openRate
*
* @return string
*/
public function getOpenRate()
{
return $this->container['openRate'];
}
/**
* Sets openRate
*
* @param string $openRate Open rate for current winning version
*
* @return $this
*/
public function setOpenRate($openRate)
{
$this->container['openRate'] = $openRate;
return $this;
}
/**
* Gets clickRate
*
* @return string
*/
public function getClickRate()
{
return $this->container['clickRate'];
}
/**
* Sets clickRate
*
* @param string $clickRate Click rate for current winning version
*
* @return $this
*/
public function setClickRate($clickRate)
{
$this->container['clickRate'] = $clickRate;
return $this;
}
/**
* Gets winningVersionRate
*
* @return string
*/
public function getWinningVersionRate()
{
return $this->container['winningVersionRate'];
}
/**
* Sets winningVersionRate
*
* @param string $winningVersionRate Open/Click rate for the winner version
*
* @return $this
*/
public function setWinningVersionRate($winningVersionRate)
{
$this->container['winningVersionRate'] = $winningVersionRate;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param integer $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}

View File

@ -13,12 +13,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -200,8 +200,7 @@ class AddChildDomain implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@ -13,12 +13,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -200,8 +200,7 @@ class AddContactToList implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@ -13,12 +13,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -206,8 +206,7 @@ class AddCredits implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@ -13,12 +13,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -225,7 +225,7 @@ class CreateAttribute implements ModelInterface, ArrayAccess
$invalidProperties = [];
$allowedValues = $this->getTypeAllowableValues();
if (!in_array($this->container['type'], $allowedValues)) {
if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value for 'type', must be one of '%s'",
implode("', '", $allowedValues)
@ -243,12 +243,7 @@ class CreateAttribute implements ModelInterface, ArrayAccess
*/
public function valid()
{
$allowedValues = $this->getTypeAllowableValues();
if (!in_array($this->container['type'], $allowedValues)) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}
@ -320,7 +315,7 @@ class CreateAttribute implements ModelInterface, ArrayAccess
public function setType($type)
{
$allowedValues = $this->getTypeAllowableValues();
if (!is_null($type) && !in_array($type, $allowedValues)) {
if (!is_null($type) && !in_array($type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'type', must be one of '%s'",

View File

@ -13,12 +13,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -212,14 +212,7 @@ class CreateAttributeEnumeration implements ModelInterface, ArrayAccess
*/
public function valid()
{
if ($this->container['value'] === null) {
return false;
}
if ($this->container['label'] === null) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@ -13,12 +13,12 @@
/**
* SendinBlue API
*
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* Contact: contact@sendinblue.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.3.1
* Swagger Codegen version: 2.4.12
*/
/**
@ -239,23 +239,7 @@ class CreateChild implements ModelInterface, ArrayAccess
*/
public function valid()
{
if ($this->container['email'] === null) {
return false;
}
if ($this->container['firstName'] === null) {
return false;
}
if ($this->container['lastName'] === null) {
return false;
}
if ($this->container['companyName'] === null) {
return false;
}
if ($this->container['password'] === null) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

Some files were not shown because too many files have changed in this diff Show More